7#include <Kokkos_Core.hpp>
23template<
typename ValueType>
27 std::pair<localIdx, localIdx> range,
28 ValueType fixedGradient
33 auto [refGradient, value, valueFraction, refValue, boundaryFaceOwners, deltaCoeffs] =
views(
46 refGradient[i] = fixedGradient;
48 value[i] = iVector[boundaryFaceOwners[i]] + fixedGradient * (1 / deltaCoeffs[i]);
49 valueFraction[i] = 0.0;
50 refValue[i] = zero<ValueType>();
57template<
typename ValueType>
65 using Base::correctBoundaryCondition;
70 : Base(mesh, dict, patchID, {.assignable =
true, .fixesValue =
false}), mesh_(mesh),
71 fixedGradient_(dict.get<ValueType>(
"fixedGradient"))
79 static std::string
name() {
return "fixedGradient"; }
83 static std::string
doc() {
return "Set a fixed gradient on the boundary."; }
85 static std::string
schema() {
return "none"; }
87 virtual std::unique_ptr<VolumeBoundaryFactory<ValueType>>
clone() const final
89 return std::make_unique<FixedGradient>(*
this);
95 ValueType fixedGradient_;
const scalarVector & deltaCoeffs() const
Get the field of delta coefficients.
const labelVector & faceOwners() const
Get the list of labels of owner cells of boundary faces.
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.
static std::string schema()
virtual std::unique_ptr< VolumeBoundaryFactory< ValueType > > clone() const final
std::string getName() const override
virtual void correctBoundaryCondition(Field< ValueType > &domainVector) final
static std::string name()
FixedGradient(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
A template class for registering derived classes with a base class.
void setGradientValue(Field< ValueType > &domainVector, const UnstructuredMesh &mesh, std::pair< localIdx, localIdx > range, ValueType fixedGradient)
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.