42Foam::timeVaryingMassSorptionFvPatchScalarField::ddtSchemeTypeNames_
45 ddtSchemeType::tsEuler,
46 fv::EulerDdtScheme<scalar>::typeName_()
49 ddtSchemeType::tsCrankNicolson,
50 fv::CrankNicolsonDdtScheme<scalar>::typeName_()
53 ddtSchemeType::tsBackward,
65 const DimensionedField<scalar, volMesh>& iF
68 fixedValueFvPatchScalarField(
p, iF),
88 if (!this->readValueEntry(
dict))
98 const timeVaryingMassSorptionFvPatchScalarField& ptf,
100 const DimensionedField<scalar, volMesh>& iF,
101 const fvPatchFieldMapper& mapper
104 fixedValueFvPatchScalarField(ptf,
p, iF, mapper),
117 fixedValueFvPatchScalarField(ptf),
131 fixedValueFvPatchScalarField(ptf, iF),
145 fixedValueFvPatchScalarField::autoMap(m);
155 fixedValueFvPatchScalarField::rmap(ptf, addr);
163 auto& source = tsource.ref();
168 source = -kabs_*w*
max(patchInternalField() -
cp, scalar(0));
170 source += kdes_*
max(
cp - patchInternalField(), scalar(0));
183 const label patchi = patch().index();
185 const scalar dt = db().time().deltaTValue();
192 const word ddtSchemeName(
fld.mesh().ddtScheme(
fld.name()));
193 const ddtSchemeType& ddtScheme = ddtSchemeTypeNames_[ddtSchemeName];
198 tmp<scalarField> dfldp =
201 *
max(patchInternalField() -
cp, scalar(0))
206 *
max(
cp - patchInternalField(), scalar(0))
212 case tsCrankNicolson:
214 operator==(fld0.boundaryField()[patchi] + dfldp);
220 const scalar dt0 = db().time().deltaT0Value();
222 const scalar
c = scalar(1) + dt/(dt + dt0);
223 const scalar c00 = dt*dt/(dt0*(dt + dt0));
224 const scalar c0 =
c + c00;
229 c0*fld0.boundaryField()[patchi]
230 - c00*fld0.oldTime().boundaryField()[patchi]
240 << ddtSchemeName <<
nl
241 <<
" on patch " << this->
patch().name()
242 <<
" of field " << this->internalField().name()
243 <<
" in file " << this->internalField().objectPath()
248 fixedValueFvPatchScalarField::updateCoeffs();
271 timeVaryingMassSorptionFvPatchScalarField
Macros for easy insertion into run-time selection tables.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void operator=(const UList< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Second-order backward-differencing ddt using the current and two previous time-step values.
This boundary condition provides a first order fixed-value condition for a given scalar field to mode...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void write(Ostream &) const
Write.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
timeVaryingMassSorptionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
ddtSchemeType
Enumeration defining the available ddt schemes.
tmp< scalarField > source() const
Return source rate.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
const dimensionedScalar c
Speed of light in a vacuum.
const std::string patch
OpenFOAM patch number as a std::string.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
MinMax< scalar > scalarMinMax
A scalar min/max range.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
static constexpr const zero Zero
Global zero (0).
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
const volScalarField & cp