8 ParmParse pp_erf(
"erf");
46 amrex::Print() <<
"Adding divergence-free perturbations "
51 amrex::Print() <<
"Adding random x-velocity perturbations" << std::endl;
54 amrex::Print() <<
"Adding random y-velocity perturbations" << std::endl;
59 ParallelForRNG(xbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
const amrex::RandomEngine& engine) noexcept {
61 const Real*
dx = geomdata.CellSize();
63 const Real z = (z_nd) ?
fourth*( z_nd(i,j ,k) + z_nd(i,j ,k+1)
64 + z_nd(i,j+1,k) + z_nd(i,j+1,k+1) )
69 x_vel_pert(i, j, k) =
U_0;
77 rand_double = amrex::Random(engine);
80 x_vel_pert(i, j, k) += x_vel_prime;
87 x_vel_pert(i, j, k) +=
ufac * damp * z_agl * std::cos(
aval * yl);
92 ParallelForRNG(ybx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
const amrex::RandomEngine& engine) noexcept
95 const Real*
dx = geomdata.CellSize();
97 const Real z = (z_nd) ?
fourth*( z_nd(i ,j,k) + z_nd(i ,j,k+1)
98 + z_nd(i+1,j,k) + z_nd(i+1,j,k+1) )
103 y_vel_pert(i, j, k) =
V_0;
111 rand_double = amrex::Random(engine);
114 y_vel_pert(i, j, k) += y_vel_prime;
121 y_vel_pert(i, j, k) +=
vfac * damp * z_agl * std::cos(
bval *
xl);
126 ParallelForRNG(zbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
const amrex::RandomEngine& engine) noexcept
128 const int dom_lo_z = geomdata.Domain().smallEnd()[2];
129 const int dom_hi_z = geomdata.Domain().bigEnd()[2];
132 if (k == dom_lo_z || k == dom_hi_z+1)
134 z_vel_pert(i, j, k) =
zero;
138 z_vel_pert(i, j, k) =
W_0;
146 rand_double = amrex::Random(engine);
149 z_vel_pert(i, j, k) += z_vel_prime;
Real bval
Definition: ERF_InitCustomPertVels_ABL.H:40
Real aval
Definition: ERF_InitCustomPertVels_ABL.H:39
Real W_0_Pert_Mag
Definition: ERF_InitCustomPertVels_ABL.H:27
int deterministic_ic_pert
Definition: ERF_InitCustomPertVels_ABL.H:4
Real pert_ref_height
Definition: ERF_InitCustomPertVels_ABL.H:34
constexpr int y_velocity_hash_comp
Definition: ERF_InitCustomPertVels_ABL.H:17
auto probhi
Definition: ERF_InitCustomPertVels_ABL.H:37
constexpr int x_velocity_hash_comp
Definition: ERF_InitCustomPertVels_ABL.H:16
ParmParse pp_prob("prob")
Real U_0_Pert_Mag
Definition: ERF_InitCustomPertVels_ABL.H:25
Real pert_periods_V
Definition: ERF_InitCustomPertVels_ABL.H:33
Real vfac
Definition: ERF_InitCustomPertVels_ABL.H:42
long random_seed
Definition: ERF_InitCustomPertVels_ABL.H:6
Real pert_deltaV
Definition: ERF_InitCustomPertVels_ABL.H:31
Real U_0
Definition: ERF_InitCustomPertVels_ABL.H:20
const std::uint64_t ic_pert_seed
Definition: ERF_InitCustomPertVels_ABL.H:13
Real ufac
Definition: ERF_InitCustomPertVels_ABL.H:41
Real V_0
Definition: ERF_InitCustomPertVels_ABL.H:21
Real pert_deltaU
Definition: ERF_InitCustomPertVels_ABL.H:30
Real pert_periods_U
Definition: ERF_InitCustomPertVels_ABL.H:32
ParallelForRNG(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real y=prob_lo[1]+(j+myhalf) *dx[1];const Real z=(z_nd) ? fourth *(z_nd(i, j, k)+z_nd(i, j, k+1)+z_nd(i, j+1, k)+z_nd(i, j+1, k+1)) :prob_lo[2]+(k+myhalf) *dx[2];const Real z_agl=z - erf_prob_heights::z_ground_xface(i, j, z_sfc_nd);x_vel_pert(i, j, k)=U_0;if((z_agl<=pert_ref_height) &&(U_0_Pert_Mag !=zero)) { Real rand_double;if(deterministic_ic_pert) { rand_double=erf_hash_rng::hash_uniform(i, j, k, x_velocity_hash_comp, lev, ic_pert_seed);} else { rand_double=amrex::Random(engine);} Real x_vel_prime=(rand_double *two - one) *U_0_Pert_Mag;x_vel_pert(i, j, k)+=x_vel_prime;} if(pert_deltaU !=zero) { const amrex::Real yl=y - prob_lo[1];const amrex::Real zl=z_agl/pert_ref_height;const amrex::Real damp=std::exp(-myhalf *zl *zl);x_vel_pert(i, j, k)+=ufac *damp *z_agl *std::cos(aval *yl);} })
Real W_0
Definition: ERF_InitCustomPertVels_ABL.H:22
int fix_random_seed
Definition: ERF_InitCustomPertVels_ABL.H:5
constexpr int z_velocity_hash_comp
Definition: ERF_InitCustomPertVels_ABL.H:18
Real V_0_Pert_Mag
Definition: ERF_InitCustomPertVels_ABL.H:26
auto problo
Definition: ERF_InitCustomPertVels_ABL.H:36
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const GpuArray< Real, AMREX_SPACEDIM > prob_lo
Definition: ERF_InitCustomPert_CloudChamber.H:33
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:46
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ xl
Definition: ERF_WSM6.H:345
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real hash_uniform(int i, int j, int k, int comp, int lev, std::uint64_t seed) noexcept
Definition: ERF_HashRNG.H:68
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_xface(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Height of the ground under x-face (i,j)
Definition: ERF_ProbHeights.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_yface(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Height of the ground under y-face (i,j)
Definition: ERF_ProbHeights.H:66