6#include <Kokkos_Core.hpp>
22template<
typename ValueType>
26 std::pair<localIdx, localIdx> range,
27 ValueType fixedGradient
32 auto [refGradient, value, valueFraction, refValue, faceCells, deltaCoeffs] =
views(
46 refGradient[i] = fixedGradient;
48 value[i] = iVector[faceCells[i]] + fixedGradient * (1 / deltaCoeffs[i]);
49 valueFraction[i] = 0.0;
50 refValue[i] = zero<ValueType>();
57template<
typename ValueType>
68 : Base(mesh, dict, patchID), mesh_(mesh),
69 fixedGradient_(dict.get<ValueType>(
"fixedGradient"))
77 static std::string
name() {
return "fixedGradient"; }
79 static std::string
doc() {
return "Set a fixed gradient on the boundary."; }
81 static std::string
schema() {
return "none"; }
83 virtual std::unique_ptr<VolumeBoundaryFactory<ValueType>>
clone() const final
85 return std::make_unique<FixedGradient>(*
this);
91 ValueType fixedGradient_;
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 scalarVector & deltaCoeffs() const
Get the field of delta coefficients.
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.
static std::string schema()
virtual std::unique_ptr< VolumeBoundaryFactory< ValueType > > clone() const final
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 Executor &exec, std::pair< localIdx, localIdx > range, Kernel kernel, std::string name="parallelFor")
auto views(Types &... args)
Unpacks all views of the passed classes.