37 namespace functionObjects
77 Foam::functionObjects::electricPotential::sigma()
const 79 const IOobject sigmaIO
86 tmp<volScalarField> tsigma = phases_[0]*sigmas_[0];
88 for (label i = 1; i < phases_.size(); ++i)
90 tsigma.ref() += phases_[i]*sigmas_[i];
112 Foam::functionObjects::electricPotential::epsilonm()
const 121 const IOobject epsilonrIO
128 tmp<volScalarField> tepsilonr = phases_[0]*epsilonrs_[0];
130 for (label i = 1; i < phases_.size(); ++i)
132 tepsilonr.ref() += phases_[i]*epsilonrs_[i];
155 Foam::functionObjects::electricPotential::electricPotential
163 phasesDict_(
dict.subOrEmptyDict(
"phases")),
172 dict.getCheckOrDefault<scalar>
186 dict.getCheckOrDefault<scalar>
212 writeDerivedFields_(false),
213 electricField_(false)
224 auto* ptr = getObjectPtr<volVectorField>(Ename_);
258 dict.readIfPresent(
"sigma", sigma_);
259 dict.readIfPresent(
"epsilonr", epsilonr_);
260 dict.readIfPresent(
"nCorr", nCorr_);
261 dict.readIfPresent(
"writeDerivedFields", writeDerivedFields_);
262 dict.readIfPresent(
"electricField", electricField_);
265 if (!phasesDict_.empty())
267 phaseNames_.setSize(phasesDict_.size());
268 phases_.setSize(phasesDict_.size());
269 sigmas_.setSize(phasesDict_.size());
271 if (writeDerivedFields_)
273 epsilonrs_.setSize(phasesDict_.size());
277 for (
const entry& dEntry : phasesDict_)
279 const word&
key = dEntry.keyword();
281 if (!dEntry.isDict())
284 <<
"Entry " <<
key <<
" is not a dictionary" <<
nl 298 subDict.getCheck<scalar>
306 if (writeDerivedFields_)
314 subDict.getCheck<scalar>
336 if (
const dictionary* dictptr =
dict.findDict(
"fvOptions"))
338 fvOptions_.reset(*dictptr);
350 const auto&
sigma = tsigma();
354 for (
int i = 1; i <= nCorr_; ++i)
363 fvOptions_.constrain(eVEqn);
370 auto& E = lookupObjectRef<volVectorField>(Ename_);
390 const auto& E = lookupObject<volVectorField>(Ename_);
397 if (writeDerivedFields_)
virtual bool write()
Write the function object output.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
defineTypeNameAndDebug(ObukhovLength, 0)
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...
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool store()
Register object with its registry and transfer ownership to the registry.
constexpr char tab
The tab '\t' character(0x09)
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionedScalar epsilon0
Electric constant: default SI units: [F/m].
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
virtual bool read(const dictionary &dict)
Read the function object data.
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
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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...
static MinMax< scalar > ge(const scalar &minVal)
A semi-infinite range from minVal to the type max.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
virtual bool execute()
Calculate the function object.
static tmp< GeometricField< vector, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< vector >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
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.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
dimensionedScalar pow3(const dimensionedScalar &ds)
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.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0)
dimensionedScalar pow4(const dimensionedScalar &ds)
static const word & calculatedType() noexcept
The type name for calculated patch fields.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
void correctBoundaryConditions()
Correct boundary field.
virtual bool read(const dictionary &dict)
Read optional controls.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...