128 auto dx = geom.CellSizeArray();
129 auto ProbHiArr = geom.ProbHiArray();
130 auto ProbLoArr = geom.ProbLoArray();
153 const Box& domain = geom.Domain();
154 int domlo_x = domain.smallEnd(0);
155 int domhi_x = domain.bigEnd(0) + 1;
156 int domlo_y = domain.smallEnd(1);
157 int domhi_y = domain.bigEnd(1) + 1;
158 int domlo_z = domain.smallEnd(2);
159 int domhi_z = domain.bigEnd(2) + 1;
161 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
162 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
163 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
164 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
165 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
166 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
168 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
170 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
171 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
172 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
174 Real
x = ProbLoArr[0] + ii * dx[0];
175 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
176 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
179 if(use_xlo_sponge_damping){
180 if (x < xlo_sponge_end) {
181 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
182 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
186 if(use_xhi_sponge_damping){
187 if (x > xhi_sponge_start) {
188 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
189 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
194 if(use_ylo_sponge_damping){
195 if (y < ylo_sponge_end) {
196 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
197 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
201 if(use_yhi_sponge_damping){
202 if (y > yhi_sponge_start) {
203 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
204 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
209 if(use_zlo_sponge_damping){
210 if (z < zlo_sponge_end) {
211 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
212 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
218 if(use_zhi_sponge_damping){
219 if (z > zhi_sponge_start) {
220 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
221 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
227 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
229 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
230 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
231 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
233 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
234 Real
y = ProbLoArr[1] + jj * dx[1];
235 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
238 if(use_xlo_sponge_damping){
239 if (x < xlo_sponge_end) {
240 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
241 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
245 if(use_xhi_sponge_damping){
246 if (x > xhi_sponge_start) {
247 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
248 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
253 if(use_ylo_sponge_damping){
254 if (y < ylo_sponge_end) {
255 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
256 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
260 if(use_yhi_sponge_damping){
261 if (y > yhi_sponge_start) {
262 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_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_zlo_sponge_damping){
269 if (z < zlo_sponge_end) {
270 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
271 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
277 if(use_zhi_sponge_damping){
278 if (z > zhi_sponge_start) {
279 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
280 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
286 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
288 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
289 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
290 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
292 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
293 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
294 Real
z = ProbLoArr[2] + kk * dx[2];
297 if(use_xlo_sponge_damping){
298 if (x < xlo_sponge_end) {
299 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
300 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
304 if(use_xhi_sponge_damping){
305 if (x > xhi_sponge_start) {
306 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
307 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
312 if(use_ylo_sponge_damping){
313 if (y < ylo_sponge_end) {
314 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
315 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
319 if(use_yhi_sponge_damping){
320 if (y > yhi_sponge_start) {
321 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
322 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
327 if(use_zlo_sponge_damping){
328 if (z < zlo_sponge_end) {
329 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
330 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
336 if(use_zhi_sponge_damping){
337 if (z > zhi_sponge_start) {
338 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
339 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:66
amrex::Real sponge_z_velocity
Definition: ERF_SpongeStruct.H:66
amrex::Real sponge_x_velocity
Definition: ERF_SpongeStruct.H:66