TUT: added topology optimisation tutorials

using the Borrvall-Petersson method to compute the source terms of the
flow equations.
This commit is contained in:
Vaggelis Papoutsis
2023-12-13 19:44:30 +02:00
committed by Andrew Heather
parent 7868d9251a
commit 4c3f9a9772
228 changed files with 6760 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2309 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2;
format ascii;
class dictionary;
object meshDict;
}
maxCellSize 0.006;
surfaceFile fileName;
boundaryCellSize 0.004;
boundaryCellSizeRefinementThickness 0.015;
boundaryLayers
{
patchBoundaryLayers
{
"lower.*|upper.*|left.*|right.*|topOPatch"
{
nLayers 5;
thicknessRatio 1.8;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,104 @@
/*--------------------------------*- 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 singleRun;
primalSolvers
{
op1
{
active true;
type incompressible;
solver simple;
solutionControls
{
nIters 3000;
residualControl
{
"p.*" 5.e-7;
"U.*" 5.e-7;
}
}
}
}
adjointManagers
{
adjManager1
{
primalSolver op1;
adjointSolvers
{
as1
{
// choose adjoint solver
//----------------------
active false;
type incompressible;
solver adjointSimple;
computeSensitivities false;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
losses
{
weight 1.;
type PtLosses;
patches (inlet "outlet.*");
}
mass
{
weight 1.;
type flowRatePartition;
inletPatches (inlet);
outletPatches (outlet outlet-right);
targetFractions (0.5 0.5);
}
uniformity
{
weight 1.;
type uniformityPatch;
patches (outlet outlet-right);
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
}
}
}
}
}
}
// ************************************************************************* //

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 70;
deltaT 1;
writeControl timeStep;
writeInterval 70;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression yes;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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 fvOptions;
}
eqSource
{
type topOSource;
names
(
U nuTilda yWall
Uaas1 nuaTildaas1 daas1
Uamass nuaTildamass damass
);
function BorrvallPetersson;
b 100;
interpolationField beta;
}

View File

@ -0,0 +1,200 @@
/*--------------------------------*- 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
{
op1
{
active true;
type incompressible;
solver simple;
solutionControls
{
nIters 500;
nInitialIters 1000;
residualControl
{
"p.*" 5.e-7;
"U.*" 5.e-7;
"nu.*" 5.e-7;
}
}
}
}
adjointManagers
{
adjManager1
{
primalSolver op1;
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.*");
normalize true;
}
uniformity
{
weight 0.;
type uniformityPatch;
patches (outlet outlet-right);
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 500;
nInitialIters 1000;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
"nua.*" 5.e-7;
}
}
}
mass
{
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
isConstraint true;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
mass
{
weight 1.;
type flowRatePartition;
inletPatches (inlet);
outletPatches (outlet outlet-right);
targetFractions (0.5 0.5);
normalize true;
target 1.e-5;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
// solution control
//------------------
solutionControls
{
nIters 500;
nInitialIters 1000;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
"nua.*" 5.e-7;
}
}
}
vol
{
// choose adjoint solver
//----------------------
active true;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type geometric;
objectiveNames
{
vol
{
weight 1.;
type topOVolume;
percentage 0.462;
}
}
}
}
}
}
}
optimisation
{
designVariables
{
type topO;
sensitivityType topO;
fixedZeroPorousZones (IEntranceSet OEntranceSet OREntranceSet);
regularisation
{
regularise true;
growFromWalls true;
meanRadiusMult 20;
function tanh;
b 40;
}
betaMax 50;
maxInitChange 0.2;
}
updateMethod
{
method ISQP;
targetConstraintReduction 0.1;
preconditioner ShermanMorrison;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2309 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2;
format ascii;
class dictionary;
object meshDict;
}
maxCellSize 0.006;
surfaceFile fileName;
boundaryCellSize 0.004;
boundaryCellSizeRefinementThickness 0.015;
boundaryLayers
{
patchBoundaryLayers
{
"lower.*|upper.*|left.*|right.*|topOPatch"
{
nLayers 5;
thicknessRatio 1.8;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,104 @@
/*--------------------------------*- 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 singleRun;
primalSolvers
{
op1
{
active true;
type incompressible;
solver simple;
solutionControls
{
nIters 3000;
residualControl
{
"p.*" 5.e-7;
"U.*" 5.e-7;
}
}
}
}
adjointManagers
{
adjManager1
{
primalSolver op1;
adjointSolvers
{
as1
{
// choose adjoint solver
//----------------------
active false;
type incompressible;
solver adjointSimple;
computeSensitivities false;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
losses
{
weight 1.;
type PtLosses;
patches (inlet "outlet.*");
}
mass
{
weight 1.;
type flowRatePartition;
inletPatches (inlet);
outletPatches (outlet outlet-right);
targetFractions (0.5 0.5);
}
uniformity
{
weight 1.;
type uniformityPatch;
patches (outlet outlet-right);
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
}
}
}
}
}
}
// ************************************************************************* //

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 70;
deltaT 1;
writeControl timeStep;
writeInterval 70;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression yes;
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 fvOptions;
}
eqSource
{
type topOSource;
names
(
U nuTilda yWall
Ua nuaTilda da
);
function BorrvallPetersson;
b 100;
interpolationField beta;
}

View File

@ -0,0 +1,157 @@
/*--------------------------------*- 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
{
op1
{
active true;
type incompressible;
solver simple;
solutionControls
{
nIters 500;
nInitialIters 1000;
residualControl
{
"p.*" 5.e-7;
"U.*" 5.e-7;
"nu.*" 5.e-7;
}
}
}
}
adjointManagers
{
adjManager1
{
primalSolver op1;
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.*");
normalize true;
}
mass
{
weight 0.;
type flowRatePartition;
inletPatches (inlet);
outletPatches (outlet outlet-right);
targetFractions (0.5 0.5);
}
uniformity
{
weight 0.;
type uniformityPatch;
patches (outlet outlet-right);
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 500;
nInitialIters 1000;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
"nua.*" 5.e-7;
}
}
}
vol
{
// choose adjoint solver
//----------------------
active true;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type geometric;
objectiveNames
{
vol
{
weight 1.;
type topOVolume;
percentage 0.462;
}
}
}
}
}
}
}
optimisation
{
designVariables
{
type topO;
sensitivityType topO;
fixedZeroPorousZones (IEntranceSet OEntranceSet OREntranceSet);
regularisation
{
regularise true;
growFromWalls true;
meanRadiusMult 20;
function tanh;
b 40;
}
betaMax 50;
maxInitChange 0.2;
}
updateMethod
{
method ISQP;
targetConstraintReduction 0.1;
preconditioner ShermanMorrison;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
runApplication blockMesh
runApplication topoSet
runApplication setsToZones -noFlipMap
runApplication decomposePar
runParallel $(getApplication)
if [[ ! -z $(which cartesian2DMesh) ]]
then
cd reEval
./AllrunReEval > log.AllrunReEval 2>&1 &
cd ..
fi
#------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More