fvOptions/.../codedSource: Updated for compressible and phase sources

There are now three possible code entries for the scalarCodedSource,
vectorCodedSource, etc..., fvOptions. These are `codeAddSup` for basic
sources, `codeAddRhoSup` for compressible sources, and
`codeAddAlphaRhoSup` for phase (compressible) sources.

Previously `codeAddSup` was used for both basic and compressible
sources, and phase sources were not implemented. This meant that whilst
a compressible source could be created, it could not make use of the
`rho` argument or the basic source function would fail to compile.
This commit is contained in:
Will Bainbridge
2020-09-03 10:42:25 +01:00
parent 37e2922cd5
commit 9f9ef9a2c0
4 changed files with 43 additions and 95 deletions

View File

@ -23,70 +23,6 @@ License
Description
Template for use with dynamic code generation of a source.
The hook functions take the following arguments:
codeCorrect
(
GeometricField<Type, fvPatchField, volMesh>& fld
)
codeAddSup
(
fvMatrix<Type}>& eqn,
const label fieldi
)
constrain
(
fvMatrix<Type}>& eqn,
const label fieldi
)
where :
fld is the field in fieldNames
eqn is the fvMatrix
energySource
{
type scalarCodedSource;
active true;
selectionMode all;
scalarCodedSourceCoeffs
{
fieldNames (h);
name sourceTime;
codeInclude
#{
#};
codeCorrect
#{
Pout<< "**codeCorrect**" << endl;
#};
codeAddSup
#{
const Time& time = mesh().time();
const scalarField& V = mesh_.V();
scalarField& heSource = eqn.source();
heSource -= 0.1*sqr(time.value())*V;
#};
codeSetValue
#{
Pout<< "**codeSetValue**" << endl;
#};
}
sourceTimeCoeffs
{
// Dummy entry
}
}
SourceFiles
codedFvOptionTemplate.C
@ -162,6 +98,15 @@ public:
const label fieldi
) const;
//- Explicit and implicit matrix contributions for phase equations
virtual void addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<${TemplateType}>& eqn,
const label fieldi
) const;
//- Set value
virtual void constrain
(