|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
The band geometry and the closure constants, by value into every kernel. More...
#include <sharp_viscous.hpp>
Public Member Functions | |
| long | idx (const int q[3]) const |
| long | idx3 (const int q[3]) const |
| bool | inDomain (const int q[3]) const |
| double | colour (const int q[3]) const |
| int | cellClass (const int q[3]) const |
| double | mu (double f) const |
| double | res (double f) const |
| void | plane (const int q[3], int k, double m[3], double &al) const |
| The plane (m, α) of a band cell of class k, in the cell's local index coordinates (m·ξ <
α is the C = 1 side). | |
| int | edgeDistances (const int k[3], int a, int c, double dist[4]) const |
| Pass 1 of the owner set (§5.8): d_t = |m·ξ_E − α|/|m|₂ for each interfacial cell t of E_ac(k) (t in the fixed offset order, ξ_E the edge midpoint in that cell's local coordinates). | |
| int | edgeOwnerSet (const int k[3], int a, int c, double dist[4], double &dmin, double w[4]) const |
| The owner set of E_ac(k) (§5.8 items 1–2, §5.9 item 3): pass 1 (edgeDistances), d_min over K_E, the weights w[t] = w(d_t − d_min) (ownerWeight) for t ∈ K_E, 0 otherwise, from the stored d_t (never recomputed). | |
| int | edgeTieKeys (const int k[3], int ac, double &spread, double &gap, bool &blended) const |
| The census keys of edge E_ac(k), ac = 0, 1, 2 for (a, c) = (0,1), (0,2), (1,2) (§5.8; plateau semantics, §5.9 item 5): n_E = |T_E|, the plateau members (0 off the domain or off the band); spread = max_{T_E} d_t − d_min; gap = min_{K_E∖T_E} d_t − d_min, left as passed when K_E = T_E; blended set iff a candidate lies on the ramp, τ₀ < d_t − d_min < τ₁ (left as passed otherwise). | |
| template<class F> | |
| double | forEachOwner (const int k[3], int a, int c, F &&f) const |
| The owner set of E_ac(k) (§5.2, §5.8, §5.9 item 4): calls f(o, m, α, w) for each member – the interfacial cells of positive weight w = w(d_t − d_min), whose plane distance from the edge midpoint is within τ₁ of the closest – with its plane and weight, in the fixed offset order, and returns W = Σ w, summed in that order (0.0: E is not a band edge). | |
| bool | edgeFaceFraction (const int k[3], int a, int c, int row, double &f) const |
| F̄_row(E_ac(k)), row ∈ {a, c} (§5.8 item 4, §5.9): the owner-set weighted mean of the C = 1 fraction of the u_row face. | |
| bool | edgeLinkFractions (const int k[3], int a, int c, double &tac, double &tca) const |
| θ̄_ac and θ̄_ca at E_ac(k) (§5.8 item 4, §5.9): the owner-set weighted means of the C = 1 fractions of the shear links ∂_a u_c and ∂_c u_a. | |
| double | rowFaceFraction (const int k[3], int a, int c, int row, const int o[3], const double m[3], double al) const |
| The C = 1 fraction of the u_row face at E_ac(k), row ∈ {a, c} (§5.1 F_c / F_a): the plane through E normal to the OTHER edge axis, spanning [k_row − ½, k_row + ½] along row and the b-layer box; from the plane of owner-set member o. | |
| double | linkFraction (const int k[3], int dd, int cc, const int o[3], const double m[3], double al) const |
| The C = 1 fraction of the shear link ∂_dd u_cc at its edge E(k) (§5.1 L): the plane x_cc = k_cc, a hat of half-width 1 along dd centred at k_dd, the b-layer box. | |
| bool | edgeInDomain (const int k[3], int a, int c) const |
| A shear link's sample lies in the closed physical domain: the edge's b-layer is an in-domain cell layer and its (a, c) position is on or inside the faces. | |
| double | edgePhase (const int k[3], int a, int c) const |
| The C = 1 fraction of a link at an edge with no owner: its in-domain cells are pure and of one phase (two adjacent opposite pure cells would carry a virtual plane), so the link lies in it. | |
| void | edgeTau (const int k[3], int a, int c, const CCConst(&tau)[3], double t[3]) const |
| τ̂ at E_ac(k) (§5.2, §5.7 Q-A): the arithmetic mean of τ̂_K over the interfacial cells K of E, summed in the fixed offset order. | |
| double | edgeTraction (const int k[3], int a, int c, int row, const CCConst(&tau)[3]) const |
| The explicit interface-traction part of the u_row stress at E_ac(k) (§5.4 a, §5.8, §5.9), row ∈ {a, c}: the owner-set weighted mean of the single-owner term n_a τ̂_c (1 − μ̄ R̄_ac) + n_c τ̂_a (1 − μ̄ R̄_ca), μ̄ = μ(F_row(E)), (n, F and R from the member's plane, τ̂ the interfacial mean) – per member, then the mean: μ(F̄)R(L̄) is not the mean of μR. | |
| double | cellExtra (const int q[3], int c, const CCConst(&v)[3], const CCConst(&tau)[3], CCConst dnn) const |
| The explicit part of the u_c stress at cell q beyond today's 2μ(C)∂_c u_c (§5.4 b): 2(μ_A − μ_B)(C̄ − C)(∂_c u_c − D̂_nn) + 2 n_c τ̂_c (1 − μ(C̄) R(C)), C̄ the c-midsection fraction of the cell's own plane. | |
| void | fitCoef (int a, int c, double thA, const double n[3], double co[9]) const |
| One least-squares row of the kinked model (§5.3) for link ∂_a u_c with C = 1 kernel fraction thA and datum mv: coefficient of L_pq = δ_ap δ_cq + (1−θ_lo)(r−1) n_a [(Pe_c)_p n_q + (Pe_c)_q n_p] (fitCoef), accumulated into the normal equations (upper triangle, row-major 9×9) by fitRow. | |
| void | fitRow (int a, int c, double thA, double mv, const double n[3], double N[81], double rhs[9]) const |
| int | fitItem (const int K[3], int it, const CCConst(&v)[3], int ra[3], int rc[3], double th[3], double mv[3]) const |
| The rows of item it of the fit of K (§5.3), in the fit's fixed order: item it < 27 is block cell it = 9(dz+1) + 3(dy+1) + (dx+1) (offset order) with its normal links ∂_c u_c, c = x, y, z (θ̄ = C); item 27 + u is edge u = 48 pr + (its offset-order index in orientation pr, (a, c) = (0,1), (0,2), (1,2)) of the 3×3×3 block with its shear links ∂_a u_c then ∂_c u_a (θ̄ the mean over the edge's own owner set, §5.8). | |
| bool | fitCell (const int K[3], const CCConst(&v)[3], double tau[3], double &dnn) const |
| The fit of interfacial cell (X, Y, Z) (§5.3): L, the low-μ-side gradient, from the 81 normal links of the 3×3×3 block and the 288 shear links of its 144 edges (θ̄ the mean over each edge's own owner set), unit weights, Cholesky. | |
| void | fitNormal (const int K[3], double n[3]) const |
| The physical unit normal of interfacial cell K's own plane (the fit's n). | |
Static Public Member Functions | |
| static void | edgeCells (int a, int c, int da[4], int dc[4]) |
| The four cells of E_ac(k) in the fixed offset order, as (δa, δc): cell = k − δa e_a − δc e_c. | |
| template<class T> | |
| static T | pick4 (const T v[4], int t) |
| v[t] by selects, so a small array indexed by a runtime offset stays in registers. | |
| static bool | fitSolve (double N[81], const double rhs[9], const double n[3], double mulo, double tau[3], double &dnn) |
| The solve of the fit's normal equations N (upper triangle, row-major 9×9, overwritten) and right-hand side, then τ̂ and D̂_nn (see fitCell). | |
Public Attributes | |
| int | e [3] = {0, 0, 0} |
| solver block extents | |
| long | st [3] = {1, 0, 0} |
| solver block strides | |
| long | st3 [3] = {1, 0, 0} |
| colour block strides | |
| int | d = 1 |
| colour ghost − solver ghost | |
| CCConst | col |
| colour C, colour block (ghosts valid) | |
| CCConst | pm [3] |
| reconstructed PLIC normals m (index space), colour block | |
| CCConst | pa |
| reconstructed PLIC offsets α, colour block | |
| SvByteConst | cls |
| band class, solver block | |
| int | dlo [3] = {0, 0, 0} |
| in-domain cells: dlo <= x_a < dhi (solver coordinates) | |
| int | dhi [3] = {0, 0, 0} |
| double | eps = 0.0 |
| interfacial threshold: the wisp guard (set_vof_interface_eps) | |
| double | p0 = 0.0 |
| double | p1 = 0.0 |
| LinearMix μ(f) = p0 + p1·f (internal units). | |
| double | muA = 0.0 |
| double | muB = 0.0 |
| double | mulo = 0.0 |
| double | r = 1.0 |
| μ(1), μ(0), min, μ_lo/μ_hi | |
| bool | lowA = false |
| the C = 1 phase is the low-μ side | |
| double | ell [3] = {1.0, 1.0, 1.0} |
| ℓ_a = h_a/h_ref | |
| VofMetric | gm |
| the metric of vofPhysNormal (h = ℓ) | |
The band geometry and the closure constants, by value into every kernel.
Definition at line 93 of file sharp_viscous.hpp.
|
inline |
Definition at line 111 of file sharp_viscous.hpp.
References st.
Referenced by cellClass(), cellExtra(), edgeTau(), and fitItem().
|
inline |
|
inline |
Definition at line 117 of file sharp_viscous.hpp.
Referenced by edgePhase(), and fitItem().
|
inline |
Definition at line 121 of file sharp_viscous.hpp.
Referenced by cellExtra(), edgePhase(), fitItem(), and plane().
|
inline |
Definition at line 122 of file sharp_viscous.hpp.
Referenced by cellExtra(), edgeDistances(), edgeTau(), fitNormal(), and forEachOwner().
|
inline |
Definition at line 123 of file sharp_viscous.hpp.
Referenced by cellExtra(), and edgeTraction().
|
inline |
Definition at line 124 of file sharp_viscous.hpp.
Referenced by cellExtra(), and edgeTraction().
|
inline |
The plane (m, α) of a band cell of class k, in the cell's local index coordinates (m·ξ < α is the C = 1 side).
Virtual (§5.7 Q-B): ξ_a = f, f = side, m = σ e_a, α = σ f, σ = +1 iff the C = 1 phase lies at ξ_a < f.
Definition at line 129 of file sharp_viscous.hpp.
References colour(), eps, idx3(), peclet::flow::vof::kSvPlane, peclet::flow::vof::kSvVirtual0, pa, and pm.
Referenced by cellExtra(), edgeDistances(), fitNormal(), and forEachOwner().
|
inlinestatic |
The four cells of E_ac(k) in the fixed offset order, as (δa, δc): cell = k − δa e_a − δc e_c.
Definition at line 147 of file sharp_viscous.hpp.
Referenced by edgeDistances(), edgePhase(), edgeTau(), and forEachOwner().
|
inline |
Pass 1 of the owner set (§5.8): d_t = |m·ξ_E − α|/|m|₂ for each interfacial cell t of E_ac(k) (t in the fixed offset order, ξ_E the edge midpoint in that cell's local coordinates).
Returns the mask of K_E (bit t set iff cell t is interfacial); dist[t] is written for those only.
Definition at line 168 of file sharp_viscous.hpp.
References cellClass(), edgeCells(), peclet::flow::vof::kSvNone, and plane().
Referenced by edgeOwnerSet().
|
inline |
The owner set of E_ac(k) (§5.8 items 1–2, §5.9 item 3): pass 1 (edgeDistances), d_min over K_E, the weights w[t] = w(d_t − d_min) (ownerWeight) for t ∈ K_E, 0 otherwise, from the stored d_t (never recomputed).
Returns K_E's mask in bits 0–3 and the plateau set T_E = {t ∈ K_E : d_t − d_min ≤ τ₀} in bits 4–7 (0: E is not a band edge); the owner set is {w > 0} ⊇ T_E. The closest candidate (first in offset order, the f01a251 owner) is in T_E with w = 1 by construction: a no-op for finite distances, and with a NaN distance it keeps Σ w ≥ 1 iff K_E ≠ ∅ (the fit-fallback path).
Definition at line 200 of file sharp_viscous.hpp.
References edgeDistances(), peclet::flow::vof::kSvOwnerTieTol, and peclet::flow::vof::ownerWeight().
Referenced by edgeTieKeys(), and forEachOwner().
|
inline |
The census keys of edge E_ac(k), ac = 0, 1, 2 for (a, c) = (0,1), (0,2), (1,2) (§5.8; plateau semantics, §5.9 item 5): n_E = |T_E|, the plateau members (0 off the domain or off the band); spread = max_{T_E} d_t − d_min; gap = min_{K_E∖T_E} d_t − d_min, left as passed when K_E = T_E; blended set iff a candidate lies on the ramp, τ₀ < d_t − d_min < τ₁ (left as passed otherwise).
Definition at line 229 of file sharp_viscous.hpp.
References edgeInDomain(), edgeOwnerSet(), peclet::flow::vof::kSvOwnerRampTol, and peclet::flow::vof::kSvOwnerTieTol.
|
inline |
The owner set of E_ac(k) (§5.2, §5.8, §5.9 item 4): calls f(o, m, α, w) for each member – the interfacial cells of positive weight w = w(d_t − d_min), whose plane distance from the edge midpoint is within τ₁ of the closest – with its plane and weight, in the fixed offset order, and returns W = Σ w, summed in that order (0.0: E is not a band edge).
A caller sums w·G from 0.0 over the calls in this order and divides once by W: with no candidate on the ramp every w is 1.0 or 0.0 and W the integer n_E, so at n_E = 1 that is the single closest cell's output, bit for bit.
The members are gathered first (their offsets packed two bits each, in offset order) and f runs in one loop over the n_E members, not over the four offsets: the lanes of a device warp whose edges' members sit at different offsets then execute one copy of f together, as the single owner of f01a251 did, instead of one copy per offset in turn. Same calls, same order.
Definition at line 266 of file sharp_viscous.hpp.
References cellClass(), edgeCells(), edgeOwnerSet(), F, pick4(), and plane().
Referenced by edgeFaceFraction(), edgeLinkFractions(), and edgeTraction().
|
inlinestatic |
v[t] by selects, so a small array indexed by a runtime offset stays in registers.
Definition at line 294 of file sharp_viscous.hpp.
Referenced by forEachOwner().
|
inline |
F̄_row(E_ac(k)), row ∈ {a, c} (§5.8 item 4, §5.9): the owner-set weighted mean of the C = 1 fraction of the u_row face.
False on a non-band edge (f untouched).
Definition at line 300 of file sharp_viscous.hpp.
References forEachOwner(), and rowFaceFraction().
|
inline |
θ̄_ac and θ̄_ca at E_ac(k) (§5.8 item 4, §5.9): the owner-set weighted means of the C = 1 fractions of the shear links ∂_a u_c and ∂_c u_a.
False on a non-band edge (outputs untouched).
Definition at line 316 of file sharp_viscous.hpp.
References forEachOwner(), and linkFraction().
Referenced by fitItem().
|
inline |
The C = 1 fraction of the u_row face at E_ac(k), row ∈ {a, c} (§5.1 F_c / F_a): the plane through E normal to the OTHER edge axis, spanning [k_row − ½, k_row + ½] along row and the b-layer box; from the plane of owner-set member o.
Definition at line 334 of file sharp_viscous.hpp.
Referenced by edgeFaceFraction(), and edgeTraction().
|
inline |
The C = 1 fraction of the shear link ∂_dd u_cc at its edge E(k) (§5.1 L): the plane x_cc = k_cc, a hat of half-width 1 along dd centred at k_dd, the b-layer box.
Definition at line 347 of file sharp_viscous.hpp.
Referenced by edgeLinkFractions(), and edgeTraction().
|
inline |
A shear link's sample lies in the closed physical domain: the edge's b-layer is an in-domain cell layer and its (a, c) position is on or inside the faces.
Definition at line 356 of file sharp_viscous.hpp.
Referenced by edgeTieKeys(), and fitItem().
|
inline |
The C = 1 fraction of a link at an edge with no owner: its in-domain cells are pure and of one phase (two adjacent opposite pure cells would carry a virtual plane), so the link lies in it.
Definition at line 364 of file sharp_viscous.hpp.
References colour(), edgeCells(), eps, and inDomain().
Referenced by fitItem().
|
inline |
τ̂ at E_ac(k) (§5.2, §5.7 Q-A): the arithmetic mean of τ̂_K over the interfacial cells K of E, summed in the fixed offset order.
Definition at line 379 of file sharp_viscous.hpp.
References cellClass(), edgeCells(), idx(), and peclet::flow::vof::kSvNone.
Referenced by edgeTraction().
|
inline |
The explicit interface-traction part of the u_row stress at E_ac(k) (§5.4 a, §5.8, §5.9), row ∈ {a, c}: the owner-set weighted mean of the single-owner term n_a τ̂_c (1 − μ̄ R̄_ac) + n_c τ̂_a (1 − μ̄ R̄_ca), μ̄ = μ(F_row(E)), (n, F and R from the member's plane, τ̂ the interfacial mean) – per member, then the mean: μ(F̄)R(L̄) is not the mean of μR.
Zero on a non-band edge.
Definition at line 406 of file sharp_viscous.hpp.
References edgeTau(), forEachOwner(), gm, linkFraction(), mu(), res(), and rowFaceFraction().
|
inline |
The explicit part of the u_c stress at cell q beyond today's 2μ(C)∂_c u_c (§5.4 b): 2(μ_A − μ_B)(C̄ − C)(∂_c u_c − D̂_nn) + 2 n_c τ̂_c (1 − μ(C̄) R(C)), C̄ the c-midsection fraction of the cell's own plane.
Zero unless the cell is interfacial.
Definition at line 431 of file sharp_viscous.hpp.
References cellClass(), colour(), gm, idx(), peclet::flow::vof::kSvNone, mu(), muA, muB, plane(), res(), and st.
|
inline |
One least-squares row of the kinked model (§5.3) for link ∂_a u_c with C = 1 kernel fraction thA and datum mv: coefficient of L_pq = δ_ap δ_cq + (1−θ_lo)(r−1) n_a [(Pe_c)_p n_q + (Pe_c)_q n_p] (fitCoef), accumulated into the normal equations (upper triangle, row-major 9×9) by fitRow.
Definition at line 451 of file sharp_viscous.hpp.
Referenced by fitRow().
|
inline |
Definition at line 462 of file sharp_viscous.hpp.
Referenced by fitCell().
|
inline |
The rows of item it of the fit of K (§5.3), in the fit's fixed order: item it < 27 is block cell it = 9(dz+1) + 3(dy+1) + (dx+1) (offset order) with its normal links ∂_c u_c, c = x, y, z (θ̄ = C); item 27 + u is edge u = 48 pr + (its offset-order index in orientation pr, (a, c) = (0,1), (0,2), (1,2)) of the 3×3×3 block with its shear links ∂_a u_c then ∂_c u_a (θ̄ the mean over the edge's own owner set, §5.8).
Writes (a, c, θ̄, datum) per row; returns the row count, 3 or 2, and 0 when the sample is outside the domain.
Definition at line 479 of file sharp_viscous.hpp.
References colour(), edgeInDomain(), edgeLinkFractions(), edgePhase(), ell, idx(), inDomain(), peclet::flow::vof::kSvNormalItems, and st.
Referenced by fitCell().
|
inline |
The fit of interfacial cell (X, Y, Z) (§5.3): L, the low-μ-side gradient, from the 81 normal links of the 3×3×3 block and the 288 shear links of its 144 edges (θ̄ the mean over each edge's own owner set), unit weights, Cholesky.
Outputs τ̂ = μ_lo P(S n), D̂_nn = n·L n. False = fallback (smallest pivot < 1e-10·trace/9): the caller stores τ̂ = D̂ = 0. One thread; the device runs the same rows, sums and solve on a team (sharpFit).
Definition at line 520 of file sharp_viscous.hpp.
References fitItem(), fitNormal(), fitRow(), fitSolve(), peclet::flow::vof::kSvItems, mulo, and N.
|
inline |
The physical unit normal of interfacial cell K's own plane (the fit's n).
Definition at line 540 of file sharp_viscous.hpp.
References cellClass(), gm, and plane().
Referenced by fitCell().
|
inlinestatic |
The solve of the fit's normal equations N (upper triangle, row-major 9×9, overwritten) and right-hand side, then τ̂ and D̂_nn (see fitCell).
False = fallback.
Definition at line 548 of file sharp_viscous.hpp.
Referenced by fitCell(), and peclet::flow::vof::sharpFitTeam().
| int peclet::flow::vof::SharpGeom::e[3] = {0, 0, 0} |
| long peclet::flow::vof::SharpGeom::st[3] = {1, 0, 0} |
solver block strides
Definition at line 95 of file sharp_viscous.hpp.
Referenced by cellExtra(), fitItem(), and idx().
| long peclet::flow::vof::SharpGeom::st3[3] = {1, 0, 0} |
| int peclet::flow::vof::SharpGeom::d = 1 |
| CCConst peclet::flow::vof::SharpGeom::col |
colour C, colour block (ghosts valid)
Definition at line 98 of file sharp_viscous.hpp.
Referenced by colour().
| CCConst peclet::flow::vof::SharpGeom::pm[3] |
reconstructed PLIC normals m (index space), colour block
Definition at line 99 of file sharp_viscous.hpp.
Referenced by plane().
| CCConst peclet::flow::vof::SharpGeom::pa |
reconstructed PLIC offsets α, colour block
Definition at line 100 of file sharp_viscous.hpp.
Referenced by plane().
| SvByteConst peclet::flow::vof::SharpGeom::cls |
band class, solver block
Definition at line 101 of file sharp_viscous.hpp.
Referenced by cellClass().
| int peclet::flow::vof::SharpGeom::dlo[3] = {0, 0, 0} |
in-domain cells: dlo <= x_a < dhi (solver coordinates)
Definition at line 102 of file sharp_viscous.hpp.
Referenced by edgeInDomain(), and inDomain().
| int peclet::flow::vof::SharpGeom::dhi[3] = {0, 0, 0} |
Definition at line 103 of file sharp_viscous.hpp.
Referenced by edgeInDomain(), and inDomain().
| double peclet::flow::vof::SharpGeom::eps = 0.0 |
interfacial threshold: the wisp guard (set_vof_interface_eps)
Definition at line 104 of file sharp_viscous.hpp.
Referenced by edgePhase(), plane(), and mac2d.Case::vel().
| double peclet::flow::vof::SharpGeom::p0 = 0.0 |
Definition at line 105 of file sharp_viscous.hpp.
Referenced by mu().
| double peclet::flow::vof::SharpGeom::p1 = 0.0 |
LinearMix μ(f) = p0 + p1·f (internal units).
Definition at line 105 of file sharp_viscous.hpp.
Referenced by mu().
| double peclet::flow::vof::SharpGeom::muA = 0.0 |
Definition at line 106 of file sharp_viscous.hpp.
Referenced by gsv1.PCase::build(), cellExtra(), res(), gsv1.Case::U(), mac2dc.CircleCase::U(), and mac2d.Case::vel().
| double peclet::flow::vof::SharpGeom::muB = 0.0 |
Definition at line 106 of file sharp_viscous.hpp.
Referenced by gsv1.PCase::build(), cellExtra(), res(), gsv1.Case::U(), mac2dc.CircleCase::U(), and mac2d.Case::vel().
| double peclet::flow::vof::SharpGeom::mulo = 0.0 |
Definition at line 106 of file sharp_viscous.hpp.
Referenced by fitCell(), and fitSolve().
| double peclet::flow::vof::SharpGeom::r = 1.0 |
μ(1), μ(0), min, μ_lo/μ_hi
Definition at line 106 of file sharp_viscous.hpp.
Referenced by packing2d.System::add(), fitCoef(), and packing2d.System::solve().
| bool peclet::flow::vof::SharpGeom::lowA = false |
the C = 1 phase is the low-μ side
Definition at line 107 of file sharp_viscous.hpp.
Referenced by fitCoef().
| double peclet::flow::vof::SharpGeom::ell[3] = {1.0, 1.0, 1.0} |
| VofMetric peclet::flow::vof::SharpGeom::gm |
the metric of vofPhysNormal (h = ℓ)
Definition at line 109 of file sharp_viscous.hpp.
Referenced by cellExtra(), edgeTraction(), and fitNormal().