From ae07d35632a7e42fd0fd9da5faf7f118f80bf770 Mon Sep 17 00:00:00 2001 From: Eliot Quon Date: Wed, 3 Jan 2024 22:53:48 -0700 Subject: [PATCH] Fix GABLS1 case, do some minor code cleanup (#1359) * Update inputs doc for clarity * Update prob info * Make header and source var names consistent * Fix misleading comment * GABLS1 should be dry --- Docs/sphinx_doc/Inputs.rst | 6 +++--- Exec/RegTests/GABLS1/prob.H | 6 +++++- Exec/RegTests/GABLS1/prob.cpp | 9 +++++++-- Source/Advection/Advection.H | 4 ++-- Source/DataStructs/DataStruct.H | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Docs/sphinx_doc/Inputs.rst b/Docs/sphinx_doc/Inputs.rst index fed1b0655..5fdaf7cc1 100644 --- a/Docs/sphinx_doc/Inputs.rst +++ b/Docs/sphinx_doc/Inputs.rst @@ -670,11 +670,11 @@ If we set ``erf.molec_diff_type`` to ``ConstantAlpha``, then - the dynamic viscosity in the momentum equation is assumed to have the form :math:`\mu = \rho \alpha_M` where :math:`\alpha_M` is a momentum diffusivity constant with units of kinematic viscosity, calculated as ``erf.dynamicViscosity`` divided by ``erf.rho0_trans``; - this diffusivity is multiplied by the current density :math:`\rho` to form the coefficient in the momentum equation; and + this diffusivity is multiplied by the instantaneous local density :math:`\rho` to form the coefficient in the momentum equation; and -- ``erf.alpha_T`` is multiplied by the current density :math:`\rho` to form the coefficient for potential temperature, and +- ``erf.alpha_T`` is multiplied by the instantaneous local density :math:`\rho` to form the coefficient for potential temperature, and -- ``erf.alpha_C`` is multiplied by the current density :math:`\rho` to form the coefficient for an advected scalar. +- ``erf.alpha_C`` is multiplied by the instantaneous local density :math:`\rho` to form the coefficient for an advected scalar. PBL Scheme diff --git a/Exec/RegTests/GABLS1/prob.H b/Exec/RegTests/GABLS1/prob.H index ebb4d529f..cf5db4fc1 100644 --- a/Exec/RegTests/GABLS1/prob.H +++ b/Exec/RegTests/GABLS1/prob.H @@ -1,6 +1,10 @@ #ifndef _PROB_H_ #define _PROB_H_ +/* Based on ABL problem + * - initial QKE based on specified initial TKE profile + */ + #include #include "AMReX_REAL.H" @@ -69,7 +73,7 @@ public: const SolverChoice& sc) override; protected: - std::string name() override { return "ABL"; } + std::string name() override { return "ABL-GABLS1"; } private: ProbParm parms; diff --git a/Exec/RegTests/GABLS1/prob.cpp b/Exec/RegTests/GABLS1/prob.cpp index 748b65691..5aed34a33 100644 --- a/Exec/RegTests/GABLS1/prob.cpp +++ b/Exec/RegTests/GABLS1/prob.cpp @@ -63,6 +63,9 @@ Problem::init_custom_pert( const SolverChoice& sc) { const bool use_moisture = (sc.moisture_type != MoistureType::None); + if (use_moisture) { + amrex::Print() << "Note: GABLS1 is a dry case" << std::endl; + } if (state.nComp() > RhoQKE_comp) { amrex::Print() << "Initializing QKE" << std::endl; @@ -121,8 +124,10 @@ Problem::init_custom_pert( } } - 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 diff --git a/Source/Advection/Advection.H b/Source/Advection/Advection.H index d09dd1537..b859bea48 100644 --- a/Source/Advection/Advection.H +++ b/Source/Advection/Advection.H @@ -21,7 +21,7 @@ void AdvectionSrcForRho (const amrex::Box& bx, const amrex::Array4< amrex::Real>& avg_zmom, const amrex::Array4& z_nd, const amrex::Array4& detJ, - const amrex::GpuArray& cellSize, + const amrex::GpuArray& cellSizeInv, const amrex::Array4& mf_m, const amrex::Array4& mf_u, const amrex::Array4& mf_v, @@ -37,7 +37,7 @@ void AdvectionSrcForScalars (const amrex::Box& bx, const amrex::Array4& cell_prim, const amrex::Array4& src, const amrex::Array4& detJ, - const amrex::GpuArray& cellSize, + const amrex::GpuArray& cellSizeInv, const amrex::Array4& mf_m, const AdvType horiz_adv_type, const AdvType vert_adv_type, const bool use_terrain, diff --git a/Source/DataStructs/DataStruct.H b/Source/DataStructs/DataStruct.H index 2192f266a..08df800fb 100644 --- a/Source/DataStructs/DataStruct.H +++ b/Source/DataStructs/DataStruct.H @@ -206,7 +206,7 @@ struct SolverChoice { turbChoice[lev].init_params(lev,max_level); } - // If running LES/PBL then must use "ConstantAlpha" + // If running LES/PBL then molecular diffusion must be "Constant" or "None" for (int lev = 0; lev <= max_level; lev++) { if (turbChoice[lev].les_type != LESType::None) { if ( diffChoice.molec_diff_type == MolecDiffType::ConstantAlpha ) {