21 auto dx = geom.CellSizeArray();
22 auto ProbHiArr = geom.ProbHiArray();
23 auto ProbLoArr = geom.ProbLoArray();
41 const Box& domain = geom.Domain();
42 int domlo_x = domain.smallEnd(0);
43 int domhi_x = domain.bigEnd(0) + 1;
44 int domlo_y = domain.smallEnd(1);
45 int domhi_y = domain.bigEnd(1) + 1;
46 int domlo_z = domain.smallEnd(2);
47 int domhi_z = domain.bigEnd(2) + 1;
52 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
53 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
54 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
55 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
56 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
57 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
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);
63 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
65 Real
x = ProbLoArr[0] + ii * dx[0];
66 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
67 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
70 if(use_xlo_sponge_damping){
71 if (x < xlo_sponge_end) {
72 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
73 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
77 if(use_xhi_sponge_damping){
78 if (x > xhi_sponge_start) {
79 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
80 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
85 if(use_ylo_sponge_damping){
86 if (y < ylo_sponge_end) {
87 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
88 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
92 if(use_yhi_sponge_damping){
93 if (y > yhi_sponge_start) {
94 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
95 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
100 if(use_zlo_sponge_damping){
101 if (z < zlo_sponge_end) {
102 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
103 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
109 if(use_zhi_sponge_damping){
110 if (z > zhi_sponge_start) {
111 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
112 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
118 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
120 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
121 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
122 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
124 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
125 Real
y = ProbLoArr[1] + jj * dx[1];
126 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
129 if(use_xlo_sponge_damping){
130 if (x < xlo_sponge_end) {
131 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
132 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
136 if(use_xhi_sponge_damping){
137 if (x > xhi_sponge_start) {
138 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
139 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
144 if(use_ylo_sponge_damping){
145 if (y < ylo_sponge_end) {
146 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
147 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
151 if(use_yhi_sponge_damping){
152 if (y > yhi_sponge_start) {
153 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
154 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
159 if(use_zlo_sponge_damping){
160 if (z < zlo_sponge_end) {
161 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
162 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
168 if(use_zhi_sponge_damping){
169 if (z > zhi_sponge_start) {
170 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
171 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
@ vbar_sponge
Definition: ERF_DataStruct.H:75
@ ubar_sponge
Definition: ERF_DataStruct.H:75
bool use_xlo_sponge_damping
Definition: ERF_SpongeStruct.H:53
amrex::Real xlo_sponge_end
Definition: ERF_SpongeStruct.H:63
amrex::Real zlo_sponge_end
Definition: ERF_SpongeStruct.H:65
bool use_zlo_sponge_damping
Definition: ERF_SpongeStruct.H:57
amrex::Real sponge_strength
Definition: ERF_SpongeStruct.H:60
bool use_ylo_sponge_damping
Definition: ERF_SpongeStruct.H:55
amrex::Real zhi_sponge_start
Definition: ERF_SpongeStruct.H:65
bool use_xhi_sponge_damping
Definition: ERF_SpongeStruct.H:54
bool use_zhi_sponge_damping
Definition: ERF_SpongeStruct.H:58
amrex::Real yhi_sponge_start
Definition: ERF_SpongeStruct.H:64
bool use_yhi_sponge_damping
Definition: ERF_SpongeStruct.H:56
amrex::Real xhi_sponge_start
Definition: ERF_SpongeStruct.H:63
amrex::Real ylo_sponge_end
Definition: ERF_SpongeStruct.H:64