22 const int nstp,
const int nnew,
40 Box
bx =
mfi.tilebox();
48 const Box& domain =
geom[
lev].Domain();
49 const auto dlo = amrex::lbound(domain);
50 const auto dhi = amrex::ubound(domain);
105 FX(
i,
j,
k) =
XF(
i,
j,
k) * Real(0.5) * (
tke(
i-1,
j,
k,nstp) +
tke(
i,
j,
k,nstp) -
107 FXL(
i,
j,
k) =
XF(
i,
j,
k) * Real(0.5) * (
gls(
i-1,
j,
k,nstp) +
gls(
i,
j,
k,nstp) -
132 FE(
i,
j,
k) =
EF(
i,
j,
k) * Real(0.5) * (
tke(
i,
j-1,
k,nstp) +
tke(
i,
j,
k,nstp) -
134 FEL(
i,
j,
k) =
EF(
i,
j,
k) * Real(0.5) * (
gls(
i,
j-1,
k,nstp) +
gls(
i,
j,
k,nstp) -
161 Hz_half(
i,
j,
k) =
cff -
cff4 * (
XF(
i+1,
j,
k)-
XF(
i,
j,
k)+
EF(
i,
j+1,
k)-
EF(
i,
j,
k));
199 FC(
i,
j,
k) =
CF(
i,
j,
k) * (
cff1_vadv * (
tke(
i,
j,
k ,nstp) +
tke(
i,
j,
k+1,nstp)) -
201 FCL(
i,
j,
k) =
CF(
i,
j,
k) * (
cff1_vadv * (
gls(
i,
j,
k ,nstp) +
gls(
i,
j,
k+1,nstp)) -
218 tke(
i,
j,
k,2) =
cff1_loc * (
tke(
i,
j,
k,2) -
cff4 * (
FC (
i,
j,
k) -
FC (
i,
j,
k-1)));
219 gls(
i,
j,
k,2) =
cff1_loc * (
gls(
i,
j,
k,2) -
cff4 * (
FCL(
i,
j,
k) -
FCL(
i,
j,
k-1)));
252 const int nstp,
const int nnew,
253 const int N,
const Real
dt_lev)
292 for (
int n = 0; n <
NAT; ++n) {
337 +Real(3.0)/Real(2.0)*
385 Real
eps = Real(1.0e-10);
388 const DistributionMapping&
dm =
cons_old[
lev]->DistributionMap();
403 const Box& domain =
geom[0].Domain();
404 const auto dlo = amrex::lbound(domain);
405 const auto dhi = amrex::ubound(domain);
413 Box
bx =
mfi.tilebox();
435 for (
int k=1;
k<=
N;
k++) {
445 for (
int k=
N;
k>=1;
k--) {
450 for (
int k=1;
k<=
N;
k++) {
451 shear2_cached(
i,
j,
k) =
dU(
i,
j,
k) *
dU(
i,
j,
k) +
dV(
i,
j,
k) *
dV(
i,
j,
k);
477 Box
bx =
mfi.tilebox();
483 bx_rho.convert(IntVect(0,0,0));
547 tmp_buoy(
i,
j,
k)=Real(0.25) * (
bvf(
i,
j,
k) +
bvf(
i+1,
j,
k) +
bvf(
i,
j+1,
k)+
bvf(
i+1,
j+1,
k));
548 tmp_shear(
i,
j,
k)=Real(0.25) * (
shear2_cached(
i,
j,
k) +
shear2_cached(
i+1,
j,
k) +
shear2_cached(
i,
j+1,
k)+
shear2_cached(
i+1,
j+1,
k));
553 buoy2(
i,
j,
k)=Real(0.25) * (
tmp_buoy(
i,
j,
k) +
tmp_buoy(
i-1,
j,
k) +
tmp_buoy(
i,
j-1,
k)+
tmp_buoy(
i-1,
j-1,
k));
554 shear2(
i,
j,
k)=Real(0.25) * (
tmp_shear(
i,
j,
k) +
tmp_shear(
i-1,
j,
k) +
tmp_shear(
i,
j-1,
k)+
tmp_shear(
i-1,
j-1,
k));
563 gradK_ip1 = tke(i+1,j,k,2)-tke(i ,j,k,2);
565 gradP_ip1 = gls(i+1,j,k,2)-gls(i ,j,k,2);
568 gradK = tke(i ,j,k,2)-tke(i-1,j,k,2);
570 gradP = gls(i ,j,k,2)-gls(i-1,j,k,2);
573 gradK = (tke(i ,j,k,2)-tke(i-1,j,k,2)) * msku(i ,j,0);
574 gradK_ip1 = (tke(i+1,j,k,2)-tke(i ,j,k,2)) * msku(i+1,j,0);
575 gradP = (gls(i ,j,k,2)-gls(i-1,j,k,2)) * msku(i ,j,0);
576 gradP_ip1 = (gls(i+1,j,k,2)-gls(i ,j,k,2)) * msku(i+1,j,0);
627 tke(
i,
j,
k,nnew) =
tke(
i,
j,
k,nnew) -
cff * (
FXK(
i+1,
j ,
k)-
FXK(
i,
j,
k)+
631 gls(
i,
j,
k,nnew) =
gls(
i,
j,
k,nnew) -
cff * (
FXP(
i+1,
j ,
k)-
FXP(
i,
j,
k)+
639 Real
cff1 = Real(7.0) / Real(12.0);
641 for (
int k=1;
k<=
N-1;
k++) {
649 cff2 = Real(5.0)/Real(6.0);
651 Real
cff = Real(0.5) * (
W(
i,
j,0)+
W(
i,
j,1));
652 FCK(
i,
j,0) =
cff * (
cff1 *
tke(
i,
j,0,2)+
cff2 *
tke(
i,
j,1,2)-
cff3 *
tke(
i,
j,2,2));
653 FCP(
i,
j,0) =
cff * (
cff1 *
gls(
i,
j,0,2)+
cff2 *
gls(
i,
j,1,2)-
cff3 *
gls(
i,
j,2,2));
655 FCK(
i,
j,
N) =
cff * (
cff1 *
tke(
i,
j,
N+1,2)+
cff2*
tke(
i,
j,
N,2)-
cff3*
tke(
i,
j,
N-1,2));
656 FCP(
i,
j,
N) =
cff * (
cff1 *
gls(
i,
j,
N+1,2)+
cff2*
gls(
i,
j,
N,2)-
cff3*
gls(
i,
j,
N-1,2));
661 tke(
i,
j,
k,nnew) =
tke(
i,
j,
k,nnew) -
cff*(
FCK(
i,
j,
k )-
FCK(
i,
j,
k-1));
663 gls(
i,
j,
k,nnew) =
gls(
i,
j,
k,nnew) -
cff*(
FCP(
i,
j,
k )-
FCP(
i,
j,
k-1));
752 std::sqrt((sustr(
i,
j,0)+sustr(
i+1,
j,0))*(sustr(
i,
j,0)+sustr(
i+1,
j,0))+
753 (svstr(
i,
j,0)+svstr(
i,
j+1,0))*(svstr(
i,
j,0)+svstr(
i,
j+1,0))),
761 std::pow(
tke(
i,
j,
N+1,nnew),gls_m)*
773 for (
int k=
N-1;
k>=1;
k--) {
776 tke(
i,
j,
k,nnew) =
cff_BCK * (
tke(
i,
j,
k,nnew) -
FCK(
i,
j,
k) *
tke(
i,
j,
k+1,nnew));
779 tke(
i,
j,1,nnew) = std::max(
tke(
i,
j,1,nnew),gls_Kmin);
780 for (
int k=2;
k<=
N;
k++) {
781 tke(
i,
j,
k,nnew) =
tke(
i,
j,
k,nnew) -
CF(
i,
j,
k) *
tke(
i,
j,
k-1,nnew);
788 std::pow(
L_sft,(gls_n))*
798 for (
int k=
N-1;
k>=1;
k--) {
801 gls(
i,
j,
k,nnew) =
cff_BCP * (
gls(
i,
j,
k,nnew) -
FCP(
i,
j,
k)*
gls(
i,
j,
k+1,nnew));
804 for (
int k=2;
k<=
N;
k++) {
805 gls(
i,
j,
k,nnew) =
gls(
i,
j,
k,nnew) -
CF(
i,
j,
k) *
gls(
i,
j,
k-1,nnew);
816 std::pow(std::sqrt(std::max(Real(0.0),
818 gls(
i,
j,
k,nnew) = (gls_n >= Real(0.0)) ? std::min(
gls(
i,
j,
k,nnew),
gls_comparison) : std::max(
gls(
i,
j,
k,nnew),
gls_comparison);
826 std::sqrt(Real(0.56)*
tke(
i,
j,
k,nnew)/
832 std::pow(
tke(
i,
j,
k,nnew),gls_m)*
833 std::pow(
Ls_lmt,gls_n), gls_Pmin);
840 Gh=std::min(
Gh,
Gh-(
Gh-gls_Ghcri)*(
Gh-gls_Ghcri)/
841 (
Gh+gls_Gh0-
two*gls_Ghcri));
842 Gh=std::max(
Gh,gls_Ghmin);
862 Sm=std::max(
Sm,Real(0.0));
863 Sh=std::max(
Sh,Real(0.0));
886 for (
int n=0; n<
NAT; n++) {
904 std::sqrt(
tke(
i,
j,
N+1,nnew));
906 std::sqrt(
tke(
i,
j,0,nnew));
913 for (
int n=0; n<
NAT; n++) {
914 Akt(
i,
j,
N+1,n) = Akt_bak[n];
915 Akt(
i,
j,0,n) = Akt_bak[n];
constexpr amrex::Real two
constexpr amrex::Real one
constexpr amrex::Real zero
constexpr amrex::Real vonKar
mf_h setVal(geomdata.ProbHi(2))
int zvel_bc() const noexcept
int xvel_bc() const noexcept
amrex::Vector< amrex::BCRec > domain_bcs_type
vector (over BCVars) of BCRecs
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm
horizontal scaling factor: 1 / dx (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_ZoBot
Bottom roughness length [m], defined at rho points.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_tke
Turbulent kinetic energy.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_gls
Turbulent generic length scale.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_sustr
Surface stress in the u direction.
int yvel_bc() const noexcept
int foextrap_bc() const noexcept
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Lscale
Vertical mixing turbulent length scale.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Hz
Width of cells in the vertical (z-) direction (3D, Hz in ROMS)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akt
Vertical diffusion coefficient (3D)
amrex::Vector< amrex::MultiFab * > xvel_old
multilevel data container for last step's x velocities (u in ROMS)
void gls_prestep(int lev, amrex::MultiFab *mf_gls, amrex::MultiFab *mf_tke, amrex::MultiFab &mf_W, amrex::MultiFab *mf_msku, amrex::MultiFab *mf_mskv, const int nstp, const int nnew, const int iic, const int ntfirst, const int N, const amrex::Real dt_lev)
Prestep for GLS calculation.
void FillPatchNoBC(int lev, amrex::Real time, amrex::MultiFab &mf_to_be_filled, amrex::Vector< amrex::MultiFab * > const &mfs, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const bool fill_set=false)
Fill a new MultiFab by copying in phi from valid region and filling ghost cells without applying boun...
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bvf
Brunt-Vaisala frequency (3D)
amrex::Vector< std::unique_ptr< REMORAPhysBCFunct > > physbcs
Vector (over level) of functors to apply physical boundary conditions.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_svstr
Surface stress in the v direction.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Huon
u-volume flux (3D)
amrex::Vector< amrex::MultiFab * > yvel_old
multilevel data container for last step's y velocities (v in ROMS)
amrex::Vector< amrex::Real > t_new
new time at each level
static SolverChoice solverChoice
Container for algorithmic choices.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akk
Turbulent kinetic energy vertical diffusion coefficient.
amrex::Vector< amrex::MultiFab * > cons_old
multilevel data container for last step's scalar data: temperature, salinity, passive tracer
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bustr
Bottom stress in the u direction.
void FillPatch(int lev, amrex::Real time, amrex::MultiFab &mf_to_be_filled, amrex::Vector< amrex::MultiFab * > const &mfs, const int bccomp, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const bool fill_set=false, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=zero, const amrex::MultiFab &mf_calc=amrex::MultiFab())
Fill a new MultiFab by copying in phi from valid region and filling ghost cells.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_bvstr
Bottom stress in the v direction.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akv
Vertical viscosity coefficient (3D)
amrex::Vector< amrex::Real > t_old
old time at each level
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_z_w
z coordinates at w points (faces between z-cells)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Hvom
v-volume flux (3D)
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_Akp
Turbulent length scale vertical diffusion coefficient.
void gls_corrector(int lev, amrex::MultiFab *mf_gls, amrex::MultiFab *mf_tke, amrex::MultiFab &mf_W, amrex::MultiFab *mf_Akv, amrex::MultiFab *mf_Akt, amrex::MultiFab *mf_Akk, amrex::MultiFab *mf_Akp, amrex::MultiFab *mf_mskr, amrex::MultiFab *mf_msku, amrex::MultiFab *mf_mskv, const int nstp, const int nnew, const int N, const amrex::Real dt_lev)
Corrector step for GLS calculation.
static constexpr int null
amrex::Vector< amrex::Real > Akt_bak
GLS_StabilityType gls_stability_type