mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve codeTemplates
- meshTools include/library for many (most) coded items - add PatchFunction1 include for coded BCs to provide ready access to Function1 and PatchFunction1
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,11 +95,11 @@ ${typeName}FvOption${SourceType}
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetOption(name, modelType, dict, mesh)
|
||||
fv::cellSetOption(name, modelType, dict, mesh)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
printMessage("Construct ${typeName} from components");
|
||||
printMessage("Construct ${typeName} fvOption from dictionary");
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,14 +118,15 @@ ${typeName}FvOption${SourceType}::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FvOption${SourceType}::correct
|
||||
void
|
||||
${typeName}FvOption${SourceType}::correct
|
||||
(
|
||||
GeometricField<${TemplateType}, fvPatchField, volMesh>& fld
|
||||
)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::correct()\n";
|
||||
Info<< "${typeName}FvOption${SourceType}::correct()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -134,7 +135,8 @@ void ${typeName}FvOption${SourceType}::correct
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
void
|
||||
${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldi
|
||||
@ -142,7 +144,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<< "${typeName}FvOption${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -151,7 +153,8 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
void
|
||||
${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
@ -160,7 +163,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<< "${typeName}FvOption${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -169,7 +172,8 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::constrain
|
||||
void
|
||||
${typeName}FvOption${SourceType}::constrain
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const label fieldi
|
||||
@ -177,7 +181,7 @@ void ${typeName}FvOption${SourceType}::constrain
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::constrain()\n";
|
||||
Info<< "${typeName}FvOption${SourceType}::constrain()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,7 +24,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a source.
|
||||
Template for use with dynamic code generation of a finiteVolume source.
|
||||
The hook functions take the following arguments:
|
||||
|
||||
\verbatim
|
||||
@ -117,7 +116,7 @@ namespace fv
|
||||
|
||||
class ${typeName}FvOption${SourceType}
|
||||
:
|
||||
public cellSetOption
|
||||
public fv::cellSetOption
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
@ -138,7 +137,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
//- Construct from mesh
|
||||
${typeName}FvOption${SourceType}
|
||||
(
|
||||
const word& name,
|
||||
@ -147,6 +146,7 @@ public:
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FvOption${SourceType}();
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR,AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,6 +38,7 @@ License
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -96,11 +98,11 @@ ${typeName}PatchFunction1${FieldType}
|
||||
const bool faceValues
|
||||
)
|
||||
:
|
||||
PatchFunction1<${TemplateType}>(pp, entryName, dict, faceValues)
|
||||
parent_bctype(pp, entryName, dict, faceValues)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
printMessage("Construct ${typeName} from components");
|
||||
printMessage("Construct ${typeName} PatchFunction1 from dictionary");
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +113,7 @@ ${typeName}PatchFunction1${FieldType}
|
||||
const ${typeName}PatchFunction1${FieldType}& rhs
|
||||
)
|
||||
:
|
||||
PatchFunction1<${TemplateType}>(rhs)
|
||||
parent_bctype(rhs)
|
||||
{}
|
||||
|
||||
|
||||
@ -122,13 +124,13 @@ ${typeName}PatchFunction1${FieldType}
|
||||
const polyPatch& pp
|
||||
)
|
||||
:
|
||||
PatchFunction1<${TemplateType}>(rhs, pp)
|
||||
parent_bctype(rhs, pp)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<Field<${TemplateType}>>
|
||||
Foam::tmp<Foam::Field<Foam::${TemplateType}>>
|
||||
${typeName}PatchFunction1${FieldType}::value
|
||||
(
|
||||
const scalar x
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,6 +51,10 @@ class ${typeName}PatchFunction1${FieldType}
|
||||
:
|
||||
public PatchFunction1<${TemplateType}>
|
||||
{
|
||||
//- The parent PatchFunction1 type
|
||||
typedef PatchFunction1<${TemplateType}> parent_bctype;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Report a message with the SHA1sum
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "codedPoints0MotionSolverTemplate.H"
|
||||
#define namespaceFoam // Suppress <using namespace Foam;>
|
||||
#include "fvCFD.H"
|
||||
#include "unitConversion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -70,7 +69,10 @@ class ${typeName}Points0MotionSolver
|
||||
) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const ${typeName}Points0MotionSolver&) = delete;
|
||||
void operator=
|
||||
(
|
||||
const ${typeName}Points0MotionSolver&
|
||||
) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,6 +32,7 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "unitConversion.H"
|
||||
#include "PatchFunction1.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
@ -87,7 +88,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(p, iF)
|
||||
parent_bctype(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -99,13 +100,13 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf,
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& rhs,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
parent_bctype(rhs, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -122,7 +123,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(p, iF, dict)
|
||||
parent_bctype(p, iF, dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -134,10 +135,10 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& rhs
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf)
|
||||
parent_bctype(rhs)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -149,11 +150,11 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& ptf,
|
||||
const ${typeName}FixedValueFvPatch${FieldType}& rhs,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<${TemplateType}>(ptf, iF)
|
||||
parent_bctype(rhs, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -176,7 +177,8 @@ ${typeName}FixedValueFvPatch${FieldType}::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
void
|
||||
${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
@ -192,7 +194,7 @@ void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->fixedValueFvPatchField<${TemplateType}>::updateCoeffs();
|
||||
this->parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,6 +52,10 @@ class ${typeName}FixedValueFvPatch${FieldType}
|
||||
:
|
||||
public fixedValueFvPatchField<${TemplateType}>
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef fixedValueFvPatchField<${TemplateType}> parent_bctype;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Report a message with the SHA1sum
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "pointPatchFieldMapper.H"
|
||||
#include "pointFields.H"
|
||||
#include "unitConversion.H"
|
||||
#include "PatchFunction1.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
@ -86,7 +87,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(p, iF)
|
||||
parent_bctype(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -98,13 +99,13 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf,
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& rhs,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
parent_bctype(rhs, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -122,7 +123,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
const bool valueRequired
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(p, iF, dict, valueRequired)
|
||||
parent_bctype(p, iF, dict, valueRequired)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -134,10 +135,10 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& rhs
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf)
|
||||
parent_bctype(rhs)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -149,11 +150,11 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& ptf,
|
||||
const ${typeName}FixedValuePointPatch${FieldType}& rhs,
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<${TemplateType}>(ptf, iF)
|
||||
parent_bctype(rhs, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -176,7 +177,8 @@ ${typeName}FixedValuePointPatch${FieldType}::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
void
|
||||
${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
@ -192,7 +194,7 @@ void ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->fixedValuePointPatchField<${TemplateType}>::updateCoeffs();
|
||||
this->parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedValuePointPatchTemplate${FieldType}_H
|
||||
#define fixedValuePointPatchTemplate${FieldType}_H
|
||||
#ifndef coded_fixedValuePointPatchTemplate${FieldType}_H
|
||||
#define coded_fixedValuePointPatchTemplate${FieldType}_H
|
||||
|
||||
#include "fixedValuePointPatchFields.H"
|
||||
|
||||
@ -53,6 +52,10 @@ class ${typeName}FixedValuePointPatch${FieldType}
|
||||
:
|
||||
public fixedValuePointPatchField<${TemplateType}>
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef fixedValuePointPatchField<${TemplateType}> parent_bctype;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Report a message with the SHA1sum
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "functionObjectTemplate.H"
|
||||
#define namespaceFoam // Suppress <using namespace Foam;>
|
||||
#include "fvCFD.H"
|
||||
#include "unitConversion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
@ -106,7 +107,8 @@ ${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
bool
|
||||
${typeName}FunctionObject::read(const dictionary& dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -121,7 +123,8 @@ bool ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
bool ${typeName}FunctionObject::execute()
|
||||
bool
|
||||
${typeName}FunctionObject::execute()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -136,7 +139,8 @@ bool ${typeName}FunctionObject::execute()
|
||||
}
|
||||
|
||||
|
||||
bool ${typeName}FunctionObject::write()
|
||||
bool
|
||||
${typeName}FunctionObject::write()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -151,7 +155,8 @@ bool ${typeName}FunctionObject::write()
|
||||
}
|
||||
|
||||
|
||||
bool ${typeName}FunctionObject::end()
|
||||
bool
|
||||
${typeName}FunctionObject::end()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
|
||||
@ -76,10 +76,16 @@ class ${typeName}FunctionObject
|
||||
const fvMesh& mesh() const;
|
||||
|
||||
//- No copy construct
|
||||
${typeName}FunctionObject(const ${typeName}FunctionObject&) = delete;
|
||||
${typeName}FunctionObject
|
||||
(
|
||||
const ${typeName}FunctionObject&
|
||||
) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const ${typeName}FunctionObject&) = delete;
|
||||
void operator=
|
||||
(
|
||||
const ${typeName}FunctionObject&
|
||||
) = delete;
|
||||
|
||||
public:
|
||||
|
||||
@ -97,7 +103,7 @@ public:
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -107,7 +113,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the dictionary
|
||||
//- Read optional controls
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Execute (at time-step)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,6 +32,7 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "unitConversion.H"
|
||||
#include "PatchFunction1.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
@ -86,7 +87,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(p, iF)
|
||||
parent_bctype(p, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -98,13 +99,13 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf,
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& rhs,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
|
||||
parent_bctype(rhs, p, iF, mapper)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -121,7 +122,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(p, iF, dict)
|
||||
parent_bctype(p, iF, dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -133,10 +134,10 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& rhs
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf)
|
||||
parent_bctype(rhs)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -148,11 +149,11 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& ptf,
|
||||
const ${typeName}MixedValueFvPatch${FieldType}& rhs,
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<${TemplateType}>(ptf, iF)
|
||||
parent_bctype(rhs, iF)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -175,7 +176,8 @@ ${typeName}MixedValueFvPatch${FieldType}::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
void
|
||||
${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
@ -191,7 +193,7 @@ void ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
this->mixedFvPatchField<${TemplateType}>::updateCoeffs();
|
||||
this->parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR, AFFILIATION
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedFvPatchTemplate${FieldType}_H
|
||||
#define mixedFvPatchTemplate${FieldType}_H
|
||||
#ifndef coded_mixedFvPatchTemplate${FieldType}_H
|
||||
#define coded_mixedFvPatchTemplate${FieldType}_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
@ -53,6 +52,10 @@ class ${typeName}MixedValueFvPatch${FieldType}
|
||||
:
|
||||
public mixedFvPatchField<${TemplateType}>
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef mixedFvPatchField<${TemplateType}> parent_bctype;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Report a message with the SHA1sum
|
||||
|
||||
@ -124,7 +124,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(p, iF),
|
||||
parent_bctype(p, iF),
|
||||
codedBase(),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
@ -133,17 +133,17 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
template<class Type>
|
||||
Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
(
|
||||
const codedFixedValuePointPatchField<Type>& ptf,
|
||||
const codedFixedValuePointPatchField<Type>& rhs,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||
parent_bctype(rhs, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
const bool valueRequired
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
|
||||
parent_bctype(p, iF, dict, valueRequired),
|
||||
codedBase(),
|
||||
dict_
|
||||
(
|
||||
@ -182,29 +182,29 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
template<class Type>
|
||||
Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
(
|
||||
const codedFixedValuePointPatchField<Type>& ptf
|
||||
const codedFixedValuePointPatchField<Type>& rhs
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf),
|
||||
parent_bctype(rhs),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
(
|
||||
const codedFixedValuePointPatchField<Type>& ptf,
|
||||
const codedFixedValuePointPatchField<Type>& rhs,
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, iF),
|
||||
parent_bctype(rhs, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -220,10 +220,11 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
|
||||
// Make sure to construct the patchfield with up-to-date value
|
||||
|
||||
OStringStream os;
|
||||
os.writeEntry("type", name_);
|
||||
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
||||
IStringStream is(os.str());
|
||||
dictionary dict(is);
|
||||
dictionary constructDict(is);
|
||||
|
||||
constructDict.set("type", name_);
|
||||
|
||||
redirectPatchFieldPtr_.reset
|
||||
(
|
||||
@ -231,7 +232,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
|
||||
(
|
||||
this->patch(),
|
||||
this->internalField(),
|
||||
dict
|
||||
constructDict
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
@ -257,7 +258,7 @@ void Foam::codedFixedValuePointPatchField<Type>::updateCoeffs()
|
||||
// Copy through value
|
||||
this->operator==(fvp);
|
||||
|
||||
fixedValuePointPatchField<Type>::updateCoeffs();
|
||||
parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
@ -274,14 +275,14 @@ void Foam::codedFixedValuePointPatchField<Type>::evaluate
|
||||
|
||||
const_cast<pointPatchField<Type>&>(fvp).evaluate(commsType);
|
||||
|
||||
fixedValuePointPatchField<Type>::evaluate(commsType);
|
||||
parent_bctype::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fixedValuePointPatchField<Type>::write(os);
|
||||
this->parent_bctype::write(os);
|
||||
os.writeEntry("name", name_);
|
||||
|
||||
codedBase::writeCodeDict(os, dict_);
|
||||
|
||||
@ -31,6 +31,15 @@ Description
|
||||
Constructs on-the-fly a new boundary condition (derived from
|
||||
fixedValuePointPatchField) which is then used to evaluate.
|
||||
|
||||
The code entries:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
localCode | c++; local static functions
|
||||
code | c++; patch value assignment
|
||||
\endplaintable
|
||||
|
||||
Example:
|
||||
\verbatim
|
||||
movingWall
|
||||
@ -102,6 +111,10 @@ class codedFixedValuePointPatchField
|
||||
public fixedValuePointPatchField<Type>,
|
||||
protected codedBase
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef fixedValuePointPatchField<Type> parent_bctype;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
|
||||
@ -35,10 +35,10 @@ Description
|
||||
The entries are:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | include paths; inserted into EXE_INC in Make/options
|
||||
codeLibs | link line; inserted into LIB_LIBS in Make/options
|
||||
localCode | c++; local static functions;
|
||||
code | c++; upon motionSolver::curPoints();
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
localCode | c++; local static functions
|
||||
code | c++; upon motionSolver::curPoints()
|
||||
\endplaintable
|
||||
|
||||
Note that the dynamically generated motionSolver is an points0MotionSolver,
|
||||
|
||||
@ -124,7 +124,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
parent_bctype(p, iF),
|
||||
codedBase(),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
@ -133,17 +133,17 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
template<class Type>
|
||||
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
(
|
||||
const codedFixedValueFvPatchField<Type>& ptf,
|
||||
const codedFixedValueFvPatchField<Type>& rhs,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
parent_bctype(rhs, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||
parent_bctype(p, iF, dict),
|
||||
codedBase(),
|
||||
dict_
|
||||
(
|
||||
@ -181,29 +181,29 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
template<class Type>
|
||||
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
(
|
||||
const codedFixedValueFvPatchField<Type>& ptf
|
||||
const codedFixedValueFvPatchField<Type>& rhs
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
parent_bctype(rhs),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
(
|
||||
const codedFixedValueFvPatchField<Type>& ptf,
|
||||
const codedFixedValueFvPatchField<Type>& rhs,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
parent_bctype(rhs, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -219,10 +219,11 @@ Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
|
||||
// Make sure to construct the patchfield with up-to-date value
|
||||
|
||||
OStringStream os;
|
||||
os.writeEntry("type", name_);
|
||||
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
||||
IStringStream is(os.str());
|
||||
dictionary dict(is);
|
||||
dictionary constructDict(is);
|
||||
|
||||
constructDict.set("type", name_);
|
||||
|
||||
redirectPatchFieldPtr_.reset
|
||||
(
|
||||
@ -230,7 +231,7 @@ Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
|
||||
(
|
||||
this->patch(),
|
||||
this->internalField(),
|
||||
dict
|
||||
constructDict
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
@ -256,7 +257,7 @@ void Foam::codedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
// Copy through value
|
||||
this->operator==(fvp);
|
||||
|
||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||
parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
@ -273,14 +274,14 @@ void Foam::codedFixedValueFvPatchField<Type>::evaluate
|
||||
|
||||
const_cast<fvPatchField<Type>&>(fvp).evaluate(commsType);
|
||||
|
||||
fixedValueFvPatchField<Type>::evaluate(commsType);
|
||||
parent_bctype::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<Type>::write(os);
|
||||
this->parent_bctype::write(os);
|
||||
os.writeEntry("name", name_);
|
||||
|
||||
codedBase::writeCodeDict(os, dict_);
|
||||
|
||||
@ -34,6 +34,15 @@ Description
|
||||
Constructs on-the-fly a new boundary condition (derived from
|
||||
fixedValueFvPatchField) which is then used to evaluate.
|
||||
|
||||
The code entries:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
localCode | c++; local static functions
|
||||
code | c++; patch value assignment
|
||||
\endplaintable
|
||||
|
||||
Usage
|
||||
Example:
|
||||
\verbatim
|
||||
@ -104,6 +113,10 @@ class codedFixedValueFvPatchField
|
||||
public fixedValueFvPatchField<Type>,
|
||||
protected codedBase
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef fixedValueFvPatchField<Type> parent_bctype;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,7 +124,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<Type>(p, iF),
|
||||
parent_bctype(p, iF),
|
||||
codedBase(),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
@ -133,17 +133,17 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
template<class Type>
|
||||
Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
(
|
||||
const codedMixedFvPatchField<Type>& ptf,
|
||||
const codedMixedFvPatchField<Type>& rhs,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
parent_bctype(rhs, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<Type>(p, iF, dict),
|
||||
parent_bctype(p, iF, dict),
|
||||
codedBase(),
|
||||
dict_
|
||||
(
|
||||
@ -181,29 +181,29 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
template<class Type>
|
||||
Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
(
|
||||
const codedMixedFvPatchField<Type>& ptf
|
||||
const codedMixedFvPatchField<Type>& rhs
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<Type>(ptf),
|
||||
parent_bctype(rhs),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
(
|
||||
const codedMixedFvPatchField<Type>& ptf,
|
||||
const codedMixedFvPatchField<Type>& rhs,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<Type>(ptf, iF),
|
||||
parent_bctype(rhs, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
dict_(rhs.dict_),
|
||||
name_(rhs.name_),
|
||||
redirectPatchFieldPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
@ -220,24 +220,23 @@ Foam::codedMixedFvPatchField<Type>::redirectPatchField() const
|
||||
|
||||
// Write the data from the mixed b.c.
|
||||
OStringStream os;
|
||||
mixedFvPatchField<Type>::write(os);
|
||||
this->parent_bctype::write(os);
|
||||
IStringStream is(os.str());
|
||||
// Construct dictionary from it.
|
||||
dictionary dict(is);
|
||||
dictionary constructDict(is);
|
||||
|
||||
// Override the type to enforce the fvPatchField::New constructor
|
||||
// to choose our type
|
||||
dict.set("type", name_);
|
||||
// Override type
|
||||
constructDict.set("type", name_);
|
||||
|
||||
redirectPatchFieldPtr_.reset
|
||||
(
|
||||
dynamic_cast<mixedFvPatchField<Type>*>
|
||||
dynamic_cast<parent_bctype*>
|
||||
(
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
this->patch(),
|
||||
this->internalField(),
|
||||
dict
|
||||
constructDict
|
||||
).ptr()
|
||||
)
|
||||
);
|
||||
@ -257,16 +256,15 @@ void Foam::codedMixedFvPatchField<Type>::updateCoeffs()
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(name_);
|
||||
|
||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
const_cast<mixedFvPatchField<Type>&>(fvp).updateCoeffs();
|
||||
const parent_bctype& fvp = redirectPatchField();
|
||||
const_cast<parent_bctype&>(fvp).updateCoeffs();
|
||||
|
||||
// Copy through coefficients
|
||||
this->refValue() = fvp.refValue();
|
||||
this->refGrad() = fvp.refGrad();
|
||||
this->valueFraction() = fvp.valueFraction();
|
||||
|
||||
mixedFvPatchField<Type>::updateCoeffs();
|
||||
this->parent_bctype::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
@ -279,21 +277,21 @@ void Foam::codedMixedFvPatchField<Type>::evaluate
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(name_);
|
||||
|
||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
||||
const parent_bctype& fvp = redirectPatchField();
|
||||
|
||||
// - updates the value of fvp (though not used)
|
||||
// - resets the updated() flag
|
||||
const_cast<mixedFvPatchField<Type>&>(fvp).evaluate(commsType);
|
||||
const_cast<parent_bctype&>(fvp).evaluate(commsType);
|
||||
|
||||
// Update the value (using the coefficients) locally
|
||||
mixedFvPatchField<Type>::evaluate(commsType);
|
||||
parent_bctype::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
mixedFvPatchField<Type>::write(os);
|
||||
this->parent_bctype::write(os);
|
||||
os.writeEntry("name", name_);
|
||||
|
||||
codedBase::writeCodeDict(os, dict_);
|
||||
|
||||
@ -31,8 +31,17 @@ Group
|
||||
grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
Constructs on-the-fly a new boundary condition (derived from
|
||||
mixedFvPatchField) which is then used to evaluate.
|
||||
Constructs on-the-fly a new boundary condition
|
||||
(derived from mixedFvPatchField) which is then used to evaluate.
|
||||
|
||||
The code entries:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
localCode | c++; local static functions;
|
||||
code | c++; patch value assignment
|
||||
\endplaintable
|
||||
|
||||
Usage
|
||||
Example:
|
||||
@ -114,6 +123,10 @@ class codedMixedFvPatchField
|
||||
public mixedFvPatchField<Type>,
|
||||
public codedBase
|
||||
{
|
||||
//- The parent boundary condition type
|
||||
typedef mixedFvPatchField<Type> parent_bctype;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
|
||||
@ -32,6 +32,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "dynamicCode.H"
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "dictionaryContent.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -47,8 +48,8 @@ namespace functionObjects
|
||||
codedFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -36,14 +36,14 @@ Description
|
||||
The entries are:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | include paths; inserted into EXE_INC in Make/options
|
||||
codeLibs | link line; inserted into LIB_LIBS in Make/options
|
||||
codeData | c++; local member data (default constructed);
|
||||
localCode | c++; local static functions;
|
||||
codeRead | c++; upon functionObject::read();
|
||||
codeExecute | c++; upon functionObject::execute();
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
codeData | c++; local member data (default constructed)
|
||||
localCode | c++; local static functions
|
||||
codeRead | c++; upon functionObject::read()
|
||||
codeExecute | c++; upon functionObject::execute()
|
||||
codeWrite | c++; upon functionObject::write()
|
||||
codeEnd | c++; upon functionObject::end();
|
||||
codeEnd | c++; upon functionObject::end()
|
||||
\endplaintable
|
||||
|
||||
Usage
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
|
||||
#include "dynamicCode.H"
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "dictionaryContent.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -183,15 +184,13 @@ Foam::PatchFunction1Types::CodedField<Type>::redirectFunction() const
|
||||
{
|
||||
if (!redirectFunctionPtr_)
|
||||
{
|
||||
// Construct a PatchFunction1 containing the input code
|
||||
dictionary completeDict(dict_);
|
||||
dictionary constructDict;
|
||||
// Force 'name_' sub-dictionary into existence
|
||||
dictionary& coeffs = constructDict.subDictOrAdd(name_);
|
||||
|
||||
// Override the type to enforce the PatchFunction1::New constructor
|
||||
// to choose our type
|
||||
completeDict.set("type", name_);
|
||||
|
||||
dictionary dict;
|
||||
dict.add(name_, completeDict);
|
||||
coeffs = dict_; // Copy input code and coefficients
|
||||
coeffs.remove("name"); // Redundant
|
||||
coeffs.set("type", name_); // Specify our new (redirect) type
|
||||
|
||||
redirectFunctionPtr_.reset
|
||||
(
|
||||
@ -199,7 +198,7 @@ Foam::PatchFunction1Types::CodedField<Type>::redirectFunction() const
|
||||
(
|
||||
this->patch(),
|
||||
name_,
|
||||
dict,
|
||||
constructDict,
|
||||
this->faceValues()
|
||||
)
|
||||
);
|
||||
|
||||
@ -30,6 +30,15 @@ Description
|
||||
PatchFunction1 with the code supplied by an on-the-fly compiled C++
|
||||
expression.
|
||||
|
||||
The code entries:
|
||||
\plaintable
|
||||
codeInclude | include files
|
||||
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||
localCode | c++; local static functions
|
||||
code | c++; return the patch values at (scalar x)
|
||||
\endplaintable
|
||||
|
||||
Usage
|
||||
Example:
|
||||
\verbatim
|
||||
@ -38,11 +47,8 @@ Usage
|
||||
type uniformFixedValue;
|
||||
uniformValue
|
||||
{
|
||||
type coded;
|
||||
// Explictly supply name of generated PatchFunction1. Only needed
|
||||
// if entryname ('uniformValue') would clash with existing
|
||||
// runtime selection tables.
|
||||
name myExpression;
|
||||
type coded;
|
||||
name myExpression; // Name of generated PatchFunction1
|
||||
|
||||
code
|
||||
#{
|
||||
@ -50,17 +56,17 @@ Usage
|
||||
Pout<< "** Patch size:" << pp.size() << endl;
|
||||
return tmp<vectorField>::New(pp.size(), vector(1, 0, 0))
|
||||
#};
|
||||
|
||||
//codeInclude
|
||||
//#{
|
||||
// #include "volFields.H"
|
||||
//#};
|
||||
|
||||
//codeOptions
|
||||
//#{
|
||||
// -I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
//#};
|
||||
}
|
||||
|
||||
//codeInclude
|
||||
//#{
|
||||
// #include "fvCFD.H"
|
||||
//#};
|
||||
|
||||
//codeOptions
|
||||
//#{
|
||||
// -I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
//#};
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -59,7 +59,6 @@ maxCo 1.2;
|
||||
|
||||
functions
|
||||
{
|
||||
// #include "catalyst"
|
||||
probes
|
||||
{
|
||||
type probes;
|
||||
@ -82,7 +81,6 @@ functions
|
||||
(
|
||||
(0.015 0.005 0.005)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
mass
|
||||
@ -114,12 +112,10 @@ functions
|
||||
|
||||
codeWrite
|
||||
#{
|
||||
|
||||
const volScalarField& rho =
|
||||
mesh().lookupObject<volScalarField>("rho");
|
||||
|
||||
Info<< "rho volume = " << rho.weightedAverage(mesh().Vsc()) << endl;
|
||||
|
||||
#};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -24,19 +24,14 @@ functions
|
||||
libs (utilityFunctionObjects);
|
||||
enabled yes;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
|
||||
codeWrite
|
||||
#{
|
||||
scalar D = 0.57;
|
||||
scalar UInf = 50;
|
||||
scalar pInf = 101325;
|
||||
scalar TInf = 224;
|
||||
scalar gamma = 1.4;
|
||||
scalar A = -0.3*D*UInf;
|
||||
const scalar D = 0.57;
|
||||
const scalar UInf = 50;
|
||||
const scalar pInf = 101325;
|
||||
const scalar TInf = 224;
|
||||
const scalar gamma = 1.4;
|
||||
const scalar A = -0.3*D*UInf;
|
||||
const dimensionedScalar rhoRef("rhoRef", dimDensity, 1);
|
||||
const auto& rho = mesh().lookupObject<volScalarField>("rho");
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -29,11 +29,6 @@ boundaryField
|
||||
{
|
||||
type coded;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
|
||||
code
|
||||
#{
|
||||
const auto& T =
|
||||
|
||||
Reference in New Issue
Block a user