28 auto dx = geom.CellSizeArray();
29 auto ProbHiArr = geom.ProbHiArray();
30 auto ProbLoArr = geom.ProbLoArray();
32 amrex::ignore_unused(rho_w_initial_state);
35 const Box& domain = geom.Domain();
36 int domlo_x = domain.smallEnd(0);
37 int domhi_x = domain.bigEnd(0) + 1;
38 int domlo_y = domain.smallEnd(1);
39 int domhi_y = domain.bigEnd(1) + 1;
48 Real xlo_sponge_end = ProbLoArr[0] + hindcast_lateral_sponge_length;
49 Real xhi_sponge_start = ProbHiArr[0] - hindcast_lateral_sponge_length;
50 Real ylo_sponge_end = ProbLoArr[1] + hindcast_lateral_sponge_length;
51 Real yhi_sponge_start = ProbHiArr[1] - hindcast_lateral_sponge_length;
52 Real zhi_sponge_start = ProbHiArr[2] - hindcast_zhi_sponge_length;
59 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
61 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
62 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
64 Real x = ProbLoArr[0] + ii *
dx[0];
67 Real rho_u_sponge = rho_u_initial_state(i,j,k)*cons_initial_state(i,j,k,0);
69 if (x < xlo_sponge_end) {
70 Real xi = (xlo_sponge_end -
x) / hindcast_lateral_sponge_length;
71 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
74 if (x > xhi_sponge_start) {
75 Real xi = (
x - xhi_sponge_start) / hindcast_lateral_sponge_length;
76 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
79 if (y < ylo_sponge_end) {
80 Real xi = (ylo_sponge_end -
y) / hindcast_lateral_sponge_length;
81 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
84 if (y > yhi_sponge_start) {
85 Real xi = (
y - yhi_sponge_start) / hindcast_lateral_sponge_length;
86 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
91 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
93 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
94 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
97 Real y = ProbLoArr[1] + jj *
dx[1];
99 Real rho_v_sponge = rho_v_initial_state(i,j,k)*cons_initial_state(i,j,k,0);
102 if (x < xlo_sponge_end) {
103 Real xi = (xlo_sponge_end -
x) / hindcast_lateral_sponge_length;
104 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
107 if (x > xhi_sponge_start) {
108 Real xi = (
x - xhi_sponge_start) / hindcast_lateral_sponge_length;
109 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
113 if (y < ylo_sponge_end) {
114 Real xi = (ylo_sponge_end -
y) / hindcast_lateral_sponge_length;
115 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
118 if (y > yhi_sponge_start) {
119 Real xi = (
y - yhi_sponge_start) / hindcast_lateral_sponge_length;
120 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
124 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
126 Real z = z_phys_nd(i,j,k);
128 if(hindcast_zhi_sponge_damping){
129 if (z > zhi_sponge_start) {
130 Real xi = (
z - zhi_sponge_start) / hindcast_zhi_sponge_length;
131 rho_w_rhs(i, j, k) -= hindcast_zhi_sponge_strength * xi * xi * (rho_w(i, j, k) -
zero);
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real *dx=geomdata.CellSize();const Real x=(i+0.5) *dx[0];const Real y=(j+0.5) *dx[1];const Real Omg=erf_vortex_Gaussian(x, y, xc, yc, R, beta, sigma);const Real deltaT=-(gamma - 1.0)/(2.0 *sigma *sigma) *Omg *Omg;const Real rho_norm=std::pow(1.0+deltaT, inv_gm1);const Real T=(1.0+deltaT) *T_inf;const Real p=std::pow(rho_norm, Gamma)/Gamma *rho_0 *a_inf *a_inf;const Real rho_theta=rho_0 *rho_norm *(T *std::pow(p_0/p, rdOcp));state_pert(i, j, k, RhoTheta_comp)=rho_theta - getRhoThetagivenP(p_hse(i, j, k));const Real r2d_xy=std::sqrt((x-xc) *(x-xc)+(y-yc) *(y-yc));state_pert(i, j, k, RhoScalar_comp)=0.25 *(1.0+std::cos(PI *std::min(r2d_xy, R)/R));})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Real hindcast_lateral_sponge_strength
Definition: ERF_DataStruct.H:1296
amrex::Real hindcast_zhi_sponge_length
Definition: ERF_DataStruct.H:1297
bool hindcast_zhi_sponge_damping
Definition: ERF_DataStruct.H:1298
amrex::Real hindcast_lateral_sponge_length
Definition: ERF_DataStruct.H:1296
amrex::Real hindcast_zhi_sponge_strength
Definition: ERF_DataStruct.H:1297