diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C index b0177fbeb8..2febf7f912 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C @@ -266,10 +266,8 @@ template const ATCModel& adjointBoundaryCondition::getATC() const { return - patch_.boundaryMesh().mesh().lookupObject - ( - "ATCModel" + adjointSolverName_ - ); + patch_.boundaryMesh().mesh().template + lookupObject("ATCModel" + adjointSolverName_); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C index f5b8362cd0..c7d4487a47 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C @@ -70,8 +70,8 @@ adjointRotatingWallVelocityFvPatchVectorField ) : adjointWallVelocityFvPatchVectorField(p, iF, dict), - origin_(dict.lookup("origin")), - axis_(dict.lookup("axis")), + origin_(dict.get("origin")), + axis_(dict.get("axis")), omega_(Function1::New("omega", dict)) {} diff --git a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C index cd3cdc7c0d..2420ebfb24 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C @@ -177,7 +177,7 @@ void objectiveManager::update() void objectiveManager::updateOrNullify() { - //- Update contributions to adjoint if true, otherwise return nulls + // Update contributions to adjoint if true, otherwise return nulls for (objective& obj : objectives_) { if (obj.isWithinIntegrationTime()) diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.C b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.C index 19195b77b0..b6895320e3 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.C @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,7 +75,7 @@ scalar objectiveForceTarget::J() } -void objectiveForceTarget::write() const +bool objectiveForceTarget::write(const bool valid) const { if (Pstream::master()) { @@ -99,6 +99,8 @@ void objectiveForceTarget::write() const << setw(width) << force_ << " " << setw(width) << target_ << endl; } + + return true; } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.H b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.H index 1e6bb6acc3..f94763aeb9 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveForceTarget/objectiveForceTarget.H @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,7 +92,7 @@ public: scalar J(); //- Write objective value - void write() const; + virtual bool write(const bool valid = true) const; }; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.C b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.C index 1ce8b4caa4..dbc0789d24 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.C @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -546,9 +546,9 @@ void objectiveIncompressible::nullify() } -void objectiveIncompressible::write() const +bool objectiveIncompressible::write(const bool valid) const { - objective::write(); + return objective::write(valid); } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.H b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.H index 19dad81075..a96a07b003 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveIncompressible/objectiveIncompressible.H @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -306,7 +306,7 @@ public: {} //- Write objective function history - virtual void write() const; + virtual bool write(const bool valid = true) const; //- Inline functions for checking whether pointers are set or not inline bool hasdJdv() const; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.C b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.C index c4e3edb941..515b82061f 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.C @@ -65,7 +65,7 @@ objectiveNutSqr::objectiveNutSqr mesh_.cellZones().indices(this->dict().get("zones")) ) { - //- Allocate source term for the adjoint turbulence model + // Allocate source term for the adjoint turbulence model dJdTMvar1Ptr_.reset ( createZeroFieldPtr @@ -75,7 +75,7 @@ objectiveNutSqr::objectiveNutSqr (dimless/dimTime/dimTime) ) ); - //- Allocate term to be added to volume-based sensitivity derivatives + // Allocate term to be added to volume-based sensitivity derivatives divDxDbMultPtr_.reset ( createZeroFieldPtr @@ -87,7 +87,7 @@ objectiveNutSqr::objectiveNutSqr dimensionSet(0,0,0,0,0,0,0) ) ); - //- set file pointer + // set file pointer //objFunctionFilePtr_ = new OFstream(objFunctionFolder_/type()); } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.H b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.H index 977c7cc342..b2211b9b50 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectiveNutSqr/objectiveNutSqr.H @@ -85,7 +85,7 @@ public: // Constructors - //- from components + //- From components objectiveNutSqr ( const fvMesh& mesh, @@ -110,7 +110,7 @@ public: void update_dJdTMvar1(); //- Update field to be added to be added to volume-based - // sensitivity derivatives, emerging from delta ( dV ) / delta b + //- sensitivity derivatives, emerging from delta ( dV ) / delta b void update_divDxDbMultiplier(); }; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.C b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.C index 7861fac839..8fec4c11ff 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.C @@ -133,7 +133,7 @@ void objectivePartialVolume::update_dSdbMultiplier() } -void objectivePartialVolume::write() const +bool objectivePartialVolume::write(const bool valid) const { if (Pstream::master()) { @@ -153,6 +153,8 @@ void objectivePartialVolume::write() const objFunctionFilePtr_() << setw(width) << J_ << " "; objFunctionFilePtr_() << setw(width) << initVol_ << endl; } + + return true; } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.H b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.H index ba409f2af0..aec678088a 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePartialVolume/objectivePartialVolume.H @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -99,7 +99,7 @@ public: void update_dSdbMultiplier(); //- Write objective function history - void write() const; + virtual bool write(const bool valid = true) const; }; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.C b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.C index c0e0abd2ff..5379282445 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.C @@ -234,7 +234,7 @@ void objectivePtLosses::update_boundarydJdvt() } -void objectivePtLosses::write() const +bool objectivePtLosses::write(const bool valid) const { if (Pstream::master()) { @@ -266,6 +266,8 @@ void objectivePtLosses::write() const } objFunctionFilePtr_() << endl; } + + return true; } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.H b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.H index 99ce83439c..014dd3cabd 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/incompressible/objectivePtLosses/objectivePtLosses.H @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2013-2019 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -109,7 +109,7 @@ public: void update_boundarydJdvt(); //- Write objective function values and its contrituents - void write() const; + virtual bool write(const bool valid = true) const; }; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C index 1eb423c0b8..5a0bf4dea6 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.C @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2020 PCOpt/NTUA Copyright (C) 2013-2020 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -677,7 +677,7 @@ void objective::nullify() } -void objective::write() const +bool objective::write(const bool valid) const { if (Pstream::master()) { @@ -691,6 +691,8 @@ void objective::write() const objFunctionFilePtr_() << mesh_.time().value() << tab << J_ << endl; } + + return true; } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H index 56cf28ed46..4ded76e0d0 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectives/objective/objective.H @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2007-2020 PCOpt/NTUA Copyright (C) 2013-2020 FOSS GP - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -373,7 +373,7 @@ public: {} //- Write objective function history - virtual void write() const; + virtual bool write(const bool valid = true) const; //- Write objective function history at each primal solver iteration virtual void writeInstantaneousValue() const; diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C index b26898be43..1cce17ff3b 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C @@ -76,7 +76,7 @@ Foam::optMeshMovement::optMeshMovement dict.getOrDefault("writeMeshQualityMetrics", false) ) { - //- Set maxAllowedDisplacement if provided + // Set maxAllowedDisplacement if provided if (dict.found("maxAllowedDisplacement")) { maxAllowedDisplacement_.reset diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/updateMethod/updateMethod/updateMethod.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/updateMethod/updateMethod/updateMethod.C index 1410824a72..2b9b085119 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/updateMethod/updateMethod/updateMethod.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/updateMethod/updateMethod/updateMethod.C @@ -127,7 +127,7 @@ Foam::updateMethod::inv(SquareMatrix A) label n(A.n()); SquareMatrix invA(n, Zero); - //- LU decomposition of A + // LU decomposition of A labelList pivotIndices(n, Zero); LUDecompose(A, pivotIndices); DebugInfo