Closed ivanmkc closed 4 months ago
Can you reproduce this in matlab? I can reproduce this in your notebook.
I get sensible results when I lower the cfl number to 0.03 when looking at the p_max
. The further post-processing crashes for me though with colab as it runs out of memory.
There is a check_stability
function in utils.checks
which will shorten the time step if needed.
Does this help?
Thanks @djps. I haven't been using Matlab but made some progress in Python.
cfl
to 0.03 doesn't change anything for me fixes it for me as well. The time steps given are accurate when the medium properties are
homogeneous. For a heterogeneous media they give a useful, but not
exact, estimate.
I'll do more reading on how to set the cfl. Is that just a hyper-parameter to tweak and test?
Here is some additional testing. It seems like there are variations (see the diagonal artifacts) even at lower cfl values. If anyone knows a principled way to determine the correct cfl, please let me know.
Are lower cfl values strictly more "correct" than higher cfl values?
The two-points-per-wavelength rule is to be able to resolve the wave.
The simulations seem to be unstable above the a cfl of 0.045, given the huge ´p_max´.
In general I think the lower the cfl the better. There will be textbooks on the numerical solutions of partial differential equations, with chapters on the wave equation. Also Fornberg's "A Practical Guide to Pseudospectral Methods"
More correct is tricky - my feeling is that the diagonal lines are not spurious, but due to the faint inference from the one source and reflection from the interface due to the other source which are only seen at higher resolutions.
@djps Thanks for looking into this.
@ivanmkc Running with a CFL number of 0.03 I was able to produce stable simulations using your notebook.
Another good resource for you could be Section 2.7 of the k-Wave manual if you haven't already found it.
I hope that's helpful.
Closing for now
Describe the bug In some situations, adding heterogenous density results in greatly increasing pressure.
I'm new to ultrasound and k-wave so perhaps this is user error.
To Reproduce See attached notebook.
Adding a tiny area of heterogenous density is enough to reproduce this behaviour.
Ultrasound_Simulation2D(k_wave_python) (1).ipynb.zip
Expected behavior I won't expect a tiny area of different density to lead to enormous increases in pressure.
Screenshots Increasing pressure over time
Desktop (please complete the following information):
Colab
Additional context Add any other context about the problem here.