diff --git a/applications/solvers/incompressible/adjointOptimisationFoam/adjointOptimisationFoam.C b/applications/solvers/incompressible/adjointOptimisationFoam/adjointOptimisationFoam.C
index 7d29d48497..ddf2c809ab 100644
--- a/applications/solvers/incompressible/adjointOptimisationFoam/adjointOptimisationFoam.C
+++ b/applications/solvers/incompressible/adjointOptimisationFoam/adjointOptimisationFoam.C
@@ -64,13 +64,13 @@ int main(int argc, char *argv[])
{
// Solve all primal equations
om.solvePrimalEquations();
+
+ // Clear sensitivities
+ om.clearSensitivities();
+
+ // Solve all adjoint equations
+ om.solveAdjointEquations();
}
-
- // Update primal-based quantities of the adjoint solvers
- om.updatePrimalBasedQuantities();
-
- // Solve all adjoint equations
- om.solveAdjointEquations();
}
Info<< "End\n" << endl;
diff --git a/applications/utilities/postProcessing/optimisation/computeSensitivities/computeSensitivities.C b/applications/utilities/postProcessing/optimisation/computeSensitivities/computeSensitivities.C
index b7ced6e309..b1ec73c755 100644
--- a/applications/utilities/postProcessing/optimisation/computeSensitivities/computeSensitivities.C
+++ b/applications/utilities/postProcessing/optimisation/computeSensitivities/computeSensitivities.C
@@ -60,7 +60,8 @@ int main(int argc, char *argv[])
forAll(adjointSolvers, asI)
{
adjointSolvers[asI].getObjectiveManager().updateAndWrite();
- adjointSolvers[asI].computeObjectiveSensitivities();
+ adjointSolvers[asI].
+ computeObjectiveSensitivities(om.getDesignVariables());
}
}
diff --git a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/files b/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/files
deleted file mode 100644
index c6e8c8fb9d..0000000000
--- a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-writeActiveDesignVariables.C
-
-EXE = $(FOAM_APPBIN)/writeActiveDesignVariables
diff --git a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/options b/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/options
deleted file mode 100644
index f5b51c5ca7..0000000000
--- a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/Make/options
+++ /dev/null
@@ -1,14 +0,0 @@
-EXE_INC = \
- -I$(LIB_SRC)/finiteVolume/lnInclude \
- -I$(LIB_SRC)/meshTools/lnInclude \
- -I$(LIB_SRC)/finiteVolume/cfdTools \
- -I$(LIB_SRC)/dynamicMesh/lnInclude \
- -I$(LIB_SRC)/optimisation/adjointOptimisation/adjoint/lnInclude
-
-EXE_LIBS = \
- -lfiniteVolume \
- -lmeshTools \
- -lfvOptions \
- -ldynamicMesh \
- -lfvMotionSolvers \
- -ladjointOptimisation
diff --git a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/writeActiveDesignVariables.C b/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/writeActiveDesignVariables.C
deleted file mode 100644
index b87b0bb837..0000000000
--- a/applications/utilities/preProcessing/optimisation/writeActiveDesignVariables/writeActiveDesignVariables.C
+++ /dev/null
@@ -1,108 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2007-2019 PCOpt/NTUA
- Copyright (C) 2013-2019 FOSS GP
- Copyright (C) 2019-2022 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Application
- writeActiveDesignVariables
-
-Description
- Writes the active design variables based on the selected parameterisation
- scheme, as read from the meshMovement part of optimisationDict.
- Keeps a back-up of the original optimisationDict in
- system/optimisationDict.org, as comments in the dict will be lost.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-#include "optMeshMovement.H"
-#include "updateMethod.H"
-#include "OFstream.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-int main(int argc, char *argv[])
-{
- #include "setRootCase.H"
- #include "createTime.H"
- #include "createMesh.H"
-
- IOdictionary optDict
- (
- IOobject
- (
- "optimisationDict",
- mesh.time().caseSystem(),
- mesh,
- IOobject::MUST_READ_IF_MODIFIED,
- IOobject::NO_WRITE
- )
- );
-
- // Back-up old optimisationDict, to maintain potential comments in it
- if (Pstream::master())
- {
- Foam::cp(optDict.objectPath(), optDict.objectPath() + ".org");
- }
-
- // Construct mesh movement object and grab active design variables
- // Will exit with error if not implemented for this type
- const dictionary& movementDict =
- optDict.subDict("optimisation").subDict("meshMovement");
- // Empty patch list will do
- labelList patchIDs(0);
- autoPtr movementPtr
- (optMeshMovement::New(mesh, movementDict, patchIDs));
- const labelList activeDesignVariables =
- movementPtr().getActiveDesignVariables();
-
- // Construct update method to grab the type
- dictionary& updateMethodDict =
- optDict.subDict("optimisation").subDict("updateMethod");
- autoPtr updMethod(updateMethod::New(mesh, updateMethodDict));
-
- // Add to appropriate dictionary (creates it if it does not exist)
- dictionary& coeffsDict = updateMethodDict.subDictOrAdd(updMethod().type());
- coeffsDict.add
- (
- "activeDesignVariables",
- activeDesignVariables,
- true
- );
-
- // Write modified dictionary
- optDict.regIOobject::writeObject
- (
- IOstreamOption(IOstreamOption::ASCII),
- true
- );
-
- Info<< "End\n" << endl;
-
- return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.C b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.C
index d6791326aa..9a3bb69b9f 100644
--- a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.C
+++ b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.C
@@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
- Copyright (C) 2007-2021 PCOpt/NTUA
- Copyright (C) 2013-2021 FOSS GP
+ Copyright (C) 2007-2023 PCOpt/NTUA
+ Copyright (C) 2013-2023 FOSS GP
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@@ -214,6 +214,7 @@ void ATCModel::computeLimiter
scheme.interpolate(limiter)
);
limiter = fvc::average(faceLimiter);
+ limiter.correctBoundaryConditions();
}
}
diff --git a/src/optimisation/adjointOptimisation/adjoint/ATCModel/zeroATCcells/faceCells/faceCells.C b/src/optimisation/adjointOptimisation/adjoint/ATCModel/zeroATCcells/faceCells/faceCells.C
index 9f1d346ed7..714af8c921 100644
--- a/src/optimisation/adjointOptimisation/adjoint/ATCModel/zeroATCcells/faceCells/faceCells.C
+++ b/src/optimisation/adjointOptimisation/adjoint/ATCModel/zeroATCcells/faceCells/faceCells.C
@@ -52,26 +52,26 @@ faceCells::faceCells
:
zeroATCcells(mesh, dict)
{
+ DynamicList