flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
flow_ibm_scalars.hpp
Go to the documentation of this file.
1
8#ifndef PECLET_FLOW_FLOW_IBM_SCALARS_HPP
9#define PECLET_FLOW_FLOW_IBM_SCALARS_HPP
10
11namespace peclet::flow {
12
13template <class Grid>
14void Solver<Grid>::addScalar(const std::string& name, double D, int scheme, int iters,
15 bool cutcell) {
16 ScalarField sc;
17 sc.name = name;
18 sc.c = addField(name); // registered, zero-initialised, on the G=2 block
19 sc.cOld = CCField(name + "_old", n_);
20 sc.b = CCField(name + "_b", n_);
21 sc.AC = CCField(name + "_AC", n_);
22 sc.AW = CCField(name + "_AW", n_);
23 sc.AE = CCField(name + "_AE", n_);
24 sc.AS = CCField(name + "_AS", n_);
25 sc.AN = CCField(name + "_AN", n_);
26 sc.AB = CCField(name + "_AB", n_);
27 sc.AT = CCField(name + "_AT", n_);
28 // PHYSICAL diffusivity in (L^2/T), kept verbatim; the operator takes the cell Fourier number
29 // D' = D tRef/hRef^2, re-derived by `refreshUnitDerived` if tRef is pinned after this call
30 // (exactly D in cell units). The per-axis Laplacian weight w_a is applied where the stencil
31 // is built, as for mu.
32 sc.Dphys = D;
33 sc.D = D * u_.diffToInt();
34 sc.scheme = scheme;
35 sc.iters = iters < 1 ? 1 : iters;
36 if (cutcell) { // doc/scalar_ibm_design.md: the operator state lives beside the legacy bands
37 sc.cutcell = true;
38 sc.cut = std::make_shared<ScalarCutState>();
39 }
40 scalars_.push_back(sc);
41}
42
43template <class Grid>
44bool Solver<Grid>::hasScalar(const std::string& name) const {
45 for (const auto& sc : scalars_)
46 if (sc.name == name)
47 return true;
48 return false;
49}
50
51template <class Grid>
52void Solver<Grid>::setScalarBc(const std::string& name, int face, int type, double value) {
53 for (auto& sc : scalars_)
54 if (sc.name == name) {
55 sc.bc[face] = type;
56 sc.bcVal[face] = value;
57 if (sc.cutcell) // a constant value replaces an earlier per-face profile
58 sc.cut->hasProfile[face] = false;
59 return;
60 }
61 throw std::runtime_error("set_scalar_bc: no scalar named '" + name + "'");
62}
63
64template <class Grid>
66 if (scalars_.empty())
67 return;
68 const double idt = 1.0 / dt_;
69 CCField Uf, Vf, Wf;
70 if constexpr (Grid::collocated) {
71 Uf = uf_;
72 Vf = vf_;
73 Wf = wf_;
74 } else {
75 Uf = C[0].u;
76 Vf = C[1].u;
77 Wf = C[2].u;
78 }
79 // Face velocities need the ±2 advection reach -- and the high-side boundary face must survive
80 // the fill: a plain fillGhosts hands the outlet the INLET plane on both grids, and on the
81 // staggered one it overwrote the projection-corrected C[0].u in place (doc/uf_outlet_fix.md).
85 // Phase 3 (V5.4): the cell metric the scalar/energy GFM rows pull back through. The per-axis
86 // Laplacian weights are `u_.w[a]` — Phase 2's, passed at each call site in its own spelling.
87 const vof::VofMetric gmS = u_.vofMetric();
88 for (auto& sc : scalars_) {
89 if (sc.cutcell) { // doc/scalar_ibm_design.md §5.5: the cut-cell path, legacy untouched
91 continue;
92 }
93 // WO-P23: the CONSISTENT-ENERGY branch — per-cell k(C) in the bands, a rho c_p(C) time term,
94 // and NO advective term (the transport was already done geometrically with the colour's own
95 // fluxes in advectVof). Taken OUTSIDE the kernels, so a scalar without `energy` executes the
96 // validated constant-D bodies verbatim.
97 const bool energy = sc.energy && sc.kcell.extent(0) == n_;
98 const bool hasMask = sc.dmask.extent(0) == n_;
99 if (energy) {
100 scalarBuildDiffusionVarK(sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, CCConst(ox_),
101 CCConst(oy_), CCConst(oz_), CCConst(sc.kcell), CCConst(sc.rcp),
102 CCConst(sc.dmask), idt, e_, G, u_.w[0], u_.w[1], u_.w[2]);
103 applyScalarBcStencilVar(sc);
104 } else {
105 scalarBuildDiffusionOpen(sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, CCConst(ox_),
106 CCConst(oy_), CCConst(oz_), sc.D, idt, e_, G, u_.w[0], u_.w[1],
107 u_.w[2]);
108 applyScalarBcStencil(sc); // re-open Dirichlet domain faces (set_domain_bc closes openness)
109 }
110 // WO-P23: the PLANE-ANCHORED (ghost-fluid) form of that Dirichlet set — the pure cells'
111 // rows carry the condition at the PLIC plane and never read the interfacial cell's value.
112 const bool gfm = hasMask && pcPlaneDir_ && sc.gfmB.extent(0) == n_ && pcGphi_.extent(0) == n_;
113 // WO-P3g items 2 + 3: the second-order (Gibou-Fedkiw) row and/or the curvature-consistent
114 // `theta`. The branch is OUTSIDE the kernel, so the shipped configuration executes the
115 // validated `scalarMaskGfm` body verbatim.
116 const bool gfm2 = gfm && (pcGfmOrder_ >= 2 || (pcCurvDist_ && pcKappa_.extent(0) == n_));
117 if (gfm2)
118 scalarMaskGfm2(sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, sc.gfmB, CCConst(ox_),
119 CCConst(oy_), CCConst(oz_), CCConst(sc.dmask), CCConst(pcTgam_),
120 CCConst(pcGn_[0]), CCConst(pcGn_[1]), CCConst(pcGn_[2]), CCConst(pcGphi_),
121 CCConst(pcCurvDist_ && pcKappa_.extent(0) == n_ ? pcKappa_ : pcGphi_),
122 CCConst(sc.kcell), sc.D, energy, pcGfmThMin_, pcGfmThMax_, pcGfmOrder_,
123 pcCurvDist_ && pcKappa_.extent(0) == n_, e_, G, u_.w[0], u_.w[1], u_.w[2],
124 gmS);
125 else if (gfm)
126 scalarMaskGfm(sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, sc.gfmB, CCConst(ox_),
127 CCConst(oy_), CCConst(oz_), CCConst(sc.dmask), CCConst(pcTgam_),
128 CCConst(pcGn_[0]), CCConst(pcGn_[1]), CCConst(pcGn_[2]), CCConst(pcGphi_),
129 CCConst(sc.kcell), sc.D, energy, pcGfmThMin_, pcGfmThMax_, e_, G, u_.w[0],
130 u_.w[1], u_.w[2], gmS);
131 // WO-P01: the optional PER-CELL Dirichlet set (interfacial cells at T_sat). Inert — and the
132 // operator therefore bit-identical — until a caller allocates the mask.
133 if (hasMask)
134 scalarMaskStencil(sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, CCConst(sc.dmask), e_, G);
135 // c^n's ghosts must be valid BEFORE they are frozen into cOld, which the explicit advection
136 // reads at +-2: set_field, the coupling drivers and the VoF energy transport write inner
137 // cells only, and the one fill used to come after the copy, acting on c, not on cOld -- so the
138 // first step after any such write upwinded the inflow from a band of stale values (zeros on a
139 // fresh scalar: c = 1 at a Dirichlet-1 inlet fell to 0.5 in one step). The pcBuildInterface
140 // fix (WO-P23) is the same defect on the phase-change side. doc/uf_outlet_fix.md section B.
141 // It is the step's only fill of c before the smoother, which refills before every sweep: the
142 // calls up to scalarInflowGhosts write cOld only, so a second fill after them is redundant.
143 scalarFillGhosts(sc);
144 Kokkos::deep_copy(sc.cOld, sc.c);
145 // WO-P3f: add the enthalpy the interfacial cells' overwrite gave back (option, inert off).
146 if (hasMask && pcCarryConserve_ && pcCarrySrc_.extent(0) == n_)
147 pcCarryApply(sc);
148 scalarInflowGhosts(sc); // cOld's inflow ghosts = the prescribed state (for upwinding)
149 if (energy)
150 scalarBuildRhsHeat(sc.b, CCConst(sc.cOld), CCConst(sc.rcp), idt, e_, G);
151 else
152 scalarBuildRhs(sc.b, CCConst(sc.cOld), CCConst(Uf), CCConst(Vf), CCConst(Wf), CCConst(ox_),
153 CCConst(oy_), CCConst(oz_), idt, sc.scheme, e_, G);
154 if (gfm)
155 scalarAddGfmRhs(sc.b, CCConst(sc.gfmB), CCConst(sc.dmask), e_, G);
156 // WO-P3f: the energy budget's PRE snapshot — taken here because `scalarMaskRhs` on the
157 // next line is where a newly interfacial cell's transported temperature is discarded.
158 // Inert (no kernel, no allocation) unless `set_phase_change_budget(true)` ran.
159 if (hasMask && pcBudgetOn_ && pcClsPrev_.extent(0) == n_)
160 pcBudgetPre(sc);
161 if (hasMask)
162 scalarMaskRhs(sc.b, sc.c, CCConst(sc.dmask), CCConst(sc.dval), e_, G);
163 // implicit diffusion: red-black Gauss-Seidel with a ghost fill before each color sweep.
164 for (int it = 0; it < sc.iters; ++it) {
165 scalarFillGhosts(sc);
166 cutcellSmoothColor(sc.c, CCConst(sc.b), sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, e_,
167 og_, G, 0);
168 scalarFillGhosts(sc);
169 cutcellSmoothColor(sc.c, CCConst(sc.b), sc.AC, sc.AW, sc.AE, sc.AS, sc.AN, sc.AB, sc.AT, e_,
170 og_, G, 1);
171 }
172 scalarFillGhosts(sc);
173 if (hasMask && pcBudgetOn_ && pcClsPrev_.extent(0) == n_)
174 pcBudgetPost(sc); // WO-P3f, inert when the instrument is off
175 }
176}
177
178template <class Grid>
179ScalarField& Solver<Grid>::scalarField(const std::string& name) {
180 for (auto& sc : scalars_)
181 if (sc.name == name)
182 return sc;
183 throw std::runtime_error("no scalar named '" + name + "'");
184}
185
186template <class Grid>
187void Solver<Grid>::scalarDirichletMask(const std::string& name) {
188 ScalarField& sc = scalarField(name);
189 if (sc.cutcell)
190 throw std::invalid_argument(
191 "the per-cell Dirichlet mask is not available on the cut-cell "
192 "scalar '" +
193 name + "' (doc/scalar_ibm_design.md §8.1)");
194 if (sc.dmask.extent(0) != n_) {
195 sc.dmask = CCField(name + "_dmask", n_);
196 sc.dval = CCField(name + "_dval", n_);
197 sc.gfmB = CCField(name + "_gfmb", n_);
198 }
199 if (pcGphi_.extent(0) != n_) {
200 pcTgam_ = CCField("pc_tgam", n_);
201 pcGn_[0] = CCField("pc_gnx", n_);
202 pcGn_[1] = CCField("pc_gny", n_);
203 pcGn_[2] = CCField("pc_gnz", n_);
204 pcGphi_ = CCField("pc_gphi", n_);
205 }
206}
207
208template <class Grid>
209void Solver<Grid>::scalarFillGhosts(ScalarField& sc) {
210 fillGhosts(sc.c);
211 applyScalarBc(sc);
212}
213
214template <class Grid>
215void Solver<Grid>::applyScalarBc(ScalarField& sc) {
216 for (int f = 0; f < 6; ++f)
217 if (sc.bc[f] != 0 && touchesGlobalFace(f))
218 applyScalarBcFace(sc.c, f / 2, f % 2, sc.bc[f], sc.bcVal[f]);
219}
220
221template <class Grid>
222void Solver<Grid>::scalarInflowGhosts(ScalarField& sc) {
223 for (int f = 0; f < 6; ++f) {
224 const int a = f / 2;
225 const bool inflow =
226 bc_[f] == 2 && (bcProf_[f].extent(0) > 0 || std::fabs(bcVel_[f][a]) > 1e-12);
227 if (sc.bc[f] == 2 && inflow && touchesGlobalFace(f))
228 applyScalarBcFace(sc.cOld, a, f % 2, 3, sc.bcVal[f]);
229 }
230}
231
232template <class Grid>
233bool Solver<Grid>::touchesGlobalFace(int f) const {
234#ifdef PECLET_FLOW_MPI
235 if (distributed_) {
236 const int a = f / 2;
237 const int o = (a == 0) ? og_.x : (a == 1) ? og_.y : og_.z;
238 const int n = (a == 0) ? nx_ : (a == 1) ? ny_ : nz_;
239 const int gn = (a == 0) ? gnx_ : (a == 1) ? gny_ : gnz_;
240 return (f % 2 == 0) ? (o == 0) : (o + n == gn);
241 }
242#endif
243 (void)f;
244 return true;
245}
246
247template <class Grid>
248void Solver<Grid>::applyScalarBcStencilVar(ScalarField& sc) {
249 for (int f = 0; f < 6; ++f) {
250 if (sc.bc[f] != 2 || !touchesGlobalFace(f))
251 continue;
252 const int a = f / 2, side = f % 2;
253 CCField band = (a == 0) ? (side == 0 ? sc.AW : sc.AE)
254 : (a == 1) ? (side == 0 ? sc.AS : sc.AN)
255 : (side == 0 ? sc.AB : sc.AT);
256 patchScalarDirichletFaceVar(sc.AC, band, sc.kcell, a, side);
257 }
258}
259
260template <class Grid>
261void Solver<Grid>::applyScalarBcStencil(ScalarField& sc) {
262 for (int f = 0; f < 6; ++f) {
263 if (sc.bc[f] != 2 || !touchesGlobalFace(f))
264 continue; // only Dirichlet reopens; Neumann/periodic leave the (closed/interior) band
265 const int a = f / 2, side = f % 2;
266 CCField band = (a == 0) ? (side == 0 ? sc.AW : sc.AE)
267 : (a == 1) ? (side == 0 ? sc.AS : sc.AN)
268 : (side == 0 ? sc.AB : sc.AT);
269 patchScalarDirichletFace(sc.AC, band, sc.D, a, side);
270 }
271}
272
273template <class Grid>
275 int side) {
276 const double wa = u_.w[a]; // V5.4: this axis's Laplacian weight (exactly 1.0 isotropic)
277 const int t1 = (a + 1) % 3, t2 = (a + 2) % 3;
278 const int nt1 = (t1 == 0) ? nx_ : (t1 == 1) ? ny_ : nz_;
279 const int nt2 = (t2 == 0) ? nx_ : (t2 == 1) ? ny_ : nz_;
280 const int na = (a == 0) ? nx_ : (a == 1) ? ny_ : nz_;
281 const long sx = 1, sy = e_.x, sz = (long)e_.x * e_.y;
282 const long sa = (a == 0) ? sx : (a == 1) ? sy : sz;
283 const long st1 = (t1 == 0) ? sx : (t1 == 1) ? sy : sz;
284 const long st2 = (t2 == 0) ? sx : (t2 == 1) ? sy : sz;
285 const int aInner = (side == 0) ? G : (G + na - 1);
286 CCExec space;
287 Kokkos::parallel_for(
288 "peclet::flow::scalar_bc_stencil_var", MDRange2<CCExec>(space, {G, G}, {G + nt1, G + nt2}),
289 KOKKOS_LAMBDA(int j1, int j2) {
290 const long i = (long)aInner * sa + (long)j1 * st1 + (long)j2 * st2;
291 const double D = kc(i) * wa; // V5.4: this axis's Laplacian weight (1.0 isotropic)
292 AC(i) += D + band(i);
293 band(i) = -D;
294 });
295}
296
297template <class Grid>
298void Solver<Grid>::patchScalarDirichletFace(CCField AC, CCField band, double Din, int a, int side) {
299 const double D = Din * u_.w[a]; // V5.4: this axis's Laplacian weight (exactly 1.0 isotropic)
300 const int t1 = (a + 1) % 3, t2 = (a + 2) % 3;
301 const int nt1 = (t1 == 0) ? nx_ : (t1 == 1) ? ny_ : nz_;
302 const int nt2 = (t2 == 0) ? nx_ : (t2 == 1) ? ny_ : nz_;
303 const int na = (a == 0) ? nx_ : (a == 1) ? ny_ : nz_;
304 const long sx = 1, sy = e_.x, sz = (long)e_.x * e_.y;
305 const long sa = (a == 0) ? sx : (a == 1) ? sy : sz;
306 const long st1 = (t1 == 0) ? sx : (t1 == 1) ? sy : sz;
307 const long st2 = (t2 == 0) ? sx : (t2 == 1) ? sy : sz;
308 const int aInner = (side == 0) ? G : (G + na - 1);
309 CCExec space;
310 Kokkos::parallel_for(
311 "peclet::flow::scalar_bc_stencil", MDRange2<CCExec>(space, {G, G}, {G + nt1, G + nt2}),
312 KOKKOS_LAMBDA(int j1, int j2) {
313 const long i = (long)aInner * sa + (long)j1 * st1 + (long)j2 * st2;
314 // base build put band(i) = -D*open_face and A_C += D*open_face; force the face fully open
315 // (band -> -D, A_C gains D*(1-open)) without double-counting when it was already open.
316 AC(i) += D + band(i);
317 band(i) = -D;
318 });
319}
320
321template <class Grid>
322void Solver<Grid>::applyScalarBcFace(CCField c, int a, int side, int type, double val, bool edges) {
323 const int t1 = (a + 1) % 3, t2 = (a + 2) % 3;
324 const int nt1 = (t1 == 0) ? nx_ : (t1 == 1) ? ny_ : nz_;
325 const int nt2 = (t2 == 0) ? nx_ : (t2 == 1) ? ny_ : nz_;
326 const int na = (a == 0) ? nx_ : (a == 1) ? ny_ : nz_;
327 const long sx = 1, sy = e_.x, sz = (long)e_.x * e_.y;
328 const long sa = (a == 0) ? sx : (a == 1) ? sy : sz;
329 const long st1 = (t1 == 0) ? sx : (t1 == 1) ? sy : sz;
330 const long st2 = (t2 == 0) ? sx : (t2 == 1) ? sy : sz;
331 const int aInner = (side == 0) ? G : (G + na - 1); // inner boundary cell a-index
332 const int dir = (side == 0) ? -1 : +1; // toward the ghost
333 // edges: also the tangential ghost rows (their inner-normal values are the periodic/halo fill),
334 // so the edge and corner ghosts at this face carry the BC too, not a wrap from the far side.
335 const int t0 = edges ? 0 : G, t1e = edges ? nt1 + 2 * G : G + nt1,
336 t2e = edges ? nt2 + 2 * G : G + nt2;
337 CCExec space;
338 Kokkos::parallel_for(
339 "peclet::flow::scalar_bc_face", MDRange2<CCExec>(space, {t0, t0}, {t1e, t2e}),
340 KOKKOS_LAMBDA(int j1, int j2) {
341 const long base = (long)aInner * sa + (long)j1 * st1 + (long)j2 * st2;
342 for (int L = 1; L <= 2; ++L) {
343 const long gcell = base + (long)dir * L * sa;
344 const long icell = base - (long)dir * (L - 1) * sa;
345 // type 2 Dirichlet reflection, 3 the constant inflow state (scalarInflowGhosts), else
346 // the Neumann copy
347 c(gcell) = (type == 2) ? (2.0 * val - c(icell)) : (type == 3) ? val : c(icell);
348 }
349 });
350}
351
352} // namespace peclet::flow
353
354#endif // PECLET_FLOW_FLOW_IBM_SCALARS_HPP
ScalarField & scalarField(const std::string &name)
void patchScalarDirichletFaceVar(CCField AC, CCField band, CCField kc, int a, int side)
CCField addField(const std::string &name)
void advanceScalarCutCell(ScalarField &sc)
void addScalar(const std::string &name, double D, int scheme, int iters, bool cutcell=false)
void fillFaceGhostsKeepBoundary(CCField f, int a)
void applyScalarBcFace(CCField c, int a, int side, int type, double val, bool edges=false)
void setScalarBc(const std::string &name, int face, int type, double value)
void pcBudgetPost(ScalarField &sc)
WO-P3f, part 2: the state AFTER the energy solve, the heat the plane-anchored rows actually delivered...
void pcBudgetPre(ScalarField &sc)
WO-P3f, the energy-budget instrument, part 1: the state BEFORE the energy solve, and the class-change...
static constexpr int G
Definition flow_ibm.hpp:82
bool hasScalar(const std::string &name) const
void pcCarryApply(ScalarField &sc)
WO-P3f: consume pcCarrySrc_ into the energy solve's time base.
void patchScalarDirichletFace(CCField AC, CCField band, double Din, int a, int side)
void scalarDirichletMask(const std::string &name)
Allocate (idempotently) the per-cell Dirichlet mask + value of a registered scalar.
y
Definition cmp.py:24
void scalarMaskRhs(CCField b, CCField c, CCConst mask, CCConst val, C3 e, int g)
Kokkos::DefaultExecutionSpace CCExec
void scalarMaskGfm2(CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCField gfmB, CCConst ox, CCConst oy, CCConst oz, CCConst mask, CCConst tgam, CCConst gnx, CCConst gny, CCConst gnz, CCConst gphi, CCConst kap, CCConst kc, double Dconst, bool useK, double thMin, double thMax, int order, bool useKappa, C3 e, int g, double wx=1.0, double wy=1.0, double wz=1.0, vof::VofMetric gm=vof::VofMetric{})
void scalarBuildDiffusionOpen(CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCConst ox, CCConst oy, CCConst oz, double D, double idt, C3 e, int g, double wx=1.0, double wy=1.0, double wz=1.0)
Kokkos::View< const double *, CCMem > CCConst
void scalarAddGfmRhs(CCField b, CCConst gfmB, CCConst mask, C3 e, int g)
void scalarMaskGfm(CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCField gfmB, CCConst ox, CCConst oy, CCConst oz, CCConst mask, CCConst tgam, CCConst gnx, CCConst gny, CCConst gnz, CCConst gphi, CCConst kc, double Dconst, bool useK, double thMin, double thMax, C3 e, int g, double wx=1.0, double wy=1.0, double wz=1.0, vof::VofMetric gm=vof::VofMetric{})
Kokkos::View< double *, CCMem > CCField
void scalarMaskStencil(CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCConst mask, C3 e, int g)
void cutcellSmoothColor(CCField phi, CCConst b, OpV AC, OpV AW, OpV AE, OpV AS, OpV AN, OpV AB, OpV AT, C3 e, C3 og, int g, int color)
void scalarBuildDiffusionVarK(CCField AC, CCField AW, CCField AE, CCField AS, CCField AN, CCField AB, CCField AT, CCConst ox, CCConst oy, CCConst oz, CCConst kc, CCConst rcp, CCConst mask, double idt, C3 e, int g, double wx=1.0, double wy=1.0, double wz=1.0)
void scalarBuildRhsHeat(CCField b, CCConst cOld, CCConst rcp, double idt, C3 e, int g)
Kokkos::MDRangePolicy< Exec, Kokkos::Rank< 2, Kokkos::Iterate::Left, Kokkos::Iterate::Left > > MDRange2
2-D range, first index fastest (both the tile order and the order within a tile).
Definition policy.hpp:31
void scalarBuildRhs(CCField b, CCConst cOld, CCConst U, CCConst V, CCConst W, CCConst ox, CCConst oy, CCConst oz, double idt, int scheme, C3 e, int g)
static double val(long gi)
Definition symconv.cpp:27
static constexpr double AC
static double value(int gx, int gy, int gz)