flow
0.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
face_props.hpp
Go to the documentation of this file.
1
17
#ifndef PECLET_FLOW_FACE_PROPS_HPP
18
#define PECLET_FLOW_FACE_PROPS_HPP
19
20
#include <Kokkos_Core.hpp>
21
22
#include "
mac_cutcell.hpp
"
23
24
namespace
peclet::flow
{
25
26
// Constant properties — the Var kernel with this accessor is the constant-mu operator (equivalence
27
// check for the variable path).
28
struct
UniformFaceProps
{
29
double
idiag_
,
beta_
;
30
KOKKOS_INLINE_FUNCTION
double
idiag
(
long
)
const
{
return
idiag_
; }
31
KOKKOS_INLINE_FUNCTION
double
beta
(
long
,
long
)
const
{
return
beta_
; }
32
};
33
34
// Per-cell viscosity field (+ constant density for the time diagonal). harmonic=true uses the
35
// harmonic face mean (continuous shear stress across a viscosity jump); false = arithmetic.
36
struct
FieldFaceProps
{
37
CCConst
mu
;
38
double
rhoIdt
;
// rho / dt (constant-density momentum time term)
39
bool
harmonic
;
40
KOKKOS_INLINE_FUNCTION
double
idiag
(
long
)
const
{
return
rhoIdt
; }
41
KOKKOS_INLINE_FUNCTION
double
beta
(
long
i
,
long
j
)
const
{
42
const
double
a =
mu
(
i
), b =
mu
(
j
);
43
if
(
harmonic
) {
44
const
double
s = a + b;
45
return
(s > 0.0) ? (2.0 * a * b / s) : 0.0;
46
}
47
return
0.5 * (a + b);
48
}
49
};
50
51
// General accessor: viscosity constant-or-field AND density constant-or-field. The time diagonal
52
// for a variable density is the FACE density of the staggered velocity unknown (component stride
53
// sc): idiag(i) = 0.5*(rho(i)+rho(i-sc))/dt — the arithmetic mean (mass is volume-additive), and
54
// the SAME face density the variable-density projection uses, which is what makes discrete
55
// hydrostatic balance exact. Flags select the constant fallbacks so a single-variable case (only mu
56
// or only rho) composes.
57
struct
VarFaceProps
{
58
CCConst
mu
;
59
bool
haveMu
=
false
;
60
double
muC
= 0.0;
61
bool
harmMu
=
false
;
62
CCConst
rho
;
63
bool
haveRho
=
false
;
64
double
rhoIdtC
= 0.0;
// rho_/dt fallback
65
double
idt
= 0.0;
// 1/dt (variable-rho path)
66
long
sc
= 0;
// component face stride (staggered velocity placement)
67
KOKKOS_INLINE_FUNCTION
double
idiag
(
long
i
)
const
{
68
return
haveRho
? 0.5 * (
rho
(
i
) +
rho
(
i
-
sc
)) *
idt
:
rhoIdtC
;
69
}
70
KOKKOS_INLINE_FUNCTION
double
beta
(
long
i
,
long
j
)
const
{
71
if
(!
haveMu
)
72
return
muC
;
73
const
double
a =
mu
(
i
), b =
mu
(
j
);
74
if
(
harmMu
) {
75
const
double
s = a + b;
76
return
(s > 0.0) ? (2.0 * a * b / s) : 0.0;
77
}
78
return
0.5 * (a + b);
79
}
80
};
81
82
}
// namespace peclet::flow
83
84
#endif
// PECLET_FLOW_FACE_PROPS_HPP
mac_cutcell.hpp
flow — portable (Kokkos) cut-cell pressure-operator face openness from an SDF.
peclet::flow
Definition
cut_cell_ibm.hpp:17
peclet::flow::ibmFillEntry
void ibmFillEntry(const OV &o, int list_idx, int c_idx, float sdf_c, const float sdf_n[6], int bc_type, const float *thEx)
Definition
cut_cell_ibm.hpp:89
peclet::flow::CCConst
Kokkos::View< const double *, CCMem > CCConst
Definition
mac_cutcell.hpp:23
peclet::flow::FieldFaceProps
Definition
face_props.hpp:36
peclet::flow::FieldFaceProps::rhoIdt
double rhoIdt
Definition
face_props.hpp:38
peclet::flow::FieldFaceProps::harmonic
bool harmonic
Definition
face_props.hpp:39
peclet::flow::FieldFaceProps::beta
double beta(long i, long j) const
Definition
face_props.hpp:41
peclet::flow::FieldFaceProps::mu
CCConst mu
Definition
face_props.hpp:37
peclet::flow::FieldFaceProps::idiag
double idiag(long) const
Definition
face_props.hpp:40
peclet::flow::UniformFaceProps
Definition
face_props.hpp:28
peclet::flow::UniformFaceProps::idiag
double idiag(long) const
Definition
face_props.hpp:30
peclet::flow::UniformFaceProps::beta
double beta(long, long) const
Definition
face_props.hpp:31
peclet::flow::UniformFaceProps::idiag_
double idiag_
Definition
face_props.hpp:29
peclet::flow::UniformFaceProps::beta_
double beta_
Definition
face_props.hpp:29
peclet::flow::VarFaceProps
Definition
face_props.hpp:57
peclet::flow::VarFaceProps::idiag
double idiag(long i) const
Definition
face_props.hpp:67
peclet::flow::VarFaceProps::haveMu
bool haveMu
Definition
face_props.hpp:59
peclet::flow::VarFaceProps::harmMu
bool harmMu
Definition
face_props.hpp:61
peclet::flow::VarFaceProps::haveRho
bool haveRho
Definition
face_props.hpp:63
peclet::flow::VarFaceProps::mu
CCConst mu
Definition
face_props.hpp:58
peclet::flow::VarFaceProps::idt
double idt
Definition
face_props.hpp:65
peclet::flow::VarFaceProps::beta
double beta(long i, long j) const
Definition
face_props.hpp:70
peclet::flow::VarFaceProps::sc
long sc
Definition
face_props.hpp:66
peclet::flow::VarFaceProps::rho
CCConst rho
Definition
face_props.hpp:62
peclet::flow::VarFaceProps::muC
double muC
Definition
face_props.hpp:60
peclet::flow::VarFaceProps::rhoIdtC
double rhoIdtC
Definition
face_props.hpp:64
src
face_props.hpp
Generated by
1.9.8