Universite-Gustave-Eiffel / I-Simpa

An Open Source software for 3D sound propagation modelling
https://i-simpa.univ-gustave-eiffel.fr/
GNU General Public License v3.0
227 stars 56 forks source link

SPL calculation with surface receiver #372

Open rapherent opened 9 months ago

rapherent commented 9 months ago

SPL comparison

In the document "Modelling of physical phenomena in SPPS", "Calculation of the sound pressure level on a surface receiver" is written: "Note that the calculation of a sound pressure level for a surface is quite ambiguous. It should not be comparable to grid of punctual receivers on a plane."

I have made some comparative calculations and found that the expected results are far apart; in particular, the results between the sound pressure level of a punctual receiver and a surface receiver.

In the pictured modell, i designed a source on the left side and:

The calculation was done with the setting "direct field only" and SPPS.

-> The surface receiver (vertical) shows no relevant results. -> The results from the nine punctual receivers are nearly identical with the nine surface receiver (vertical) with 0° to source. -> The results from the nine punctual receivers differ from the results of the Surface receiver (horizontal) at the points 10-90 m. -> The difference in SPL between the first an last punctual receiver is around 20 dB; the horizontal sourface receivers shows a difference in SPL of 30 dB.

From my point of view, this creates the following problems:

-> The calculation of SPL on a sourface receiver depends on the angle of incident; that should not be. -> All acoustic parameters who are based on SPL calculation (without an angle of incident) are wrong, because the results will get a weighting of angle of incident. ---> The calculation and presentation of results as a sourface receiver is useless.

Why is there no calculation with a grid of punctual receiver and a presentation of the results as a sourface?

Many thanks in advance.

wbinek commented 9 months ago

In SPPS properties you can change the surface receiver mode from "Intensity" to "SPL". In "SPL" mode there should be no dependency on the angle of incidence for the surface receiver.

The problem with vertical plane is that for the ray to be recorded on the surface it must cross the surface. If the ray is ideally parallel to the surface receiver it will not be recorded. It can be easily mitigated by making the receiver surface and the sound source not exactly within same plane.

Edit: Actually whether the surface receiver results should or should not depend on the angle of incidence is not so simple. In case of simulating the behaviour of point receiver they should not (so SPL mode), but to properly record the energy incident to the surface (as surface, not as point receiver grid) they should (so Intensity mode).

rapherent commented 9 months ago
wbinek commented 9 months ago

Could you please share the model you use for testing as it is really nice. I will look into it, but I can't promise a quick and easy fix :)

rapherent commented 9 months ago

The results shown above are from a simple sound propagation calculation:

You can download the file here: https://www.dropbox.com/scl/fi/k52z2tdxbozy2ncyu2o55/ExampleFreeField.proj?rlkey=2guhpkblwqbwn7mgo7udsauzq&dl=0

Another point: The colours (SPL results) at the crossing between a vertical and horizontal surface receiver must be the same.

wbinek commented 9 months ago

I do understand the problem. I will look into it tomorrow.

I am almost certain that there is no explicit angle dependency in the surface receiver source code in SPL mode (there is in Intensity mode). However as the rays are close to parallel to the surface the probability of crossing the surface decreases (as with the sun rays close to the poles) and it is not compensated. As l am thinking about it now it may be a flaw of the surface receiver implementation but it will require more thinking and some testing.

rapherent commented 9 months ago

I get nearby the right results with this correction: Correction

Somewhere in the SPL code is the cos (Theta) included; i think it uses the Ijsurf(n) part from the intensity for SPL calculations of P2jsurf(n) and then LjSPL,surf(n).

Thank you in advance!

rapherent commented 9 months ago

In "I-Simpa/src/spps/input_output/reportmanager.cpp" in row 544 and 561 I found:

float i0_div_p0sqr=pow(10.f,-12.f)/pow((float)(20pow(10.f,(int)-6)),(int)2)(coreConfig.FastGetConfigValue(Core_Configuration::FPROP_RHO))(*coreConfig.FastGetConfigValue(Core_Configuration::FPROP_CELERITE));

Could that be the reason?

wbinek commented 9 months ago

Let's start with the source of angle dependency. In general you are right that in SPL mode the angle dependency should be neglected, in receiver's Intensity mode we include the angle dependency.

The source code for energy recording on surface receivers is in reportmanager in lines 187-190 and repeated for different surface receiver type in lines 281-284:

if(*(this->paramReport.configManager->FastGetConfigValue(Core_Configuration::I_PROP_SURFACE_RECEIVER_MODE))==0)             
    (*itrs)->data[particleInfos.frequenceIndex][CellRow][CellCol][particleInfos.pasCourant]+=particleInfos.energie*cosf(normal.angle(particleInfos.direction));
else
    (*itrs)->data[particleInfos.frequenceIndex][CellRow][CellCol][particleInfos.pasCourant]+=particleInfos.energie;

As I said before in Intensity mode we explicitly multiply the energy with cosine of angle of incidence, but in SPL mode there is no such thing, but... This code is wrong, as when we look at ray propagation and the way it hits the surface we get an image like this (note that dA and spacing between rays is equal in both cases): aoi

When rays are perpendicular to the surface there is higher ray density per differential surface dA than in case of oblique angles. This makes the angle dependency implicit in general ray tracing and ray-surface intersection. As a side note - this is not the case with point receivers as for point we always assume that the ray is perpendicular to the differential surface.

Therefore we now have two sources of angle dependency in surface receiver - explicit: written directly in the code and implicit: due to the nature of ray tracing. Now when we take into account the fact that implicit dependency is always present the right code for the energy recording is as follows:

if (*(this->paramReport.configManager->FastGetConfigValue(Core_Configuration::I_PROP_SURFACE_RECEIVER_MODE)) == 0)
    face->recepteurS->energieRecu[particleInfos.frequenceIndex][particleInfos.pasCourant] += particleInfos.energie;
else
    face->recepteurS->energieRecu[particleInfos.frequenceIndex][particleInfos.pasCourant] += particleInfos.energie / max(cosf(normal.angle(particleInfos.direction)), 0.000000001f); 

In Intensity mode we rely on implicit angle dependency, so there is no multiplication. In SPL mode we compensate the dependency by dividing the energy with the cosine of angle of incidence. The max() is there to avoid division by zero.

Finally, the corrected code gives correct results in the model you provided in SPL mode. image

wbinek commented 9 months ago

As for vertical receiver where no rays are detected - I would say that it is impossible to be easily fixed without some hacky solutions that may backfire at some point. To be detected the ray must cross the receiver surface (which being a surface is indefinitely thin). When the source is in plane with the receiver the rays will never cross the plane as they move parallel to it.

rapherent commented 8 months ago

Thanks for superfast trouble shooting! The result looks as it should be. I assume that the results for the reverberation time etc. on a surface receiver are now also correct?!

The sound incidence at an angle of 90° to a surface receiver corresponds to a theoretical special case, i don't consider it to be all that important. It was part of the test model I came up with in order to understand how the program works. The major disadvantage of the planar receiver is that the projected area becomes smaller as the angle of theta increases (min area, 0 m² at 90°) and correspondingly fewer particles are detected on it in the direction of sound propagation. This would be clearer if the results were displayed from a grid of punctual receiver, as each receiver balloon would detect independently of the angle of sound incidence.

Is it already known when a revision of the program is to be expected?

wbinek commented 8 months ago

I have not done any tests on other acoustic parameters, but I suspect the agreement between point and surface receivers should be improved.

You are correct, that the number of detected particles decreases as the theta increases and it is a drawback of a planar receiver. Currently it is possible to make a point receiver grid, but there is no build in tool for merging the results into a map. It would probably require more effort to implement such functionality into I-SIMPA. In fact it may be easier to do in postprocessing when required.

Regarding the revision - I have created a pull request, but I don't know when it may be merged. @nicolas-f, @Picaut, Could you please take a look at this issue and the pull request?

nicolas-f commented 8 months ago

Hello,

Yes we will look into your PR, thanks for your support @wbinek

For SPPS and Plan Receiver (not the surface one) it should be implemented as a grid of point receivers.