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:
@ -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
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user