Apply sponge zone damping to momentum RHS using target states read from a file.
36 auto dx = geom.CellSizeArray();
37 auto ProbHiArr = geom.ProbHiArray();
38 auto ProbLoArr = geom.ProbLoArray();
56 const Box& domain = geom.Domain();
57 int domlo_x = domain.smallEnd(0);
58 int domhi_x = domain.bigEnd(0) + 1;
59 int domlo_y = domain.smallEnd(1);
60 int domhi_y = domain.bigEnd(1) + 1;
75 const Real L_xlo = use_xlo_sponge_damping ? (xlo_sponge_end - ProbLoArr[0]) :
one;
76 const Real L_xhi = use_xhi_sponge_damping ? (ProbHiArr[0] - xhi_sponge_start) :
one;
77 const Real L_ylo = use_ylo_sponge_damping ? (ylo_sponge_end - ProbLoArr[1]) :
one;
78 const Real L_yhi = use_yhi_sponge_damping ? (ProbHiArr[1] - yhi_sponge_start) :
one;
79 const Real L_zlo = use_zlo_sponge_damping ? (zlo_sponge_end - ProbLoArr[2]) :
one;
80 const Real L_zhi = use_zhi_sponge_damping ? (ProbHiArr[2] - zhi_sponge_start) :
one;
82 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
84 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
85 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
87 Real x = ProbLoArr[0] + ii *
dx[0];
89 Real z = z_phys_cc(i,j,k);
92 if(use_xlo_sponge_damping){
93 if (x < xlo_sponge_end) {
94 Real xi = (xlo_sponge_end -
x) / L_xlo;
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]);
99 if(use_xhi_sponge_damping){
100 if (x > xhi_sponge_start) {
101 Real xi = (
x - xhi_sponge_start) / L_xhi;
102 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
107 if(use_ylo_sponge_damping){
108 if (y < ylo_sponge_end) {
109 Real xi = (ylo_sponge_end -
y) / L_ylo;
110 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
114 if(use_yhi_sponge_damping){
115 if (y > yhi_sponge_start) {
116 Real xi = (
y - yhi_sponge_start) / L_yhi;
117 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 if(use_zlo_sponge_damping){
123 if (z < zlo_sponge_end) {
124 Real xi = (zlo_sponge_end -
z) / L_zlo;
125 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
131 if(use_zhi_sponge_damping){
132 if (z > zhi_sponge_start) {
133 Real xi = (
z - zhi_sponge_start) / L_zhi;
134 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - cell_data(i,j,k,0)*
ubar_sponge[k]);
140 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
142 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
143 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
146 Real y = ProbLoArr[1] + jj *
dx[1];
147 Real z = z_phys_cc(i,j,k);
150 if(use_xlo_sponge_damping){
151 if (x < xlo_sponge_end) {
152 Real xi = (xlo_sponge_end -
x) / L_xlo;
153 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
157 if(use_xhi_sponge_damping){
158 if (x > xhi_sponge_start) {
159 Real xi = (
x - xhi_sponge_start) / L_xhi;
160 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
165 if(use_ylo_sponge_damping){
166 if (y < ylo_sponge_end) {
167 Real xi = (ylo_sponge_end -
y) / L_ylo;
168 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_yhi_sponge_damping){
173 if (y > yhi_sponge_start) {
174 Real xi = (
y - yhi_sponge_start) / L_yhi;
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]);
180 if(use_zlo_sponge_damping){
181 if (z < zlo_sponge_end) {
182 Real xi = (zlo_sponge_end -
z) / L_zlo;
183 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - cell_data(i,j,k,0)*
vbar_sponge[k]);
189 if(use_zhi_sponge_damping){
190 if (z > zhi_sponge_start) {
191 Real xi = (
z - zhi_sponge_start) / L_zhi;
192 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:202
@ ubar_sponge
Definition: ERF_DataStruct.H:202
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 myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
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 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
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
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