56void objectiveNutSqr::populateFieldNames()
58 if (adjointTurbulenceNames_.
empty())
65 adjointRAS().getAdjointTMVariablesBaseNames();
70 adjointTurbulenceNames_.
83 const word& adjointSolverName,
84 const word& primalSolverName
87 objectiveIncompressible(
mesh,
dict, adjointSolverName, primalSolverName),
88 zones_(mesh_.cellZones().indices(
dict.get<wordRes>(
"zones"))),
89 adjointTurbulenceNames_()
127 for (
const label zI : zones_)
130 for (
const label cellI : zoneI)
178 for (
const label zI : zones_)
181 for (
const label cellI : zoneI)
183 dJdvPtr_()[cellI] = dnutdU()[cellI];
193 const autoPtr<incompressible::RASModelVariables>&
194 turbVars =
vars_.RASModelVariables();
233 for (
const label zI : zones_)
236 for (
const label cellI : zoneI)
247 populateFieldNames();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void push_back(link *item)
Add at back of list.
void correctBoundaryConditions()
Correct boundary field.
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
void push_back(const T &val)
Append an element at the end of the list.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Mesh data needed to do the Finite Volume discretisation.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const Time & time() const
Return the top-level database.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Base class for incompressibleAdjoint solvers.
virtual const incompressibleAdjointVars & getAdjointVars() const
Access to the incompressible adjoint variables set.
const autoPtr< incompressibleAdjoint::adjointRASModel > & adjointTurbulence() const
Return const reference to the adjointRASModel.
virtual tmp< volScalarField > nutJacobianTMVar2() const
Jacobian of nut wrt the second turbulence model variable.
virtual tmp< volScalarField > nutJacobianTMVar1() const
Jacobian of nut wrt the first turbulence model variable.
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
bool foundObject(const word &name, const bool recursive=false) const
Contains the named Type?
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Abstract base class for objective functions in incompressible flows.
const volScalarField & dJdTMvar1()
Contribution to field adjoint turbulence model variable 1.
autoPtr< volScalarField > dJdTMvar2Ptr_
Second turbulence model variable.
void update_dJdTMvar(autoPtr< volScalarField > &dJdTMvarPtr, tmp< volScalarField >(incompressibleAdjoint::adjointRASModel::*JacobianFunc)() const, const volScalarField &JacobianMultiplier, const labelList &zones)
Compute dJdTMVar{1,2}.
const volScalarField & dJdTMvar2()
Contribution to field adjoint turbulence model variable 2.
void allocatedJdTurbulence()
Allocate fields related to the differentiation of turbulence models, if necessary.
autoPtr< volScalarField > dJdTMvar1Ptr_
First turbulence model variable.
const incompressibleVars & vars_
void checkCellZonesSize(const labelList &zoneIDs) const
Check if cellZones provided include at least one cell.
autoPtr< volVectorField > dJdvPtr_
const word objectiveName_
wordList fieldNames_
List of adjoint fields for which this objective will contribute sources to their equations.
virtual scalar weight() const
Return the objective function weight.
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
scalar J_
Objective function value and weight.
const dictionary & dict() const
Return objective dictionary.
const word adjointSolverName_
Objective qualitatively quantifying noise through the integral of the squared turbulent viscosity ove...
virtual void update_dJdTMvar2()
Update field to be added to the second adjoint turbulence model PDE.
objectiveNutSqr(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
Construct from components.
virtual void addSource(fvScalarMatrix &matrix)
Add source terms to the adjoint turbulence model equations.
virtual scalar J()
Return the objective function value.
virtual void update_dJdTMvar1()
Update field to be added to the first adjoint turbulence model PDE.
virtual void update_divDxDbMultiplier()
Update field to be added to be added to volume-based sensitivity derivatives, emerging from delta ( d...
virtual void update_dJdv()
Update values to be added to the adjoint outlet velocity.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
word extendedVariableName(const word &varName) const
Given a variable name, return a name that is possibly appended by the solverName, depending on useSol...
A class for managing temporary objects.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
List< word > wordList
List of word.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
static constexpr const zero Zero
Global zero (0).
autoPtr< GeometricField< Type, fvPatchField, volMesh > > createZeroFieldPtr(const fvMesh &mesh, const word &name, const dimensionSet dims, bool printAllocation=false)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
#define forAll(list, i)
Loop across all elements in list.