42 { equilibriumModelType::LANGMUIR,
"Langmuir" }
52 { kineticModelType::PseudoFirstOrder,
"PseudoFirstOrder" }
59 Foam::speciesSorptionFvPatchScalarField::calcMoleFractions()
const 62 auto& Mole = tMole.ref();
71 const PtrList<volScalarField>&
Y =
thermo.composition().Y();
77 const label speciesId =
83 thermo.composition().W(speciesId)
90 const label
cellId = faceCells[i];
97 <<
"Thermo type is not 'rhoReactionThermo'. " <<
nl 98 <<
"This BC is designed to operate with a rho based thermo." 107 Foam::speciesSorptionFvPatchScalarField::field
109 const word& fieldName,
110 const dimensionSet& dim
113 const fvMesh&
mesh = this->internalField().mesh();
148 zeroGradientFvPatchScalarField(
p, iF),
149 equilibriumModel_(equilibriumModelType::LANGMUIR),
150 kinematicModel_(kineticModelType::PseudoFirstOrder),
151 thicknessPtr_(nullptr),
169 zeroGradientFvPatchScalarField(
p, iF,
dict),
170 equilibriumModel_(equilibriumModelTypeNames.
get(
"equilibriumModel",
dict)),
171 kinematicModel_(kinematicModelTypeNames.
get(
"kinematicModel",
dict)),
176 rhoS_(
dict.
get<scalar>(
"rhoS")),
177 pName_(
dict.getOrDefault<
word>(
"p",
"p")),
190 const speciesSorptionFvPatchScalarField& ptf,
192 const DimensionedField<scalar, volMesh>& iF,
193 const fvPatchFieldMapper& mapper
196 zeroGradientFvPatchScalarField(ptf,
p, iF, mapper),
197 equilibriumModel_(ptf.equilibriumModel_),
198 kinematicModel_(ptf.kinematicModel_),
199 thicknessPtr_(ptf.thicknessPtr_.clone(
patch().
patch())),
205 dfldp_(ptf.dfldp_, mapper),
206 mass_(ptf.mass_, mapper)
215 zeroGradientFvPatchScalarField(ptf),
216 equilibriumModel_(ptf.equilibriumModel_),
217 kinematicModel_(ptf.kinematicModel_),
218 thicknessPtr_(ptf.thicknessPtr_.clone(
patch().
patch())),
235 zeroGradientFvPatchScalarField(ptf, iF),
236 equilibriumModel_(ptf.equilibriumModel_),
237 kinematicModel_(ptf.kinematicModel_),
238 thicknessPtr_(ptf.thicknessPtr_.clone(
patch().
patch())),
256 zeroGradientFvPatchScalarField::autoMap(m);
263 thicknessPtr_->autoMap(m);
274 zeroGradientFvPatchScalarField::rmap(ptf, addr);
276 const auto& tiptf = refCast<const speciesSorptionFvPatchScalarField>(ptf);
278 dfldp_.rmap(tiptf.dfldp_, addr);
279 mass_.rmap(tiptf.mass_, addr);
283 thicknessPtr_->rmap(tiptf.thicknessPtr_(), addr);
291 const auto&
thermo = db().lookupObject<rhoReactionThermo>
296 const label speciesId =
301 const scalar t = db().time().timeOutputValue();
314 const label faceCelli = this->
patch().faceCells()[facei];
315 Vol[facei] = this->internalField().mesh().V()[faceCelli];
324 Info<<
" Patch mass rate min/max [kg/m3/sec]: " 349 switch (equilibriumModel_)
351 case equilibriumModelType::LANGMUIR:
354 tmp<scalarField> tco = calcMoleFractions();
358 cEq = max_*(kl_*tco()*
pp/(1 + kl_*tco()*
pp));
368 switch (kinematicModel_)
370 case kineticModelType::PseudoFirstOrder:
372 dfldp_ = kabs_*(cEq - mass_);
379 const scalar dt = db().time().deltaTValue();
381 mass_ =
max(mass_, scalar(0));
386 "absorbedMass" + this->internalField().
name(),
388 ).boundaryFieldRef()[
patch().index()];
394 Info<<
" Absorption rate min/max [mol/kg/sec]: " 398 zeroGradientFvPatchScalarField::updateCoeffs();
408 "equilibriumModel", equilibriumModelTypeNames[equilibriumModel_]
412 "kinematicModel", kinematicModelTypeNames[kinematicModel_]
416 thicknessPtr_->writeData(
os);
438 speciesSorptionFvPatchScalarField
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
word dictName() const
The local dictionary name (final part of scoped name)
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
const objectRegistry & db() const
The associated objectRegistry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const fvPatch & patch() const noexcept
Return the patch.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
equilibriumModelType
Options for the equilibrum model.
const speciesTable & species() const
Return the table of species.
bool store()
Register object with its registry and transfer ownership to the registry.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
speciesSorptionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
const Time & time() const
Return the top-level database.
virtual void write(Ostream &) const
Write.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
This boundary condition provides a first-order zero-gradient condition for a given scalar field to mo...
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
psiReactionThermo & thermo
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
kineticModelType
Options for the kinematic model.
fvPatchField< scalar > fvPatchScalarField
virtual void write(Ostream &) const
Write.
A class for handling words, derived from Foam::string.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const labelUList & faceCells() const
Return faceCells.
A FieldMapper for finite-volume patch fields.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
label size() const noexcept
The number of elements in the container.
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
static const Enum< equilibriumModelType > equilibriumModelTypeNames
Names for equilibriumModelType.
tmp< scalarField > mass() const
Access to mass.
const dimensionedScalar h
Planck constant.
static const Enum< kineticModelType > kinematicModelTypeNames
Names for kineticModelType.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
virtual void operator=(const UList< Type > &)
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Automatically write from objectRegistry::writeObject()
const DimensionedField< scalar, volMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual basicSpecieMixture & composition()=0
Return the composition of the multi-component mixture.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
List< label > labelList
A List of labels.
A class for managing temporary objects.
virtual scalar W(const label speciei) const =0
Molecular weight of the given specie [kg/kmol].
virtual tmp< scalarField > patchSource() const
Source of cells next to the patch.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Request registration (bool: true)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)