ENH: electricPotential: add finite-volume constraint hook

This commit is contained in:
Kutalmis Bercin
2023-07-12 16:47:54 +01:00
committed by Andrew Heather
parent a50ee8e2d2
commit f3d939fa10
2 changed files with 18 additions and 0 deletions

View File

@ -217,6 +217,7 @@ Foam::functionObjects::electricPotential::electricPotential
IOobject::scopedName(typeName, "E")
)
),
fvOptions_(mesh_),
nCorr_(1),
writeDerivedFields_(false),
electricField_(false)
@ -341,6 +342,11 @@ bool Foam::functionObjects::electricPotential::read(const dictionary& dict)
}
}
if (const dictionary* dictptr = dict.findDict("fvOptions"))
{
fvOptions_.reset(*dictptr);
}
return true;
}
@ -363,6 +369,8 @@ bool Foam::functionObjects::electricPotential::execute()
eVEqn.relax();
fvOptions_.constrain(eVEqn);
eVEqn.solve();
}

View File

@ -123,6 +123,7 @@ Usage
V <word>;
electricField <bool>;
E <word>;
fvOptions <dict>;
// Inherited entries
...
@ -141,10 +142,12 @@ Usage
V | Name of electric potential field | word | no | electricPotential:V
electricField | Flag to calculate electric field | bool | no | false
E | Name of electric field | word | no | electricPotential:E
fvOptions | List of finite-volume options | dict | no | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fvOption.H \endlink
Fields written out when the \c writeDerivedFields entry is \c true:
\table
@ -153,6 +156,9 @@ Usage
Charge density | volScalarField | \<time\>/electricPotential:rho
\endtable
Note
- Only constraint-type finite-volume options can be used.
SourceFiles
electricPotential.C
@ -163,6 +169,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "volFields.H"
#include "fvOptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -208,6 +215,9 @@ class electricPotential
//- Name of electric field
word Ename_;
//- Run-time selectable finite volume options
fv::optionList fvOptions_;
//- Number of corrector iterations
int nCorr_;