14 #include <AMReX_FArrayBox.H>
15 #include <AMReX_Geometry.H>
16 #include <AMReX_MultiFabUtil.H>
17 #include <AMReX_GpuContainers.H>
43 using FabPtr = std::shared_ptr<amrex::MultiFab>;
65 Init (
const amrex::MultiFab& cons_in,
66 const amrex::BoxArray& ,
67 const amrex::Geometry& geom,
68 const amrex::Real& dt_advance,
69 std::unique_ptr<amrex::MultiFab>& ,
70 std::unique_ptr<amrex::MultiFab>& )
override;
119 std::vector<int>& a_idx,
120 std::vector<std::string>& a_names)
const override
126 AMREX_GPU_HOST_DEVICE
130 const amrex::Real& fac_cond,
131 const amrex::Array4<amrex::Real>& tabs_array,
132 const amrex::Array4<amrex::Real>& pres_array,
133 const amrex::Array4<amrex::Real>& qv_array,
134 const amrex::Array4<amrex::Real>& qc_array)
137 amrex::Real tol = 1.0e-8;
140 amrex::Real qsat, dqsat;
144 amrex::Real fff, dfff;
145 amrex::Real dtabs, delta_qv;
148 amrex::Real
tabs = tabs_array(i,j,k);
149 amrex::Real
pres = pres_array(i,j,k);
164 fff = -
tabs + tabs_array(i,j,k) + fac_cond*(qv_array(i,j,k) - qsat);
167 dfff = -1.0 - fac_cond*dqsat;
175 }
while(std::abs(dtabs) > tol && niter < 20);
181 delta_qv = qv_array(i,j,k) - qsat;
184 qv_array(i,j,k) = qsat;
185 qc_array(i,j,k) += delta_qv;
constexpr amrex::Real lcond
Definition: ERF_Constants.H:66
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_dtqsatw(amrex::Real t, amrex::Real p, amrex::Real &dtqsatw)
Definition: ERF_MicrophysicsUtils.H:170
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsatw(amrex::Real t, amrex::Real p, amrex::Real &qsatw)
Definition: ERF_MicrophysicsUtils.H:158
Definition: ERF_NullMoist.H:8
Definition: ERF_SatAdj.H:41
amrex::Real m_fac_cond
Definition: ERF_SatAdj.H:208
int Qmoist_Size() override
Definition: ERF_SatAdj.H:112
void Update_Micro_Vars(amrex::MultiFab &cons_in) override
Definition: ERF_SatAdj.H:82
amrex::Geometry m_geom
Definition: ERF_SatAdj.H:202
void Qmoist_Restart_Vars(const SolverChoice &, std::vector< int > &a_idx, std::vector< std::string > &a_names) const override
Definition: ERF_SatAdj.H:118
amrex::Array< FabPtr, MicVar_SatAdj::NumVars > mic_fab_vars
Definition: ERF_SatAdj.H:212
amrex::Real m_rdOcp
Definition: ERF_SatAdj.H:209
SatAdj()
Definition: ERF_SatAdj.H:47
virtual ~SatAdj()=default
amrex::MultiFab * Qmoist_Ptr(const int &varIdx) override
Definition: ERF_SatAdj.H:105
int Qstate_Size() override
Definition: ERF_SatAdj.H:115
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real NewtonIterSat(int &i, int &j, int &k, const amrex::Real &fac_cond, const amrex::Array4< amrex::Real > &tabs_array, const amrex::Array4< amrex::Real > &pres_array, const amrex::Array4< amrex::Real > &qv_array, const amrex::Array4< amrex::Real > &qc_array)
Definition: ERF_SatAdj.H:129
int m_qstate_size
Definition: ERF_SatAdj.H:196
std::shared_ptr< amrex::MultiFab > FabPtr
Definition: ERF_SatAdj.H:43
void Update_State_Vars(amrex::MultiFab &cons_in) override
Definition: ERF_SatAdj.H:89
void Copy_Micro_to_State(amrex::MultiFab &cons_in) override
Definition: ERF_UpdateSatAdj.cpp:12
void Init(const amrex::MultiFab &cons_in, const amrex::BoxArray &, const amrex::Geometry &geom, const amrex::Real &dt_advance, std::unique_ptr< amrex::MultiFab > &, std::unique_ptr< amrex::MultiFab > &) override
Definition: ERF_InitSatAdj.cpp:17
void Advance(const amrex::Real &dt_advance, const SolverChoice &solverChoice) override
Definition: ERF_SatAdj.H:96
amrex::Vector< int > MicVarMap
Definition: ERF_SatAdj.H:199
int m_qmoist_size
Definition: ERF_SatAdj.H:193
void AdvanceSatAdj(const SolverChoice &)
Definition: ERF_SatAdj.cpp:8
amrex::Real dt
Definition: ERF_SatAdj.H:205
void Define(SolverChoice &sc) override
Definition: ERF_SatAdj.H:57
void Copy_State_to_Micro(const amrex::MultiFab &cons_in) override
Definition: ERF_InitSatAdj.cpp:43
Definition: ERF_SatAdj.H:27
@ theta
Definition: ERF_SatAdj.H:31
@ rho
Definition: ERF_SatAdj.H:30
@ pres
Definition: ERF_SatAdj.H:33
@ NumVars
Definition: ERF_SatAdj.H:37
@ qv
Definition: ERF_SatAdj.H:35
@ tabs
Definition: ERF_SatAdj.H:32
@ qc
Definition: ERF_SatAdj.H:36
Definition: ERF_DataStruct.H:82
amrex::Real rdOcp
Definition: ERF_DataStruct.H:619
amrex::Real c_p
Definition: ERF_DataStruct.H:618