From 3ac47b6da391dddda963168f73d7a889c0bcdc15 Mon Sep 17 00:00:00 2001 From: Nadakkal Appukuttan Date: Mon, 15 Apr 2024 15:20:12 -0600 Subject: [PATCH 1/9] Added variables for chem mask --- Source/PeleC.H | 4 ++++ Source/PeleC.cpp | 15 +++++++++++++++ Source/React.cpp | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/Source/PeleC.H b/Source/PeleC.H index 2fe920754..ee4c61dee 100644 --- a/Source/PeleC.H +++ b/Source/PeleC.H @@ -742,6 +742,10 @@ protected: static amrex::Vector src_list; + static bool use_chem_mask; + static amrex::GpuArray lo_chem_mask_coordinate; + static amrex::GpuArray hi_chem_mask_coordinate; + static bool use_typical_vals_chem; static bool use_typical_vals_chem_usr; static amrex::Real typical_rhoY_val_min; diff --git a/Source/PeleC.cpp b/Source/PeleC.cpp index 1fe583595..68fa9151f 100644 --- a/Source/PeleC.cpp +++ b/Source/PeleC.cpp @@ -108,6 +108,10 @@ amrex::Vector PeleC::m_diagVars; amrex::Vector PeleC::src_list; +bool PeleC::use_chem_mask=false; //Flag to check if mask is activated. +amrex::GpuArray PeleC::lo_chem_mask_coordinate; //Box coordinate low +amrex::GpuArray PeleC::hi_chem_mask_coordinate; //Box coordinate high + // this will be reset upon restart amrex::Real PeleC::previousCPUTimeUsed = 0.0; amrex::Real PeleC::startCPUTime = 0.0; @@ -250,6 +254,17 @@ PeleC::read_params() pp.query("use_typ_vals_chem", use_typical_vals_chem); pp.query("use_typ_vals_chem_usr", use_typical_vals_chem_usr); + pp.query("chem_mask",use_chem_mask); + + //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); + pp.get("hi_chemmask", hi_chem_mask_coordinate[n], n); + } + } + if (use_typical_vals_chem_usr) { use_typical_vals_chem = true; } diff --git a/Source/React.cpp b/Source/React.cpp index 1ec951b38..104e7f8c8 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -38,6 +38,9 @@ PeleC::react_state( const amrex::Real strt_time = amrex::ParallelDescriptor::second(); + const auto plo = geom.ProbLoArray(); + const auto dx = geom.CellSizeArray(); + AMREX_ASSERT(do_react == 1); if ((verbose != 0) && amrex::ParallelDescriptor::IOProcessor()) { @@ -170,6 +173,20 @@ PeleC::react_state( auto const& mask = dummyMask.array(mfi); auto const& fc = fctCount.array(mfi); + if(use_chem_mask) + { + amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { + amrex::Real x=plo[0]+(i+0.5)*dx[0]; + amrex::Real y=plo[1]+(j+0.5)*dx[1]; + amrex::Real z=plo[2]+(k+0.5)*dx[2]; + + if((x>=lo_chem_mask_coordinate[0] && x<=hi_chem_mask_coordinate[0]) && ( y>=lo_chem_mask_coordinate[1] && y<=hi_chem_mask_coordinate[1])&& (z>=lo_chem_mask_coordinate[2] && z<=hi_chem_mask_coordinate[2])) + { + mask(i,j,k)=-1; + } + }); + } + amrex::ParallelFor( bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { // work on old state @@ -236,6 +253,15 @@ PeleC::react_state( - rho_old * e_old) // old internal energy / dt; + if(use_chem_mask && mask(i,j,k)==-1) + { + for(int nsp=0;nsp Date: Mon, 15 Apr 2024 16:16:19 -0600 Subject: [PATCH 2/9] Added device variables --- Source/PeleC.H | 2 ++ Source/PeleC.cpp | 7 +++++++ Source/React.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/PeleC.H b/Source/PeleC.H index ee4c61dee..d22925427 100644 --- a/Source/PeleC.H +++ b/Source/PeleC.H @@ -745,6 +745,8 @@ protected: static bool use_chem_mask; static amrex::GpuArray lo_chem_mask_coordinate; static amrex::GpuArray hi_chem_mask_coordinate; + static amrex::Gpu::DeviceVector d_lo_chem_mask_coordinate; + static amrex::Gpu::DeviceVector d_hi_chem_mask_coordinate; static bool use_typical_vals_chem; static bool use_typical_vals_chem_usr; diff --git a/Source/PeleC.cpp b/Source/PeleC.cpp index 68fa9151f..a070936f9 100644 --- a/Source/PeleC.cpp +++ b/Source/PeleC.cpp @@ -112,6 +112,9 @@ bool PeleC::use_chem_mask=false; //Flag to check if mask is activated. amrex::GpuArray PeleC::lo_chem_mask_coordinate; //Box coordinate low amrex::GpuArray PeleC::hi_chem_mask_coordinate; //Box coordinate high +amrex::Gpu::DeviceVector PeleC::d_hi_chem_mask_coordinate; //Box coordinate high +amrex::Gpu::DeviceVector PeleC::d_lo_chem_mask_coordinate; //Box coordinate high + // this will be reset upon restart amrex::Real PeleC::previousCPUTimeUsed = 0.0; amrex::Real PeleC::startCPUTime = 0.0; @@ -263,6 +266,10 @@ PeleC::read_params() pp.get("lo_chemmask", lo_chem_mask_coordinate[n], n); pp.get("hi_chemmask", hi_chem_mask_coordinate[n], n); } + amrex::Gpu::copy( + amrex::Gpu::hostToDevice, lo_chem_mask_coordinate.begin(), lo_chem_mask_coordinate.end(), d_lo_chem_mask_coordinate.begin()); + amrex::Gpu::copy( + amrex::Gpu::hostToDevice, hi_chem_mask_coordinate.begin(), hi_chem_mask_coordinate.end(), d_hi_chem_mask_coordinate.begin()); } if (use_typical_vals_chem_usr) { diff --git a/Source/React.cpp b/Source/React.cpp index 104e7f8c8..a0fed9d79 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -180,7 +180,7 @@ PeleC::react_state( amrex::Real y=plo[1]+(j+0.5)*dx[1]; amrex::Real z=plo[2]+(k+0.5)*dx[2]; - if((x>=lo_chem_mask_coordinate[0] && x<=hi_chem_mask_coordinate[0]) && ( y>=lo_chem_mask_coordinate[1] && y<=hi_chem_mask_coordinate[1])&& (z>=lo_chem_mask_coordinate[2] && z<=hi_chem_mask_coordinate[2])) + if((x>=d_lo_chem_mask_coordinate[0] && x<=d_hi_chem_mask_coordinate[0]) && ( y>=d_lo_chem_mask_coordinate[1] && y<=d_hi_chem_mask_coordinate[1])&& (z>=d_lo_chem_mask_coordinate[2] && z<=d_hi_chem_mask_coordinate[2])) { mask(i,j,k)=-1; } From 6c6ddb4ce7c0cf6aad13a7ebb22a24b29e1896f0 Mon Sep 17 00:00:00 2001 From: Nadakkal Appukuttan Date: Mon, 15 Apr 2024 17:18:53 -0600 Subject: [PATCH 3/9] Added device fun --- Source/PeleC.H | 4 ++-- Source/PeleC.cpp | 7 ------- Source/React.cpp | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Source/PeleC.H b/Source/PeleC.H index d22925427..1352abb59 100644 --- a/Source/PeleC.H +++ b/Source/PeleC.H @@ -745,8 +745,7 @@ protected: static bool use_chem_mask; static amrex::GpuArray lo_chem_mask_coordinate; static amrex::GpuArray hi_chem_mask_coordinate; - static amrex::Gpu::DeviceVector d_lo_chem_mask_coordinate; - static amrex::Gpu::DeviceVector d_hi_chem_mask_coordinate; + static bool use_typical_vals_chem; static bool use_typical_vals_chem_usr; @@ -907,4 +906,5 @@ PeleC::getFluxReg(int lev) return getLevel(lev).getFluxReg(); } + #endif diff --git a/Source/PeleC.cpp b/Source/PeleC.cpp index a070936f9..68fa9151f 100644 --- a/Source/PeleC.cpp +++ b/Source/PeleC.cpp @@ -112,9 +112,6 @@ bool PeleC::use_chem_mask=false; //Flag to check if mask is activated. amrex::GpuArray PeleC::lo_chem_mask_coordinate; //Box coordinate low amrex::GpuArray PeleC::hi_chem_mask_coordinate; //Box coordinate high -amrex::Gpu::DeviceVector PeleC::d_hi_chem_mask_coordinate; //Box coordinate high -amrex::Gpu::DeviceVector PeleC::d_lo_chem_mask_coordinate; //Box coordinate high - // this will be reset upon restart amrex::Real PeleC::previousCPUTimeUsed = 0.0; amrex::Real PeleC::startCPUTime = 0.0; @@ -266,10 +263,6 @@ PeleC::read_params() pp.get("lo_chemmask", lo_chem_mask_coordinate[n], n); pp.get("hi_chemmask", hi_chem_mask_coordinate[n], n); } - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, lo_chem_mask_coordinate.begin(), lo_chem_mask_coordinate.end(), d_lo_chem_mask_coordinate.begin()); - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, hi_chem_mask_coordinate.begin(), hi_chem_mask_coordinate.end(), d_hi_chem_mask_coordinate.begin()); } if (use_typical_vals_chem_usr) { diff --git a/Source/React.cpp b/Source/React.cpp index a0fed9d79..782d63699 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -129,6 +129,19 @@ PeleC::react_state( #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif { + amrex::Gpu::DeviceVector dv_lo_chem_mask(lo_chem_mask_coordinate.size()); + amrex::Gpu::DeviceVector dv_hi_chem_mask(hi_chem_mask_coordinate.size()); + + amrex::Real* lo_chem_mask_ptr = dv_lo_chem_mask.data(); + amrex::Real* hi_chem_mask_ptr = dv_hi_chem_mask.data(); + + amrex::Gpu::copy( + amrex::Gpu::hostToDevice, lo_chem_mask_coordinate.begin(), lo_chem_mask_coordinate.end(), + dv_lo_chem_mask.begin()); + amrex::Gpu::copy( + amrex::Gpu::hostToDevice, hi_chem_mask_coordinate.begin(), hi_chem_mask_coordinate.end(), + dv_hi_chem_mask.begin()); + for (amrex::MFIter mfi(S_new, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) { @@ -180,7 +193,7 @@ PeleC::react_state( amrex::Real y=plo[1]+(j+0.5)*dx[1]; amrex::Real z=plo[2]+(k+0.5)*dx[2]; - if((x>=d_lo_chem_mask_coordinate[0] && x<=d_hi_chem_mask_coordinate[0]) && ( y>=d_lo_chem_mask_coordinate[1] && y<=d_hi_chem_mask_coordinate[1])&& (z>=d_lo_chem_mask_coordinate[2] && z<=d_hi_chem_mask_coordinate[2])) + if((x>=lo_chem_mask_ptr[0] && x<=hi_chem_mask_ptr[0]) && ( y>=lo_chem_mask_ptr[1] && y<=hi_chem_mask_ptr[1])&& (z>=lo_chem_mask_ptr[2] && z<=hi_chem_mask_ptr[2])) { mask(i,j,k)=-1; } From 8481cc2535ce3dfdf5326bc5fbed50dc98d607f0 Mon Sep 17 00:00:00 2001 From: snadakka Date: Fri, 19 Apr 2024 16:34:25 -0600 Subject: [PATCH 4/9] Simplified using realbox --- Source/React.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Source/React.cpp b/Source/React.cpp index 782d63699..61bc75ec3 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -129,7 +129,7 @@ PeleC::react_state( #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif { - amrex::Gpu::DeviceVector dv_lo_chem_mask(lo_chem_mask_coordinate.size()); + /*amrex::Gpu::DeviceVector dv_lo_chem_mask(lo_chem_mask_coordinate.size()); amrex::Gpu::DeviceVector dv_hi_chem_mask(hi_chem_mask_coordinate.size()); amrex::Real* lo_chem_mask_ptr = dv_lo_chem_mask.data(); @@ -140,7 +140,15 @@ PeleC::react_state( dv_lo_chem_mask.begin()); amrex::Gpu::copy( amrex::Gpu::hostToDevice, hi_chem_mask_coordinate.begin(), hi_chem_mask_coordinate.end(), - dv_hi_chem_mask.begin()); + dv_hi_chem_mask.begin());*/ + + /*Hari's suggestion*/ + + amrex::GpuArray chemlo={AMREX_D_DECL(lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], lo_chem_mask_coordinate[2])}; + amrex::GpuArray chemhi={AMREX_D_DECL(hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], hi_chem_mask_coordinate[2])}; + amrex::RealBox Chem_Masked_Region( AMREX_D_DECL(lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], lo_chem_mask_coordinate[2]), + AMREX_D_DECL(hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], hi_chem_mask_coordinate[2])); + for (amrex::MFIter mfi(S_new, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) { @@ -189,11 +197,12 @@ PeleC::react_state( if(use_chem_mask) { amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - amrex::Real x=plo[0]+(i+0.5)*dx[0]; - amrex::Real y=plo[1]+(j+0.5)*dx[1]; - amrex::Real z=plo[2]+(k+0.5)*dx[2]; + amrex::XDim3 point; + point.x=plo[0]+(i+0.5)*dx[0]; + point.y=plo[1]+(j+0.5)*dx[1]; + point.z=plo[2]+(k+0.5)*dx[2]; - if((x>=lo_chem_mask_ptr[0] && x<=hi_chem_mask_ptr[0]) && ( y>=lo_chem_mask_ptr[1] && y<=hi_chem_mask_ptr[1])&& (z>=lo_chem_mask_ptr[2] && z<=hi_chem_mask_ptr[2])) + if(Chem_Masked_Region.contains(point)) { mask(i,j,k)=-1; } From 798b36678b427f2833537cd8987d3666573e3b51 Mon Sep 17 00:00:00 2001 From: snadakka Date: Fri, 19 Apr 2024 19:47:02 -0600 Subject: [PATCH 5/9] Included mask in RK64 --- Submodules/PelePhysics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodules/PelePhysics b/Submodules/PelePhysics index c0f30b91b..50b990b82 160000 --- a/Submodules/PelePhysics +++ b/Submodules/PelePhysics @@ -1 +1 @@ -Subproject commit c0f30b91b1d21f98c2b13bb1c37f5c86f29f7a0a +Subproject commit 50b990b8274edc2d50aa4fea909785537bc787f4 From 0cc4444f1d86ecf04e2cb886bdc62cd952c5865c Mon Sep 17 00:00:00 2001 From: Nadakkal Appukuttan Date: Fri, 24 May 2024 15:42:52 -0600 Subject: [PATCH 6/9] Modified PelePhysics --- Submodules/PelePhysics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodules/PelePhysics b/Submodules/PelePhysics index 50b990b82..7a51a73a4 160000 --- a/Submodules/PelePhysics +++ b/Submodules/PelePhysics @@ -1 +1 @@ -Subproject commit 50b990b8274edc2d50aa4fea909785537bc787f4 +Subproject commit 7a51a73a4f7bc0be44f13ea24d23211754d32f62 From 153694ae8db7b58eea6615542220375f12295b2f Mon Sep 17 00:00:00 2001 From: snadakka Date: Fri, 24 May 2024 19:41:36 -0400 Subject: [PATCH 7/9] Corrected React.cpp to run on HIP --- Source/React.cpp | 4 ++-- Submodules/PelePhysics | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/React.cpp b/Source/React.cpp index 61bc75ec3..8f70bd077 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -248,7 +248,7 @@ PeleC::react_state( ); amrex::Gpu::Device::streamSynchronize(); - + bool use_chem_mask_d = use_chem_mask; // unpack data amrex::ParallelFor( bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { @@ -275,7 +275,7 @@ PeleC::react_state( - rho_old * e_old) // old internal energy / dt; - if(use_chem_mask && mask(i,j,k)==-1) + if(use_chem_mask_d && mask(i,j,k)==-1) { for(int nsp=0;nsp Date: Mon, 27 May 2024 14:15:16 -0600 Subject: [PATCH 8/9] Removed unused variables --- Source/React.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Source/React.cpp b/Source/React.cpp index 8f70bd077..3760b0e0e 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -129,23 +129,7 @@ PeleC::react_state( #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif { - /*amrex::Gpu::DeviceVector dv_lo_chem_mask(lo_chem_mask_coordinate.size()); - amrex::Gpu::DeviceVector dv_hi_chem_mask(hi_chem_mask_coordinate.size()); - amrex::Real* lo_chem_mask_ptr = dv_lo_chem_mask.data(); - amrex::Real* hi_chem_mask_ptr = dv_hi_chem_mask.data(); - - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, lo_chem_mask_coordinate.begin(), lo_chem_mask_coordinate.end(), - dv_lo_chem_mask.begin()); - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, hi_chem_mask_coordinate.begin(), hi_chem_mask_coordinate.end(), - dv_hi_chem_mask.begin());*/ - - /*Hari's suggestion*/ - - amrex::GpuArray chemlo={AMREX_D_DECL(lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], lo_chem_mask_coordinate[2])}; - amrex::GpuArray chemhi={AMREX_D_DECL(hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], hi_chem_mask_coordinate[2])}; amrex::RealBox Chem_Masked_Region( AMREX_D_DECL(lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], lo_chem_mask_coordinate[2]), AMREX_D_DECL(hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], hi_chem_mask_coordinate[2])); From 1a0f6e2e19c93dfc4f1b6d28b71472500620085a Mon Sep 17 00:00:00 2001 From: Nadakkal Appukuttan Date: Mon, 27 May 2024 14:53:52 -0600 Subject: [PATCH 9/9] Clang-tidy ied --- Source/PeleC.H | 2 -- Source/PeleC.cpp | 23 +++++++++++----------- Source/React.cpp | 51 ++++++++++++++++++++++++------------------------ 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Source/PeleC.H b/Source/PeleC.H index 1352abb59..ee4c61dee 100644 --- a/Source/PeleC.H +++ b/Source/PeleC.H @@ -746,7 +746,6 @@ protected: static amrex::GpuArray lo_chem_mask_coordinate; static amrex::GpuArray hi_chem_mask_coordinate; - static bool use_typical_vals_chem; static bool use_typical_vals_chem_usr; static amrex::Real typical_rhoY_val_min; @@ -906,5 +905,4 @@ PeleC::getFluxReg(int lev) return getLevel(lev).getFluxReg(); } - #endif diff --git a/Source/PeleC.cpp b/Source/PeleC.cpp index 68fa9151f..174666a90 100644 --- a/Source/PeleC.cpp +++ b/Source/PeleC.cpp @@ -108,9 +108,11 @@ amrex::Vector PeleC::m_diagVars; amrex::Vector PeleC::src_list; -bool PeleC::use_chem_mask=false; //Flag to check if mask is activated. -amrex::GpuArray PeleC::lo_chem_mask_coordinate; //Box coordinate low -amrex::GpuArray PeleC::hi_chem_mask_coordinate; //Box coordinate high +bool PeleC::use_chem_mask = false; // Flag to check if mask is activated. +amrex::GpuArray + PeleC::lo_chem_mask_coordinate; // Box coordinate low +amrex::GpuArray + PeleC::hi_chem_mask_coordinate; // Box coordinate high // this will be reset upon restart amrex::Real PeleC::previousCPUTimeUsed = 0.0; @@ -254,15 +256,14 @@ PeleC::read_params() pp.query("use_typ_vals_chem", use_typical_vals_chem); pp.query("use_typ_vals_chem_usr", use_typical_vals_chem_usr); - pp.query("chem_mask",use_chem_mask); + pp.query("chem_mask", use_chem_mask); - //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); - pp.get("hi_chemmask", hi_chem_mask_coordinate[n], n); - } + // 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); + pp.get("hi_chemmask", hi_chem_mask_coordinate[n], n); + } } if (use_typical_vals_chem_usr) { diff --git a/Source/React.cpp b/Source/React.cpp index 3760b0e0e..0c2eff344 100644 --- a/Source/React.cpp +++ b/Source/React.cpp @@ -39,7 +39,7 @@ PeleC::react_state( const amrex::Real strt_time = amrex::ParallelDescriptor::second(); const auto plo = geom.ProbLoArray(); - const auto dx = geom.CellSizeArray(); + const auto dx = geom.CellSizeArray(); AMREX_ASSERT(do_react == 1); @@ -130,9 +130,13 @@ PeleC::react_state( #endif { - amrex::RealBox Chem_Masked_Region( AMREX_D_DECL(lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], lo_chem_mask_coordinate[2]), - AMREX_D_DECL(hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], hi_chem_mask_coordinate[2])); - + amrex::RealBox Chem_Masked_Region( + AMREX_D_DECL( + lo_chem_mask_coordinate[0], lo_chem_mask_coordinate[1], + lo_chem_mask_coordinate[2]), + AMREX_D_DECL( + hi_chem_mask_coordinate[0], hi_chem_mask_coordinate[1], + hi_chem_mask_coordinate[2])); for (amrex::MFIter mfi(S_new, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) { @@ -178,20 +182,19 @@ PeleC::react_state( auto const& mask = dummyMask.array(mfi); auto const& fc = fctCount.array(mfi); - if(use_chem_mask) - { - amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - amrex::XDim3 point; - point.x=plo[0]+(i+0.5)*dx[0]; - point.y=plo[1]+(j+0.5)*dx[1]; - point.z=plo[2]+(k+0.5)*dx[2]; - - if(Chem_Masked_Region.contains(point)) - { - mask(i,j,k)=-1; - } - }); - } + if (use_chem_mask) { + amrex::ParallelFor( + bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { + amrex::XDim3 point; + point.x = plo[0] + (i + 0.5) * dx[0]; + point.y = plo[1] + (j + 0.5) * dx[1]; + point.z = plo[2] + (k + 0.5) * dx[2]; + + if (Chem_Masked_Region.contains(point)) { + mask(i, j, k) = -1; + } + }); + } amrex::ParallelFor( bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { @@ -259,13 +262,11 @@ PeleC::react_state( - rho_old * e_old) // old internal energy / dt; - if(use_chem_mask_d && mask(i,j,k)==-1) - { - for(int nsp=0;nsp