-
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
[WIP] Add collisional diagnostic buffers #5543
base: development
Are you sure you want to change the base?
[WIP] Add collisional diagnostic buffers #5543
Conversation
…ifab
for more information, see https://pre-commit.ci
This looks good. A comment - these new MultiFabs will automatically be accessible from Python since they are stored in the MultiFab map. You can also add convenience wrappers for them by adding the appropriate wrapper routines in |
@dpgrote, thanks for the tip! |
const auto [ii, jj, kk] = amrex::getParticleCell(p , plo, dxi).dim3(); | ||
|
||
// store energy lost in the buffer | ||
coll_ionization_arr(ii, jj, kk, 0) += w[ip + np_elec]; |
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've added everything that I think I'll need for this diagnostic, but am running into the following compilation error:
/home/bj8080/src/warpx/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp:603:67: error:
assignment of read-only location 'coll_ionization_arr.amrex::Array4<const double>::operator()<>(((int)ii), ((int)jj), ((int)kk), 0)'
603 | coll_ionization_arr(ii, jj, kk, 0) += w[ip + np_elec];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
since coll_ionization_tracking
is a constant. When I correct for this by removing const
from the initialization of coll_ionization_arr
and the earlier line initializing coll_ionization
, I get an error:
/home/bj8080/src/warpx/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp:586:67:
error: cannot bind non-const lvalue reference of type 'amrex::Array4<double>&' to an rvalue of type 'amrex::Array4<double>'
586 | auto& coll_ionization_arr = coll_ionization[pti].array();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
I think to get around this I should create a multifab
to sum up the ionization events, and then add that multifab to coll_ionization_arr. How would I do this? Or, is there a better approach?
Stemming out of conversation #5381 with @roelof-groenewald, included is initial work on adding
multifab
buffers to track collisional diagnostics in a MCC-type simulation.The work on two buffers is in progress--one for ionization and one for total collisional energy loss. Both
multifabs
have been included inFields.H
and initialized inWarpX.cpp
. Relevant flags to turn on MCC tracking have been created inWarpX.H
and initialized inWarpX.cpp
. The energy lossmultifab
has been added into the collision protocol, and future commits will add the ionization buffer.In the end, I aim to set up Python access to these
multifabs
, with similar functionality to theparticle_containers.ParticleBoundaryBufferWrapper()
wrappers.