ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
288 stars 184 forks source link

Some basic AMR questions`1 #5029

Closed archermarx closed 1 month ago

archermarx commented 1 month ago

Hi all,

I'm trying to understand how AMR works in WarpX, practically. I read the theory section in the docs, but it's all pretty low-level stuff about the specifics how how deposition is handled across mesh levels. I'm trying to understand some of the higher level concepts.

  1. How is mesh refinement triggered during a simulation? I.e. if I enable mesh refinement by setting amr.max_level = 1, how does WarpX determine when it needs to refine the mesh

  2. How many refined regions can be active on the same level? Can you only have one refined region at level 1, or can you have multiple (possibly disconnected) refined regions.

  3. Is there an equivalent of the amr.max_level setting for PICMI inputs?

RevathiJambunathan commented 1 month ago

Hi @archermarx

In WarpX, we have a static mesh refinement and currently adaptive MR is not supported

  1. Mesh-refinement, if turned on, will therefore be triggered at initialization and the MR patch will remain static throughout the simulation. If you setamr.max_level = 1, you would also need to specify the region that you would want to refine. This relates to the answer for (2)

  2. You could have as many refined regions as you want, provided they do not overlap. You can set the region that you want to refine using an analytical function : `warpx.ref_patch_function(x,y,z)'. (I need to look up to see if this is supported with PICMI interface) Here is an example https://github.com/ECP-WarpX/WarpX/blob/development/Examples/Tests/particles_in_pml/inputs_mr_2d

  3. Here is an example of how a refined grid is added with level specification https://github.com/ECP-WarpX/WarpX/blob/development/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_mr.py

archermarx commented 1 month ago

Thanks for the answers!