From ab40d502a7d7a4f2f2883ac569e4af4bb6ea6079 Mon Sep 17 00:00:00 2001 From: Vaggelis Papoutsis Date: Mon, 13 Dec 2021 11:04:54 +0200 Subject: [PATCH] TUT: updated the BFGS continuation tutorial to be in line with the changes in 00f46a2c52 and added the same tutorial which performs the optimisation in one-go, for comparison. --- .../SA/opt/BFGS-continuation/Allclean | 3 +- .../turbulent/SA/opt/BFGS-continuation/Allrun | 3 +- .../opt/BFGS-continuation/system/controlDict | 42 +++--- .../sbend/turbulent/SA/opt/BFGS/op1/0.orig/U | 9 +- .../sbend/turbulent/opt/BFGS-oneGo/0.orig/U | 59 ++++++++ .../sbend/turbulent/opt/BFGS-oneGo/0.orig/Ua | 60 ++++++++ .../turbulent/opt/BFGS-oneGo/0.orig/nuTilda | 59 ++++++++ .../turbulent/opt/BFGS-oneGo/0.orig/nuaTilda | 65 +++++++++ .../sbend/turbulent/opt/BFGS-oneGo/0.orig/nut | 59 ++++++++ .../sbend/turbulent/opt/BFGS-oneGo/0.orig/p | 56 +++++++ .../sbend/turbulent/opt/BFGS-oneGo/0.orig/pa | 56 +++++++ .../sbend/turbulent/opt/BFGS-oneGo/Allclean | 8 + .../sbend/turbulent/opt/BFGS-oneGo/Allrun | 18 +++ .../BFGS-oneGo/constant/adjointRASProperties | 22 +++ .../opt/BFGS-oneGo/constant/dynamicMeshDict | 48 ++++++ .../BFGS-oneGo/constant/transportProperties | 22 +++ .../BFGS-oneGo/constant/turbulenceProperties | 29 ++++ .../opt/BFGS-oneGo/system/controlDict | 58 ++++++++ .../opt/BFGS-oneGo/system/decomposeParDict | 27 ++++ .../turbulent/opt/BFGS-oneGo/system/fvSchemes | 71 +++++++++ .../opt/BFGS-oneGo/system/fvSolution | 68 +++++++++ .../opt/BFGS-oneGo/system/optimisationDict | 137 ++++++++++++++++++ 22 files changed, 947 insertions(+), 32 deletions(-) create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/U create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/Ua create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuTilda create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuaTilda create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nut create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/p create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/pa create mode 100755 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allclean create mode 100755 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allrun create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/adjointRASProperties create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/dynamicMeshDict create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/transportProperties create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/turbulenceProperties create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/controlDict create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/decomposeParDict create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSchemes create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSolution create mode 100644 tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/optimisationDict diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allclean b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allclean index df20f8d8ba..175743adca 100755 --- a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allclean +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allclean @@ -5,7 +5,6 @@ cd "${0%/*}" || exit # Run from this directory cleanCase0 -sed -i 's/endTime 10/endTime 5/g' system/controlDict -sed -i 's/fromFile/axisAligned/g' constant/dynamicMeshDict +foamDictionary system/controlDict -entry endTime -set 5 #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allrun b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allrun index 5edb0947e4..ad92ce8199 100755 --- a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allrun +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/Allrun @@ -13,8 +13,7 @@ runApplication decomposePar runParallel -s adjointOptimisationFoamFirstPhase $(getApplication) -sed -i 's/endTime 5/endTime 10/g' system/controlDict -sed -i 's/axisAligned/fromFile/g' constant/dynamicMeshDict +foamDictionary system/controlDict -entry endTime -set 10 runParallel $(getApplication) diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/system/controlDict b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/system/controlDict index 06c0c78cbe..8e87d44bd0 100644 --- a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/system/controlDict +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS-continuation/system/controlDict @@ -1,46 +1,46 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: v2112 | +| \\ / O peration | Version: 2202 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // FoamFile { - version 2.0; - format ascii; - class dictionary; - object controlDict; + version 2; + format ascii; + class dictionary; + object controlDict; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application adjointOptimisationFoam; +application adjointOptimisationFoam; -startFrom latestTime; +startFrom latestTime; -startTime 0; +startTime 0; -stopAt endTime; +stopAt endTime; -endTime 5; +endTime 5; -deltaT 1; +deltaT 1; -writeControl timeStep; +writeControl timeStep; -writeInterval 1; +writeInterval 1; -purgeWrite 0; +purgeWrite 0; -writeFormat ascii; +writeFormat ascii; -writePrecision 16; +writePrecision 16; -writeCompression true; +writeCompression true; -timeFormat general; +timeFormat general; -timePrecision 6; +timePrecision 6; runTimeModifiable yes; @@ -49,7 +49,7 @@ functions yPlus { type yPlus; - libs (fieldFunctionObjects); + libs ( fieldFunctionObjects ); writeControl writeTime; } } diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS/op1/0.orig/U b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS/op1/0.orig/U index e53846113f..ed9098b54b 100644 --- a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS/op1/0.orig/U +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/SA/opt/BFGS/op1/0.orig/U @@ -16,7 +16,7 @@ FoamFile dimensions [ 0 1 -1 0 0 0 0 ]; -internalField uniform ( 3.95 0 0 ); +internalField uniform ( 0.3 0 0 ); boundaryField { @@ -24,31 +24,26 @@ boundaryField { type empty; } - sideWall { type fixedValue; value uniform ( 0 0 0 ); } - lower { type fixedValue; value uniform ( 0 0 0 ); } - upper { type fixedValue; value uniform ( 0 0 0 ); } - Inlet { type fixedValue; - value uniform ( 3.95 0 0 ); + value uniform ( 0.3 0 0 ); } - Outlet { type zeroGradient; diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/U b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/U new file mode 100644 index 0000000000..298753e214 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/U @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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 ( 3.95 0 0 ); + +boundaryField +{ + frontBack + { + type empty; + } + + sideWall + { + type fixedValue; + value uniform ( 0 0 0 ); + } + + lower + { + type fixedValue; + value uniform ( 0 0 0 ); + } + + upper + { + type fixedValue; + value uniform ( 0 0 0 ); + } + + Inlet + { + type fixedValue; + value uniform ( 3.95 0 0 ); + } + + Outlet + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/Ua b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/Ua new file mode 100644 index 0000000000..1fc0fe4bd1 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/Ua @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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; + } + + sideWall + { + type adjointWallVelocity; + value uniform ( 0 0 0 ); + } + + upper + { + type adjointWallVelocity; + value uniform ( 0 0 0 ); + } + + Inlet + { + type adjointInletVelocity; + value uniform ( 0 0 0 ); + } + + Outlet + { + type adjointOutletVelocity; + value uniform ( 0 0 0 ); + } + + lower + { + type adjointWallVelocity; + value uniform ( 0 0 0 ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuTilda b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuTilda new file mode 100644 index 0000000000..c2700cf58a --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuTilda @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 4.5e-05; + +boundaryField +{ + frontBack + { + type empty; + } + + sideWall + { + type fixedValue; + value uniform 0; + } + + upper + { + type fixedValue; + value uniform 0; + } + + lower + { + type fixedValue; + value uniform 0; + } + + Inlet + { + type fixedValue; + value uniform 4.5e-05; + } + + Outlet + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuaTilda b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuaTilda new file mode 100644 index 0000000000..6db256c64d --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nuaTilda @@ -0,0 +1,65 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuaTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 0 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + frontBack + { + type empty; + } + + sideWall + { + type fixedValue; + value uniform 0; + } + + upper + { + type fixedValue; + value uniform 0; + } + + lower + { + type fixedValue; + value uniform 0; + } + + Inlet + { + type adjointInletNuaTilda; + value uniform 0; + } + + Outlet + { + type adjointOutletNuaTilda; + value uniform 0; + } + + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nut b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nut new file mode 100644 index 0000000000..4a31a745ed --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/nut @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 3.15e-06; + +boundaryField +{ + frontBack + { + type empty; + } + + sideWall + { + type nutLowReWallFunction; + value uniform 0; + } + + upper + { + type nutLowReWallFunction; + value uniform 0; + } + + lower + { + type nutLowReWallFunction; + value uniform 0; + } + + Inlet + { + type fixedValue; + value uniform 3.15e-06; + } + + Outlet + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/p b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/p new file mode 100644 index 0000000000..699b59ee70 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/p @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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; + } + + lower + { + type zeroGradient; + } + + upper + { + type zeroGradient; + } + + sideWall + { + type zeroGradient; + } + + Inlet + { + type zeroGradient; + } + + Outlet + { + type fixedValue; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/pa b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/pa new file mode 100644 index 0000000000..ae3ee3de00 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/0.orig/pa @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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; + } + + sideWall + { + type zeroGradient; + } + + upper + { + type zeroGradient; + } + + Inlet + { + type zeroGradient; + } + + Outlet + { + type adjointOutletPressure; + value uniform 0; + } + + lower + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allclean b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allclean new file mode 100755 index 0000000000..fb1f384730 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions +#------------------------------------------------------------------------------ + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allrun b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allrun new file mode 100755 index 0000000000..b0a1e0e51b --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/Allrun @@ -0,0 +1,18 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +resourcesDir="$FOAM_TUTORIALS"/incompressible/adjointOptimisationFoam/resources + +restore0Dir + +cp -rf "$resourcesDir"/meshes/sbend/polyMesh/ constant/ + +runApplication decomposePar + +runParallel $(getApplication) + +runParallel cumulativeDisplacement + +#------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/adjointRASProperties b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/adjointRASProperties new file mode 100644 index 0000000000..e1a77480e6 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/adjointRASProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object adjointTurbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +adjointRASModel adjointSpalartAllmaras; + +adjointTurbulence on; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/dynamicMeshDict b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/dynamicMeshDict new file mode 100644 index 0000000000..207b369a45 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/dynamicMeshDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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 9; + nCPsV 5; + nCPsW 3; + degreeU 3; + degreeV 3; + degreeW 2; + + controlPointsDefinition axisAligned; + lowerCpBounds (-1.1 -0.21 -0.05); + upperCpBounds ( 1.1 0.39 0.15); + + confineUMovement false; + confineVMovement false; + confineWMovement true; + confineBoundaryControlPoints false; + + confineUMinCPs ( (true true true) (true true true) ); + confineUMaxCPs ( (true true true) (true true true) ); + confineWMinCPs ( (true true true) ); + confineWMaxCPs ( (true true true) ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/transportProperties b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/transportProperties new file mode 100644 index 0000000000..6c0ac43026 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu 1.5e-05; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/turbulenceProperties b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/turbulenceProperties new file mode 100644 index 0000000000..41fad5f8bd --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/constant/turbulenceProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel SpalartAllmaras; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/controlDict b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/controlDict new file mode 100644 index 0000000000..3f5404dfa6 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/controlDict @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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 10; + +deltaT 1; + +writeControl timeStep; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 16; + +writeCompression true; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +functions +{ + yPlus + { + type yPlus; + libs (fieldFunctionObjects); + writeControl writeTime; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/decomposeParDict b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/decomposeParDict new file mode 100644 index 0000000000..d5a60a630a --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/decomposeParDict @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +coeffs +{ + n (4 1 1); +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSchemes b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSchemes new file mode 100644 index 0000000000..ed12fcf5b5 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSchemes @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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; + gradDConv cellLimited Gauss linear 1; +} + +divSchemes +{ + default Gauss linear; + + div(phi,U) bounded Gauss linearUpwind gradUConv; + div(phi,nuTilda) bounded Gauss linearUpwind gradNuTildaConv; + div(yPhi,yWall) Gauss linearUpwind gradDConv; + div(-phi,Ua) bounded Gauss linearUpwind gradUaConv; + div(-phi,nuaTilda) bounded Gauss linearUpwind gradNuaTildaConv; + div(-yPhi,da) Gauss linearUpwind gradDaConv; + + div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(grad(Ua).T()))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +wallDist +{ + method advectionDiffusion; + advectionDiffusionCoeffs + { + method meshWave; + tolerance 3.e-6; + maxIter 1000; + epsilon 0.1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSolution b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSolution new file mode 100644 index 0000000000..f9b4f42755 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/fvSolution @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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-9; + relTol 0.01; + }; + + "(m|ma)" + { + solver PCG; + preconditioner DIC; + tolerance 1e-9; + relTol 0.01; + }; + + "(U|Ua|nuTilda|nuaTilda|yWall|da)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-9; + relTol 0.1; + }; +} + +relaxationFactors +{ + fields + { + p 0.5; + pa 0.5; + } + equations + { + U 0.7; + Ua 0.7; + nuTilda 0.7; + nuaTilda 0.7; + yWall 0.7; + da 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/optimisationDict b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/optimisationDict new file mode 100644 index 0000000000..a56964e9e6 --- /dev/null +++ b/tutorials/incompressible/adjointOptimisationFoam/shapeOptimisation/sbend/turbulent/opt/BFGS-oneGo/system/optimisationDict @@ -0,0 +1,137 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / 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; + solutionControls + { + nIters 3000; + residualControl + { + "p.*" 1.e-7; + "U.*" 1.e-7; + "nuTilda.*" 1.e-7; + } + } + } +} + +adjointManagers +{ + am1 + { + primalSolver p1; + adjointSolvers + { + as1 + { + // choose adjoint solver + //---------------------- + active true; + type incompressible; + solver adjointSimple; + + // manage objectives + //------------------ + objectives + { + type incompressible; + objectiveNames + { + losses + { + weight 1; + type PtLosses; + patches (Inlet Outlet); + } + } + } + + // ATC treatment + //-------------- + ATCModel + { + ATCModel standard; + } + + // solution control + //------------------ + solutionControls + { + nIters 3000; + residualControl + { + "pa.*" 1.e-7; + "Ua.*" 1.e-7; + } + } + } + } + } +} + +optimisation +{ + optimisationType + { + type shapeOptimisation; + writeEachMesh true; + } + + sensitivities + { + type volumetricBSplinesFI; + patches (lower upper); + } + updateMethod + { + method BFGS; + BFGS + { + 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; + } +} + + +// ************************************************************************* //