From 01dfdc479429c46e92404b84a4ec489c624da4d0 Mon Sep 17 00:00:00 2001 From: Vaggelis Papoutsis <vaggelisp@gmail.com> Date: Mon, 6 Apr 2020 11:58:50 +0300 Subject: [PATCH] ENH: objective: added function to output a blank line to be used in separating instantaneous objective values of different optimisation cycles. --- .../adjoint/objectives/objective/objective.C | 16 ++++++++++++++-- .../adjoint/objectives/objective/objective.H | 7 +++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C index a9a910d6a7a..975813fdbc9 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C @@ -5,8 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2007-2019 PCOpt/NTUA - Copyright (C) 2013-2019 FOSS GP + Copyright (C) 2007-2020 PCOpt/NTUA + Copyright (C) 2013-2020 FOSS GP Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -624,6 +624,18 @@ void objective::writeInstantaneousValue() const } +void objective::writeInstantaneousSeparator() const +{ + if (Pstream::master()) + { + if (instantValueFilePtr_.valid()) + { + instantValueFilePtr_() << endl; + } + } +} + + void objective::writeMeanValue() const { if (Pstream::master()) diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H index 2293da74de4..7b6a3aa3d49 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H @@ -5,8 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2007-2019 PCOpt/NTUA - Copyright (C) 2013-2019 FOSS GP + Copyright (C) 2007-2020 PCOpt/NTUA + Copyright (C) 2013-2020 FOSS GP Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -355,6 +355,9 @@ public: //- Write objective function history at each primal solver iteration virtual void writeInstantaneousValue() const; + //- Write objective function history at each primal solver iteration + virtual void writeInstantaneousSeparator() const; + //- Write mean objective function history virtual void writeMeanValue() const; -- GitLab