45 const word& managerType,
47 bool overrideUseSolverName
65 primalSolverName_(
dict.get<
word>(
"primalSolver")),
67 objectiveSolverIDs_(0),
68 constraintSolverIDs_(0),
71 dict.getOrDefault<scalar>(
"operatingPointWeight", 1)
77 const wordList adjSolverNames = adjointSolversDict.
toc();
83 forAll(adjSolverNames, namei)
86 adjointSolversDict.
subDict(adjSolverNames[namei]);
89 solverDict.
add<
bool>(
"useSolverNameForFields",
true);
116 <<
" adjoint solvers acting as constraints" <<
endl;
123 <<
"Number of adjoint solvers corresponding to objectives "
125 <<
"Consider aggregating your objectives to one" <<
endl;
156 return primalSolverName_;
169 return adjointSolvers_;
176 return adjointSolvers_;
182 return operatingPointWeight_;
188 return constraintSolverIDs_.size();
194 return objectiveSolverIDs_.size();
200 return nConstraints() + nObjectives();
222 for (
const label solveri : objectiveSolverIDs_)
226 adjointSolvers_[solveri].getObjectiveSensitivities();
243 forAll(constraintSens, cI)
245 label consI = constraintSolverIDs_[cI];
249 new scalarField(adjointSolvers_[consI].getObjectiveSensitivities())
253 return constraintSens;
261 adjSolver.computeObjectiveSensitivities();
270 adjSolver.clearSensitivities();
277 scalar objValue(
Zero);
278 for (
const label solveri : objectiveSolverIDs_)
281 adjointSolvers_[solveri].getObjectiveManager();
282 objValue += objManager.
print();
296 forAll(constraintValues, cI)
299 adjointSolvers_[constraintSolverIDs_[cI]].getObjectiveManager();
300 constraintValues[cI] = objManager.
print();
303 return tconstraintValues;
309 if (primalSolverName_ ==
name)
313 solver.updatePrimalBasedQuantities();
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setSize(const label n)
Alias for resize()
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
virtual void updatePrimalBasedQuantities()
Class for managing adjoint solvers, which may be more than one per operating point.
void clearSensitivities()
Clear sensitivity fields from all adjoint solvers.
scalar objectiveValue()
Get objective value.
labelList objectiveSolverIDs_
virtual PtrList< scalarField > constraintSensitivities()
Get constraint sensitivities. One scalarField per constraint.
label nAdjointSolvers() const
Total number of adjoint solvers.
virtual tmp< scalarField > constraintValues()
Get constraint values.
virtual bool readDict(const dictionary &dict)
virtual tmp< scalarField > aggregateSensitivities()
Aggregate sensitivities from various adjoint solvers.
void computeAllSensitivities()
const word & primalSolverName() const
Const access to the primal solver name.
PtrList< adjointSolver > adjointSolvers_
label nConstraints() const
Number of adjoint solvers corresponding to constraints.
virtual void solveAdjointEquations()
const dictionary & dict() const
Const access to the construction dictionary.
scalar operatingPointWeight() const
Const access to adjoint solvers.
const word primalSolverName_
labelList constraintSolverIDs_
const PtrList< adjointSolver > & adjointSolvers() const
Const access to adjoint solvers.
label nObjectives() const
Number of adjoint solvers corresponding to objectives.
const word & managerName() const
Const access to the manager name.
Base class for adjoint solvers.
const word & name() const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
wordList toc() const
Return the table of contents.
Mesh data needed to do the Finite Volume discretisation.
class for managing incompressible objective functions.
scalar print()
Print to screen.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Base class for solution control classes.
virtual bool readDict(const dictionary &dict)
virtual void solve()=0
Main control loop.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const word dictName("faMeshDefinition")
#define WarningInFunction
Report a warning using Foam::Warning.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.