37Foam::electrostaticDepositionFvPatchScalarField::eVPatch
54void Foam::electrostaticDepositionFvPatchScalarField::setMaster()
const
78 eVpf.master() = master;
84void Foam::electrostaticDepositionFvPatchScalarField::round
92 f = std::round(
f*dcml)/dcml;
97void Foam::electrostaticDepositionFvPatchScalarField::writeFilmFields()
const
146 fixedValueFvPatchScalarField(
p, iF),
176 h_(
"h",
dict,
p.size()),
187 Vi_(
dict.getOrDefault<scalar>(
"Vi", 0)),
188 Vanode_(
dict.getOrDefault<scalar>(
"Vanode", GREAT)),
189 phasesDict_(
dict.subOrEmptyDict(
"phases")),
198 dict.getCheckOrDefault<scalar>
209 if (!this->readValueEntry(
dict))
211 this->extrapolateInternal();
215 if (!phasesDict_.
empty())
217 phaseNames_.setSize(phasesDict_.size());
218 phases_.setSize(phasesDict_.size());
219 sigmas_.setSize(phasesDict_.size());
222 for (const entry& dEntry : phasesDict_)
224 const word& key = dEntry.keyword();
226 if (!dEntry.isDict())
228 FatalIOErrorInFunction(phasesDict_)
229 <<
"Entry " << key <<
" is not a dictionary" << nl
230 << exit(FatalIOError);
233 const dictionary& subDict = dEntry.dict();
235 phaseNames_[phasei] = key;
240 new dimensionedScalar
242 sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)),
243 subDict.getCheck<scalar>
246 scalarMinMax::ge(SMALL)
259 db().getObjectPtr<volScalarField>(phaseNames_[i])
275 fixedValueFvPatchScalarField(ptf,
p, iF, mapper),
277 qcum_(ptf.qcum_, mapper),
278 Vfilm_(ptf.Vfilm_, mapper),
279 Ceffptr_(ptf.Ceffptr_.clone(
p.
patch())),
280 rptr_(ptf.rptr_.clone(
p.
patch())),
285 Vanode_(ptf.Vanode_),
286 phasesDict_(ptf.phasesDict_),
287 phaseNames_(ptf.phaseNames_),
288 phases_(ptf.phases_),
302 fixedValueFvPatchScalarField(ptf),
306 Ceffptr_(ptf.Ceffptr_.clone(patch().patch())),
307 rptr_(ptf.rptr_.clone(patch().patch())),
312 Vanode_(ptf.Vanode_),
313 phasesDict_(ptf.phasesDict_),
314 phaseNames_(ptf.phaseNames_),
315 phases_(ptf.phases_),
330 fixedValueFvPatchScalarField(ptf, iF),
334 Ceffptr_(ptf.Ceffptr_.clone(patch().patch())),
335 rptr_(ptf.rptr_.clone(patch().patch())),
340 Vanode_(ptf.Vanode_),
341 phasesDict_(ptf.phasesDict_),
342 phaseNames_(ptf.phaseNames_),
343 phases_(ptf.phases_),
358 fixedValueFvPatchScalarField::autoMap(m);
366 Ceffptr_->autoMap(m);
382 fixedValueFvPatchScalarField::rmap(ptf, addr);
387 h_.rmap(tiptf.h_, addr);
388 qcum_.rmap(tiptf.qcum_, addr);
389 Vfilm_.rmap(tiptf.Vfilm_, addr);
393 Ceffptr_->rmap(tiptf.Ceffptr_(), addr);
398 rptr_->rmap(tiptf.rptr_(), addr);
406 const label patchi = patch().index();
410 tmp<scalarField> tsigma =
411 phases_[0].boundaryField()[patchi]*sigmas_[0].value();
413 for (label i = 1; i < phases_.size(); ++i)
416 phases_[i].boundaryField()[patchi]*sigmas_[i].value();
438 const scalar t = db().time().timeOutputValue();
439 const scalar dt = db().time().deltaTValue();
440 const label patchi =
patch().index();
448 jnp =
max(jnp, scalar(0));
460 dh =
max(dh, scalar(0));
468 if (qcum_[i] < qMin_)
483 Vfilm_ =
min(Vfilm_, Vanode_);
494 fixedValueFvPatchScalarField::updateCoeffs();
496 timei_ = db().time().timeIndex();
505 <<
", h: min = " <<
limits.min()
506 <<
", max = " <<
limits.max()
507 <<
", average = " << avg <<
nl
513 if (db().time().writeTime())
518 if (
patch().index() == master_)
530 h_.writeEntry(
"h",
os);
534 Ceffptr_->writeData(
os);
539 rptr_->writeData(
os);
542 if (!phasesDict_.empty())
544 phasesDict_.writeEntry(phasesDict_.dictName(),
os);
548 sigma_.writeEntry(
"sigma",
os);
570 electrostaticDepositionFvPatchScalarField
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))
bool empty() const noexcept
True if the list is empty.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
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.
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.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
The electrostaticDeposition is a boundary condition to calculate electric potential (V) on a given bo...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
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.
const scalarField & h() const noexcept
Return const access to film thickness patch field.
electrostaticDepositionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
tmp< scalarField > sigma() const
Return the isotropic electrical conductivity field of mixture.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
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.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
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.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
const std::string patch
OpenFOAM patch number as a std::string.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere).
MinMax< scalar > scalarMinMax
A scalar min/max range.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
#define forAll(list, i)
Loop across all elements in list.