- in some cases, additional dictionary inputs are useful for extending the input parameters or functionality of dynamic coded conditions. Typically this can be used to provide a simple set of dictionary inputs that are used to drive specific code, but allows changing the inputs without causing a recompilation. Accessed with this type of code: ``` const dictionary& dict = this->codeContext(); ``` boundary conditions and function objects: * specify an additional codeContext dictionary entry: ``` codeContext { ... } ``` PatchFunction1: * The code context dictionary is simply the dictionary used to specify the PatchFunction1 coefficients. To replicated persistant data, use local member static data. Eg, ``` code #{ // Persistent (Member) Data static autoPtr<Function1<scalar>> baseVel; static autoPtr<Function1<vector>> baseDir; ... #} ``` fvOptions: * currently not applicable
142 lines
3.7 KiB
C
142 lines
3.7 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | www.openfoam.com
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
Copyright (C) 2021 OpenCFD Ltd.
|
|
Copyright (C) YEAR AUTHOR,AFFILIATION
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#include "codedPatchFunction1Template.H"
|
|
#include "polyMesh.H"
|
|
#include "addToRunTimeSelectionTable.H"
|
|
#include "fvPatchFieldMapper.H"
|
|
#include "volFields.H"
|
|
#include "surfaceFields.H"
|
|
#include "unitConversion.H"
|
|
|
|
//{{{ begin codeInclude
|
|
${codeInclude}
|
|
//}}} end codeInclude
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
|
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
|
|
|
//{{{ begin localCode
|
|
${localCode}
|
|
//}}} end localCode
|
|
|
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
|
|
// dynamicCode:
|
|
// SHA1 = ${SHA1sum}
|
|
//
|
|
// unique function name that can be checked if the correct library version
|
|
// has been loaded
|
|
extern "C" void ${typeName}_${SHA1sum}(bool load)
|
|
{
|
|
if (load)
|
|
{
|
|
// Code that can be explicitly executed after loading
|
|
}
|
|
else
|
|
{
|
|
// Code that can be explicitly executed before unloading
|
|
}
|
|
}
|
|
|
|
|
|
namespace PatchFunction1Types
|
|
{
|
|
|
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
|
|
//makePatchFunction1(${typeName}PatchFunction1${FieldType});
|
|
defineTypeNameAndDebug
|
|
(
|
|
${typeName}PatchFunction1${FieldType},
|
|
0
|
|
);
|
|
PatchFunction1<${TemplateType}>::adddictionaryConstructorToTable
|
|
<${typeName}PatchFunction1${FieldType}>
|
|
add${typeName}PatchFunction1${FieldType}ConstructorToTable_;
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
${typeName}PatchFunction1${FieldType}::
|
|
${typeName}PatchFunction1${FieldType}
|
|
(
|
|
const polyPatch& pp,
|
|
const word& redirectType,
|
|
const word& entryName,
|
|
const dictionary& dict,
|
|
const bool faceValues
|
|
)
|
|
:
|
|
parent_bctype(pp, entryName, dict, faceValues)
|
|
{
|
|
if (${verbose:-false})
|
|
{
|
|
printMessage("Construct ${typeName} PatchFunction1 from dictionary");
|
|
}
|
|
}
|
|
|
|
|
|
${typeName}PatchFunction1${FieldType}::
|
|
${typeName}PatchFunction1${FieldType}
|
|
(
|
|
const ${typeName}PatchFunction1${FieldType}& rhs,
|
|
const polyPatch& pp
|
|
)
|
|
:
|
|
parent_bctype(rhs, pp)
|
|
{}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
Foam::tmp<Foam::Field<Foam::${TemplateType}>>
|
|
${typeName}PatchFunction1${FieldType}::value
|
|
(
|
|
const scalar x
|
|
) const
|
|
{
|
|
//{{{ begin code
|
|
${code}
|
|
//}}} end code
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
} // End namespace PatchFunction1Types
|
|
} // End namespace Foam
|
|
|
|
|
|
// ************************************************************************* //
|