6#include <Kokkos_Core.hpp>
19template<
typename ValueType>
23 std::pair<size_t, size_t> range,
25 ValueType fixedGradient
37 KOKKOS_LAMBDA(
const size_t i) {
38 refGradient[i] = fixedGradient;
41 iField[
static_cast<size_t>(faceCells[i])] + fixedGradient * (1 / deltaCoeffs[i]);
48template<
typename ValueType>
59 : Base(mesh, dict, patchID), mesh_(mesh),
60 fixedGradient_(dict.get<ValueType>(
"fixedGradient"))
66 domainField, mesh_, this->range(), this->patchID(), fixedGradient_
70 static std::string
name() {
return "fixedGradient"; }
72 static std::string
doc() {
return "Set a fixed gradient on the boundary."; }
74 static std::string
schema() {
return "none"; }
76 virtual std::unique_ptr<VolumeBoundaryFactory<ValueType>>
clone() const final
78 return std::make_unique<FixedGradient>(*
this);
84 ValueType fixedGradient_;
const NeoFOAM::Field< T > & refGrad() const
Get the view storing the Neumann boundary values.
const NeoFOAM::Field< T > & value() const
Get the view storing the computed values from the boundary condition.
const scalarField & deltaCoeffs() const
Get the field of delta coefficients.
const labelField & 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 Executor & exec() const
const BoundaryFields< ValueType > & boundaryField() const
const Field< ValueType > & internalField() const
Represents an unstructured mesh in NeoFOAM.
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
FixedGradient(const UnstructuredMesh &mesh, const Dictionary &dict, std::size_t patchID)
virtual std::unique_ptr< VolumeBoundaryFactory< ValueType > > clone() const final
static std::string name()
static std::string schema()
virtual void correctBoundaryCondition(DomainField< ValueType > &domainField) final
A template class for registering derived classes with a base class.
void setGradientValue(DomainField< ValueType > &domainField, const UnstructuredMesh &mesh, std::pair< size_t, size_t > range, size_t patchID, ValueType fixedGradient)
void parallelFor(const Executor &exec, std::pair< size_t, size_t > range, Kernel kernel, std::string name="parallelFor")