diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C index b0177fbeb828439137eece459b66c1cb66e76dba..2febf7f9125ba530823dd8072d0a420c1febfab3 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C @@ -266,10 +266,8 @@ template<class Type> const ATCModel& adjointBoundaryCondition<Type>::getATC() const { return - patch_.boundaryMesh().mesh().lookupObject<ATCModel> - ( - "ATCModel" + adjointSolverName_ - ); + patch_.boundaryMesh().mesh().template + lookupObject<ATCModel>("ATCModel" + adjointSolverName_); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointRotatingWallVelocity/adjointRotatingWallVelocityFvPatchVectorField.C index f5b8362cd054eb18b4cad6ba01c21ae3b9f3304a..c7d4487a479238c20fbe4a326f9808cfd81b6b9e 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<vector>("origin")), + axis_(dict.get<vector>("axis")), omega_(Function1<scalar>::New("omega", dict)) {} diff --git a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C index cd3cdc7c0d2610360830759d9debd8e2fdbed87f..2420ebfb244a55e47c3d112cf623d061d309e55f 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 19195b77b0be718a89cd38f4c7c61dc8e169353e..b6895320e3e9273132bd018efa69882f68e2772b 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 1e6bb6acc3d7d0d104c859ad4ee75f2ab0cfea67..f94763aeb9e1c152ba6d02325f58f4a2b8a9bb60 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 1ce8b4caa4e6576e4736f0f5c558fe390e0b2a14..dbc0789d24bd6a9d871fdbf1426f47bee22178e4 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 19dad8107568226620cc8d1ad0e78b4d1604e4db..a96a07b003ce4410896532b848509cb1ff3ce23c 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 c4e3edb94141691f5b087e04527183051ef32531..515b82061ff3bdc6172ffb510000c8c4e3808d5d 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<wordRes>("zones")) ) { - //- Allocate source term for the adjoint turbulence model + // Allocate source term for the adjoint turbulence model dJdTMvar1Ptr_.reset ( createZeroFieldPtr<scalar> @@ -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<scalar> @@ -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 977c7cc342b107888cb8506b5101d476b90cbf19..b2211b9b506fe28b31ef3f929538fc0730aad7d0 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 7861fac8392da0b27612e0c38ec4b45c50bb8dba..8fec4c11ff16de8934690a32750d2f9404dd2397 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 ba409f2af07468c463072fcd434b5ce4ca9325cb..aec678088a96017b0d9ce5f0204db95d0d274c46 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 c0e0abd2ff7830eb437f7bd49ba2ad689154e4c4..53792824458558d4c7a294179b443a7cdf7f4b1e 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 99ce83439cc06627db9767426ab6c268a2f897c5..014dd3cabdc0fe5a37ec1c067f87fd2590ee3ceb 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 1eb423c0b8e9e3a4df1b6c8bd505be7f84c3abf8..5a0bf4dea6d1355e6d3cdec869be103729f2ff4f 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 56cf28ed46db79b33e74ec4a1a180812204d3fe2..4ded76e0d0e839a3124539a0b9f1ce0745cd70f6 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 b26898be43b917e28fbdc9fa94563753d8687434..1cce17ff3bf3347a9b9d1b682c320ce652669d9b 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 1410824a72b4421bc00ed505a171b533206955ed..2b9b08511969331373ce854ea81fae72e9cb26c6 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<scalar> A) label n(A.n()); SquareMatrix<scalar> invA(n, Zero); - //- LU decomposition of A + // LU decomposition of A labelList pivotIndices(n, Zero); LUDecompose(A, pivotIndices); DebugInfo