Go to the documentation of this file.
38 namespace incompressibleAdjoint
47 adjointTurbulenceModel,
49 adjointTurbulenceModel
112 adjointRASModel::adjointRASModel
118 const word& adjointTurbulenceModelName
126 adjointTurbulenceModelName
132 "adjointRASProperties",
133 primalVars.
U().time().constant(),
140 objectiveManager_(objManager),
142 adjointTurbulence_(get<word>(
"adjointTurbulence")),
143 printCoeffs_(getOrDefault<Switch>(
"printCoeffs",
false)),
144 coeffDict_(subOrEmptyDict(
type +
"Coeffs")),
148 adjointTMVariable1Ptr_(
nullptr),
149 adjointTMVariable2Ptr_(
nullptr),
150 adjointTMVariable1MeanPtr_(
nullptr),
151 adjointTMVariable2MeanPtr_(
nullptr),
152 adjMomentumBCSourcePtr_( createZeroBoundaryPtr<vector>(mesh_) ),
153 wallShapeSensitivitiesPtr_( createZeroBoundaryPtr<vector>(mesh_) ),
154 wallFloCoSensitivitiesPtr_( createZeroBoundaryPtr<vector>(mesh_) ),
155 includeDistance_(
false),
156 changedPrimalSolution_(
true)
167 const word& adjointTurbulenceModelName
174 "adjointRASProperties",
175 primalVars.
U().time().constant(),
183 const word modelType(
dict.get<
word>(
"adjointRASModel"));
185 Info<<
"Selecting adjointRAS turbulence model " << modelType <<
endl;
187 auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
189 if (!cstrIter.found())
196 *dictionaryConstructorTablePtr_
207 adjointTurbulenceModelName
236 IOdictionary::readStream
272 "adjointTMVariable1" +
type(),
299 "adjointTMVariable2" +
type(),
361 "nutJacobianTMVar1"+
type(),
384 "nutJacobianTMVar2"+
type(),
442 const label iAverageIter = solControl.
averageIter();
443 scalar avIter(iAverageIter);
444 scalar oneOverItP1 = 1./(avIter+1);
445 scalar mult = avIter*oneOverItP1;
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bool changing() const
Is mesh changing (topology changing and/or moving)
Manages the adjoint mean flow fields and their mean values.
class for managing incompressible objective functions.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
virtual bool readData(Istream &)
The readData function required by regIOobject read operation.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
bool doAverageIter() const
volScalarField & getAdjointTMVariable1()
Return non-constant reference to adjoint turbulence model variable 1.
virtual tmp< volScalarField > nutJacobianTMVar2() const
Jacobian of nut wrt the second turbulence model variable.
A class for handling words, derived from Foam::string.
addToRunTimeSelectionTable(adjointTurbulenceModel, adjointRASModel, adjointTurbulenceModel)
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
virtual tmp< volScalarField > nutJacobianTMVar1() const
Jacobian of nut wrt the first turbulence model variable.
autoPtr< volScalarField > adjointTMVariable2MeanPtr_
Adjoint turbulence model variable 2, mean value.
dictionary coeffDict_
Model coefficients dictionary.
static word timeName(const scalar t, const int precision=precision_)
virtual void correct()
Solve the adjoint turbulence equations.
Base class for solver control classes.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool changedPrimalSolution_
Has the primal solution changed?
autoPtr< volScalarField > adjointTMVariable1MeanPtr_
Adjoint turbulence model variable 1, mean value.
virtual tmp< scalarField > diffusionCoeffVar2(label patchI) const
const word & name() const
nearWallDist y_
Near wall distance boundary field.
virtual bool read()
Read adjointRASProperties dictionary.
virtual void correct()
Correct for mesh geom/topo changes.
autoPtr< volScalarField > adjointTMVariable2Ptr_
Adjoint turbulence model variable 2.
volScalarField & getAdjointTMVariable2Inst()
Return non-constant reference to adjoint turbulence model variable 2.
defineTypeNameAndDebug(adjointRASModel, 0)
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
volScalarField & getAdjointTMVariable2()
Return non-constant reference to adjoint turbulence model variable 2.
messageStream Info
Information stream (uses stdout - output is on the master only)
bool useAveragedFields() const
autoPtr< volScalarField > & getAdjointTMVariable2InstPtr()
Return non-constant autoPtr to adjoint turbulence model variable 2.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const volVectorField & U() const
Return const reference to velocity.
Abstract base class for incompressible adjoint turbulence models (RAS, LES and laminar).
void setChangedPrimalSolution()
Set flag of changed primal solution to true.
label & averageIter()
Return average iteration index reference.
Switch adjointTurbulence_
Turbulence on/off flag.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
bool includeDistance() const
Should the adjoint to the eikonal equation be computed.
virtual void correct()=0
Solve the adjoint turbulence equations.
const solverControl & getSolverControl() const
Return const reference to solverControl.
defineRunTimeSelectionTable(adjointRASModel, dictionary)
errorManipArg< error, int > exit(error &err, const int errNo=1)
volScalarField & getAdjointTMVariable1Inst()
Return non-constant reference to adjoint turbulence model variable 1.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void close()
Close Istream.
autoPtr< volScalarField > adjointTMVariable1Ptr_
Adjoint turbulence model variable 1.
virtual void printCoeffs()
Print model coefficients.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
autoPtr< volScalarField > & getAdjointTMVariable1InstPtr()
Return non-constant autoPtr to adjoint turbulence model variable 1.
virtual tmp< scalarField > diffusionCoeffVar1(label patchI) const
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
incompressibleAdjointMeanFlowVars & adjointVars_
const Time & time() const
Return the top-level database.
void resetMeanFields()
Reset mean fields to zero.
void setMeanFields()
Set mean fields.
virtual const volScalarField & nut() const
Return the turbulence viscosity.
Switch printCoeffs_
Flag to print the model coeffs at run-time.
bool average() const
Whether averaging is enabled or not.
Base class for solution control classes.
void computeMeanFields()
Average adjoint fields on the fly.
static autoPtr< adjointRASModel > New(incompressibleVars &primalVars, incompressibleAdjointMeanFlowVars &adjointVars, objectiveManager &objManager, const word &adjointTurbulenceModelName=adjointTurbulenceModel::typeName)
Return a reference to the selected adjointRAS model.