25 auto dx = geom.CellSizeArray();
26 auto ProbHiArr = geom.ProbHiArray();
27 auto ProbLoArr = geom.ProbLoArray();
45 const Box& domain = geom.Domain();
46 int domlo_x = domain.smallEnd(0);
47 int domhi_x = domain.bigEnd(0) + 1;
48 int domlo_y = domain.smallEnd(1);
49 int domhi_y = domain.bigEnd(1) + 1;
50 int domlo_z = domain.smallEnd(2);
51 int domhi_z = domain.bigEnd(2) + 1;
56 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
57 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
58 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
59 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
60 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
61 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
63 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
65 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
66 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
67 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
69 Real
x = ProbLoArr[0] + ii * dx[0];
70 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
71 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
74 if(use_xlo_sponge_damping){
75 if (x < xlo_sponge_end) {
76 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
77 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
81 if(use_xhi_sponge_damping){
82 if (x > xhi_sponge_start) {
83 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
84 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
89 if(use_ylo_sponge_damping){
90 if (y < ylo_sponge_end) {
91 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
92 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
96 if(use_yhi_sponge_damping){
97 if (y > yhi_sponge_start) {
98 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
99 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
104 if(use_zlo_sponge_damping){
105 if (z < zlo_sponge_end) {
106 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
107 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
113 if(use_zhi_sponge_damping){
114 if (z > zhi_sponge_start) {
115 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
116 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
122 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
124 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
125 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
126 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
128 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
129 Real
y = ProbLoArr[1] + jj * dx[1];
130 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
133 if(use_xlo_sponge_damping){
134 if (x < xlo_sponge_end) {
135 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
136 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
140 if(use_xhi_sponge_damping){
141 if (x > xhi_sponge_start) {
142 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
143 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
148 if(use_ylo_sponge_damping){
149 if (y < ylo_sponge_end) {
150 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
151 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
155 if(use_yhi_sponge_damping){
156 if (y > yhi_sponge_start) {
157 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
158 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
163 if(use_zlo_sponge_damping){
164 if (z < zlo_sponge_end) {
165 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
166 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
172 if(use_zhi_sponge_damping){
173 if (z > zhi_sponge_start) {
174 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
175 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:71
@ ubar_sponge
Definition: ERF_DataStruct.H:71
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