58 time_(const_cast<
Time&>(
mesh.time())),
60 adjointSolverManagers_(),
61 managerType_(get<
word>(
"optimisationManager")),
65 const wordList& primalSolverNames = primalSolversDict.
toc();
72 primalSolversDict.
subDict(primalSolverNames[solveri]);
75 solverDict.
add<
bool>(
"useSolverNameForFields",
true);
91 const wordList& adjointManagerNames = adjointManagersDict.
toc();
94 label nAdjointSolvers(0);
105 adjointManagersDict.
subDict(adjointManagerNames[manageri]),
106 overrideUseSolverName
117 if (!solveri.useSolverNameForFields())
120 <<
"Multiple primal solvers are present but "
121 <<
"useSolverNameForFields is set to false in "
122 <<
"primal solver " << solveri.solverName() <<
nl
123 <<
"This is considered fatal."
129 if (nAdjointSolvers > 1)
136 if (!asI.useSolverNameForFields())
139 <<
"Multiple adjoint solvers are present but "
140 <<
"useSolverNameForFields is set to false in "
141 <<
"adjoint solver " << asI.solverName() <<
nl
142 <<
"This is considered fatal."
173 Info<<
"optimisationManager type : " << modelType <<
endl;
175 auto* ctorPtr = dictionaryConstructorTable(modelType);
182 "optimisationManager",
184 *dictionaryConstructorTablePtr_
199 const dictionary& primalSolversDict = subDict(
"primalSolvers");
202 sol.readDict(primalSolversDict.
subDict(sol.solverName()));
205 const dictionary& adjointManagersDict = subDict(
"adjointManagers");
208 man.readDict(adjointManagersDict.
subDict(man.managerName()));
220 return primalSolvers_;
227 return adjointSolverManagers_;
234 forAll(primalSolvers_, psI)
236 primalSolvers_[psI].solve();
244 forAll(adjointSolverManagers_, amI)
246 adjointSolverManagers_[amI].solveAdjointEquations();
254 forAll(adjointSolverManagers_, amI)
256 adjointSolverManagers_[amI].computeAllSensitivities();
263 forAll(adjointSolverManagers_, amI)
266 adjointSolverManagers_[amI].adjointSolvers();
268 forAll(adjointSolvers, asI)
270 adjointSolvers[asI].updatePrimalBasedQuantities();
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const word & system() const
Return system name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
Class for managing adjoint solvers, which may be more than one per operating point.
Base class for adjoint solvers.
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
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.
const Time & time() const
Return the top-level database.
Abstract base class for optimisation methods.
virtual void solvePrimalEquations()
Solve all primal equations.
virtual void updatePrimalBasedQuantities()
Solve all primal equations.
PtrList< adjointSolverManager > adjointSolverManagers_
virtual void solveAdjointEquations()
Solve all adjoint equations.
virtual PtrList< adjointSolverManager > & adjointSolverManagers()
PtrList< primalSolver > primalSolvers_
virtual void computeSensitivities()
Compute all adjoint sensitivities.
virtual PtrList< primalSolver > & primalSolvers()
virtual bool read()
Read object.
Base class for primal solvers.
virtual bool read()
Read object.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.