-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add FieldPoyntingFlux reduced diagnostic #5475
base: development
Are you sure you want to change the base?
Add FieldPoyntingFlux reduced diagnostic #5475
Conversation
The periodic boundaries are handled explicitly in the calculation
Now only calculates component normal to the surface. Now works in RZ (for only one mode)
for more information, see https://pre-commit.ci
Fix #5482. Also, with this PR the temporary implicit particle attributes are not written to the checkpoint file, and also are not communicated when doing a redistribute of the particles. Note that this requires AMReX PR #4264. A CI test of this restart is included in PR #5475. --------- Co-authored-by: David Grote <[email protected]>
if (face().isHigh() && WarpX::field_boundary_hi[face_dir] == FieldBoundaryType::Periodic) { | ||
// For upper periodic boundaries, copy the lower value instead of regenerating it. | ||
int const iu = int(face()); | ||
int const il = int(face().flip()); | ||
m_data[iu] = -m_data[il]; | ||
m_data[iu + 2*AMREX_SPACEDIM] = -m_data[il + 2*AMREX_SPACEDIM]; | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps another option to consider would be to skip writing for periodic directions all together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather leave it in. It could be a useful diagnostic to keep track of flows in the system. Also, skipping the periodic directions would make the format of the output file be dependent on the boundary conditions which would be problematic when reading it.
This looks good to me, pending the minor comments I made. After a closer look at the 2D CI test, it seems that FieldBoundaryType::Neumann does nothing for the electromagnetic solvers. As we have discussed, this can be addressed in a future PR. |
This adds a reduced diagnostic that calculates the Poynting flux on the surfaces of the domain, providing the power flow into and out of the domain. This also includes the time integrated data.
When using the implicit evolve scheme, to get the energy accounting correct, the flux needs to be calculated at the mid step. For this reason, the
ComputeDiagsMidStep
was added which is called directly at the appropriate times.Because of the time integration, there are two main differences of this reduced diagnostic compared to the others. The first is that it is calculated every time step in order to get the full resolution in time. The intervals parameter still controls how often the diagnostic data is written out. The second is that a facility is added to write out the values of the time integration to a file when a checkpoint is made, so on a restart the integration can continue with the previous values. The facility was written in a general way so that other reduced diagnostics can also do this.
The CI test using the implicit solver is dependent on PR #5498 and PR #5489.