134 auto dx = geom.CellSizeArray();
135 auto ProbHiArr = geom.ProbHiArray();
136 auto ProbLoArr = geom.ProbLoArray();
145 if (!use_xlo_sponge_damping &&
146 !use_xhi_sponge_damping &&
147 !use_ylo_sponge_damping &&
148 !use_yhi_sponge_damping &&
149 !use_zlo_sponge_damping &&
150 !use_zhi_sponge_damping)
165 const bool use_base = (sponge_density_tmp < 0.);
168 const Box& domain = geom.Domain();
169 int domlo_x = domain.smallEnd(0);
170 int domhi_x = domain.bigEnd(0) + 1;
171 int domlo_y = domain.smallEnd(1);
172 int domhi_y = domain.bigEnd(1) + 1;
174 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
175 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
176 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
177 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
178 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
179 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
181 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
183 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
184 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
186 Real
x = ProbLoArr[0] + ii * dx[0];
187 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
188 Real
z = z_phys_cc(i,j,k);
190 Real sponge_density = (use_base) ? 0.5 * (r0(i,j,k) + r0(i-1,j,k)) : sponge_density_tmp;
193 if(use_xlo_sponge_damping){
194 if (x < xlo_sponge_end) {
195 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
196 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
200 if(use_xhi_sponge_damping){
201 if (x > xhi_sponge_start) {
202 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
203 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
208 if(use_ylo_sponge_damping){
209 if (y < ylo_sponge_end) {
210 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
211 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
215 if(use_yhi_sponge_damping){
216 if (y > yhi_sponge_start) {
217 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
218 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
223 if(use_zlo_sponge_damping){
224 if (z < zlo_sponge_end) {
225 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
226 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
232 if(use_zhi_sponge_damping){
233 if (z > zhi_sponge_start) {
234 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
235 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
241 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
243 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
244 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
246 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
247 Real
y = ProbLoArr[1] + jj * dx[1];
248 Real
z = z_phys_cc(i,j,k);
250 Real sponge_density = (use_base) ? 0.5 * (r0(i,j,k) + r0(i,j-1,k)) : sponge_density_tmp;
253 if(use_xlo_sponge_damping){
254 if (x < xlo_sponge_end) {
255 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
256 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
260 if(use_xhi_sponge_damping){
261 if (x > xhi_sponge_start) {
262 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
263 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
268 if(use_ylo_sponge_damping){
269 if (y < ylo_sponge_end) {
270 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
271 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
275 if(use_yhi_sponge_damping){
276 if (y > yhi_sponge_start) {
277 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
278 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
283 if(use_zlo_sponge_damping){
284 if (z < zlo_sponge_end) {
285 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
286 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
292 if(use_zhi_sponge_damping){
293 if (z > zhi_sponge_start) {
294 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
295 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
301 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
303 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
304 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
306 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
307 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
308 Real
z = z_phys_nd(i,j,k);
310 Real sponge_density = (use_base) ? 0.5 * (r0(i,j,k) + r0(i,j,k-1)) : sponge_density_tmp;
313 if(use_xlo_sponge_damping){
314 if (x < xlo_sponge_end) {
315 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
316 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
320 if(use_xhi_sponge_damping){
321 if (x > xhi_sponge_start) {
322 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
323 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
328 if(use_ylo_sponge_damping){
329 if (y < ylo_sponge_end) {
330 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
331 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
335 if(use_yhi_sponge_damping){
336 if (y > yhi_sponge_start) {
337 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
338 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
343 if(use_zlo_sponge_damping){
344 if (z < zlo_sponge_end) {
345 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
346 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
352 if(use_zhi_sponge_damping){
353 if (z > zhi_sponge_start) {
354 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
355 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
amrex::Real sponge_y_velocity
Definition: ERF_SpongeStruct.H:64
amrex::Real sponge_z_velocity
Definition: ERF_SpongeStruct.H:64
amrex::Real sponge_x_velocity
Definition: ERF_SpongeStruct.H:64