org-arl / UnderwaterAcoustics.jl

Julia toolbox for underwater acoustic modeling
MIT License
43 stars 13 forks source link

Absorption units #54

Closed ElOceanografo closed 3 months ago

ElOceanografo commented 4 months ago

It's unclear from the documentation what units the result of the absorption function has. Is it just a loss ratio?

I would find it useful to have a function that calculates the absorption coefficient in units of dB/m. Maybe this could be factored out of the current absorption function, or, at the very least, to have a description in the docstring for how to back this quantity out of the returned value...

mchitre commented 4 months ago

The absorption coefficient is a scale factor for the acoustic pressure to account for absorption. To get absorption in dB/m, simply compute it at 1 m range and convert to dB. Example:

plot(fkHz -> -20*log10(absorption(1000fkHz, 1)), 1, 100;
  xscale=:log10, yscale=:log10, xlims=(1, 100), ylims=(0.0001, 0.1),
  legend=false, xlabel="Frequency (kHz)", ylabel="Absorption (dB/m)")
image
ElOceanografo commented 4 months ago

Thanks, that clarifies it. Could that info be added to the docstring?

mchitre commented 3 months ago

Thanks for the PR. Approved and will merge shortly.