Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PML for heterogeneous media #1747

Open
charlie-garcia opened this issue Oct 8, 2024 · 4 comments
Open

PML for heterogeneous media #1747

charlie-garcia opened this issue Oct 8, 2024 · 4 comments

Comments

@charlie-garcia
Copy link

Hi,

I'm trying to use specfem for underwater bioacoustic problems and I cannot find a way to use PML for heterogeneous media. I'm meshing cubit.

A very simple example would be this: A half space fluid elastic half water (top) half elastic (bottom)

half_space

How do I set the PML across all boundaries? My simulations worked fine if I set only an acoustic medium with PMLs. However, I don't have any clue about PML in heterogeneous media. Especially if there's more than one acoustic or elastic medium at the boundaries or in the presence of different materials.

I was suggested that maybe @tianshi-liu, @casarotti or @danielpeter could give me a hand?

Thank you,

Carlos

@tianshi-liu
Copy link

Hi Carlos,

Thanks a lot for posting the issue. First of all, just hoping to confirm the meaning of "heterogeneous media", does it mean the existence of different types of media (e.g., acoustic and elastic) in your situation? Because in seismology, "heterogeneous" specifically means having non-uniform properties (e.g., seismic velocity varies with spatial locations).

I have never used PML in case of acoustic-elastic interface, but based on my understanding of how PML and acoustic-elastic interface work in SPECFEM, there should be no problem with having both acoustic and elastic elements and designating elements (either acoustic or elastic) as PML elements. SPECFEM handles acoustic and elastic elements (including their own PML memory variables) independently, and imposes the continuity condition weakly at the acoustic-elastic interface.

Have you tried running a simulation in the presence of both acoustic and elastic elements, and just setting elements as PML the same way you would do with purely acoustic/elastic simulations? If you haven't, could you please take a try and see if it works just fine? My guess is that everything has been handled well in the program. If you have tried and had problems, could you let us know specifically where did the problem occur (e.g., mesher / generate_databases / solver)? It would be always helpful if you could post the error message and the OUTPUT_FILES/output_*.txt file.

Let me know if there's any doubts.

Tianshi

@charlie-garcia
Copy link
Author

Hi Tianshi,

Thank you for your quick response. And yes, by heterogeneous media I mean not only different acoustic-elastic media but also different media where density may vary (acoustic and/or elastic).

I'm working with Cubit to mesh my model. I've created manually the PML layers and all the respective flags (as stated in the documentation. In the homogeneous case, I tested an acoustic medium and it worked pretty well. I must also assign a material to the PML, so I set the same fluid properties.

Now, in my actual case, I have a heterogeneous medium segment coming from a CT scan, so at the boundaries I have different materials of different kinds. I can create PML layers and elements but then I don't know which material properties I must assign to the PML!

So far, I've tested two cases:

Case One: If I create the PML and I assign (within Cubit) the material properties of the fluid I do not have reflections for the acoustic media but I do for the elastic media. So I thought it was because of the impedance difference that I have such reflections and the PML is nor working propertly.

Case Two: I extruded the last layer, i.e. the mesh and the material properties at the boundaries to create the PML. So, there are different materials in the PML. This case does not work. The program stops at the generating databases step. The last log line is "maximum Vp in C-PML 3476."

I've attached the output_generate_databases_PML_error.txt for this case. I forgot to mention, I'm working with version specfem3d V.3

Thank you!

Carlos

@tianshi-liu
Copy link

Hi Carlos,

Sorry for the late response. I think Case Two is the way to go.

I was looking at your output_generate_databases.txt file, and it seems that the PML elements are not correctly identified. By looking at these lines:

Boundary values of X-/Y-/Z-regions:
X: -0.319997996, 0.319997996
Y: -0.303997993, 0.303997993
Z: -2.400000021E-2, 0.779995024

Origins of left/right X-surface C-PML 0., 4.290014505E-3
Origins of back/front Y-surface C-PML 0., 3.672987223E-3
Origin of bottom Z-surface C-PML 0.377942264
Origin of top Z-surface C-PML 0.377997994

CPML_width_x: 0.319997996
CPML_width_y: 0.303997993
CPML_width_z: 0.40199703

For example, the line "Origins of left/right X-surface C-PML 0., 4.290014505E-3" tells you the x coordinates of the right-most point of your left PML and the left-most point of your right PML. They are both almost zero, meaning that the PML elements that you put in extends from the sides all the way to the center of the mesh. Note that you need to ensure the interface between PML and the physical domain is honored, meaning that the interface does not run through any elements. I suggest you inspect the absorbing_cpml_file (first line is the element index), and for each element in that file, make sure that it is indeed in PML.

In case of heterogeneous material (e.g., density varies with spatial location), you need to make sure that the material in the PML does not vary along the direction that is perpendicular to the PML (e.g., you can achieve this by extruding the properties into PML). In practice, I find that PML still works OK if the properties slightly vary in PML for my simulations, but I'm not sure if it is the case for yours.

Sections "PML absorbing boundary layers" in https://specfem3d.readthedocs.io/en/latest/04_creating_databases/ and "Exporting the Mesh with run_cubit2specfem3d.py" in https://specfem3d.readthedocs.io/en/latest/03_mesh_generation/ should be useful if you are not familiar with them.

Let me know if there is any doubts!

Tianshi

@charlie-garcia
Copy link
Author

charlie-garcia commented Oct 30, 2024

Hi Tianshi,

Yes, that was the issue, thanks! I know now that if you change something in your model meshing with cubit, sometimes the face ordering also changes, so always check!

In this case, I was able to make the PML "work," but there are still some issues. I turned off the absorption Q values, and the PMLs don't vary.

pml_error

You can see a frontwave traveling from acoustic to elastic media. Some nodes have pressure values that go to infinity. This happens at the last element of the PML layer and when the frontwave reaches the elastic medium. In this case, it doesn't affect my simulation, but I tested other cases and it seems to cause numerical instabilities and create an exponentially growing source. It always happens at the acoustic/elastic interface.

It's hard for me to figure out why this is happening. Maybe you have any thoughts?

PS: I rotated the domain 90 deg to better visualize the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants