adjointLaminar.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 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
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 
30 #include "adjointLaminar.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace incompressibleAdjoint
38 {
39 namespace adjointRASModels
40 {
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
49 adjointLaminar::adjointLaminar
50 (
51  incompressibleVars& primalVars,
53  objectiveManager& objManager,
54  const word& adjointTurbulenceModelName,
55  const word& modelName
56 )
57 :
59  (
60  modelName,
61  primalVars,
62  adjointVars,
63  objManager,
64  adjointTurbulenceModelName
65  )
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
70 
72 {
73  const volVectorField& Ua = adjointVars_.Ua();
75  (
77  (
78  IOobject
79  (
80  "devRhoReff",
82  mesh_,
85  ),
86  -nu()*dev(twoSymm(fvc::grad(Ua)))
87  )
88  );
89 }
90 
91 
93 {
94  return
95  (
96  - fvm::laplacian(nuEff(), U)
97  - fvc::div(nuEff()*dev(T(fvc::grad(U))))
98  );
99 }
100 
101 
103 {
105  (
106  IOobject
107  (
108  "adjointMeanFlowSource",
109  runTime_.timeName(),
110  mesh_,
113  ),
114  mesh_,
116  (
117  dimensionSet(0, 1, -2, 0, 0),
118  Zero
119  )
120  );
121 }
122 
123 
125 {
126  // zero contribution
127  return adjMomentumBCSourcePtr_();
128 }
129 
130 
132 {
134 }
135 
136 
138 {
140 }
141 
142 
144 {
146  (
147  IOobject
148  (
149  "adjointEikonalSource" + type(),
150  runTime_.timeName(),
151  mesh_,
154  ),
155  mesh_,
157  );
158 }
159 
160 
162 {
164  (
165  IOobject
166  (
167  "volumeSensTerm" + type(),
168  runTime_.timeName(),
169  mesh_,
172  ),
173  mesh_,
174  dimensionedTensor(dimensionSet(0, 2, -3, 0, 0), Zero)
175  );
176 }
177 
178 
180 {
181  // Does nothing. No fields to nullify
182 }
183 
184 
186 {
187  return adjointRASModel::read();
188 }
189 
190 
192 {
194 }
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace adjointRASModels
199 } // End namespace incompressibleAdjoint
200 } // End namespace Foam
201 
202 // ************************************************************************* //
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::adjointMeanFlowSource
virtual tmp< volVectorField > adjointMeanFlowSource()
Definition: adjointLaminar.C:102
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
adjointLaminar.H
Foam::incompressibleAdjointMeanFlowVars
Manages the adjoint mean flow fields and their mean values.
Definition: incompressibleAdjointMeanFlowVars.H:51
Foam::objectiveManager
class for managing incompressible objective functions.
Definition: objectiveManager.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
Foam::incompressibleAdjoint::adjointRASModel::wallShapeSensitivitiesPtr_
autoPtr< boundaryVectorField > wallShapeSensitivitiesPtr_
Wall sensitivity term for shape optimisation.
Definition: adjointRASModel.H:129
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::devReff
virtual tmp< volSymmTensorField > devReff() const
Return the effective stress tensor, i.e. the adjointLaminar stress.
Definition: adjointLaminar.C:71
Foam::incompressibleAdjoint::adjointTurbulenceModel::nuEff
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity.
Definition: adjointTurbulenceModel.H:167
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::nullify
virtual void nullify()
Nullify all adjoint turbulence model fields and their old times.
Definition: adjointLaminar.C:179
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:49
Foam::incompressibleAdjoint::adjointRASModel::wallFloCoSensitivitiesPtr_
autoPtr< boundaryVectorField > wallFloCoSensitivitiesPtr_
Wall sensitivity term for flow control optimisation.
Definition: adjointRASModel.H:132
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::correct
virtual void correct()
Correct the primal viscosity field. Redundant?
Definition: adjointLaminar.C:191
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::wallShapeSensitivities
virtual const boundaryVectorField & wallShapeSensitivities()
Returns zero field.
Definition: adjointLaminar.C:131
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::divDevReff
virtual tmp< fvVectorMatrix > divDevReff(volVectorField &U) const
Return the diffusion term for the momentum equation.
Definition: adjointLaminar.C:92
Foam::incompressibleAdjoint::adjointRASModel::read
virtual bool read()
Read adjointRASProperties dictionary.
Definition: adjointRASModel.C:226
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::FISensitivityTerm
virtual tmp< volTensorField > FISensitivityTerm()
Returns zero field.
Definition: adjointLaminar.C:161
Foam::incompressibleAdjoint::adjointTurbulenceModel::mesh_
const fvMesh & mesh_
Definition: adjointTurbulenceModel.H:93
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::adjointMomentumBCSource
virtual const boundaryVectorField & adjointMomentumBCSource() const
Returns zero field.
Definition: adjointLaminar.C:124
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:48
Foam::incompressibleAdjoint::adjointRASModel::adjMomentumBCSourcePtr_
autoPtr< boundaryVectorField > adjMomentumBCSourcePtr_
Definition: adjointRASModel.H:126
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::read
virtual bool read()
Read adjointRASProperties dictionary.
Definition: adjointLaminar.C:185
Foam::incompressibleAdjointMeanFlowVars::Ua
const volVectorField & Ua() const
Return const reference to velocity.
Definition: incompressibleAdjointMeanFlowVars.C:173
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::incompressibleAdjoint::adjointTurbulenceModel::correct
virtual void correct()=0
Solve the adjoint turbulence equations.
Definition: adjointTurbulenceModel.C:130
Foam::dimensioned< vector >
Foam::incompressibleAdjoint::adjointRASModel
Abstract base class for incompressible turbulence models.
Definition: adjointRASModel.H:77
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressibleAdjoint::adjointTurbulenceModel::runTime_
const Time & runTime_
Definition: adjointTurbulenceModel.H:92
U
U
Definition: pEqn.H:72
Foam::incompressibleAdjoint::adjointRASModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(adjointRASModel, adjointLaminar, dictionary)
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::wallFloCoSensitivities
virtual const boundaryVectorField & wallFloCoSensitivities()
Returns zero field.
Definition: adjointLaminar.C:137
Foam::GeometricField::Boundary
The boundary fields.
Definition: GeometricField.H:115
Foam::incompressibleAdjoint::adjointRASModels::defineTypeNameAndDebug
defineTypeNameAndDebug(adjointLaminar, 0)
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::incompressibleAdjoint::adjointTurbulenceModel::adjointVars_
incompressibleAdjointMeanFlowVars & adjointVars_
Definition: adjointTurbulenceModel.H:91
Foam::incompressibleAdjoint::adjointTurbulenceModel::nu
tmp< volScalarField > nu() const
Return the laminar viscosity.
Definition: adjointTurbulenceModel.H:155
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar::distanceSensitivities
virtual tmp< volScalarField > distanceSensitivities()
Returns zero field.
Definition: adjointLaminar.C:143
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::dimensionedTensor
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedTensor.H:52
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54
Foam::incompressibleAdjoint::adjointRASModels::adjointLaminar
Dummy turbulence model for a laminar incompressible flow. Can also be used when the "frozen turbulenc...
Definition: adjointLaminar.H:58
Foam::dev
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:106