53 const label m(rhoValues.
size() - 1);
60 <<
setw(width) <<
"#OuterIter" <<
" "
61 <<
setw(width) <<
"InnerIter" <<
" "
62 <<
setw(width) <<
"rhoObj" <<
" ";
65 <<
setw(width) <<
"#nCycle" <<
" "
66 <<
setw(width) <<
"cumulativeCost" <<
" "
67 <<
setw(width) <<
"Objective" <<
" ";
68 for (label i = 0; i < m; ++i)
71 <<
setw(width) <<
"rhoConst" <<
" ";
73 <<
setw(width) <<
"Constraint" <<
" ";
76 <<
setw(width) <<
"J" <<
" "
77 <<
setw(width) <<
"JTilda" <<
" ";
78 for (label i = 0; i < m; ++i)
81 <<
setw(width) <<
"C" <<
" "
82 <<
setw(width) <<
"CTilda" <<
" ";
96 <<
setw(width) << rhoValues[i] <<
" ";
101 <<
setw(width) << objValues[0][i] <<
" "
102 <<
setw(width) << objValues[1][i] <<
" ";
117 <<
setw(width) << objValues[0][i] <<
" ";
137 (time.globalPath()/
"optimisation"/
"objective"/time.
timeName()/
"GCMMA"),
140 time.globalPath()/
"optimisation"/
"objective"/time.
timeName()
147 mma_.setVariableRho();
157 bool isConverged = mma_.converged();
158 writeToFiles(isConverged);
161 <<
"GCMMA converged ... " <<
Switch(isConverged) <<
endl;
169 <<
"GCMMA:: recomputing direction "<<
endl;
175 mma_.solveSubproblem();
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Class implementing a workaround for using the Globally converging wrapper of the MMA update method....
virtual bool converged()
Check whether linear search has converged.
virtual void updateStep()
Actually computes a new direction entirely, targeting the satisfaction of the GCMMA condition.
OFstream GCMMAFile_
File with rho values in each inner loop.
void writeToFiles(bool isConverged)
Write rho and objective/constraint values & approx to files.
virtual void updateCorrection(scalarField &correction)
Replace the correction with the one computed in updateStep.
MMA & mma_
Cast of the update method to MMA.
OFstream costFile_
File with CPU cost in each inner loop.
label cost_
Total cost, measured in Equivalent Flow Solutions, up to this cycle.
bool writeHeader_
Write the header of the output files.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Update design variables using the Method of Moving Assymptotes. Can handle inequality constraints.
const scalarField & getRho() const
Get rho value if needed.
const PtrList< scalarField > & getValuesAndApproximations() const
Get objective/constraint values and their approximations.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base class for line search methods.
label iter_
Optimisation cycle.
label innerIter_
Inner line search iteration.
Abstract base class for optimisation methods.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define DebugInfo
Report an information message using Foam::Info.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
#define forAll(list, i)
Loop across all elements in list.