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];
68 Real rho_on_u_face =
myhalf * (cons_initial_state(i-1,j,k,0) + cons_initial_state(i,j,k,0));
69 Real rho_u_sponge = rho_u_initial_state(i,j,k)*rho_on_u_face;
71 if (x < xlo_sponge_end) {
72 Real xi = (xlo_sponge_end -
x) / hindcast_lateral_sponge_length;
73 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
76 if (x > xhi_sponge_start) {
77 Real xi = (
x - xhi_sponge_start) / hindcast_lateral_sponge_length;
78 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
81 if (y < ylo_sponge_end) {
82 Real xi = (ylo_sponge_end -
y) / hindcast_lateral_sponge_length;
83 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
86 if (y > yhi_sponge_start) {
87 Real xi = (
y - yhi_sponge_start) / hindcast_lateral_sponge_length;
88 rho_u_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_u(i, j, k) - rho_u_sponge);
93 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
95 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
96 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
99 Real y = ProbLoArr[1] + jj *
dx[1];
102 Real rho_on_v_face =
myhalf * (cons_initial_state(i,j-1,k,0) + cons_initial_state(i,j,k,0));
103 Real rho_v_sponge = rho_v_initial_state(i,j,k)*rho_on_v_face;
106 if (x < xlo_sponge_end) {
107 Real xi = (xlo_sponge_end -
x) / hindcast_lateral_sponge_length;
108 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
111 if (x > xhi_sponge_start) {
112 Real xi = (
x - xhi_sponge_start) / hindcast_lateral_sponge_length;
113 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
117 if (y < ylo_sponge_end) {
118 Real xi = (ylo_sponge_end -
y) / hindcast_lateral_sponge_length;
119 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
122 if (y > yhi_sponge_start) {
123 Real xi = (
y - yhi_sponge_start) / hindcast_lateral_sponge_length;
124 rho_v_rhs(i, j, k) -= hindcast_lateral_sponge_strength * xi * xi * (rho_v(i, j, k) - rho_v_sponge);
128 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
130 Real z = z_phys_nd(i,j,k);
132 if(hindcast_zhi_sponge_damping){
133 if (z > zhi_sponge_start) {
134 Real xi = (
z - zhi_sponge_start) / hindcast_zhi_sponge_length;
135 rho_w_rhs(i, j, k) -= hindcast_zhi_sponge_strength * xi * xi * (rho_w(i, j, k) -
zero);
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Real hindcast_zhi_sponge_length
Length of the upper hindcast sponge layer.
Definition: ERF_DataStruct.H:3056
bool hindcast_zhi_sponge_damping
Whether upper-boundary hindcast sponge damping is enabled.
Definition: ERF_DataStruct.H:3057
amrex::Real hindcast_lateral_sponge_strength
Strength of the hindcast lateral sponge layer.
Definition: ERF_DataStruct.H:3055
amrex::Real hindcast_lateral_sponge_length
Length of the hindcast lateral sponge layer.
Definition: ERF_DataStruct.H:3055
amrex::Real hindcast_zhi_sponge_strength
Strength of the upper hindcast sponge layer.
Definition: ERF_DataStruct.H:3056