Skip to content

Commit

Permalink
more cleanup of moisture stuff (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Dec 12, 2023
1 parent 59c4ca9 commit 76e7512
Show file tree
Hide file tree
Showing 65 changed files with 810 additions and 1,037 deletions.
18 changes: 0 additions & 18 deletions Build/cmake_with_warm_no_precip.sh

This file was deleted.

1 change: 0 additions & 1 deletion CMake/BuildERFExe.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/TimeIntegration/ERF_advance_microphysics.cpp
${SRC_DIR}/TimeIntegration/ERF_advance_radiation.cpp
${SRC_DIR}/TimeIntegration/ERF_make_buoyancy.cpp
${SRC_DIR}/TimeIntegration/ERF_make_condensation_source.cpp
${SRC_DIR}/TimeIntegration/ERF_make_fast_coeffs.cpp
${SRC_DIR}/TimeIntegration/ERF_slow_rhs_pre.cpp
${SRC_DIR}/TimeIntegration/ERF_ApplySpongeZoneBCs.cpp
Expand Down
10 changes: 7 additions & 3 deletions Exec/ABL/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ Problem::init_custom_pert(
amrex::Array4<amrex::Real const> const& /*mf_m*/,
amrex::Array4<amrex::Real const> const& /*mf_u*/,
amrex::Array4<amrex::Real const> const& /*mf_v*/,
const SolverChoice& /*sc*/)
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

ParallelForRNG(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
// Geometry
const Real* prob_lo = geomdata.ProbLo();
Expand Down Expand Up @@ -93,8 +95,10 @@ Problem::init_custom_pert(
// Set an initial value for QKE
state(i, j, k, RhoQKE_comp) = parms.QKE_0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
10 changes: 7 additions & 3 deletions Exec/ABL_input_sounding/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ Problem::init_custom_pert(
amrex::Array4<amrex::Real const> const& /*mf_m*/,
amrex::Array4<amrex::Real const> const& /*mf_u*/,
amrex::Array4<amrex::Real const> const& /*mf_v*/,
const SolverChoice& /*sc*/)
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
// Geometry
const Real* prob_lo = geomdata.ProbLo();
Expand All @@ -86,8 +88,10 @@ Problem::init_custom_pert(
// Set an initial value for QKE
state(i, j, k, RhoQKE_comp) = parms.QKE_0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
11 changes: 7 additions & 4 deletions Exec/DevTests/MovingTerrain/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_m*/,
Array4<Real const> const& /*mf_u*/,
Array4<Real const> const& /*mf_v*/,
const SolverChoice&)
const SolverChoice& sc)
{
const int khi = geomdata.Domain().bigEnd()[2];

const bool use_moisture = (sc.moisture_type != MoistureType::None);

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

const Real T_sfc = parms.T_0;
Expand Down Expand Up @@ -83,9 +85,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = state(i,j,k,Rho_comp);

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;

if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
8 changes: 6 additions & 2 deletions Exec/DevTests/MultiBlock/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Problem::init_custom_pert(
{
const int khi = geomdata.Domain().bigEnd()[2];

const bool use_moisture = (sc.moisture_type != MoistureType::None);

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

const Real rho_sfc = p_0 / (R_d*parms.T_0);
Expand Down Expand Up @@ -86,8 +88,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
10 changes: 7 additions & 3 deletions Exec/DevTests/ParticlesOverWoA/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_m*/,
Array4<Real const> const& /*mf_u*/,
Array4<Real const> const& /*mf_v*/,
const SolverChoice&)
const SolverChoice& sc)
{
const int khi = geomdata.Domain().bigEnd()[2];

const bool use_moisture = (sc.moisture_type != MoistureType::None);

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

const Real rho_sfc = p_0 / (R_d*parms.T_0);
Expand Down Expand Up @@ -85,8 +87,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
30 changes: 17 additions & 13 deletions Exec/Radiation/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,16 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_v*/,
const SolverChoice& sc)
{
const int khi = geomdata.Domain().bigEnd()[2];
const int khi = geomdata.Domain().bigEnd()[2];

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
const bool use_moisture = (sc.moisture_type != MoistureType::None);

// This is what we do at k = 0 -- note we assume p = p_0 and T = T_0 at z=0
const amrex::Real& dz = geomdata.CellSize()[2];
const amrex::Real& prob_lo_z = geomdata.ProbLo()[2];
const amrex::Real& prob_hi_z = geomdata.ProbHi()[2];
AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

// This is what we do at k = 0 -- note we assume p = p_0 and T = T_0 at z=0
const amrex::Real& dz = geomdata.CellSize()[2];
const amrex::Real& prob_lo_z = geomdata.ProbLo()[2];
const amrex::Real& prob_hi_z = geomdata.ProbHi()[2];

const amrex::Real rdOcp = sc.rdOcp;

Expand Down Expand Up @@ -182,15 +184,17 @@ Problem::init_custom_pert(
state(i, j, k, RhoScalar_comp) = 0.0;

// mean states
state(i, j, k, RhoQ1_comp) = rho*qvapor;
state(i, j, k, RhoQ2_comp) = 0.0;
qv(i, j, k) = qvapor;
qc(i, j, k) = 0.0;
qi(i, j, k) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = rho*qvapor;
state(i, j, k, RhoQ2_comp) = 0.0;
qv(i, j, k) = qvapor;
qc(i, j, k) = 0.0;
qi(i, j, k) = 0.0;
#if defined(ERF_USE_WARM_NO_PRECIP)
state(i, j, k, RhoQ1_comp) = rho*qvapor;
state(i, j, k, RhoQ2_comp) = 0.0;
state(i, j, k, RhoQ1_comp) = rho*qvapor;
state(i, j, k, RhoQ2_comp) = 0.0;
#endif
}
});

// Set the x-velocity
Expand Down
14 changes: 10 additions & 4 deletions Exec/RegTests/Bubble/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Problem::init_custom_pert(
{
const int khi = geomdata.Domain().bigEnd()[2];

const bool use_moisture = (sc.moisture_type != MoistureType::None);

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

const Real rho_sfc = p_0 / (R_d*parms.T_0);
Expand Down Expand Up @@ -131,8 +133,10 @@ Problem::init_custom_pert(

state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}

});
} else {
Expand Down Expand Up @@ -177,8 +181,10 @@ Problem::init_custom_pert(

state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});
}

Expand Down
10 changes: 7 additions & 3 deletions Exec/RegTests/CouetteFlow/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_m*/,
Array4<Real const> const& /*mf_u*/,
Array4<Real const> const& /*mf_v*/,
const SolverChoice&)
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

amrex::ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {

// Set scalar to 0
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}

});

Expand Down
34 changes: 20 additions & 14 deletions Exec/RegTests/DensityCurrent/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,21 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_v*/,
const SolverChoice& sc)
{
const int khi = geomdata.Domain().bigEnd()[2];
const int khi = geomdata.Domain().bigEnd()[2];

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
const bool use_moisture = (sc.moisture_type != MoistureType::None);

const Real l_x_r = parms.x_r;
//const Real l_x_r = parms.x_r * mf_u(0,0,0); //used to validate constant msf
const Real l_z_r = parms.z_r;
const Real l_x_c = parms.x_c;
const Real l_z_c = parms.z_c;
const Real l_Tpt = parms.T_pert;
const Real rdOcp = sc.rdOcp;
AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

if (z_cc) {
const Real l_x_r = parms.x_r;
//const Real l_x_r = parms.x_r * mf_u(0,0,0); //used to validate constant msf
const Real l_z_r = parms.z_r;
const Real l_x_c = parms.x_c;
const Real l_z_c = parms.z_c;
const Real l_Tpt = parms.T_pert;
const Real rdOcp = sc.rdOcp;

if (z_cc) {
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
// Geometry (note we must include these here to get the data on device)
Expand All @@ -88,8 +90,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});
} else {
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
Expand Down Expand Up @@ -118,8 +122,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});
}

Expand Down
7 changes: 5 additions & 2 deletions Exec/RegTests/DynamicRefinement/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_v*/,
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

Real xc = parms.xc; Real yc = parms.yc;
Real R = parms.R ; Real beta = parms.beta;
Expand Down Expand Up @@ -126,8 +127,10 @@ Problem::init_custom_pert(
// Set scalar = 0 -- unused
state(i, j, k, RhoScalar_comp) = 1.0 + Omg;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
10 changes: 7 additions & 3 deletions Exec/RegTests/EkmanSpiral_custom/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_m*/,
Array4<Real const> const& /*mf_u*/,
Array4<Real const> const& /*mf_v*/,
const SolverChoice&)
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
// Geometry
//const Real* prob_lo = geomdata.ProbLo();
Expand All @@ -54,8 +56,10 @@ Problem::init_custom_pert(
// Set scalar = 0 everywhere
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}

});

Expand Down
4 changes: 3 additions & 1 deletion Exec/RegTests/GABLS1/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ Problem::init_custom_pert(
amrex::Array4<amrex::Real const> const& /*mf_m*/,
amrex::Array4<amrex::Real const> const& /*mf_u*/,
amrex::Array4<amrex::Real const> const& /*mf_v*/,
const SolverChoice& /*sc*/)
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

if (state.nComp() > RhoQKE_comp) {
amrex::Print() << "Initializing QKE" << std::endl;
}
Expand Down
7 changes: 5 additions & 2 deletions Exec/RegTests/IsentropicVortex/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Problem::init_custom_pert(
Array4<Real const> const& /*mf_v*/,
const SolverChoice& sc)
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

Real xc = parms.xc; Real yc = parms.yc;
Real R = parms.R ; Real beta = parms.beta;
Expand Down Expand Up @@ -128,8 +129,10 @@ Problem::init_custom_pert(
// Set scalar = 0 -- unused
state(i, j, k, RhoScalar_comp) = 0.0;

state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
if (use_moisture) {
state(i, j, k, RhoQ1_comp) = 0.0;
state(i, j, k, RhoQ2_comp) = 0.0;
}
});

// Set the x-velocity
Expand Down
Loading

0 comments on commit 76e7512

Please sign in to comment.