adjointTurbulenceModel.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2019 PCOpt/NTUA
9 Copyright (C) 2013-2019 FOSS GP
10 Copyright (C) 2019-2021 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28\*---------------------------------------------------------------------------*/
29
31#include "volFields.H"
32#include "surfaceFields.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
38namespace incompressibleAdjoint
39{
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
45
46// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47
49(
50 incompressibleVars& primalVars,
52 objectiveManager& objManager,
53 const word& adjointTurbulenceModelName
54)
55:
57 (
59 (
60 adjointTurbulenceModelName,
61 primalVars.U().time().constant(),
62 primalVars.U().db(),
63 IOobject::NO_READ,
64 IOobject::NO_WRITE
65 )
66 ),
67 primalVars_(primalVars),
68 adjointVars_(adjointVars),
69 runTime_(primalVars.U().time()),
70 mesh_(primalVars.U().mesh())
71{}
72
73
74// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
75
77(
78 incompressibleVars& primalVars,
80 objectiveManager& objManager,
81 const word& adjointTurbulenceModelName
82)
83{
84 const word modelType
85 (
87 (
89 (
90 "turbulenceProperties",
91 primalVars.U().time().constant(),
92 primalVars.U().db(),
95 false // Do not register
96 )
97 ).get<word>("simulationType")
98 );
99
100 Info<< "Selecting turbulence model type " << modelType << endl;
101
102 auto* ctorPtr = adjointTurbulenceModelConstructorTable(modelType);
103
104 if (!ctorPtr)
105 {
107 (
108 "adjointTurbulenceModel",
109 modelType,
110 *adjointTurbulenceModelConstructorTablePtr_
111 ) << exit(FatalError);
112 }
113
115 (
116 ctorPtr
117 (
118 primalVars,
119 adjointVars,
120 objManager,
121 adjointTurbulenceModelName
122 )
123 );
124}
125
126
127// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
128
130{
132}
133
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace incompressibleAdjoint
138} // End namespace Foam
139
140// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:506
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:180
const word & constant() const
Return constant name.
Definition: TimePathsI.H:96
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Manages the adjoint mean flow fields and their mean values.
Abstract base class for incompressible adjoint turbulence models (RAS, LES and laminar).
virtual void correct()=0
Solve the adjoint turbulence equations.
Base class for solution control classes.
const volVectorField & U() const
Return const reference to velocity.
const singlePhaseTransportModel & laminarTransport() const
Return const reference to transport model.
class for managing incompressible objective functions.
constant condensation/saturation model.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
virtual void correct()
Correct the laminar viscosity.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
U
Definition: pEqn.H:72
dynamicFvMesh & mesh
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Definition: error.H:457
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
Foam::surfaceFields.