Skip to content

Commit

Permalink
Fix GABLS1 case, do some minor code cleanup (#1359)
Browse files Browse the repository at this point in the history
* Update inputs doc for clarity

* Update prob info

* Make header and source var names consistent

* Fix misleading comment

* GABLS1 should be dry
  • Loading branch information
ewquon authored Jan 4, 2024
1 parent 10adbad commit ae07d35
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Exec/RegTests/GABLS1/prob.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _PROB_H_
#define _PROB_H_

/* Based on ABL problem
* - initial QKE based on specified initial TKE profile
*/

#include <string>

#include "AMReX_REAL.H"
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions Exec/RegTests/GABLS1/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Source/Advection/Advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void AdvectionSrcForRho (const amrex::Box& bx,
const amrex::Array4< amrex::Real>& avg_zmom,
const amrex::Array4<const amrex::Real>& z_nd,
const amrex::Array4<const amrex::Real>& detJ,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& cellSize,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& cellSizeInv,
const amrex::Array4<const amrex::Real>& mf_m,
const amrex::Array4<const amrex::Real>& mf_u,
const amrex::Array4<const amrex::Real>& mf_v,
Expand All @@ -37,7 +37,7 @@ void AdvectionSrcForScalars (const amrex::Box& bx,
const amrex::Array4<const amrex::Real>& cell_prim,
const amrex::Array4<amrex::Real>& src,
const amrex::Array4<const amrex::Real>& detJ,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& cellSize,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& cellSizeInv,
const amrex::Array4<const amrex::Real>& mf_m,
const AdvType horiz_adv_type, const AdvType vert_adv_type,
const bool use_terrain,
Expand Down
2 changes: 1 addition & 1 deletion Source/DataStructs/DataStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit ae07d35

Please sign in to comment.