peclet-amr 0.2.0
Block-local-Morton AMR octree + collocated cut-cell Navier–Stokes solver (header-only C++20, Kokkos + MPI)
Loading...
Searching...
No Matches
face_geom.hpp
Go to the documentation of this file.
1// core — FaceGeom: the static (sub)face geometry CSR of the collocated AMR projection.
2//
3// Factored out of flow.hpp into its own header so the device face-geometry assembler
4// (facegeom_assembly.hpp) and the flow driver (flow.hpp) can both name the type without a
5// circular include (flow.hpp consumes the assembler, the assembler produces a FaceGeom).
6//
7// Per (sub)face (matching AmrPoisson::forEachFaceFull, 2:1 sub-faces): neighbour, axis, dir, α·area
8// (divergence weight), raw area (advection flux), face-normal distance, openness α (gradient gate),
9// and the two SOU upstream-probe leaves. Per cell: 1/V and a fluid flag. Plus, since ROADMAP
10// B5, the seam-reconstruction descriptors and records of docs/amr_cf_convective.md §5.2 (built
11// by seam_recon.hpp, read by the two advective kernels only; empty where there is no 2:1 seam).
12//
13// Requires a Kokkos build (View).
14#ifndef PECLET_AMR_FACE_GEOM_HPP
15#define PECLET_AMR_FACE_GEOM_HPP
16
17#include "peclet/amr/common.hpp"
18#include "peclet/core/common/types.hpp"
19#include "peclet/core/common/view.hpp"
20
21namespace peclet::amr {
22
23struct FaceGeom {
36 Index n = 0;
37 // ---- seam reconstruction of the ADVECTED value (docs/amr_cf_convective.md §5.2) -------------
38 // Empty unless the seam builder ran (seam_recon.hpp; setSolid). `seam` is the per-slot
39 // descriptor id, −1 = plain slot; the descriptor arrays are indexed by it and the records by a
40 // descriptor's four record ids. Read ONLY by the two advective kernels.
52};
53
58struct SeamView {
61 bool on = false;
62
65 template <class FldFn>
66 KOKKOS_INLINE_FUNCTION double gather(Index r, const FldFn& fld) const {
67 double v = 0.0;
68 for (Index e = recStart(r); e < recStart(r + 1); ++e)
69 v += recW(e) * fld(recCell(e));
70 return v;
71 }
72};
73
76inline SeamView makeSeamView(const FaceGeom& g, bool on) {
78 sv.on = on && g.seam.extent(0) > 0;
79 sv.seam = g.seam;
80 sv.sampI = g.sampI;
81 sv.sampJ = g.sampJ;
82 sv.uuRecI = g.uuRecI;
83 sv.uuRecJ = g.uuRecJ;
84 sv.recStart = g.recStart;
85 sv.recCell = g.recCell;
86 sv.d1I = g.d1I;
87 sv.d1J = g.d1J;
88 sv.recDist = g.recDist;
89 sv.recW = g.recW;
90 return sv;
91}
92
93} // namespace peclet::amr
94
95#endif // PECLET_AMR_FACE_GEOM_HPP
SeamView makeSeamView(const FaceGeom &g, bool on)
Bundle a FaceGeom's seam tables for the kernels.
Definition face_geom.hpp:76
std::vector< std::array< double, Dim > > transferFieldGradients(const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF)
Per-old-leaf minmod prolongation gradients (per fine-coordinate unit) — transferField's stencil,...
Definition adapt.hpp:51
View< Index > uuRecJ
per descriptor: upstream-probe record for up == j, else −1
Definition face_geom.hpp:45
View< double > recDist
per record: dUU for UPSTREAM use (unused as a φ_U* sample)
Definition face_geom.hpp:49
View< Index > uuRecI
per descriptor: upstream-probe record for up == i, else −1
Definition face_geom.hpp:44
View< Index > recCell
record entries: cell slot
Definition face_geom.hpp:50
View< double > alphaArea
α·area (physical) per face, size nFaces
Definition face_geom.hpp:28
View< int > dir
face direction +1/-1, size nFaces
Definition face_geom.hpp:27
View< double > recW
record entries: weight
Definition face_geom.hpp:51
View< double > invVol
1/V_i per cell, size n
Definition face_geom.hpp:34
View< double > rawArea
raw face area (physical, no openness) per face — advection flux
Definition face_geom.hpp:29
View< int > axis
face axis 0/1/2, size nFaces
Definition face_geom.hpp:26
View< Index > upupJ
upstream-of-j probe (periodicNeighbor(j,axis,+dir)) — SOU, size nFaces
Definition face_geom.hpp:33
View< Index > nbr
neighbour leaf per face, size nFaces
Definition face_geom.hpp:25
View< double > alpha
openness per face (gradient gate), size nFaces
Definition face_geom.hpp:31
View< double > dist
face-normal distance (physical) per face, size nFaces
Definition face_geom.hpp:30
View< Index > start
CSR row offsets, size n+1.
Definition face_geom.hpp:24
View< Index > sampI
per descriptor: sample record when i is the COARSE cell, else −1
Definition face_geom.hpp:42
View< Index > seam
descriptor id per face slot, −1 = plain slot; size nFaces
Definition face_geom.hpp:41
View< Index > upupI
upstream-of-i probe (periodicNeighbor(i,axis,−dir)) — SOU, size nFaces
Definition face_geom.hpp:32
View< Index > recStart
record CSR offsets, size nRec+1
Definition face_geom.hpp:48
View< char > fluid
per-cell fluid flag, size n
Definition face_geom.hpp:35
View< double > d1J
per descriptor: half width of j along the face axis (physical)
Definition face_geom.hpp:47
View< double > d1I
per descriptor: half width of i along the face axis (physical)
Definition face_geom.hpp:46
View< Index > sampJ
per descriptor: sample record when j is the COARSE cell, else −1
Definition face_geom.hpp:43
The seam tables as the advective kernels capture them: const Views plus the ablation flag (AmrFlow::s...
Definition face_geom.hpp:58
View< const Index > recStart
Definition face_geom.hpp:59
View< const Index > sampI
Definition face_geom.hpp:59
View< const Index > seam
Definition face_geom.hpp:59
View< const Index > recCell
Definition face_geom.hpp:59
View< const double > recW
Definition face_geom.hpp:60
View< const double > d1J
Definition face_geom.hpp:60
View< const Index > sampJ
Definition face_geom.hpp:59
View< const double > d1I
Definition face_geom.hpp:60
View< const Index > uuRecJ
Definition face_geom.hpp:59
View< const double > recDist
Definition face_geom.hpp:60
double gather(Index r, const FldFn &fld) const
Σ over the record's entries IN RECORD ORDER, never reordered — that is what keeps np = 1 bitwise agai...
Definition face_geom.hpp:66
View< const Index > uuRecI
Definition face_geom.hpp:59