Merge branch 'fix-function-objects-in-optimisation' into 'develop'

FIX: functions objects in optimisation

See merge request Development/openfoam!654
This commit is contained in:
Andrew Heather 2023-12-21 09:50:33 +00:00
commit f88e06cac2
8 changed files with 9 additions and 65 deletions

View File

@ -107,7 +107,8 @@ Foam::simple::simple
incoVars_(allocateVars()),
MRF_(mesh, word(useSolverNameForFields() ? solverName_ : word::null)),
cumulativeContErr_(Zero),
objectives_()
objectives_(),
allowFunctionObjects_(dict.getOrDefault("allowFunctionObjects", false))
{
addExtraSchemes();
setRefCell
@ -246,7 +247,7 @@ void Foam::simple::postIter()
{
// Execute function objects in optimisation cases
// Disabled in Time since we are subsycling
if (managerType_ == "steadyOptimisation")
if (managerType_ == "steadyOptimisation" && allowFunctionObjects_)
{
const_cast<Time&>(mesh_.time()).functionObjects().execute(false);
}

View File

@ -86,6 +86,12 @@ protected:
//- List of objectives related to this primal solver
UPtrList<objective> objectives_;
//- Allow the execution of function objects in optimisation mode.
// Depending on the functions used and the setup, this might lead
// to a high amount of data written to the hard drive.
// WIP
bool allowFunctionObjects_;
//- Protected Member Functions

View File

@ -44,16 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
yPlus
{
type yPlus;
libs ( fieldFunctionObjects );
writeFields yes;
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -44,16 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeFields yes;
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -44,16 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeFields yes;
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -44,15 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeFields yes;
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -44,15 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeFields yes;
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -44,15 +44,5 @@ timePrecision 6;
runTimeModifiable yes;
functions
{
// yPlus
// {
// type yPlus;
// libs ("libfieldFunctionObjects.so");
// writeFields yes;
// writeControl writeTime;
// }
}
// ************************************************************************* //