OpenImpala
Image-based parallel transport property solver
Loading...
Searching...
No Matches
MacroGeometry.H
Go to the documentation of this file.
1
4#ifndef OPENIMPALA_MACRO_GEOMETRY_H
5#define OPENIMPALA_MACRO_GEOMETRY_H
6
7#ifndef OPENIMPALA_UNIT_TEST
8#include <AMReX_Geometry.H>
9#include <AMReX_REAL.H>
10#endif
11
12namespace OpenImpala {
13
14#ifdef OPENIMPALA_UNIT_TEST
15using Real = double;
16#else
17using Real = amrex::Real;
18#endif
19
31 int nx = 0;
32 int ny = 0;
33 int nz = 0;
34
43 static MacroGeometry fromDimensions(int nx_in, int ny_in, int nz_in, int flow_dir_idx) {
45 mg.nx = nx_in;
46 mg.ny = ny_in;
47 mg.nz = nz_in;
48
49 int dims[3] = {nx_in, ny_in, nz_in};
50 mg.thickness = static_cast<Real>(dims[flow_dir_idx]);
51
52 // Cross-section = product of lateral dimensions
53 Real cs = 1.0;
54 for (int d = 0; d < 3; ++d) {
55 if (d != flow_dir_idx) {
56 cs *= static_cast<Real>(dims[d]);
57 }
58 }
59 mg.cross_section = cs;
61 return mg;
62 }
63
64#ifndef OPENIMPALA_UNIT_TEST
71 static MacroGeometry fromGeometry(const amrex::Geometry& geom, int flow_dir_idx) {
72 const amrex::Box& domain = geom.Domain();
73 return fromDimensions(domain.length(0), domain.length(1), domain.length(2), flow_dir_idx);
74 }
75#endif
76};
77
78} // namespace OpenImpala
79
80#endif // OPENIMPALA_MACRO_GEOMETRY_H
Definition CathodeWrite.cpp:12
amrex::Real Real
Definition MacroGeometry.H:17
Macro-geometric parameters derived from the AMReX Geometry.
Definition MacroGeometry.H:27
Real cross_section
Area perpendicular to flow in voxel units.
Definition MacroGeometry.H:29
int nx
Grid dimension X.
Definition MacroGeometry.H:31
Real thickness
Length along flow direction (Lp) in voxel units.
Definition MacroGeometry.H:28
static MacroGeometry fromDimensions(int nx_in, int ny_in, int nz_in, int flow_dir_idx)
Construct MacroGeometry from known dimensions and a flow direction index.
Definition MacroGeometry.H:43
int ny
Grid dimension Y.
Definition MacroGeometry.H:32
static MacroGeometry fromGeometry(const amrex::Geometry &geom, int flow_dir_idx)
Construct MacroGeometry from an AMReX Geometry and flow Direction.
Definition MacroGeometry.H:71
Real total_volume
Lp * A.
Definition MacroGeometry.H:30
int nz
Grid dimension Z.
Definition MacroGeometry.H:33