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

[WIP] Check Guard Cells v. Valid Cells in PML #2779

Closed
wants to merge 10 commits into from

Conversation

EZoni
Copy link
Member

@EZoni EZoni commented Jan 25, 2022

Following up on #1873, we now check that the number of guard cells does not exceed the number of valid cells also in the PML region (rather than only in the regular domain).

We also make the checks more robust, by verifying that each MultiFab pointer is actually allocated, before passing it the function that performs the check (both for regular grid and PML).

@EZoni EZoni added bug Something isn't working bug: affects latest release Bug also exists in latest release version component: boundary PML, embedded boundaries, et al. labels Jan 25, 2022
Copy link
Member Author

@EZoni EZoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving two comments that will need to be discussed when the PR is reviewed.

Comment on lines 43 to 46
psatd.nox = 8
psatd.noz = 8
psatd.nx_guard = 8
psatd.nz_guard = 8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I needed to decrease the spectral order as well as the number of guard cells from 16 to 8. The check was otherwise failing and my understanding is that this was happening because we have 10 PML cells and the 16 guard cells of the regular grid along the PML interface would span beyond the 10 cells of the PML grid. Does it make sense to you, too?

runtime_params = algo.maxwell_solver = psatd warpx.use_filter = 1 amr.max_level = 1 amr.ref_ratio = 4 warpx.fine_tag_lo = -10.e-6 -10.e-6 warpx.fine_tag_hi = 10.e-6 10.e-6 diag1.electrons.variables = w ux uy uz diag1.positrons.variables = w ux uy uz
runtime_params = algo.maxwell_solver = psatd warpx.use_filter = 1 amr.max_level = 1 amr.ref_ratio = 4 warpx.fine_tag_lo = -10.e-6 -10.e-6 warpx.fine_tag_hi = 10.e-6 10.e-6 warpx.pml_ncell = 36 warpx.pml_delta = 36 diag1.electrons.variables = w ux uy uz diag1.positrons.variables = w ux uy uz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I had to increase pml_ncell and pml_delta from 10 (default) to 36. The check was otherwise failing and my understanding is that this was happening because we have a mesh refinement ratio of 4, 8 guard cells, and need to make sure that when we construct the coarse BoxArray for the PML,

const IntVect cncells = IntVect(ncell)/ref_ratio;
const IntVect cdelta = IntVect(delta)/ref_ratio;
// Assuming that refinement ratio is equal in all dimensions
const BoxArray& cba = MakeBoxArray(is_single_box_domain, cdomain, *cgeom, grid_cba_reduced,
cncells, do_pml_in_domain, do_pml_Lo, do_pml_Hi);

the ratios of ncell and delta over the refinement ratio are still larger than the number of guard cells.

This seems to require using a lot of cells for the PML grid when using mesh refinement with high refinement ratios. So I'm not sure that I'm fixing this correctly, it would need to be double checked.

Also, we might not need to increase both pml_ncell and pml_delta, pml_ncell might be sufficient (but I'm not sure about what happens algorithmically if pml_delta is smaller than pml_ncell, e.g., what kinds of consequences this has on the absorption rate of the PML).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prkkumar These are the PR and the comment on guard cells v. PML width with MR that we talked about before, just for reference. Your feedback on this is welcome as well, since you're trying out similar things on your LWFA tests with MR.

@EZoni EZoni changed the title [WIP] Check Guard Cells v. Valid Cells in PML Check Guard Cells v. Valid Cells in PML Jan 26, 2022
@ax3l ax3l mentioned this pull request Feb 2, 2022
@EZoni EZoni requested a review from prkkumar February 2, 2022 22:56
@EZoni
Copy link
Member Author

EZoni commented Feb 10, 2022

HIP warning/error addressed in #2840.

@RemiLehe
Copy link
Member

I think that I agree in principle with the motivation ; however, that has some implications for the users of the code (i.e. with the default code parameters, I think that the user will get an error everytime they try to use PSATD with PML).
Maybe we could have a quick offline meeting to discuss how to solve this.

@EZoni EZoni changed the title Check Guard Cells v. Valid Cells in PML [WIP] Check Guard Cells v. Valid Cells in PML Feb 15, 2022
@EZoni
Copy link
Member Author

EZoni commented Feb 16, 2022

Update after an offline discussion with Remi and Jean-Luc: for now we should restrict this check to the directions that are tangential to the PML boundary (as we do not decompose the domain in the normal direction), if that does not prove to be still too stringent for corner cases.

@EZoni EZoni closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: boundary PML, embedded boundaries, et al.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants