7#include <Kokkos_Core.hpp>
21template<
typename ValueType>
25 std::pair<localIdx, localIdx> range
33 std::pair<localIdx, localIdx> range
38 auto [refGradV, valueV, valueFractionV, refValueV, faceCellsV] =
views(
50 const localIdx owner = faceCellsV[i];
51 const auto v = internalV[owner];
56 valueFractionV[i] = 0.0;
59 "setSymmetryValue(scalar)"
68 std::pair<localIdx, localIdx> range
73 auto [refGradV, valueV, valueFractionV, refValueV, faceCellsV, nHatV] =
views(
86 const localIdx owner = faceCellsV[i];
87 const auto v = internalV[owner];
88 const auto n = nHatV[i];
91 const auto vn = v & n;
92 const auto vtan = v - n * vn;
96 valueFractionV[i] = 0.0;
97 refGradV[i] = NeoN::zero<NeoN::Vec3>();
99 "setSymmetryValue(Vec3)"
106template<
typename ValueType>
116 : Base(mesh, dict, patchID, {.assignable =
false}), mesh_(mesh)
124 static std::string
name() {
return "symmetry"; }
128 return "Symmetry plane (scalar: zero-gradient; vector: tangential projection).";
131 static std::string
schema() {
return "none"; }
133 virtual std::unique_ptr<VolumeBoundaryFactory<ValueType>>
clone() const final
135 return std::make_unique<Symmetry>(*
this);
const Vector< T > & refGrad() const
Get the view storing the Neumann boundary values.
const Vector< T > & refValue() const
Get the view storing the Dirichlet boundary values.
const Vector< T > & value() const
Get the view storing the computed values from the boundary condition.
const Vector< scalar > & valueFraction() const
Get the view storing the fraction of the boundary value.
const vectorVector & nf() const
Get the field of face unit normals.
const labelVector & faceCells() const
Get the field of face cells.
A class representing a dictionary that stores key-value pairs.
Represents the domain fields for a computational domain.
const BoundaryData< ValueType > & boundaryData() const
const Executor & exec() const
const Vector< ValueType > & internalVector() const
Represents an unstructured mesh in NeoN.
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
virtual void correctBoundaryCondition(Field< ValueType > &domainVector) final
static std::string name()
virtual std::unique_ptr< VolumeBoundaryFactory< ValueType > > clone() const final
Symmetry(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
static std::string schema()
A template class for registering derived classes with a base class.
void setSymmetryValue(Field< ValueType > &domainVector, const UnstructuredMesh &mesh, std::pair< localIdx, localIdx > range)
void setSymmetryValue< NeoN::scalar >(Field< NeoN::scalar > &domainVector, const UnstructuredMesh &mesh, std::pair< localIdx, localIdx > range)
void setSymmetryValue< NeoN::Vec3 >(Field< NeoN::Vec3 > &domainVector, const UnstructuredMesh &mesh, std::pair< localIdx, localIdx > range)
void parallelFor(const ExecutorType &exec, std::pair< localIdx, localIdx > range, Kernel kernel, std::string name)
auto views(Types &... args)
Unpacks all views of the passed classes.