mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: electricPotential: simplify read function
- change 'fieldName' to 'Vname' for better clarity
This commit is contained in:
committed by
Kutalmış Berçin
parent
7269cc1d3b
commit
efe8220a26
@ -201,11 +201,11 @@ Foam::functionObjects::electricPotential::electricPotential
|
||||
)
|
||||
)
|
||||
),
|
||||
fieldName_
|
||||
Vname_
|
||||
(
|
||||
dict.getOrDefault<word>
|
||||
(
|
||||
"field",
|
||||
"V",
|
||||
IOobject::scopedName(typeName, "V")
|
||||
)
|
||||
),
|
||||
@ -216,7 +216,7 @@ Foam::functionObjects::electricPotential::electricPotential
|
||||
|
||||
// Force creation of transported field so any BCs using it can
|
||||
// look it up
|
||||
volScalarField& eV = getOrReadField(fieldName_);
|
||||
volScalarField& eV = getOrReadField(Vname_);
|
||||
eV.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
@ -225,8 +225,11 @@ Foam::functionObjects::electricPotential::electricPotential
|
||||
|
||||
bool Foam::functionObjects::electricPotential::read(const dictionary& dict)
|
||||
{
|
||||
if (fvMeshFunctionObject::read(dict))
|
||||
if (!fvMeshFunctionObject::read(dict))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Log << type() << " read: " << name() << endl;
|
||||
|
||||
dict.readIfPresent("sigma", sigma_);
|
||||
@ -306,9 +309,6 @@ bool Foam::functionObjects::electricPotential::read(const dictionary& dict)
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -318,11 +318,11 @@ bool Foam::functionObjects::electricPotential::execute()
|
||||
Log << type() << " execute: " << name() << endl;
|
||||
|
||||
tmp<volScalarField> tsigma = this->sigma();
|
||||
const volScalarField& sigma = tsigma();
|
||||
const auto& sigma = tsigma();
|
||||
|
||||
volScalarField& eV = getOrReadField(fieldName_);
|
||||
volScalarField& eV = getOrReadField(Vname_);
|
||||
|
||||
for (label i = 1; i <= nCorr_; ++i)
|
||||
for (int i = 1; i <= nCorr_; ++i)
|
||||
{
|
||||
fvScalarMatrix eVEqn
|
||||
(
|
||||
@ -343,10 +343,10 @@ bool Foam::functionObjects::electricPotential::execute()
|
||||
bool Foam::functionObjects::electricPotential::write()
|
||||
{
|
||||
Log << type() << " write: " << name() << nl
|
||||
<< tab << fieldName_
|
||||
<< tab << Vname_
|
||||
<< endl;
|
||||
|
||||
volScalarField& eV = getOrReadField(fieldName_);
|
||||
volScalarField& eV = getOrReadField(Vname_);
|
||||
|
||||
if (writeDerivedFields_)
|
||||
{
|
||||
|
||||
@ -118,9 +118,9 @@ Usage
|
||||
}
|
||||
|
||||
// Optional entries
|
||||
nCorr <label>;
|
||||
nCorr <int>;
|
||||
writeDerivedFields <bool>;
|
||||
fieldName <word>;
|
||||
V <word>;
|
||||
|
||||
// Inherited entries
|
||||
...
|
||||
@ -134,9 +134,9 @@ Usage
|
||||
libs | Library name: solverFunctionObjects | word | yes | -
|
||||
sigma | Isotropic electrical conductivity of phase | scalar | yes | -
|
||||
epsilonr | Isotropic relative permittivity of phase | scalar | no | -
|
||||
nCorr | Number of corrector iterations | label | no | 1
|
||||
nCorr | Number of corrector iterations | int | no | 1
|
||||
writeDerivedFields | Flag to write extra fields | bool | no | false
|
||||
fieldName | Name of operand field | word | no | electricPotential:V
|
||||
V | Name of electric potential field | word | no | electricPotential:V
|
||||
\endtable
|
||||
|
||||
The inherited entries are elaborated in:
|
||||
@ -199,11 +199,11 @@ class electricPotential
|
||||
//- Isotropic relative permittivity of a single phase
|
||||
dimensionedScalar epsilonr_;
|
||||
|
||||
//- Name of the operand field
|
||||
word fieldName_;
|
||||
//- Name of electric potential field
|
||||
word Vname_;
|
||||
|
||||
//- Number of corrector iterations
|
||||
label nCorr_;
|
||||
int nCorr_;
|
||||
|
||||
//- Flag to write derived fields of
|
||||
//- electric field, current density and free-charge density
|
||||
|
||||
Reference in New Issue
Block a user