Apply sponge zone damping to cell-centered state variables.
33 auto dx = geom.CellSizeArray();
34 auto ProbHiArr = geom.ProbHiArray();
35 auto ProbLoArr = geom.ProbLoArray();
44 if (!use_xlo_sponge_damping &&
45 !use_xhi_sponge_damping &&
46 !use_ylo_sponge_damping &&
47 !use_yhi_sponge_damping &&
48 !use_zlo_sponge_damping &&
49 !use_zhi_sponge_damping)
62 const bool use_base_density = (sponge_density_tmp <
zero);
63 const bool use_base_rhotheta = (sponge_rhotheta_tmp <
zero);
64 const bool use_base_rhomoist = (sponge_rhomoist_tmp <
zero);
67 const Box& domain = geom.Domain();
68 int domlo_x = domain.smallEnd(0);
69 int domhi_x = domain.bigEnd(0) + 1;
70 int domlo_y = domain.smallEnd(1);
71 int domhi_y = domain.bigEnd(1) + 1;
83 const Real L_xlo = use_xlo_sponge_damping ? (xlo_sponge_end - ProbLoArr[0]) :
one;
84 const Real L_xhi = use_xhi_sponge_damping ? (ProbHiArr[0] - xhi_sponge_start) :
one;
85 const Real L_ylo = use_ylo_sponge_damping ? (ylo_sponge_end - ProbLoArr[1]) :
one;
86 const Real L_yhi = use_yhi_sponge_damping ? (ProbHiArr[1] - yhi_sponge_start) :
one;
87 const Real L_zlo = use_zlo_sponge_damping ? (zlo_sponge_end - ProbLoArr[2]) :
one;
88 const Real L_zhi = use_zhi_sponge_damping ? (ProbHiArr[2] - zhi_sponge_start) :
one;
90 ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept
92 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
93 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
97 Real z = z_phys_cc(i,j,k);
99 Real sponge_density = (use_base_density) ?
r0(i,j,k) : sponge_density_tmp;
100 Real sponge_rhotheta = (use_base_rhotheta) ?
r0(i,j,k)*th0(i,j,k) : sponge_rhotheta_tmp;
101 Real sponge_rhomoist = (use_base_rhomoist) ?
r0(i,j,k)*qv0(i,j,k) : sponge_rhomoist_tmp;
104 if(use_xlo_sponge_damping){
105 if (x < xlo_sponge_end) {
106 Real xi = (xlo_sponge_end -
x) / L_xlo;
107 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
108 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
110 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
112 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
118 if(use_xhi_sponge_damping){
119 if (x > xhi_sponge_start) {
120 Real xi = (
x - xhi_sponge_start) / L_xhi;
121 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
122 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
124 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
126 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
133 if(use_ylo_sponge_damping){
134 if (y < ylo_sponge_end) {
135 Real xi = (ylo_sponge_end -
y) / L_ylo;
136 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
137 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
139 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
141 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
147 if(use_yhi_sponge_damping){
148 if (y > yhi_sponge_start) {
149 Real xi = (
y - yhi_sponge_start) / L_yhi;
150 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
151 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
153 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
155 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
162 if(use_zlo_sponge_damping){
163 if (z < zlo_sponge_end) {
164 Real xi = (zlo_sponge_end -
z) / L_zlo;
165 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
166 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
168 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
170 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
176 if(use_zhi_sponge_damping){
177 if (z > zhi_sponge_start) {
178 Real xi = (
z - zhi_sponge_start) / L_zhi;
179 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
180 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
182 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
184 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:49
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:48
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 one
Definition: ERF_NumericalConstants.H:37
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
real(kind=kind_phys), parameter, private r0
Definition: ERF_module_mp_wdm6.F90:75
amrex::Real zlo_sponge_end
Physical end location of the low-z sponge layer.
Definition: ERF_SpongeStruct.H:105
amrex::Real xlo_sponge_end
Physical end location of the low-x sponge layer.
Definition: ERF_SpongeStruct.H:103
bool use_zlo_sponge_damping
Whether sponge damping is applied at the low-z boundary.
Definition: ERF_SpongeStruct.H:94
amrex::Real ylo_sponge_end
Physical end location of the low-y sponge layer.
Definition: ERF_SpongeStruct.H:104
amrex::Real sponge_strength
Sponge damping strength.
Definition: ERF_SpongeStruct.H:97
amrex::Real sponge_rhotheta
Target rho-theta used by sponge damping.
Definition: ERF_SpongeStruct.H:107
amrex::Real yhi_sponge_start
Physical start location of the high-y sponge layer.
Definition: ERF_SpongeStruct.H:104
bool use_zhi_sponge_damping
Whether sponge damping is applied at the high-z boundary.
Definition: ERF_SpongeStruct.H:95
amrex::Real sponge_density
Target density used by sponge damping.
Definition: ERF_SpongeStruct.H:106
bool use_xlo_sponge_damping
Whether sponge damping is applied at the low-x boundary.
Definition: ERF_SpongeStruct.H:90
amrex::Real xhi_sponge_start
Physical start location of the high-x sponge layer.
Definition: ERF_SpongeStruct.H:103
bool use_xhi_sponge_damping
Whether sponge damping is applied at the high-x boundary.
Definition: ERF_SpongeStruct.H:91
amrex::Real sponge_rhomoist
Target moist density variable used by sponge damping.
Definition: ERF_SpongeStruct.H:108
bool use_yhi_sponge_damping
Whether sponge damping is applied at the high-y boundary.
Definition: ERF_SpongeStruct.H:93
bool use_ylo_sponge_damping
Whether sponge damping is applied at the low-y boundary.
Definition: ERF_SpongeStruct.H:92
amrex::Real zhi_sponge_start
Physical start location of the high-z sponge layer.
Definition: ERF_SpongeStruct.H:105