From 059c9620155c29c75a8e160e5bacff6cb9815c44 Mon Sep 17 00:00:00 2001 From: Mahesh Natarajan Date: Tue, 2 Jan 2024 09:06:40 -0800 Subject: [PATCH] Buoyancy term and bc term for bx_xhi_face (#1356) * Updating type 1 buoyancy with precipitation term * updating buoynacy term and switching lo(3) to hi(0) --------- Co-authored-by: Mahesh Natarajan --- Source/BoundaryConditions/BoundaryConditions_xvel.cpp | 2 +- Source/TimeIntegration/ERF_make_buoyancy.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/BoundaryConditions/BoundaryConditions_xvel.cpp b/Source/BoundaryConditions/BoundaryConditions_xvel.cpp index 6bdcb5096..041b068bf 100644 --- a/Source/BoundaryConditions/BoundaryConditions_xvel.cpp +++ b/Source/BoundaryConditions/BoundaryConditions_xvel.cpp @@ -95,7 +95,7 @@ void ERFPhysBCFunct::impose_lateral_xvel_bcs (const Array4& dest_arr, }, // We only set the values on the domain faces themselves if EXT_DIR bx_xhi_face, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { - if (bc_ptr[n].lo(3) == ERFBCType::ext_dir) + if (bc_ptr[n].hi(0) == ERFBCType::ext_dir) dest_arr(i,j,k) = l_bc_extdir_vals_d[n][3]; } ); diff --git a/Source/TimeIntegration/ERF_make_buoyancy.cpp b/Source/TimeIntegration/ERF_make_buoyancy.cpp index d9db696d5..b8b1e5476 100644 --- a/Source/TimeIntegration/ERF_make_buoyancy.cpp +++ b/Source/TimeIntegration/ERF_make_buoyancy.cpp @@ -160,8 +160,14 @@ void make_buoyancy (Vector& S_data, amrex::ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real rhop_hi = cell_data(i,j,k ,Rho_comp) + cell_data(i,j,k ,RhoQ1_comp) + cell_data(i,j,k ,RhoQ2_comp) + cell_data(i,j,k ,RhoQ3_comp) - r0_arr(i,j,k ); - Real rhop_lo = cell_data(i,j,k-1,Rho_comp) + cell_data(i,j,k-1,RhoQ1_comp) + cell_data(i,j,k-1,RhoQ2_comp) + cell_data(i,j,k-1,RhoQ3_comp) - r0_arr(i,j,k-1); + Real rhop_lo, rhop_hi; + if(solverChoice.moisture_type == MoistureType::FastEddy){ + rhop_hi = cell_data(i,j,k ,Rho_comp) + cell_data(i,j,k ,RhoQ1_comp) + cell_data(i,j,k ,RhoQ2_comp) - r0_arr(i,j,k ); + rhop_lo = cell_data(i,j,k-1,Rho_comp) + cell_data(i,j,k-1,RhoQ1_comp) + cell_data(i,j,k-1,RhoQ2_comp) - r0_arr(i,j,k-1); + }else{ + rhop_hi = cell_data(i,j,k ,Rho_comp) + cell_data(i,j,k ,RhoQ1_comp) + cell_data(i,j,k ,RhoQ2_comp) + cell_data(i,j,k ,RhoQ3_comp) - r0_arr(i,j,k ); + rhop_lo = cell_data(i,j,k-1,Rho_comp) + cell_data(i,j,k-1,RhoQ1_comp) + cell_data(i,j,k-1,RhoQ2_comp) + cell_data(i,j,k-1,RhoQ3_comp) - r0_arr(i,j,k-1); + } buoyancy_fab(i, j, k) = grav_gpu[2] * 0.5 * ( rhop_hi + rhop_lo ); }); } // mfi