26 constexpr scalar small = 1.0e-30;
27 const auto ratio = corrMag / (fluxMag + small);
50 auto [outV, flux0V, uf0V, SfV] =
views(
55 {
size_t(0),
static_cast<size_t>(nInternalFaces)},
57 const auto d = (SfV[i] & uf0V[i]);
58 const auto corr = flux0V[i] - d;
60 outV[i] = limiter * a1 * corr;
62 "ddtFluxCorr::BDF1::internal"
78 auto [outBV, flux0BV, uf0BV] =
views(
84 {
size_t(0),
static_cast<size_t>(nBoundaryFaces + nProcBoundaryFaces)},
86 const auto d = (bFaceNormals[bfi] & uf0BV[bfi]);
87 const auto corr = flux0BV[bfi] - d;
89 outBV[bfi] = limiter * a1 * corr;
91 "ddtFluxCorr::BDF1::boundary"
109 const scalar a1 = 2.0 / dt;
110 const scalar a2 = -0.5 / dt;
117 auto [outV, flux0V, flux00V, uf0V, uf00V, SfV] =
views(
127 {
size_t(0),
static_cast<size_t>(nInternalFaces)},
129 const auto d1 = (SfV[i] & uf0V[i]);
130 const auto corr1 = flux0V[i] - d1;
132 const auto d2 = (SfV[i] & uf00V[i]);
133 const auto corr2 = flux00V[i] - d2;
138 outV[i] = limiter1 * a1 * corr1 + limiter2 * a2 * corr2;
140 "ddtFluxCorr::BDF2::internal"
157 {
size_t(0),
static_cast<size_t>(nBoundaryFaces + nProcBoundaryFaces)},
159 const auto d1 = (bFaceNormals[bfi] & uf0BV[bfi]);
160 const auto corr1 = flux0BV[bfi] - d1;
162 const auto d2 = (bFaceNormals[bfi] & uf00BV[bfi]);
163 const auto corr2 = flux00BV[bfi] - d2;
168 outBV[bfi] = limiter1 * a1 * corr1 + limiter2 * a2 * corr2;
170 "ddtFluxCorr::BDF2::boundary"
180 const auto& mesh = u.
mesh();
181 const auto& exec = phi.
exec();
195 const auto& phi0 =
oldTime(phi);
201 const auto& phi00 =
oldTime(phi0);
const vectorVector & faceNormals() const
Get the field of face areas normals.
A class representing a list of tokens.
Represents an unstructured mesh in NeoN.
localIdx nProcBoundaryFaces() const
Get the number of processor-boundary faces (inter-rank faces).
localIdx nBoundaryFaces() const
Get the number of boundary faces in the mesh.
localIdx nInternalFaces() const
Get the number of internal faces in the mesh.
const vectorVector & faceNormals() const
Get the field of face normal vectors.
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
View< ValueType > view() &&=delete
const UnstructuredMesh & mesh() const
Returns a const reference to the unstructured mesh object.
const BoundaryData< ValueType > & boundaryData() const
Returns a const reference to the boundary field.
const Executor & exec() const
Returns a const reference to the executor object.
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
void correctBoundaryConditions()
Corrects the boundary conditions of the surface field.
void interpolate(const VolumeField< ValueType > &src, SurfaceField< ValueType > &dst) const
Represents a volume field in a finite volume method.
void ddtFluxCorrBDF1Kernel(const Executor &exec, const UnstructuredMesh &mesh, const SurfScalarField &flux0, const SurfaceField< Vec3 > &uf0, SurfScalarField &fluxCorr, scalar dt)
KOKKOS_INLINE_FUNCTION scalar ddtFluxCorrLimiter(const scalar fluxMag, const scalar corrMag)
void ddtFluxCorrBDF2Kernel(const Executor &exec, const UnstructuredMesh &mesh, const SurfScalarField &flux0, const SurfScalarField &flux00, const SurfaceField< Vec3 > &uf0, const SurfaceField< Vec3 > &uf00, SurfScalarField &fluxCorr, scalar dt)
int oldTimeLevel(const VectorType &field)
Helper function to retrieve the history depth of a field in oldTimeCollection.
std::vector< SurfaceBoundary< scalar > > createFluxCorrBCsFromU(const UnstructuredMesh &mesh, const VolumeField< Vec3 > &u)
Boundary condition to apply to ddtFluxCorr surfaceScalarField. It sets the flux correction to zero fo...
SurfaceField< scalar > SurfScalarField
SurfScalarField ddtFluxCorr(const VolVectorField &u, const SurfScalarField &phi, scalar dt, DdtScheme scheme)
VectorType & oldTime(VectorType &field)
Retrieves the old time field of a given field.
KOKKOS_INLINE_FUNCTION scalar mag(const scalar &s)
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
void parallelFor(const ExecutorType &, std::pair< localIdx, localIdx > range, const Kernel &kernel, std::string name)
auto views(Types &... args)
Unpacks all views of the passed classes.