mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: changes related to when the objective value is written
- Objective now inherits from localIOdictionary and writes the mean objective value under the uniform folder, each time mesh.write() is called. This is crucial for getting the correct old merit function value if the simulation is continued from a previous state and lineSearch is used. - Objectives are now computed and written even if the corresponding adjoint solver is inactive. This, among others, is also essential for getting the correct old merit function value in case of continuation. - Writing of the objective function (and its mean, if present) history has now moved to updatePrimalBasedQuantities, instead of the preLoop part of the adjoint solvers. This was decided to get the objective values to files, even if the adjoint solver is inactive. Arguably, an even better place to write the objective functions would be the postLoop part of the primal solvers, however this might cause multiple writes of the objective value for the inner iterations of lineSearch, if one is used.
This commit is contained in:
committed by
Andrew Heather
parent
01dfdc4794
commit
4d67819a2c
@ -40,6 +40,7 @@ SourceFiles
|
||||
#ifndef objective_H
|
||||
#define objective_H
|
||||
|
||||
#include "localIOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "OFstream.H"
|
||||
@ -57,6 +58,8 @@ namespace Foam
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class objective
|
||||
:
|
||||
public localIOdictionary
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -70,9 +73,13 @@ protected:
|
||||
bool computeMeanFields_;
|
||||
bool nullified_;
|
||||
|
||||
// Objective function value and weight
|
||||
//- Objective function value and weight
|
||||
scalar J_;
|
||||
scalar JMean_; //average value
|
||||
|
||||
//- Average objective value
|
||||
scalar JMean_;
|
||||
|
||||
//- Objective weight
|
||||
scalar weight_;
|
||||
|
||||
// Objective integration start and end times (for unsteady flows)
|
||||
@ -361,6 +368,9 @@ public:
|
||||
//- Write mean objective function history
|
||||
virtual void writeMeanValue() const;
|
||||
|
||||
//- Write averaged objective for continuation
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
// Inline functions for checking whether pointers are set or not
|
||||
inline const word& objectiveName() const;
|
||||
inline bool hasdJdb() const;
|
||||
|
||||
Reference in New Issue
Block a user