Skip to content

Commit

Permalink
Merge branch 'development' into thin_immersed_bndry
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Apr 6, 2024
2 parents b6eac48 + 46a9dd8 commit 58b00da
Show file tree
Hide file tree
Showing 19 changed files with 359 additions and 84 deletions.
80 changes: 80 additions & 0 deletions Exec/SquallLine_2D/inputs_moisture_SAM
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 14400
stop_time = 90000.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 2048 1024 2048

# PROBLEM SIZE & GEOMETRY
geometry.prob_lo = -25000. 0. 0.
geometry.prob_hi = 25000. 400. 20000.
amr.n_cell = 192 4 128

geometry.is_periodic = 1 1 0

#xlo.type = "Open"
#xhi.type = "Open"
zlo.type = "SlipWall"
zhi.type = "Outflow"

# TIME STEP CONTROL
erf.use_native_mri = 1
erf.fixed_dt = 1.0 # fixed time step [s] -- Straka et al 1993
erf.fixed_fast_dt = 0.5 # fixed time step [s] -- Straka et al 1993
#erf.no_substepping = 1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 1 # timesteps between computing mass
erf.v = 1 # verbosity in ERF.cpp
amr.v = 1 # verbosity in Amr.cpp

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed

# CHECKPOINT FILES
amr.check_file = chk # root name of checkpoint file
amr.check_int = 1000 # number of timesteps between checkpoints
#amr.restart = chk01000

# PLOTFILES
erf.plot_file_1 = plt # root name of plotfile
erf.plot_int_1 = 60 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhotheta rhoQ1 rhoQ2 rhoQ3 x_velocity y_velocity z_velocity pressure theta temp qv qc qrain qsnow qgraup rain_accum snow_accum graup_accum pert_dens

# SOLVER CHOICE
erf.use_gravity = true
erf.buoyancy_type = 1
erf.use_coriolis = false
erf.use_rayleigh_damping = false

#
# diffusion coefficient from Straka, K = 75 m^2/s
#
erf.molec_diff_type = "ConstantAlpha"
erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities
erf.dynamicViscosity = 100.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s
erf.alpha_T = 100.0 # [m^2/s]
erf.alpha_C = 100.0

erf.moisture_model = "SAM"
erf.use_moist_background = true

erf.dycore_horiz_adv_type = "Centered_2nd"
erf.dycore_vert_adv_type = "Centered_2nd"
erf.dryscal_horiz_adv_type = "Centered_2nd"
erf.dryscal_vert_adv_type = "Centered_2nd"
erf.moistscal_horiz_adv_type = "Centered_2nd"
erf.moistscal_vert_adv_type = "Centered_2nd"

# PROBLEM PARAMETERS (optional)
prob.z_tr = 12000.0
prob.height = 1200.0
prob.theta_0 = 300.0
prob.theta_tr = 343.0
prob.T_tr = 213.0
prob.x_c = 0.0
prob.z_c = 1500.0
prob.x_r = 4000.0
prob.z_r = 1500.0
prob.theta_c = 3.0
1 change: 1 addition & 0 deletions Source/Advection/Advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void AdvectionSrcForMom (const amrex::Box& bxx, const amrex::Box& bxy, const amr
const amrex::Array4<const amrex::Real>& w ,
const amrex::Array4<const amrex::Real>& rho_u , const amrex::Array4<const amrex::Real>& rho_v,
const amrex::Array4<const amrex::Real>& Omega ,
const amrex::Array4<const amrex::Real>& z_nd,
const amrex::Array4<const amrex::Real>& ax,
const amrex::Array4<const amrex::Real>& ay,
const amrex::Array4<const amrex::Real>& az,
Expand Down
57 changes: 34 additions & 23 deletions Source/Advection/AdvectionSrcForMom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using namespace amrex;
* @param[in] rho_u x-component of the momentum
* @param[in] rho_v y-component of the momentum
* @param[in] Omega component of the momentum normal to the z-coordinate surface
* @param[in] z_nd height coordinate at nodes
* @param[in] ax Area fraction of x-faces
* @param[in] ay Area fraction of y-faces
* @param[in] az Area fraction of z-faces
Expand All @@ -48,6 +49,7 @@ AdvectionSrcForMom (const Box& bxx, const Box& bxy, const Box& bxz,
const Array4<const Real>& rho_u,
const Array4<const Real>& rho_v,
const Array4<const Real>& Omega,
const Array4<const Real>& z_nd,
const Array4<const Real>& ax,
const Array4<const Real>& ay,
const Array4<const Real>& az,
Expand Down Expand Up @@ -215,11 +217,13 @@ AdvectionSrcForMom (const Box& bxx, const Box& bxy, const Box& bxz,
Real xflux_lo = 0.25 * (rho_u(i,j,k) * mf_u_inv(i,j,0) + rho_u(i-1,j,k) * mf_u_inv(i-1,j,0)) *
(u(i-1,j,k) + u(i,j,k)) * 0.5 * (ax(i,j,k) + ax(i-1,j,k));

Real yflux_hi = 0.25 * (rho_v(i,j+1,k) * mf_v_inv(i,j+1,0) + rho_v(i-1,j+1,k) * mf_v_inv(i-1,j+1,0)) *
(u(i,j+1,k) + u(i,j,k)) * 0.5 * (ay(i,j,k) + ay(i,j+1,k));
Real met_h_zeta_yhi = Compute_h_zeta_AtEdgeCenterK(i,j+1,k,cellSizeInv,z_nd);
Real yflux_hi = 0.25 * (rho_v(i,j+1,k)*mf_v_inv(i,j+1,0) + rho_v(i-1,j+1,k)*mf_v_inv(i-1,j+1,0)) *
(u(i,j+1,k) + u(i,j,k)) * met_h_zeta_yhi;

Real yflux_lo = 0.25 * (rho_v(i,j,k) * mf_v_inv(i,j,0) + rho_v(i-1,j,k) * mf_v_inv(i-1,j,0)) *
(u(i,j-1,k) + u(i,j,k)) * 0.5 * (ay(i,j,k) + ay(i,j-1,k));
Real met_h_zeta_ylo = Compute_h_zeta_AtEdgeCenterK(i,j ,k,cellSizeInv,z_nd);
Real yflux_lo = 0.25 * (rho_v(i,j ,k)*mf_v_inv(i,j ,0) + rho_v(i-1,j ,k)*mf_v_inv(i-1,j ,0)) *
(u(i,j-1,k) + u(i,j,k)) * met_h_zeta_ylo;

Real zflux_hi = 0.25 * (Omega(i,j,k+1) + Omega(i-1,j,k+1)) * (u(i,j,k+1) + u(i,j,k)) *
0.5 * (az(i,j,k+1) + az(i-1,j,k+1));
Expand All @@ -236,16 +240,19 @@ AdvectionSrcForMom (const Box& bxx, const Box& bxy, const Box& bxz,
},
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real xflux_hi = 0.25 * (rho_u(i+1,j,k) * mf_u_inv(i+1,j,0) + rho_u(i+1,j-1, k) * mf_u_inv(i+1,j-1,0)) *
(v(i+1,j,k) + v(i,j,k)) * 0.5 * (ax(i,j,k) + ax(i+1,j,k));

Real xflux_lo = 0.25 * (rho_u(i,j,k) * mf_u_inv(i,j,0) + rho_u(i ,j-1, k) * mf_u_inv(i-1,j ,0)) *
(v(i-1,j,k) + v(i,j,k)) * 0.5 * (ax(i,j,k) + ax(i-1,j,k));
Real met_h_zeta_xhi = Compute_h_zeta_AtEdgeCenterK(i+1,j,k,cellSizeInv,z_nd);
Real xflux_hi = 0.25 * (rho_u(i+1,j,k)*mf_u_inv(i+1,j,0) + rho_u(i+1,j-1,k)*mf_u_inv(i+1,j-1,0)) *
(v(i+1,j,k) + v(i,j,k)) * met_h_zeta_xhi;

Real yflux_hi = 0.25 * (rho_v(i,j+1,k) * mf_v_inv(i,j+1,0) + rho_v(i ,j ,k) * mf_v_inv(i ,j ,0)) *
Real met_h_zeta_xlo = Compute_h_zeta_AtEdgeCenterK(i ,j,k,cellSizeInv,z_nd);
Real xflux_lo = 0.25 * (rho_u(i, j, k)*mf_u_inv(i ,j,0) + rho_u(i ,j-1,k)*mf_u_inv(i-1,j ,0)) *
(v(i-1,j,k) + v(i,j,k)) * met_h_zeta_xlo;

Real yflux_hi = 0.25 * (rho_v(i,j+1,k)*mf_v_inv(i,j+1,0) + rho_v(i,j ,k) * mf_v_inv(i,j ,0)) *
(v(i,j+1,k) + v(i,j,k)) * 0.5 * (ay(i,j,k) + ay(i,j+1,k));

Real yflux_lo = 0.25 * (rho_v(i,j,k) * mf_v_inv(i,j,0) + rho_v(i , j-1, k) * mf_v_inv(i ,j-1,0)) *
Real yflux_lo = 0.25 * (rho_v(i,j ,k)*mf_v_inv(i,j ,0) + rho_v(i,j-1,k) * mf_v_inv(i,j-1,0)) *
(v(i,j-1,k) + v(i,j,k)) * 0.5 * (ay(i,j,k) + ay(i,j-1,k));

Real zflux_hi = 0.25 * (Omega(i,j,k+1) + Omega(i, j-1, k+1)) * (v(i,j,k+1) + v(i,j,k)) *
Expand All @@ -263,17 +270,21 @@ AdvectionSrcForMom (const Box& bxx, const Box& bxy, const Box& bxz,
},
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real xflux_hi = 0.25*(rho_u(i+1,j,k) + rho_u(i+1,j,k-1)) * mf_u_inv(i+1,j ,0) *
(w(i+1,j,k) + w(i,j,k)) * 0.5 * (ax(i+1,j,k) + ax(i+1,j,k-1));
Real met_h_zeta_xhi = Compute_h_zeta_AtEdgeCenterJ(i+1,j ,k ,cellSizeInv,z_nd);
Real xflux_hi = 0.25*(rho_u(i+1,j ,k) + rho_u(i+1,j,k-1)) * mf_u_inv(i+1,j,0) *
(w(i+1,j,k) + w(i,j,k)) * met_h_zeta_xhi;

Real xflux_lo = 0.25*(rho_u(i,j,k) + rho_u(i,j,k-1)) * mf_u_inv(i ,j ,0) *
(w(i-1,j,k) + w(i,j,k)) * 0.5 * (ax(i,j,k) + ax(i,j,k-1));
Real met_h_zeta_xlo = Compute_h_zeta_AtEdgeCenterJ(i ,j ,k ,cellSizeInv,z_nd);
Real xflux_lo = 0.25*(rho_u(i ,j ,k) + rho_u(i ,j,k-1)) * mf_u_inv(i ,j,0) *
(w(i-1,j,k) + w(i,j,k)) * met_h_zeta_xlo;

Real yflux_hi = 0.25*(rho_v(i ,j+1,k) + rho_v(i, j+1, k-1)) * mf_v_inv(i ,j+1,0) *
(w(i,j+1,k) + w(i,j,k)) * 0.5 * (ay(i,j+1,k) + ay(i,j+1,k-1));
Real met_h_zeta_yhi = Compute_h_zeta_AtEdgeCenterI(i ,j+1,k ,cellSizeInv,z_nd);
Real yflux_hi = 0.25*(rho_v(i,j+1,k) + rho_v(i,j+1,k-1)) * mf_v_inv(i,j+1,0) *
(w(i,j+1,k) + w(i,j,k)) * met_h_zeta_yhi;

Real yflux_lo = 0.25*(rho_v(i ,j ,k) + rho_v(i, j , k-1)) * mf_v_inv(i ,j ,0) *
(w(i,j-1,k) + w(i,j,k)) * 0.5 * (ay(i,j,k) + ay(i,j,k-1));
Real met_h_zeta_ylo = Compute_h_zeta_AtEdgeCenterI(i ,j ,k ,cellSizeInv,z_nd);
Real yflux_lo = 0.25*(rho_v(i,j ,k) + rho_v(i,j ,k-1)) * mf_v_inv(i,j ,0) *
(w(i,j-1,k) + w(i,j,k)) * met_h_zeta_ylo;

Real zflux_lo = 0.25 * (Omega(i,j,k) + Omega(i,j,k-1)) * (w(i,j,k) + w(i,j,k-1));

Expand All @@ -294,35 +305,35 @@ AdvectionSrcForMom (const Box& bxx, const Box& bxy, const Box& bxz,
if (horiz_adv_type == AdvType::Centered_2nd) {
AdvectionSrcForMomVert<CENTERED2>(bxx, bxy, bxz,
rho_u_rhs, rho_v_rhs, rho_w_rhs,
rho_u, rho_v, Omega, u, v, w, ax, ay, az, detJ,
rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
cellSizeInv, mf_m, mf_u_inv, mf_v_inv,
horiz_upw_frac, vert_upw_frac,
vert_adv_type, lo_z_face, hi_z_face);
} else if (horiz_adv_type == AdvType::Upwind_3rd) {
AdvectionSrcForMomVert<UPWIND3>(bxx, bxy, bxz,
rho_u_rhs, rho_v_rhs, rho_w_rhs,
rho_u, rho_v, Omega, u, v, w, ax, ay, az, detJ,
rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
cellSizeInv, mf_m, mf_u_inv, mf_v_inv,
horiz_upw_frac, vert_upw_frac,
vert_adv_type, lo_z_face, hi_z_face);
} else if (horiz_adv_type == AdvType::Centered_4th) {
AdvectionSrcForMomVert<CENTERED4>(bxx, bxy, bxz,
rho_u_rhs, rho_v_rhs, rho_w_rhs,
rho_u, rho_v, Omega, u, v, w, ax, ay, az, detJ,
rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
cellSizeInv, mf_m, mf_u_inv, mf_v_inv,
horiz_upw_frac, vert_upw_frac,
vert_adv_type, lo_z_face, hi_z_face);
} else if (horiz_adv_type == AdvType::Upwind_5th) {
AdvectionSrcForMomVert<UPWIND5>(bxx, bxy, bxz,
rho_u_rhs, rho_v_rhs, rho_w_rhs,
rho_u, rho_v, Omega, u, v, w, ax, ay, az, detJ,
rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
cellSizeInv, mf_m, mf_u_inv, mf_v_inv,
horiz_upw_frac, vert_upw_frac,
vert_adv_type, lo_z_face, hi_z_face);
} else if (horiz_adv_type == AdvType::Centered_6th) {
AdvectionSrcForMomVert<CENTERED6>(bxx, bxy, bxz,
rho_u_rhs, rho_v_rhs, rho_w_rhs,
rho_u, rho_v, Omega, u, v, w, ax, ay, az, detJ,
rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
cellSizeInv, mf_m, mf_u_inv, mf_v_inv,
horiz_upw_frac, vert_upw_frac,
vert_adv_type, lo_z_face, hi_z_face);
Expand Down
Loading

0 comments on commit 58b00da

Please sign in to comment.