Reaction mask implementation gpu#805
Reaction mask implementation gpu#805SreejithNREL wants to merge 9 commits intoAMReX-Combustion:developmentfrom
Conversation
|
|
||
| static amrex::Vector<int> src_list; | ||
|
|
||
| static bool use_chem_mask; |
There was a problem hiding this comment.
The best way to do this is actually a bit different. You would add the option(s) here and run the Source/Params/mk_params.sh script to make this all automatic. I will do the definition/declaration/parmparse for you.
There was a problem hiding this comment.
Can you also add some documentation about what these new input parameters mean for the user?
| // Reading chemistry mask box coordinates | ||
| if (use_chem_mask) { | ||
| for (int n = 0; n < AMREX_SPACEDIM; ++n) { | ||
| pp.get("lo_chemmask", lo_chem_mask_coordinate[n], n); |
There was a problem hiding this comment.
let's be more explicit with this user facing string lo_chemistry_mask e.g.
| #endif | ||
| { | ||
|
|
||
| amrex::RealBox Chem_Masked_Region( |
There was a problem hiding this comment.
name this masked_chemistry_box, make it const.
| if (use_chem_mask) { | ||
| amrex::ParallelFor( | ||
| bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { | ||
| amrex::XDim3 point; |
There was a problem hiding this comment.
can simplify: const amrex::IntVect iv = {AMREX_D_DECL(plo[0] + (i + 0.5) * dx[0], etc)}; see other examples in the code.
There was a problem hiding this comment.
This should probably just happen once? No need to do it every step? if so, can we move to the init somewhere?
There was a problem hiding this comment.
I think @marchdf means const amrex::RealVect = .... The AMREX_D_DECL is needed so the code also works in 2d. You can also use the pc_cmp_loc function which wraps this.
| @@ -170,6 +182,20 @@ PeleC::react_state( | |||
| auto const& mask = dummyMask.array(mfi); | |||
There was a problem hiding this comment.
while we are at it. Let's rename this "dummyMask` to something that means something.
| point.z = plo[2] + (k + 0.5) * dx[2]; | ||
|
|
||
| if (Chem_Masked_Region.contains(point)) { | ||
| mask(i, j, k) = -1; |
There was a problem hiding this comment.
You can then make this a ternary expression: mask(i, j, k) = Chem_Masked_Region.contains(iv)? -1 : 0;. It's also weird to me that mask is -1 when masked. Should it be 0? And then 1 for when unmasked. That would fit my mental definition of true/false and other uses of the term "mask" in amrex codes.
|
|
||
| amrex::Gpu::Device::streamSynchronize(); | ||
|
|
||
| bool use_chem_mask_d = use_chem_mask; |
Updated PeleC to include Chemical mask implementation in PelePhysics. The PR for that update has already been made.