ENH: overhaul of the adjoint optimisation library

Parts of the adjoint optimisation library were re-designed to generalise
the way sensitivity derivatives (SDs) are computed and to allow easier
extension to primal problems other than the ones governed by
incompressible flows. In specific:
- the adjoint solver now holds virtual functions returning the part of
  SDs that depends only on the primal and the adjoint fields.
- a new class named designVariables was introduced which, apart from
  defining the design variables of the optimisation problem and
  providing hooks for updating them in an optimisation loop, provides
  the part of the SDs that affects directly the flow residuals (e.g.
  geometric variations in shape optimisation, derivatives of source
  terms in topology optimisation, etc). The final assembly of the SDs
  happens here, with the updated sensitivity class acting as an
  intermediate.

With the new structure, when the primal problem changes (for instance,
passive scalars are included), the same design variables and sensitivity
classes can be re-used for all physics, with additional contributions to
the SDs being limited (and contained) to the new adjoint solver to be
implemented. The old code structure would require new SD classes for
each additional primal problem.

As a side-effect, setting up a case has arguably become a bit easier and
more intuitive.

Additional changes include:
---------------------------

- Changes in the formulation and computation of shape sensitivity derivatives
  using the E-SI approach. The latter is now derived directly from the
  FI approach, with proper discretization for the terms and boundary
  conditions that emerge from applying the Gauss divergence theorem used
  to transition from FI to E-SI. When E-SI and FI are based on the same
  Laplace grid displacement model, they are now numerically equivalent
  (the previous formulation proved the theoretical equivalence of the
  two approaches but numerical results could differ, depending on the
  case).
- Sensitivity maps at faces are now computed based (and are deriving
  from) sensitivity maps at points, with a constistent point-to-face
  interpolation (requires the differentiation of volPointInterpolation).
- The objective class now allocates only the member pointers that
  correspond to the non-zero derivatives of the objective w.r.t. the
  flow and geometric quantities, leading to a reduced memory footprint.
  Additionally, contributions from volume-based objectives to the
  adjoint equations have been re-worked, removing the need for
  objectiveManager to be virtual.
- In constrained optimisation, an adjoint solver needs to be present for
  each constraint function. For geometric constraints though, no adjoint
  equations need to solved. This is now accounted for through the null
  adjoint solver and the geometric objectives which do not allocate
  adjoint fields for this kind of constraints, reducing memory
  requirements and file clutter.
- Refactoring of the updateMethod to collaborate with the new
  designVariables. Additionally, all updateMethods can now read and
  write restart data in binary, facilitating exact continuation.
  Furthermore, code shared by various quasi-Newton methods (BFGS, DBFGS,
  LBFGS, SR1) has been organised in the namesake class. Over and above,
  an SQP variant capable of tackling inequality constraints has been
  added (ISQP, with I indicating that the QP problem in the presence of
  inequality constraints is solved through an interior point method).
  Inequality constraints can be one-sided (constraint < upper-value)
  or double-sided (lower-value < constraint < upper-value).
- Bounds can now be defined for the design variables.
  For volumetricBSplines in specific, these can be computed as the
  mid-points of the control points and their neighbouring ones. This
  usually leads to better-defined optimisation problems and reduces the
  chances of an invalid mesh during optimisation.
- Convergence criteria can now be defined for the optimisation loop
  which will stop if the relative objective function reduction over
  the last objective value is lower than a given threshold and
  constraints are satisfied within a give tolerance. If no criteria are
  defined, the optimisation will run for the max. given number of cycles
  provided in controlDict.
- Added a new grid displacement method based on the p-Laplacian
  equation, which seems to outperform other PDE-based approaches.

TUT: updated the shape optimisation tutorials and added a new one
showcasing the use of double-sided constraints, ISQP, applying
no-overlapping constraints to volumetric B-Splines control points
and defining convergence criteria for the optimisation loop.
This commit is contained in:
Vaggelis Papoutsis
2023-07-18 17:07:55 +03:00
committed by Andrew Heather
parent ae8b654a86
commit b6a30fae61
266 changed files with 16883 additions and 11733 deletions

View File

@ -106,63 +106,65 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
// Used to compute a number of variants of the sensitivity map
// at once
type multiple;
patches (motorBikeGroup);
sensTypes
{
pointBased
{
type surfacePoints;
patches (motorBikeGroup);
includeSurfaceArea false;
adjointEikonalSolver
{
tolerance 1.e-5;
iters 1000;
epsilon 0.1;
}
}
sensitivityType multiple;
sensitivityTypes
(
pointBased
faceBased-unsmoothed
{
type surface;
patches (motorBikeGroup);
includeSurfaceArea false;
}
faceBased-RMult_2
{
type surface;
patches (motorBikeGroup);
includeSurfaceArea false;
smoothSensitivities true;
meanRadiusMultiplier 2;
suffix Rmult2; // suffix of the sensitivity map output files
iters 2000;
}
faceBased-RMult_5
{
type surface;
patches (motorBikeGroup);
includeSurfaceArea false;
smoothSensitivities true;
meanRadiusMultiplier 5;
suffix Rmult5; // suffix of the sensitivity map output files
iters 2000;
}
faceBased-RMult_10
);
patches (motorBikeGroup);
pointBased
{
sensitivityType surfacePoints;
patches (motorBikeGroup);
adjointEikonalSolver
{
type surface;
patches (motorBikeGroup);
includeSurfaceArea false;
smoothSensitivities true;
meanRadiusMultiplier 10;
suffix Rmult10; // suffix of the sensitivity map output files
iters 2000;
tolerance 1.e-5;
iters 1000;
epsilon 0.1;
}
}
faceBased-unsmoothed
{
sensitivityType surface;
patches (motorBikeGroup);
includeSurfaceArea true;
}
faceBased-RMult_2
{
sensitivityType surface;
patches (motorBikeGroup);
includeSurfaceArea true;
smoothSensitivities true;
meanRadiusMultiplier 2;
suffix Rmult2; // suffix of the sensitivity map output files
iters 1000;
}
faceBased-RMult_5
{
sensitivityType surface;
patches (motorBikeGroup);
includeSurfaceArea true;
smoothSensitivities true;
meanRadiusMultiplier 5;
suffix Rmult5; // suffix of the sensitivity map output files
iters 1000;
}
faceBased-RMult_10
{
sensitivityType surface;
patches (motorBikeGroup);
includeSurfaceArea true;
smoothSensitivities true;
meanRadiusMultiplier 10;
suffix Rmult10; // suffix of the sensitivity map output files
iters 1000;
}
}
}

View File

@ -95,9 +95,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (pressure suction);
}
}

View File

@ -95,9 +95,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (pressure suction);
}
}

View File

@ -97,9 +97,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (pressure suction);
}
}

View File

@ -103,14 +103,13 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
patches (pressure suction);
sensitivityType surfacePoints;
patches (pressure suction);
includeSurfaceArea false;
includeDistance true;
includeMeshMovement true;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
adjointMeshMovementSolver
{

View File

@ -97,10 +97,10 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
patches (pressure suction);
sensitivityType surfacePoints;
patches (pressure suction);
}
}

View File

@ -91,9 +91,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (lower upper);
}
}

View File

@ -91,9 +91,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (lower upper);
}
}

View File

@ -163,10 +163,10 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
patches (lower upper);
sensitivityType surfacePoints;
patches (lower upper);
}
}

View File

@ -91,9 +91,9 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type surfacePoints;
sensitivityType surfacePoints;
patches (lower upper);
}
}

View File

@ -93,25 +93,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (upperWall lowerWall middleWall);
maxInitChange 1.e-3;
}
updateMethod
{
method conjugateGradient;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 1.e-3;
}
}
// ************************************************************************* //

View File

@ -97,25 +97,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (upperWall lowerWall middleWall);
maxInitChange 1.e-3;
}
updateMethod
{
method conjugateGradient;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 1.e-3;
}
}
// ************************************************************************* //

View File

@ -93,25 +93,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (upperWall lowerWall middleWall);
maxInitChange 1.e-3;
}
updateMethod
{
method conjugateGradient;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 1.e-3;
}
}
// ************************************************************************* //

View File

@ -106,15 +106,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
patches (motorBikeGroup);
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (motorBikeGroup);
maxInitChange 2.e-3;
}
updateMethod
{
@ -125,11 +123,6 @@ optimisation
}
//eta 1; //optional
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -97,9 +97,11 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (pressure suction);
}
}

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solver laplacianMotionSolver;
laplacianMotionSolverCoeffs
{
diffusivity uniform;
iters 1000;
tolerance 1.e-06;
}
// ************************************************************************* //

View File

@ -95,31 +95,28 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type multiple; // used to compute many kinds of sensitivities at the same time
type shape;
shapeType Bezier;
sensitivityType multiple;
sensitivityTypes (FI ESI SI);
patches (pressure suction);
sensTypes
ESI
{
ESI
{
type Bezier;
patches (pressure suction);
}
SI
{
type Bezier;
patches (pressure suction);
surfaceSensitivities
{
includeMeshMovement false;
}
}
FI
{
type BezierFI;
patches (pressure suction);
}
sensitivityType shapeESI;
patches (pressure suction);
}
SI
{
sensitivityType shapeESI;
patches (pressure suction);
includeMeshMovement false;
}
FI
{
sensitivityType shapeFI;
patches (pressure suction);
}
}
}

View File

@ -94,15 +94,14 @@ adjointManagers
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type incompressible;
type geometric;
objectiveNames
{
vol
@ -113,25 +112,6 @@ adjointManagers
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 3000;
residualControl
{
"pa.*" 1.e-7;
"Ua.*" 1.e-7;
}
}
}
}
}
@ -139,25 +119,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (pressure suction);
maxInitChange 5.e-3;
}
updateMethod
{
method constraintProjection;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 5.e-3;
}
}

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solver laplacianMotionSolver;
laplacianMotionSolverCoeffs
{
diffusivity uniform;
iters 1000;
tolerance 1.e-06;
}
// ************************************************************************* //

View File

@ -97,36 +97,28 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type multiple; // used to compute many kinds of sensitivities at the same time
patches (pressure suction);
sensTypes
type shape;
shapeType Bezier;
sensitivityType multiple;
sensitivityTypes (FI ESI SI);
patches (pressure suction);
ESI
{
ESI
{
type Bezier;
patches (pressure suction);
}
SI
{
type Bezier;
patches (pressure suction);
surfaceSensitivities
{
includeMeshMovement false;
}
}
FI
{
type BezierFI;
patches (pressure suction);
}
surface
{
type surface;
patches (pressure suction);
}
sensitivityType shapeESI;
patches (pressure suction);
}
SI
{
sensitivityType shapeESI;
patches (pressure suction);
includeMeshMovement false;
}
FI
{
sensitivityType shapeFI;
patches (pressure suction);
}
}
}

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
internalField uniform ( 5.996344962 0.20939698 0 );
boundaryField
{
frontBack
{
type empty;
}
suction
{
type fixedValue;
value uniform ( 0 0 0 );
}
pressure
{
type fixedValue;
value uniform ( 0 0 0 );
}
inlet
{
type freestream;
freestreamValue uniform ( 5.996344962 0.20939698 0 );
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object Ua;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
internalField uniform ( 0 0 0 );
boundaryField
{
frontBack
{
type empty;
}
suction
{
type adjointWallVelocity;
value uniform ( 0 0 0 );
}
pressure
{
type adjointWallVelocity;
value uniform ( 0 0 0 );
}
inlet
{
type adjointFarFieldVelocity;
value uniform ( 0 0 0 );
}
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
frontBack
{
type empty;
}
suction
{
type zeroGradient;
}
pressure
{
type zeroGradient;
}
inlet
{
type outletInlet;
outletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object pa;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
frontBack
{
type empty;
}
suction
{
type zeroGradient;
}
pressure
{
type zeroGradient;
}
inlet
{
type adjointFarFieldPressure;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase
rm -r constant/PARSEC 2> /dev/null
#------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
resourcesDir=$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/resources
\cp -r $resourcesDir/meshes/naca0012/polyMesh constant
runApplication decomposePar
runParallel $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
adjointRASModel adjointLaminar;
adjointTurbulence on;
printCoeffs off;
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solver volumetricBSplinesMotionSolver;
volumetricBSplinesMotionSolverCoeffs
{
duct
{
type cartesian;
nCPsU 8;
nCPsV 6;
nCPsW 3;
degreeU 3;
degreeV 3;
degreeW 2;
controlPointsDefinition axisAligned;
lowerCpBounds ( 0.1 -0.25 -0.1);
upperCpBounds ( 0.9 0.25 1.1);
confineUMovement false;
confineVMovement false;
confineWMovement true;
confineBoundaryControlPoints true;
confineUMinCPs ( (true true true) (true true true) );
confineUMaxCPs ( (true true true) (true true true) );
}
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 6.e-03;
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,15 @@
set multiplot layout 2,2
set grid
set xl 'Optimization cycle'
set yl 'C_d/C_{d,init}'
p 'optimisation/objective/0/dragas1' u 1:3 w lp notitle
set yl 'C_l'
set yr [0.05266:0.05366]
p 'optimisation/objective/0/liftlift' u 1:2 w lp notitle, 0.05340147181439196 t 'upper bound', 0.05320147181439196 t 'lower bound'
set autoscale y
set yl '(V-Vinit)/Vinit'
p 'optimisation/objective/0/volvol' u 1:2 w lp notitle, -0.15 t 'lower bound'

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application adjointOptimisationFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 90;
deltaT 1;
writeControl timeStep;
writeInterval 10;
purgeWrite 0;
writeFormat binary;
writePrecision 16;
writeCompression false;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

@ -0,0 +1,26 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method hierarchical;
coeffs
{
n (2 2 1);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
gradUConv cellLimited Gauss linear 0.5;
}
divSchemes
{
default Gauss linear;
div(phi,U) bounded Gauss linearUpwind gradUConv;
div(-phi,Uaas1) bounded Gauss linearUpwind gradUaConv;
div(-phi,Ualift) bounded Gauss linearUpwind gradUaConv;
div(-phi,Uamoment) bounded Gauss linearUpwind gradUaConv;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
solvers
{
"p.*|pa.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-14;
relTol 0.01;
};
"m|ma"
{
solver PCG;
preconditioner DIC;
tolerance 1e-14;
relTol 0.01;
};
"U.*|Ua.*"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-14;
relTol 0.1;
}
}
relaxationFactors
{
fields
{
"p.*" 0.8;
"pa.*" 0.8;
}
equations
{
"U.*" 0.9;
"Ua.*" 0.9;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,209 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object optimisationDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
optimisationManager steadyOptimisation;
primalSolvers
{
p1
{
active true;
type incompressible;
solver simple;
consistent true;
solutionControls
{
nIters 3000;
nInitialIters 10000;
consistent true;
residualControl
{
"p.*" 1.e-7;
"U.*" 1.e-7;
}
}
}
}
adjointManagers
{
am1
{
primalSolver p1;
adjointSolvers
{
as1
{
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
consistent true;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
drag
{
weight 1.;
type force;
patches (pressure suction);
direction (0.9993908270189999 0.034899496703 0);
Aref 2.;
rhoInf 1.225;
UInf 6;
normalize true;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 3000;
nInitialIters 10000;
consistent true;
residualControl
{
"pa.*" 1.e-7;
"Ua.*" 1.e-7;
}
}
}
lift
{
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
isDoubleSidedConstraint true;
consistent true;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
lift
{
weight 1000.;
type force;
patches (pressure suction);
direction (-0.034899496703 0.9993908270189999 0);
Aref 2.;
rhoInf 1.225;
UInf 6;
target 0.05340147181439196;
targetLeft 0.05320147181439196;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 3000;
nInitialIters 10000;
consistent true;
residualControl
{
"pa.*" 1.e-7;
"Ua.*" 1.e-7;
}
}
}
vol
{
// choose adjoint solver
//----------------------
active true;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type geometric;
objectiveNames
{
vol
{
weight -1;
type partialVolume;
patches (pressure suction);
target -0.15;
}
}
}
}
}
}
}
optimisation
{
convergence
{
objective 1.e-04;
}
designVariables
{
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (pressure suction);
maxInitChange 5.e-3;
nonOverlappingCPs true;
}
updateMethod
{
method ISQP;
delta 1;
lineSearch
{
type ArmijoConditions;
stepUpdateType quadratic;
minRatio 0.05;
}
}
}
// ************************************************************************* //

View File

@ -88,14 +88,13 @@ adjointManagers
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type incompressible;
type geometric;
objectiveNames
{
@ -107,25 +106,6 @@ adjointManagers
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 3000;
residualControl
{
"pa.*" 1.e-7;
"Ua.*" 1.e-7;
}
}
}
}
}
@ -133,16 +113,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
@ -155,12 +132,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -91,16 +91,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
@ -113,12 +110,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -91,16 +91,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
@ -113,12 +110,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -90,25 +90,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
{
method steepestDescent;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -91,16 +91,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
@ -113,12 +110,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -92,50 +92,28 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type multiple; // used to compute many kinds of sensitivities at the same time
patches (lower upper);
sensTypes
type shape;
shapeType Bezier;
sensitivityType multiple;
sensitivityTypes (FI ESI SI);
patches (lower upper);
FI
{
FIVolSplines
{
type volumetricBSplinesFI;
patches (lower upper);
}
ESIVolSplines
{
type volumetricBSplines;
patches (lower upper);
}
SIVolSplines
{
type volumetricBSplines;
patches (lower upper);
surfaceSensitivities
{
includeMeshMovement false;
}
}
FIBezier
{
type BezierFI;
patches (lower upper);
}
ESIBezier
{
type Bezier;
patches (lower upper);
}
SIBezier
{
type Bezier;
patches (lower upper);
surfaceSensitivities
{
includeMeshMovement false;
}
}
sensitivityType shapeFI;
patches (lower upper);
}
ESI
{
sensitivityType shapeESI;
patches (lower upper);
}
SI
{
sensitivityType shapeESI;
patches (lower upper);
includeMeshMovement false;
}
}
}

View File

@ -1,10 +1,11 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / O peration | Version: 2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2;
@ -12,7 +13,6 @@ FoamFile
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application adjointOptimisationFoam;

View File

@ -92,17 +92,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -110,27 +108,8 @@ optimisation
{
etaHessian 0.8;
scaleFirstHessian true;
/*
activeDesignVariables
(
141 142 144 145 147 148
150 151 153 154 168 169
171 172 174 175 177 178
180 181 195 196 198 199
201 202 204 205 207 208
222 223 225 226 228 229
231 232 234 235 249 250
252 253 255 256 258 259
261 262
);
*/
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -92,17 +92,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -110,27 +108,8 @@ optimisation
{
etaHessian 0.8;
scaleFirstHessian true;
/*
activeDesignVariables
(
141 142 144 145 147 148
150 151 153 154 168 169
171 172 174 175 177 178
180 181 195 196 198 199
201 202 204 205 207 208
222 223 225 226 228 229
231 232 234 235 249 250
252 253 255 256 258 259
261 262
);
*/
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -163,17 +163,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -184,11 +182,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -92,17 +92,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -113,11 +111,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -91,16 +91,13 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
updateMethod
@ -113,12 +110,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}

View File

@ -93,17 +93,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -113,11 +111,7 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}
// ************************************************************************* //

View File

@ -93,17 +93,15 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches (lower upper);
maxInitChange 2.e-3;
}
sensitivities
{
type volumetricBSplinesFI;
patches (lower upper);
}
updateMethod
{
method BFGS;
@ -113,11 +111,6 @@ optimisation
scaleFirstHessian true;
}
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 2.e-3;
}
}
// ************************************************************************* //

View File

@ -92,50 +92,28 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type multiple; // used to compute many kinds of sensitivities at the same time
patches (lower upper);
sensTypes
type shape;
shapeType Bezier;
sensitivityType multiple;
sensitivityTypes (FI ESI SI);
patches (lower upper);
FI
{
FIVolSplines
{
type volumetricBSplinesFI;
patches (lower upper);
}
ESIVolSplines
{
type volumetricBSplines;
patches (lower upper);
}
SIVolSplines
{
type volumetricBSplines;
patches (lower upper);
surfaceSensitivities
{
includeMeshMovement false;
}
}
FIBezier
{
type BezierFI;
patches (lower upper);
}
ESIBezier
{
type Bezier;
patches (lower upper);
}
SIBezier
{
type Bezier;
patches (lower upper);
surfaceSensitivities
{
includeMeshMovement false;
}
}
sensitivityType shapeFI;
patches (lower upper);
}
ESI
{
sensitivityType shapeESI;
patches (lower upper);
}
SI
{
sensitivityType shapeESI;
patches (lower upper);
includeMeshMovement false;
}
}
}

View File

@ -94,132 +94,28 @@ adjointManagers
optimisation
{
sensitivities
designVariables
{
type multiple; // used to compute many kinds of sensitivities at the same time
patches (lower upper);
sensTypes
type shape;
shapeType Bezier;
sensitivityType multiple;
sensitivityTypes (FI ESI SI);
patches (lower upper);
FI
{
FIVolSplines
{
type volumetricBSplinesFI;
patches (lower upper);
includeDistance true;
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
}
ESIVolSplines
{
type volumetricBSplines;
patches (lower upper);
includeObjectiveContribution true; // one of this or the equivalent flag in
// surfaceSensitivities has to be set to true
// with this being the prefered one
surfaceSensitivities
{
patches (lower upper);
includeSurfaceArea true;
includeMeshMovement true;
includeDistance true;
includeObjectiveContribution false;
// adjointEikonal and adjointMeshMovement solvers should be always nested
// within the dictionary of the sensitivity type they correspond to.
// For (E)SI based sensitivities, this means the surfaceSensitivities dict
// Default values are provided, so the dictionaries can be skipped
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
adjointMeshMovementSolver
{
iters 10000;
tolerance 1.e-6;
}
}
}
SIVolSplines
{
type volumetricBSplines;
patches (lower upper);
includeObjectiveContribution true; // same comment as above
surfaceSensitivities
{
patches (lower upper);
includeSurfaceArea true;
includeMeshMovement false;
includeDistance true;
includeObjectiveContribution false;
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
}
}
FIBezier
{
type BezierFI;
includeDistance true;
patches (lower upper);
dxdbSolver
{
iters 1000;
tolerance 1.e-6;
}
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
}
ESIBezier
{
type Bezier;
includeObjectiveContribution true; // same comment as above
surfaceSensitivities
{
patches (lower upper);
includeSurfaceArea true;
includeMeshMovement true;
includeDistance true;
includeObjectiveContribution false;
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
adjointMeshMovementSolver
{
iters 10000;
tolerance 1.e-6;
}
}
patches (lower upper);
}
SIBezier
{
type Bezier;
includeObjectiveContribution true; // same comment as above
surfaceSensitivities
{
patches (lower upper);
includeSurfaceArea true;
includeMeshMovement false;
includeDistance true;
includeObjectiveContribution false;
adjointEikonalSolver
{
iters 1000;
tolerance 1.e-6;
}
}
patches (lower upper);
}
sensitivityType shapeFI;
patches (lower upper);
}
ESI
{
sensitivityType shapeESI;
patches (lower upper);
}
SI
{
sensitivityType shapeESI;
patches (lower upper);
includeMeshMovement false;
}
}
}

View File

@ -95,25 +95,18 @@ adjointManagers
optimisation
{
optimisationType
designVariables
{
type shapeOptimisation;
writeEachMesh true;
}
sensitivities
{
type volumetricBSplinesFI;
type shape;
shapeType volumetricBSplines;
sensitivityType shapeFI;
patches ( lower upper );
maxInitChange 0.002;
}
updateMethod
{
method BFGS;
}
meshMovement
{
type volumetricBSplines;
maxAllowedDisplacement 0.002;
}
}
// ************************************************************************* //