17amrex::Real AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
alpha_flux(
22 const amrex::Real margin,
23 amrex::Array4<amrex::Real const>
const& vof,
24 amrex::Array4<amrex::Real const>
const& tg_vof,
25 amrex::Array4<amrex::Real const>
const& normal)
28 const amrex::IntVect iv{i, j, k};
29 const amrex::IntVect dv{(int)(dir == 0), (int)(dir == 1), (int)(dir == 2)};
30 const amrex::IntVect ivm = iv - dv;
33 const amrex::Real gphi = (vof(iv) - vof(ivm));
35 const amrex::Real norm_ = std::abs(normal(iv, dir));
36 const amrex::Real norm_nb = std::abs(normal(ivm, dir));
40 const amrex::Real dphi_ = (vof(iv) - tg_vof(iv)) * norm_;
41 const amrex::Real dphi_nb = (tg_vof(ivm) - vof(ivm)) * norm_nb;
43 amrex::Real dphi_eval = 0.5 * (dphi_ + dphi_nb);
46 if ((std::abs(vof(iv) - 0.5) > margin ||
47 std::abs(vof(ivm) - 0.5) > margin)) {
49 dphi_eval = (vof(ivm) < 0.5 && vof(iv) <= 0.5 + margin) ? dphi_nb
52 (vof(ivm) >= 0.5 - margin && vof(iv) > 0.5) ? dphi_ : dphi_eval;
56 (vof(iv) < 0.5 && vof(ivm) <= 0.5 + margin) ? dphi_ : dphi_eval;
57 dphi_eval = (vof(iv) >= 0.5 - margin && vof(ivm) > 0.5) ? dphi_nb
69 amrex::Array4<amrex::Real const>
const& vof,
70 amrex::Array4<amrex::Real const>
const& velocity,
76 const amrex::IntVect iv{i, j, k};
77 const amrex::IntVect dv{(int)(dir == 0), (int)(dir == 1), (int)(dir == 2)};
78 const amrex::IntVect ivm = iv - dv;
81 const amrex::Real gphi = (vof(iv) - vof(ivm));
84 const amrex::Real u_ = velocity(iv, 0);
85 const amrex::Real v_ = velocity(iv, 1);
86 const amrex::Real w_ = velocity(iv, 2);
87 const amrex::Real u_nb = velocity(ivm, 0);
88 const amrex::Real v_nb = velocity(ivm, 1);
89 const amrex::Real w_nb = velocity(ivm, 2);
91 uface = 0.5 * (u_ + u_nb);
92 vface = 0.5 * (v_ + v_nb);
93 wface = 0.5 * (w_ + w_nb);
112 amrex::Array4<amrex::Real const>
const& vof,
113 amrex::Array4<amrex::Real const>
const& gp,
114 amrex::Array4<amrex::Real const>
const& rho,
120 const amrex::IntVect iv{i, j, k};
121 const amrex::IntVect dv{(int)(dir == 0), (int)(dir == 1), (int)(dir == 2)};
122 const amrex::IntVect ivm = iv - dv;
125 const amrex::Real gphi = (vof(iv) - vof(ivm));
128 const amrex::Real u_ = gp(iv, 0) / rho(iv);
129 const amrex::Real v_ = gp(iv, 1) / rho(iv);
130 const amrex::Real w_ = gp(iv, 2) / rho(iv);
131 const amrex::Real u_nb = gp(ivm, 0) / rho(ivm);
132 const amrex::Real v_nb = gp(ivm, 1) / rho(ivm);
133 const amrex::Real w_nb = gp(ivm, 2) / rho(ivm);
135 uface = 0.5 * (u_ + u_nb);
136 vface = 0.5 * (v_ + v_nb);
137 wface = 0.5 * (w_ + w_nb);
155 amrex::Array4<amrex::Real const>
const& fx,
156 amrex::Array4<amrex::Real const>
const& fy,
157 amrex::Array4<amrex::Real const>
const& fz,
158 const amrex::Real tiny)
161 const amrex::Real avg_fx = fx(i, j, k, 8) + fx(i, j, k - 1, 8) +
162 fx(i, j - 1, k, 8) + fx(i, j - 1, k - 1, 8) +
164 const amrex::Real avg_fy = fy(i, j, k, 8) + fy(i - 1, j, k, 8) +
165 fy(i, j, k - 1, 8) + fy(i - 1, j, k - 1, 8) +
167 const amrex::Real avg_fz = fz(i, j, k, 8) + fz(i - 1, j, k, 8) +
168 fz(i, j - 1, k, 8) + fz(i - 1, j - 1, k, 8) +
173 f_otimes_gradp.xx() = (fx(i, j, k, 5) + fx(i, j, k - 1, 5) +
174 fx(i, j - 1, k, 5) + fx(i, j - 1, k - 1, 5)) /
176 f_otimes_gradp.xy() = (fx(i, j, k, 6) + fx(i, j, k - 1, 6) +
177 fx(i, j - 1, k, 6) + fx(i, j - 1, k - 1, 6)) /
179 f_otimes_gradp.xz() = (fx(i, j, k, 7) + fx(i, j, k - 1, 7) +
180 fx(i, j - 1, k, 7) + fx(i, j - 1, k - 1, 7)) /
182 f_otimes_gradp.yx() = (fy(i, j, k, 5) + fy(i - 1, j, k, 5) +
183 fy(i, j, k - 1, 5) + fy(i - 1, j, k - 1, 5)) /
185 f_otimes_gradp.yy() = (fy(i, j, k, 6) + fy(i - 1, j, k, 6) +
186 fy(i, j, k - 1, 6) + fy(i - 1, j, k - 1, 6)) /
188 f_otimes_gradp.yz() = (fy(i, j, k, 7) + fy(i - 1, j, k, 7) +
189 fy(i, j, k - 1, 7) + fy(i - 1, j, k - 1, 7)) /
191 f_otimes_gradp.zx() = (fz(i, j, k, 5) + fz(i - 1, j, k, 5) +
192 fz(i, j - 1, k, 5) + fz(i - 1, j - 1, k, 5)) /
194 f_otimes_gradp.zy() = (fz(i, j, k, 6) + fz(i - 1, j, k, 6) +
195 fz(i, j - 1, k, 6) + fz(i - 1, j - 1, k, 6)) /
197 f_otimes_gradp.zz() = (fz(i, j, k, 7) + fz(i - 1, j, k, 7) +
198 fz(i, j - 1, k, 7) + fz(i - 1, j - 1, k, 7)) /
201 return f_otimes_gradp;
208 amrex::Array4<amrex::Real const>
const& fx,
209 amrex::Array4<amrex::Real const>
const& fy,
210 amrex::Array4<amrex::Real const>
const& fz,
211 amrex::Array4<amrex::Real const>
const& vof,
212 const amrex::Real tiny)
215 const amrex::Real avg_fx = fx(i, j, k, 8) + fx(i, j, k - 1, 8) +
216 fx(i, j - 1, k, 8) + fx(i, j - 1, k - 1, 8) +
218 const amrex::Real avg_fy = fy(i, j, k, 8) + fy(i - 1, j, k, 8) +
219 fy(i, j, k - 1, 8) + fy(i - 1, j, k - 1, 8) +
221 const amrex::Real avg_fz = fz(i, j, k, 8) + fz(i - 1, j, k, 8) +
222 fz(i, j - 1, k, 8) + fz(i - 1, j - 1, k, 8) +
228 ((vof(i, j, k) - vof(i - 1, j, k)) * fx(i, j, k, 8) +
229 (vof(i, j - 1, k) - vof(i - 1, j - 1, k)) * fx(i, j - 1, k, 8) +
230 (vof(i, j, k - 1) - vof(i - 1, j, k - 1)) * fx(i, j, k - 1, 8) +
231 (vof(i, j - 1, k - 1) - vof(i - 1, j - 1, k - 1)) *
232 fx(i, j - 1, k - 1, 8)) /
235 ((vof(i, j, k) - vof(i, j - 1, k)) * fy(i, j, k, 8) +
236 (vof(i - 1, j, k) - vof(i - 1, j - 1, k)) * fy(i - 1, j, k, 8) +
237 (vof(i, j, k - 1) - vof(i, j - 1, k - 1)) * fy(i, j, k - 1, 8) +
238 (vof(i - 1, j, k - 1) - vof(i - 1, j - 1, k - 1)) *
239 fy(i - 1, j, k - 1, 8)) /
242 ((vof(i, j, k) - vof(i, j, k - 1)) * fz(i, j, k, 8) +
243 (vof(i - 1, j, k) - vof(i - 1, j, k - 1)) * fz(i - 1, j, k, 8) +
244 (vof(i, j - 1, k) - vof(i, j - 1, k - 1)) * fz(i, j - 1, k, 8) +
245 (vof(i - 1, j - 1, k) - vof(i - 1, j - 1, k - 1)) *
246 fz(i - 1, j - 1, k, 8)) /
254 n_tensor.rows(n_zeta, n_zeta, n_zeta);
255 n_tensor_T.cols(n_zeta, n_zeta, n_zeta);
259 n_tensor.x() * n_tensor_T.x(), n_tensor.y() * n_tensor_T.y(),
260 n_tensor.z() * n_tensor_T.z());