Go to the documentation of this file.
37 namespace incompressible
57 if (!updateMethod_->initialEtaSet())
64 scalar eta = optMeshMovement_->computeEta(
correction);
69 updateMethod_->setStep(eta);
70 updateMethod_->initialEtaSet() =
true;
85 shapeOptimisation::shapeOptimisation
93 optMeshMovement_(
nullptr),
96 dict.subDict(
"optimisationType").
97 lookupOrDefault<bool>(
"writeEachMesh",
false)
101 dict.subDict(
"optimisationType").
102 lookupOrDefault<bool>(
"updateGeometry",
true)
108 mesh_.boundaryMesh().patchSet
110 dict_.subDict(
"sensitivities").get<
wordRes>(
"patches")
116 <<
"There is no patch on which to compute sensitivities. "
117 <<
"Check optimisationDict \n"
121 optMeshMovement_.reset
126 dict_.subDict(
"meshMovement"),
134 !updateMethod_->initialEtaSet()
135 && !optMeshMovement_().maxAllowedDisplacementSet()
139 <<
"Neither eta (updateMethod) "
140 <<
"nor maxAllowedDisplacement (meshMovement) have been set"
156 scalar objectiveValue(
Zero);
167 if (objectiveSens.empty())
169 objectiveSens.setSize(tadjointSolverManagerSens().size(),
Zero);
171 objectiveSens += opWeight*tadjointSolverManagerSens();
178 if (constraintSens.empty())
180 constraintSens.
setSize(adjointSolverManagerConstSens.size());
181 forAll(constraintSens, cI)
188 adjointSolverManagerConstSens[cI].size(),
192 constraintValues.setSize(cValues().size());
193 constraintValues =
Zero;
197 forAll(constraintSens, cI)
199 constraintSens[cI] += opWeight*adjointSolverManagerConstSens[cI];
201 constraintValues += opWeight*cValues();
223 Info<<
" Writing new mesh points " <<
endl;
266 Info<<
" Writing new mesh points " <<
endl;
virtual const pointField & points() const
Return raw points.
virtual void storeDesignVariables()
Store design variables, as the starting point for line search.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
scalar operatingPointWeight() const
Const access to adjoint solvers.
virtual PtrList< scalarField > constraintSensitivities()
Get constraint sensitivities. One scalarField per constraint.
A primitive field of type <T> with automated input and output.
defineTypeNameAndDebug(adjointEikonalSolver, 0)
virtual void write()
Write useful quantities to files.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero.
static autoPtr< optMeshMovement > New(fvMesh &mesh, const dictionary &dict, const labelList &patchIDs)
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Abstract base class for optimisation methods.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual tmp< scalarField > aggregateSensitivities()
Aggregate sensitivities from various adjoint solvers.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
autoPtr< optMeshMovement > optMeshMovement_
#define forAll(list, i)
Loop across all elements in list.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual void write()
Write useful quantities to files.
addToRunTimeSelectionTable(adjointSensitivity, sensitivityBezier, dictionary)
virtual tmp< scalarField > constraintValues()
Get constraint values.
messageStream Info
Information stream (uses stdout - output is on the master only)
void setSize(const label newLen)
Same as resize()
PtrList< adjointSolverManager > & adjointSolverManagers
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
virtual void resetDesignVariables()
Store design variables, as the starting point for line search.
Class for managing adjoint solvers, which may be more than one per operating point.
PtrList< adjointSolverManager > & adjointSolvManagers_
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Shape optimisation support library.
scalar objectiveValue()
Get objective value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
autoPtr< updateMethod > updateMethod_
void update()
Master function. Calls all the others.
A List of wordRe with additional matching capabilities.
const polyBoundaryMesh & patches
virtual void computeEta(scalarField &correction)
#define WarningInFunction
Report a warning using Foam::Warning.
autoPtr< lineSearch > lineSearch_