AMReX-Hydro
AMReX-based hydro routines for low Mach number flows
hydro_utils.H
Go to the documentation of this file.
1 /** \addtogroup Utilities
2  * @{
3  */
4 
5 #ifndef HYDRO_UTILS_H
6 #define HYDRO_UTILS_H
7 
8 #include <AMReX_MultiFabUtil.H>
9 #include <AMReX_BCRec.H>
10 #include <hydro_godunov_ppm.H>
11 
12 #ifdef AMREX_USE_EB
13 #include <AMReX_EBFabFactory.H>
14 #include <AMReX_EBMultiFabUtil.H>
15 #endif
16 
17 /**
18  * Collection of hydro utility functions
19  *
20  */
21 
22 namespace HydroUtils {
23 
24 /**
25  * \brief Compute edge state and flux. Most general version for use with multilevel synchonization.
26  *
27  */
28 void
32  amrex::Array4<amrex::Real> const& flux_y,
33  amrex::Array4<amrex::Real> const& flux_z),
35  amrex::Array4<amrex::Real> const& face_y,
36  amrex::Array4<amrex::Real> const& face_z),
37  bool knownFaceState,
43  amrex::Array4<amrex::Real const> const& w_flux),
46  amrex::Geometry geom,
47  amrex::Real l_dt,
48  amrex::Vector<amrex::BCRec> const& h_bcrec,
49  const amrex::BCRec* d_bcrec,
50  int const* iconserv,
51 #ifdef AMREX_USE_EB
52  const amrex::EBFArrayBoxFactory& ebfact,
53  amrex::Array4<amrex::Real const> const& values_on_eb_inflow,
54 #endif
55  bool godunov_use_ppm, bool godunov_use_forces_in_trans,
56  bool is_velocity, bool fluxes_are_area_weighted,
57  std::string const& advection_type,
58  int limiter_type = PPM::VanLeer);
59 /**
60  * \brief Compute edge state and flux. For typical advection, and also allows for inflow on EB.
61  *
62  */
63 void
67  amrex::Array4<amrex::Real> const& flux_y,
68  amrex::Array4<amrex::Real> const& flux_z),
70  amrex::Array4<amrex::Real> const& face_y,
71  amrex::Array4<amrex::Real> const& face_z),
72  bool knownFaceState,
78  amrex::Geometry geom,
79  amrex::Real l_dt,
80  amrex::Vector<amrex::BCRec> const& h_bcrec,
81  const amrex::BCRec* d_bcrec,
82  int const* iconserv,
83 #ifdef AMREX_USE_EB
84  const amrex::EBFArrayBoxFactory& ebfact,
85  amrex::Array4<amrex::Real const> const& values_on_eb_inflow,
86 #endif
87  bool godunov_use_ppm, bool godunov_use_forces_in_trans,
88  bool is_velocity, bool fluxes_are_area_weighted,
89  std::string const& advection_type,
90  int limiter_type = PPM::VanLeer);
91 
92 /**
93  * \brief Compute edge state and flux. For typical advection, but no inflow through EB.
94  *
95  */
96 #ifdef AMREX_USE_EB
97 void
98 ComputeFluxesOnBoxFromState ( amrex::Box const& bx, int ncomp, amrex::MFIter& mfi,
101  amrex::Array4<amrex::Real> const& flux_y,
102  amrex::Array4<amrex::Real> const& flux_z),
104  amrex::Array4<amrex::Real> const& face_y,
105  amrex::Array4<amrex::Real> const& face_z),
106  bool knownFaceState,
109  amrex::Array4<amrex::Real const> const& w_mac),
112  amrex::Geometry geom,
113  amrex::Real l_dt,
114  amrex::Vector<amrex::BCRec> const& h_bcrec,
115  const amrex::BCRec* d_bcrec,
116  int const* iconserv,
117  const amrex::EBFArrayBoxFactory& ebfact,
118  bool godunov_use_ppm, bool godunov_use_forces_in_trans,
119  bool is_velocity, bool fluxes_are_area_weighted,
120  std::string const& advection_type,
121  int limiter_type = PPM::VanLeer);
122 #endif
123 
124 #ifdef AMREX_USE_EB
125 void
126 ExtrapVelToFaces ( amrex::MultiFab const& vel,
127  amrex::MultiFab const& vel_forces,
129  amrex::MultiFab& v_mac,
130  amrex::MultiFab& w_mac),
131  amrex::Vector<amrex::BCRec> const& h_bcrec,
132  amrex::BCRec const* d_bcrec,
133  const amrex::Geometry& geom,
134  amrex::Real dt,
135  const amrex::EBFArrayBoxFactory& ebfact,
136  bool godunov_ppm, bool godunov_use_forces_in_trans,
137  std::string const& advection_type,
138  int limiter_type = PPM::VanLeer);
139 #endif
140 
141 void
142 ExtrapVelToFaces ( amrex::MultiFab const& vel,
143  amrex::MultiFab const& vel_forces,
145  amrex::MultiFab& v_mac,
146  amrex::MultiFab& w_mac),
147  amrex::Vector<amrex::BCRec> const& h_bcrec,
148  amrex::BCRec const* d_bcrec,
149  const amrex::Geometry& geom,
150  amrex::Real dt,
151 #ifdef AMREX_USE_EB
152  const amrex::EBFArrayBoxFactory& ebfact,
153  amrex::MultiFab const* velocity_on_eb_inflow,
154 #endif
155  bool godunov_ppm, bool godunov_use_forces_in_trans,
156  std::string const& advection_type,
157  int limiter_type = PPM::VanLeer);
158 
159 /**
160  * \brief If convective, compute convTerm = u dot grad q = div (u q) - q div(u).
161  *
162  */
163 void
164 ComputeConvectiveTerm ( amrex::Box const& bx, int num_comp, amrex::MFIter& mfi,
167  amrex::Array4<amrex::Real const> const& q_on_face_y,
168  amrex::Array4<amrex::Real const> const& q_on_face_z),
170  amrex::Array4<amrex::Real> const& convTerm,
171  int const* iconserv,
172 #ifdef AMREX_USE_EB
173  const amrex::EBFArrayBoxFactory& ebfact,
174 #endif
175  std::string const& advection_type);
176 
177 /**
178  * \brief Compute Fluxes.
179  *
180  */
181 void ComputeFluxes ( amrex::Box const& bx,
183  amrex::Array4<amrex::Real> const& fy,
184  amrex::Array4<amrex::Real> const& fz),
191  amrex::Geometry const& geom, int ncomp,
192  bool fluxes_are_area_weighted);
193 
194 /**
195  * \brief Compute divergence.
196  *
197  */
198 
199 void ComputeDivergence ( amrex::Box const& bx,
200  amrex::Array4<amrex::Real> const& div,
204  int ncomp, amrex::Geometry const& geom,
205  amrex::Real mult,
206  bool fluxes_are_area_weighted);
207 
208 #ifdef AMREX_USE_EB
209 
210 void EB_ComputeFluxes ( amrex::Box const& bx,
212  amrex::Array4<amrex::Real> const& fy,
213  amrex::Array4<amrex::Real> const& fz),
219  amrex::Array4<amrex::Real const> const& zedge),
223  amrex::Geometry const& geom, int ncomp,
225  bool fluxes_are_area_weighted);
226 
227 
228 void EB_ComputeDivergence ( amrex::Box const& bx,
229  amrex::Array4<amrex::Real> const& div,
234  int ncomp, amrex::Geometry const& geom,
235  amrex::Real mult,
236  bool fluxes_are_area_weighted);
237 
238 
239 void EB_ComputeDivergence ( amrex::Box const& bx,
240  amrex::Array4<amrex::Real> const& div,
245  int ncomp, amrex::Geometry const& geom,
246  amrex::Real mult,
247  bool fluxes_are_area_weighted,
248  amrex::Array4<amrex::Real const> const& eb_velocity,
249  amrex::Array4<amrex::Real const> const& values_on_eb_inflow,
252  amrex::Array4<amrex::Real const> const& bnorm);
253 #endif
254 }
255 
256 #endif
257 /** @}*/
#define AMREX_D_DECL(a, b, c)
void ExtrapVelToFaces(amrex::MultiFab const &vel, amrex::MultiFab const &vel_forces, AMREX_D_DECL(amrex::MultiFab &u_mac, amrex::MultiFab &v_mac, amrex::MultiFab &w_mac), amrex::Vector< amrex::BCRec > const &h_bcrec, amrex::BCRec const *d_bcrec, const amrex::Geometry &geom, amrex::Real dt, bool godunov_ppm, bool godunov_use_forces_in_trans, std::string const &advection_type, int limiter_type=PPM::VanLeer)
Compute edge state and flux. For typical advection, but no inflow through EB.
Definition: hydro_extrap_vel_to_faces.cpp:41
Definition: hydro_utils.H:22
void ComputeConvectiveTerm(amrex::Box const &bx, int num_comp, amrex::MFIter &mfi, amrex::Array4< amrex::Real const > const &q, AMREX_D_DECL(amrex::Array4< amrex::Real const > const &q_on_face_x, amrex::Array4< amrex::Real const > const &q_on_face_y, amrex::Array4< amrex::Real const > const &q_on_face_z), amrex::Array4< amrex::Real const > const &divu, amrex::Array4< amrex::Real > const &convTerm, int const *iconserv, std::string const &advection_type)
If convective, compute convTerm = u dot grad q = div (u q) - q div(u).
void ComputeDivergence(amrex::Box const &bx, amrex::Array4< amrex::Real > const &div, AMREX_D_DECL(amrex::Array4< amrex::Real const > const &fx, amrex::Array4< amrex::Real const > const &fy, amrex::Array4< amrex::Real const > const &fz), int ncomp, amrex::Geometry const &geom, amrex::Real mult, bool fluxes_are_area_weighted)
Compute divergence.
void ComputeFluxes(amrex::Box const &bx, AMREX_D_DECL(amrex::Array4< amrex::Real > const &fx, amrex::Array4< amrex::Real > const &fy, amrex::Array4< amrex::Real > const &fz), AMREX_D_DECL(amrex::Array4< amrex::Real const > const &umac, amrex::Array4< amrex::Real const > const &vmac, amrex::Array4< amrex::Real const > const &wmac), AMREX_D_DECL(amrex::Array4< amrex::Real const > const &xed, amrex::Array4< amrex::Real const > const &yed, amrex::Array4< amrex::Real const > const &zed), amrex::Geometry const &geom, int ncomp, bool fluxes_are_area_weighted)
Compute Fluxes.
void ComputeFluxesOnBoxFromState(amrex::Box const &bx, int ncomp, amrex::MFIter &mfi, amrex::Array4< amrex::Real const > const &q, AMREX_D_DECL(amrex::Array4< amrex::Real > const &flux_x, amrex::Array4< amrex::Real > const &flux_y, amrex::Array4< amrex::Real > const &flux_z), AMREX_D_DECL(amrex::Array4< amrex::Real > const &face_x, amrex::Array4< amrex::Real > const &face_y, amrex::Array4< amrex::Real > const &face_z), bool knownFaceState, AMREX_D_DECL(amrex::Array4< amrex::Real const > const &u_mac, amrex::Array4< amrex::Real const > const &v_mac, amrex::Array4< amrex::Real const > const &w_mac), AMREX_D_DECL(amrex::Array4< amrex::Real const > const &u_flux, amrex::Array4< amrex::Real const > const &v_flux, amrex::Array4< amrex::Real const > const &w_flux), amrex::Array4< amrex::Real const > const &divu, amrex::Array4< amrex::Real const > const &fq, amrex::Geometry geom, amrex::Real l_dt, amrex::Vector< amrex::BCRec > const &h_bcrec, const amrex::BCRec *d_bcrec, int const *iconserv, bool godunov_use_ppm, bool godunov_use_forces_in_trans, bool is_velocity, bool fluxes_are_area_weighted, std::string const &advection_type, int limiter_type=PPM::VanLeer)
Compute edge state and flux. Most general version for use with multilevel synchonization.
@ VanLeer
Definition: hydro_godunov_ppm.H:17