37 Foam::electrostaticDepositionFvPatchScalarField::eVPatch
48 refCast<const electrostaticDepositionFvPatchScalarField>(bf[patchi]);
54 void Foam::electrostaticDepositionFvPatchScalarField::setMaster()
const 69 if (isA<electrostaticDepositionFvPatchScalarField>(bf[patchi]))
71 electrostaticDepositionFvPatchScalarField& eVpf = eVPatch(patchi);
78 eVpf.master() = master;
84 void Foam::electrostaticDepositionFvPatchScalarField::round
92 f = std::round(
f*dcml)/dcml;
97 void Foam::electrostaticDepositionFvPatchScalarField::writeFilmFields()
const 104 const fvMesh&
mesh = eV.mesh();
123 if (isA<electrostaticDepositionFvPatchScalarField>(bf[patchi]))
125 electrostaticDepositionFvPatchScalarField& eVpf = eVPatch(patchi);
127 auto& hp =
h.boundaryFieldRef()[patchi];
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())
229 <<
"Entry " <<
key <<
" is not a dictionary" <<
nl 243 subDict.getCheck<scalar>
259 db().getObjectPtr<volScalarField>(phaseNames_[i])
269 const electrostaticDepositionFvPatchScalarField& ptf,
271 const DimensionedField<scalar, volMesh>& iF,
272 const fvPatchFieldMapper& mapper
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())),
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())),
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);
385 refCast<const electrostaticDepositionFvPatchScalarField>(ptf);
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();
446 tmp<scalarField> tjnp = -this->
sigma()*eV.boundaryField()[patchi].snGrad();
448 jnp =
max(jnp, scalar(0));
455 tmp<scalarField> tCoulombicEfficiency = Ceffptr_->value(t);
456 tmp<scalarField> tdh = tCoulombicEfficiency*(jnp - jMin_)*dt;
460 dh =
max(dh, scalar(0));
468 if (qcum_[i] < qMin_)
479 tmp<scalarField> tresistivity = rptr_->value(t);
480 tmp<scalarField> tRfilm = tresistivity*tdh;
481 tmp<scalarField> tdV = jnp*tRfilm;
483 Vfilm_ =
min(Vfilm_, Vanode_);
487 tmp<scalarField> tVbody = tjnp*Rbody_;
494 fixedValueFvPatchScalarField::updateCoeffs();
496 timei_ = db().time().timeIndex();
499 const scalar hMin =
gMin(h_);
500 const scalar hMax =
gMax(h_);
506 <<
", h: min = " << hMin
507 <<
", max = " << hMax
508 <<
", average = " << hAvg <<
nl 514 if (db().time().writeTime())
519 if (
patch().index() == master_)
531 h_.writeEntry(
"h",
os);
535 Ceffptr_->writeData(
os);
540 rptr_->writeData(
os);
543 if (!phasesDict_.empty())
545 phasesDict_.writeEntry(phasesDict_.dictName(),
os);
549 sigma_.writeEntry(
"sigma",
os);
571 electrostaticDepositionFvPatchScalarField
tmp< scalarField > sigma() const
Return the isotropic electrical conductivity field of mixture.
electrostaticDepositionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Type gMin(const FieldField< Field, Type > &f)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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.
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.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
Type of boundary fields.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
virtual void write(Ostream &) const
Write.
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
void setSize(const label n)
Alias for resize()
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
static MinMax< scalar > ge(const scalar &minVal)
A semi-infinite range from minVal to the type max.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
const dimensionedScalar h
Planck constant.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar pow3(const dimensionedScalar &ds)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Type gAverage(const FieldField< Field, Type > &f)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual void write(Ostream &) const
Write.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
List< label > labelList
A List of labels.
A class for managing temporary objects.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
The electrostaticDeposition is a boundary condition to calculate electric potential (V) on a given bo...
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Do not request registration (bool: false)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...