48 objectiveIncompressible,
56 void objectiveNutSqr::populateFieldNames()
58 if (adjointTurbulenceNames_.
empty())
60 const incompressibleAdjointSolver& adjSolver =
62 const autoPtr<incompressibleAdjoint::adjointRASModel>& adjointRAS =
63 adjSolver.getAdjointVars().adjointTurbulence();
65 adjointRAS().getAdjointTMVariablesBaseNames();
69 (adjSolver.extendedVariableName(baseNames[nI]));
70 adjointTurbulenceNames_.
71 push_back(adjSolver.extendedVariableName(baseNames[nI]));
83 const word& adjointSolverName,
84 const word& primalSolverName
89 adjointTurbulenceNames_()
127 for (
const label zI : zones_)
130 for (
const label cellI : zoneI)
166 createZeroFieldPtr<vector>
178 for (
const label zI : zones_)
181 for (
const label cellI : zoneI)
183 dJdvPtr_()[cellI] = dnutdU()[cellI];
193 const autoPtr<incompressible::RASModelVariables>&
233 for (
const label zI : zones_)
236 for (
const label cellI : zoneI)
247 populateFieldNames();
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
objectiveNutSqr(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
Construct from components.
void size(const label n)
Older name for setAddressableSize.
fvMatrix< scalar > fvScalarMatrix
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...
const word adjointSolverName_
virtual void update_dJdTMvar2()
Update field to be added to the second adjoint turbulence model PDE.
autoPtr< volScalarField > dJdTMvar2Ptr_
Second turbulence model variable.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual const incompressibleAdjointVars & getAdjointVars() const
Access to the incompressible adjoint variables set.
virtual void update_dJdv()
Update values to be added to the adjoint outlet velocity.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void update_dJdTMvar(autoPtr< volScalarField > &dJdTMvarPtr, tmp< volScalarField >(incompressibleAdjoint::adjointRASModel::*JacobianFunc)() const, const volScalarField &JacobianMultiplier, const labelList &zones)
Compute dJdTMVar{1,2}.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
void checkCellZonesSize(const labelList &zoneIDs) const
Check if cellZones provided include at least one cell.
virtual scalar J()
Return the objective function value.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
void push_back(const T &val)
Append an element at the end of the list.
virtual void update_divDxDbMultiplier()
Update field to be added to be added to volume-based sensitivity derivatives, emerging from delta ( d...
Macros for easy insertion into run-time selection tables.
const word objectiveName_
Base class for incompressibleAdjoint solvers.
#define forAll(list, i)
Loop across all elements in list.
wordList fieldNames_
List of adjoint fields for which this objective will contribute sources to their equations.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const volScalarField & dJdTMvar1()
Contribution to field adjoint turbulence model variable 1.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A class for handling words, derived from Foam::string.
autoPtr< volVectorField > dJdvPtr_
defineTypeNameAndDebug(objectivePartialVolume, 1)
virtual void addSource(fvScalarMatrix &matrix)
Add source terms to the adjoint turbulence model equations.
A List of wordRe with additional matching capabilities.
const autoPtr< incompressibleAdjoint::adjointRASModel > & adjointTurbulence() const
Return const reference to the adjointRASModel.
scalar J_
Objective function value and weight.
label find(const T &val) const
Find index of the first occurrence of the value.
virtual scalar weight() const
Return the objective function weight.
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.
virtual void update_dJdTMvar1()
Update field to be added to the first adjoint turbulence model PDE.
addToRunTimeSelectionTable(objectiveGeometric, objectivePartialVolume, dictionary)
void allocatedJdTurbulence()
Allocate fields related to the differentiation of turbulence models, if necessary.
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
const incompressibleVars & vars_
word extendedVariableName(const word &varName) const
Given a variable name, return a name that is possibly appended by the solverName, depending on useSol...
List< word > wordList
List of word.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void correctBoundaryConditions()
Correct boundary field.
const volScalarField & dJdTMvar2()
Contribution to field adjoint turbulence model variable 2.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
A class for managing temporary objects.
autoPtr< volScalarField > dJdTMvar1Ptr_
First turbulence model variable.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual tmp< volScalarField > nutJacobianTMVar2() const
Jacobian of nut wrt the second turbulence model variable.
Abstract base class for objective functions in incompressible flows.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
virtual tmp< volScalarField > nutJacobianTMVar1() const
Jacobian of nut wrt the first turbulence model variable.
static constexpr const zero Zero
Global zero (0)