TUT: additional topology optimisation tutorials

- 1_Inlet_2_Outlet/porosityBased/R_10x-init/reEval: showcases the
  initialization of the design variables using topoSet and setFields
- 3DBox/losses-mass-uniformity-SQP-extraVars: showcases the use of the
  so-called 'extra variables' in the QP problem which relax it,
  allowing its solution even if there is no feasible one
This commit is contained in:
Vaggelis Papoutsis 2024-11-25 13:09:26 +02:00 committed by Andrew Heather
parent f90c7b17fc
commit 8d0f4eb87a
70 changed files with 3703 additions and 0 deletions

View File

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0.001 0.001 0);
boundaryField
{
frontBack
{
type empty;
}
designWall
{
type fixedValue;
value uniform (0 0 0);
}
IEntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
OEntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
OREntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type fixedValue;
value uniform (1 0 0);
}
outlet
{
type zeroGradient;
}
outlet-right
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,72 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
IEntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
OEntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
OREntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
inlet
{
type adjointInletVelocity;
value uniform (0 0 0);
}
outlet
{
type adjointOutletVelocity;
value uniform (0 0 0);
}
outlet-right
{
type adjointOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class volScalarField;
location "0";
object alpha;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
designWall
{
type zeroGradient;
}
IEntranceWall
{
type zeroGradient;
}
OEntranceWall
{
type zeroGradient;
}
OREntranceWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
outlet-right
{
type fixedValue;
value uniform 0;
}
frontBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type zeroGradient;
}
IEntranceWall
{
type zeroGradient;
}
OEntranceWall
{
type zeroGradient;
}
OREntranceWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0.0;
}
outlet-right
{
type fixedValue;
value uniform 0.0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type zeroGradient;
}
IEntranceWall
{
type zeroGradient;
}
OEntranceWall
{
type zeroGradient;
}
OREntranceWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type adjointOutletPressure;
value uniform 0.0;
}
outlet-right
{
type adjointOutletPressure;
value uniform 0.0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,14 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
if [ -d "reEval" ]
then
cd reEval
./Allclean
cd ..
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
restore0Dir
runApplication blockMesh
runApplication topoSet
runApplication setsToZones -noFlipMap
runApplication setFields
runApplication decomposePar
runParallel $(getApplication)
if [[ ! -z $(which cartesian2DMesh) ]]
then
echo "Re-evaluating topO solution on a body-fitted grid"
cd reEval
./AllrunReEval > log.AllrunReEval 2>&1 && echo "End" >> log.AllrunReEval
cd ..
fi
#------------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@ -0,0 +1,76 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0.001 0.001 0);
boundaryField
{
frontBack
{
type empty;
}
designWall
{
type fixedValue;
value uniform (0 0 0);
}
topOPatch
{
type fixedValue;
value uniform (0 0 0);
}
IEntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
OEntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
OREntranceWall
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type fixedValue;
value uniform (1 0 0);
}
outlet
{
type zeroGradient;
}
outlet-right
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
topOPatch
{
type adjointWallVelocity;
value uniform (0 0 0);
}
IEntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
OEntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
OREntranceWall
{
type adjointWallVelocity;
value uniform (0 0 0);
}
inlet
{
type adjointInletVelocity;
value uniform (0 0 0);
}
outlet
{
type adjointOutletVelocity;
value uniform (0 0 0);
}
outlet-right
{
type adjointOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,72 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type zeroGradient;
}
topOPatch
{
type zeroGradient;
}
IEntranceWall
{
type zeroGradient;
}
OEntranceWall
{
type zeroGradient;
}
OREntranceWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0.0;
}
outlet-right
{
type fixedValue;
value uniform 0.0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,72 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
}
designWall
{
type zeroGradient;
}
topOPatch
{
type zeroGradient;
}
IEntranceWall
{
type zeroGradient;
}
OEntranceWall
{
type zeroGradient;
}
OREntranceWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type adjointOutletPressure;
value uniform 0.0;
}
outlet-right
{
type adjointOutletPressure;
value uniform 0.0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase
rm -f *.stl *.fms
foamDictionary system/meshDict -entry surfaceFile -set fileName > /dev/null
#------------------------------------------------------------------------------

View File

@ -0,0 +1,18 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
time=$(foamDictionary ../system/controlDict -entry endTime -value)
cp ../optimisation/topOIsoSurfaces/topOIsoSurface$time.stl .
runApplication surfaceToFMS topOIsoSurface$time.stl
foamDictionary system/meshDict -entry surfaceFile -set topOIsoSurface$time.fms > /dev/null
sed -i 's/empty/wall/g' topOIsoSurface$time.fms
sed -i 's/inlet wall/inlet patch/g' topOIsoSurface$time.fms
sed -i 's/outlet wall/outlet patch/g' topOIsoSurface$time.fms
sed -i 's/outlet-right wall/outlet-right patch/g' topOIsoSurface$time.fms
runApplication cartesian2DMesh
runApplication decomposePar
runParallel $(getApplication)
#------------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 100;
deltaT 1;
writeControl timeStep;
writeInterval 3000;
purgeWrite 1;
writeFormat ascii;
writePrecision 6;
writeCompression yes;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
gradConv cellLimited Gauss linear 1;
}
divSchemes
{
default Gauss linear;
div(phi,U) bounded Gauss linearUpwind gradConv;
div(-phi,Ua) bounded Gauss linearUpwind gradConv;
}
interpolationSchemes
{
default linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
solvers
{
"p|pa.*|bTilda"
{
solver PCG;
preconditioner DIC;
tolerance 1e-09;
relTol 0.1;
}
"U|Ua.*"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-9;
relTol 0.1;
};
}
relaxationFactors
{
fields
{
p 0.3;
"pa.*" 0.2;
}
equations
{
U 0.7;
"Ua.*" 0.5;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2406 |
| \\ / 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,91 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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.*");
normalize true;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
}
}
}
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,209 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0) //0
(0 0.3 0) //1
(0 0.5 0) //2
(0 0.55 0) //3
(0 0.75 0) //4
(0 1 0) //5
(0.5 0 0) //6
(0.5 0.3 0) //7
(0.5 0.5 0) //8
(0.5 0.55 0) //9
(0.5 0.75 0) //10
(0.5 1 0) //11
(0.7 0 0) //12
(0.7 0.3 0) //13
(0.7 0.5 0) //14
(0.7 0.55 0) //15
(0.7 0.75 0) //16
(0.7 1 0) //17
(1 0 0) //18
(1 0.3 0) //19
(1 0.5 0) //20
(1 0.55 0) //21
(1 0.75 0) //22
(1 1 0) //23
(0 0 0.1) //24
(0 0.3 0.1) //25
(0 0.5 0.1) //26
(0 0.55 0.1) //27
(0 0.75 0.1) //28
(0 1 0.1) //29
(0.5 0 0.1) //30
(0.5 0.3 0.1) //31
(0.5 0.5 0.1) //32
(0.5 0.55 0.1) //33
(0.5 0.75 0.1) //34
(0.5 1 0.1) //35
(0.7 0 0.1) //36
(0.7 0.3 0.1) //37
(0.7 0.5 0.1) //38
(0.7 0.55 0.1) //39
(0.7 0.75 0.1) //40
(0.7 1 0.1) //41
(1 0 0.1) //42
(1 0.3 0.1) //43
(1 0.5 0.1) //44
(1 0.55 0.1) //45
(1 0.75 0.1) //46
(1 1 0.1) //47
(-0.5 0.3 0) //48
(-0.5 0.5 0) //49
(-0.5 0.3 0.1) //50
(-0.5 0.5 0.1) //51
(0.5 -0.5 0) //52
(0.7 -0.5 0) //53
(0.5 -0.5 0.1) //54
(0.7 -0.5 0.1) //55
(1.5 0.55 0) //56
(1.5 0.75 0) //57
(1.5 0.55 0.1) //58
(1.5 0.75 0.1) //59
);
blocks
(
hex (48 50 25 1 49 51 26 2 ) (1 50 20) simpleGrading (1 1 1) //0
hex (0 24 30 6 1 25 31 7 ) (1 50 30) simpleGrading (1 1 1) //1
hex (1 25 31 7 2 26 32 8 ) (1 50 20) simpleGrading (1 1 1) //2
hex (2 26 32 8 3 27 33 9 ) (1 50 5) simpleGrading (1 1 1) //3
hex (3 27 33 9 4 28 34 10) (1 50 20) simpleGrading (1 1 1) //4
hex (4 28 34 10 5 29 35 11) (1 50 25) simpleGrading (1 1 1) //5
hex (6 30 36 12 7 31 37 13) (1 20 30) simpleGrading (1 1 1) //6
hex (7 31 37 13 8 32 38 14) (1 20 20) simpleGrading (1 1 1) //7
hex (8 32 38 14 9 33 39 15) (1 20 5) simpleGrading (1 1 1) //8
hex (9 33 39 15 10 34 40 16) (1 20 20) simpleGrading (1 1 1) //9
hex (10 34 40 16 11 35 41 17) (1 20 25) simpleGrading (1 1 1) //10
hex (12 36 42 18 13 37 43 19) (1 30 30) simpleGrading (1 1 1) //11
hex (13 37 43 19 14 38 44 20) (1 30 20) simpleGrading (1 1 1) //12
hex (14 38 44 20 15 39 45 21) (1 30 5) simpleGrading (1 1 1) //13
hex (15 39 45 21 16 40 46 22) (1 30 20) simpleGrading (1 1 1) //14
hex (16 40 46 22 17 41 47 23) (1 30 25) simpleGrading (1 1 1) //15
hex (52 54 55 53 6 30 36 12) (1 20 50) simpleGrading (1 1 1) //16
hex (21 45 58 56 22 46 59 57) (1 50 20) simpleGrading (1 1 1) //17
);
edges
(
);
patches
(
wall designWall
(
(1 0 24 25)
(3 2 26 27)
(4 3 27 28)
(5 4 28 29)
(11 5 29 35)
(17 11 35 41)
(23 17 41 47)
(22 23 47 46)
(20 21 45 44)
(19 20 44 43)
(18 19 43 42)
(0 6 30 24)
(12 18 42 36)
)
wall IEntranceWall
(
(48 1 25 50)
(51 26 2 49)
)
wall OEntranceWall
(
(6 52 54 30)
(12 36 55 53)
)
wall OREntranceWall
(
(22 46 59 57)
(21 56 58 45)
)
patch inlet
(
(49 48 50 51)
)
patch outlet
(
(52 53 55 54)
)
patch outlet-right
(
(56 57 59 58)
)
empty frontBack
(
(51 50 25 26)
(49 2 1 48)
(30 54 55 36)
(6 12 53 52)
(46 45 58 59)
(22 57 56 21)
(0 1 7 6)
(1 2 8 7)
(2 3 9 8)
(3 4 10 9)
(4 5 11 10)
(6 7 13 12)
(7 8 14 13)
(8 9 15 14)
(9 10 16 15)
(10 11 17 16)
(12 13 19 18)
(13 14 20 19)
(14 15 21 20)
(15 16 22 21)
(16 17 23 22)
(24 30 31 25)
(25 31 32 26)
(26 32 33 27)
(27 33 34 28)
(28 34 35 29)
(30 36 37 31)
(31 37 38 32)
(32 38 39 33)
(33 39 40 34)
(34 40 41 35)
(36 42 43 37)
(37 43 44 38)
(38 44 45 39)
(39 45 46 40)
(40 46 47 41)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 50;
deltaT 1;
writeControl timeStep;
writeInterval 50;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression yes;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,26 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
momSource
{
type topOSource;
names (U Ua);
function linear;
interpolationField beta;
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
gradConv cellLimited Gauss linear 1;
}
divSchemes
{
default Gauss linear;
div(phi,U) bounded Gauss linearUpwind gradConv;
div(-phi,Ua) bounded Gauss linearUpwind gradConv;
}
interpolationSchemes
{
default linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
solvers
{
"p|pa.*|bTilda"
{
solver PCG;
preconditioner DIC;
tolerance 1e-09;
relTol 0.1;
}
"U|Ua.*"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-9;
relTol 0.1;
};
}
relaxationFactors
{
fields
{
p 0.3;
"pa.*" 0.2;
}
equations
{
U 0.7;
"Ua.*" 0.5;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,140 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 300;
residualControl
{
"p.*" 5.e-7;
"U.*" 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;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 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 10;
function tanh;
b 20;
}
betaMax 2500;
maxInitChange 0.2;
}
updateMethod
{
method ISQP;
preconditioner ShermanMorrison;
includeExtraVars true;
c 2;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- 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 setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha 0
);
regions
(
boxToCell
{
box (0.0 0.0 0.0)(0.35 0.15 1.0);
fieldValues
(
volScalarFieldValue alpha 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,82 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
// Inlet
{
name IEntranceSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-1.0 0.0 0.0)(0.0 1.0 1.0);
}
}
// Outlet
{
name OEntranceSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-1.0 -1.0 0.0)(1.0 0.0 1.0);
}
}
// Outlet-right
{
name OREntranceSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (1.0 0.0 0.0)(2.0 1.0 1.0);
}
}
// Design space
{
name designSpace;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0.0 0.0 0.0)(0.1 0.1 1.0);
}
}
// Initialisation
/*
{
name init;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0.0 0.0 0.0)(0.45 0.25 1.0);
}
}
*/
);
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0 0 0);
boundaryField
{
"wall|fixedWalls"
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type surfaceNormalFixedValue;
refValue uniform -10;
value uniform (0 0 0);
}
"outlet.*"
{
type zeroGradient;
}
symmetry
{
type symmetry;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0 0 0);
boundaryField
{
"wall|fixedWalls"
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type adjointInletVelocity;
value uniform (0 0 0);
}
"outlet.*"
{
type adjointOutletVelocityFlux;
value uniform (0 0 0);
}
symmetry
{
type symmetry;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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
{
"wall|fixedWalls"
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
"outlet.*"
{
type fixedValue;
value uniform 0;
}
symmetry
{
type symmetry;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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
{
"wall|fixedWalls"
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
"outlet.*"
{
type adjointOutletPressure;
value uniform 0;
}
symmetry
{
type symmetry;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
if [ -d reEval ]
then
cd reEval
./Allclean
cd ..
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
runApplication blockMesh
runApplication -s 'refinementZones' topoSet
runApplication refineHexMesh -overwrite allIO
runApplication -s 'allZones' topoSet
runApplication setsToZones -noFlipMap
runApplication createPatch -overwrite
restore0Dir
runApplication decomposePar
runParallel $(getApplication)
if [ -d reEval ]
then
cd reEval
./AllrunReEval > log.AllrunReEval 2>&1 && echo "End" >> log.AllrunReEval
cd ..
fi
#------------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0 0 0);
boundaryField
{
"wall|fixedWalls|topOPatch"
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type surfaceNormalFixedValue;
refValue uniform -10;
value uniform (0 0 0);
}
"outlet.*"
{
type zeroGradient;
}
symmetry
{
type symmetry;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 (0 0 0);
boundaryField
{
"wall|fixedWalls|topOPatch"
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type adjointInletVelocity;
value uniform (0 0 0);
}
"outlet.*"
{
type adjointOutletVelocityFlux;
value uniform (0 0 0);
}
symmetry
{
type symmetry;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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
{
"wall|fixedWalls|topOPatch"
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
"outlet.*"
{
type fixedValue;
value uniform 0;
}
symmetry
{
type symmetry;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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
{
"wall|fixedWalls|topOPatch"
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
"outlet.*"
{
type adjointOutletPressure;
value uniform 0;
}
symmetry
{
type symmetry;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
# Remove surface and features
rm -rf constant/extendedFeatureEdgeMesh
rm -rf constant/triSurface/*
# Restore default entries in snappyHexMeshDict and surfaceFeatureExtractDict
foamDictionary system/snappyHexMeshDict -entry castellatedMeshControls.locationInMesh -remove
foamDictionary system/snappyHexMeshDict -entry castellatedMeshControls.locationInMesh -add "myLocationInMesh"
topOEndTime=$(foamDictionary ../system/controlDict -entry 'endTime' -value)
fileName=topOIsoSurface$topOEndTime
sed -i "s|$fileName|stlName|g" system/snappyHexMeshDict
sed -i "s|$fileName|stlName|g" system/surfaceFeatureExtractDict
#------------------------------------------------------------------------------

View File

@ -0,0 +1,31 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
topOEndTime=$(foamDictionary ../system/controlDict -entry 'endTime' -value)
fileName=topOIsoSurface$topOEndTime
# A bit ugly but expanding a stored variable of the form "(a b c)" seems tricky
locationInMesh="\(0.058 0.15 0.094\)"
sed -i "s|myLocationInMesh|$locationInMesh|g" system/snappyHexMeshDict
sed -i "s|stlName|$fileName|g" system/snappyHexMeshDict
sed -i "s|stlName|$fileName|g" system/surfaceFeatureExtractDict
mkdir -p constant/triSurface
cp ../optimisation/topOIsoSurfaces/$fileName.stl constant/triSurface/.
runApplication blockMesh
runApplication surfaceFeatureExtract
runApplication decomposePar
runParallel snappyHexMesh -overwrite
restore0Dir -processor
runParallel $(getApplication)
#------------------------------------------------------------------------------

View File

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

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicRefineFvMesh;
dynamicRefineFvMeshCoeffs
{
// How often to refine
refineInterval 1;
// Field to be refinement on
field mmagfi;
// Refine field inbetween lower..upper
lowerRefineLevel -0.003;
upperRefineLevel 0;
// If value < unrefineLevel unrefine
unrefineLevel -0.003;
// Have slower than 2:1 refinement
nBufferLayers 1;
// Refine cells only up to maxRefinement levels
maxRefinement 1;
// Stop refinement if maxCells reached
maxCells 500000;
// Flux field and corresponding velocity field. Fluxes on changed
// faces get recalculated by interpolating the velocity. Use 'none'
// on surfaceScalarFields that do not need to be reinterpolated.
correctFluxes
(
// (phi U)
// (phia Ua)
);
// Write the refinement level as a volScalarField
dumpLevel true;
}
// ************************************************************************* //

View File

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

View File

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

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0) //0
(0.3 0 0) //1
(0.3 0.3 0) //2
(0 0.3 0) //3
(0 0 0.3) //4
(0.3 0 0.3) //5
(0.3 0.3 0.3) //6
(0 0.3 0.3) //7
);
blocks
(
hex (0 1 2 3 4 5 6 7) (75 75 75) simpleGrading (1 1 1)
);
edges
(
);
patches
(
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 100;
deltaT 1;
writeControl timeStep;
writeInterval 3000;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression false;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
gradUATC cellLimited Gauss linear 1;
grad(U) cellLimited Gauss linear 1;
gradUConv cellLimited Gauss linear 1;
gradUaConv cellLimited Gauss linear 1;
}
divSchemes
{
default Gauss linear;
div(phi,U) bounded Gauss linearUpwindV gradUConv;
div(-phi,Ua) bounded Gauss linearUpwindV gradUaConv;
}
interpolationSchemes
{
default linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
snGradSchemes
{
default corrected;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
solvers
{
"p|pa.*|bTilda"
{
solver PCG;
preconditioner DIC;
tolerance 1e-09;
relTol 0.1;
}
"U|Ua.*" smoothSolver
{
smoother GaussSeidel;
tolerance 1e-9;
relTol 0.1;
};
}
relaxationFactors
{
fields
{
p 0.6;
"pa.*" 0.7;
}
equations
{
U 0.8;
"Ua.*" 0.7;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,104 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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.*");
}
uniformity
{
weight 1.;
type uniformityPatch;
patches (outlet1 outlet2);
}
mass
{
weight 1.;
type flowRatePartition;
inletPatches (inlet);
outletPatches (outlet1 outlet2);
targetFractions (0.5 0.5);
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
residualControl
{
"pa.*" 5.e-7;
"Ua.*" 5.e-7;
}
}
}
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
castellatedMesh true;
snap true;
addLayers true;
singleRegionName true;
geometry
{
stlName.stl
{
type triSurfaceMesh;
name duct;
regions
{
fixedWalls
{
name fixedWalls;
}
symmetry
{
name symmetry;
}
outlet1
{
name outlet1;
}
outlet2
{
name outlet2;
}
inlet
{
name inlet;
}
topOPatch
{
name topOPatch;
}
}
}
}
castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 2000000;
minRefinementCells 100;
maxLoadUnbalance 0.2;
nCellsBetweenLevels 2;
features ( { file stlName.eMesh ; level 2 ; } );
refinementSurfaces
{
duct
{
level ( 2 2 );
patchInfo
{
type patch;
}
regions
{
"topOPatch|fixedWalls"
{
level ( 2 2 );
patchInfo
{
type wall;
inGroups ( ductWalls );
}
}
symmetry
{
level ( 1 1 );
patchInfo
{
type symmetry;
}
}
}
}
}
resolveFeatureAngle 30;
refinementRegions
{
}
allowFreeStandingZoneFaces true;
locationInMesh myLocationInMesh;
}
snapControls
{
nSmoothPatch 3;
tolerance 2;
nSolveIter 30;
nRelaxIter 5;
nFeatureSnapIter 10;
implicitFeatureSnap false;
explicitFeatureSnap true;
multiRegionFeatureSnap false;
}
addLayersControls
{
relativeSizes true;
layers
{
"topOPatch|fixedWalls"
{
nSurfaceLayers 2;
}
}
expansionRatio 1;
finalLayerThickness 0.3;
minThickness 0.1;
nGrow 0;
featureAngle 60;
slipFeatureAngle 30;
nRelaxIter 3;
nSmoothSurfaceNormals 1;
nSmoothNormals 3;
nSmoothThickness 10;
maxFaceThicknessRatio 0.5;
maxThicknessToMedialRatio 0.3;
minMedialAxisAngle 90;
nBufferCellsNoExtrude 0;
nLayerIter 50;
}
meshQualityControls
{
maxNonOrtho 65;
maxBoundarySkewness 20;
maxInternalSkewness 4;
maxConcave 80;
minVol 1e-13;
minTetQuality 1e-15;
minArea -1;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.02;
minVolRatio 0.01;
minTriangleTwist -1;
nSmoothScale 4;
errorReduction 0.75;
}
writeFlags ( scalarLevels layerSets layerFields );
mergeTolerance 1e-06;
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object surfaceFeatureExtractDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
stlName.stl
{
// How to obtain raw features (extractFromFile || extractFromSurface)
extractionMethod extractFromSurface;
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 120;
subsetFeatures
{
// Keep nonManifold edges (edges with >2 connected faces)
nonManifoldEdges no;
// Keep open edges (edges with 1 connected face)
openEdges yes;
}
// Write options
// Write features to obj format for postprocessing
writeObj yes;
}
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0) //0
(0.2 0 0) //1
(0.2 0.1 0) //2
(0.2 0.2 0) //3
(0.1 0.2 0) //4
(0 0.1 0) //5
(0 0 0.1) //6
(0.2 0 0.1) //7
(0.2 0.1 0.1) //8
(0.2 0.2 0.1) //9
(0.1 0.2 0.1) //10
(0 0.1 0.1) //11
);
blocks
(
hex (0 1 2 5 6 7 8 11) (76 38 38) simpleGrading (1 1 1)
hex (5 2 3 4 11 8 9 10) (76 38 38) simpleGrading (1 1 1)
);
edges
(
);
patches
(
wall fixedWalls
(
(0 1 2 5)
(7 1 2 8)
(6 0 5 11)
(0 1 7 6)
(5 2 3 4)
(8 2 3 9)
(11 5 4 10)
(4 3 9 10)
)
symmetry symmetry
(
(6 7 8 11)
(11 8 9 10)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 binary;
writePrecision 6;
writeCompression false;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View File

@ -0,0 +1,91 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// This application/dictionary controls:
// - optional: create new patches from boundary faces (either given as
// a set of patches or as a faceSet)
// - always: order faces on coupled patches such that they are opposite. This
// is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.
// - always: remove zero-sized (non-coupled) patches (that were not added)
// 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
// "face 0 area does not match neighbour 2 by 0.0100005%"
// " -- possible face ordering problem."
// - in polyMesh/boundary file:
// - loosen matchTolerance of all cyclics to get case to load
// - or change patch type from 'cyclic' to 'patch'
// and regenerate cyclic as above
// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
// with transformations (i.e. cyclics).
pointSync false;
// Patches to create.
patches
(
{
name inlet;
patchInfo
{
type patch;
}
constructFrom set;
set inlet;
}
{
// Name of new patch
name outlet1;
// Dictionary to construct new patch from
patchInfo
{
type patch;
}
constructFrom set;
set outlet1;
}
{
// Name of new patch
name outlet2;
// Dictionary to construct new patch from
patchInfo
{
type patch;
}
constructFrom set;
set outlet2;
}
);
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
momSource
{
type topOSource;
names (U Uaas1 Uauniformity Uamass);
function BorrvallPetersson;
b 100;
interpolationField beta;
}

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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;
gradUATC cellLimited Gauss linear 1;
grad(U) cellLimited Gauss linear 1;
gradUConv cellLimited Gauss linear 1;
gradUaConv cellLimited Gauss linear 1;
}
divSchemes
{
default Gauss linear;
div(phi,U) bounded Gauss linearUpwindV gradUConv;
"div\(-phi,Ua.*\)" bounded Gauss linearUpwindV gradUaConv;
}
interpolationSchemes
{
default linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
snGradSchemes
{
default corrected;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

@ -0,0 +1,237 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / 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 300;
consistent true;
residualControl
{
"p.*" 1.e-6;
"U.*" 1.e-6;
}
}
}
}
adjointManagers
{
adjManager1
{
primalSolver op1;
adjointSolvers
{
as1
{
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
isConstraint true;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
losses
{
weight 1.;
type PtLosses;
patches ("inlet.*" "outlet.*");
normalize true;
target 0.778;
normFactor 0.778;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
consistent true;
residualControl
{
"pa.*" 1.e-6;
"Ua.*" 1.e-6;
}
}
}
uniformity
{
// choose adjoint solver
//----------------------
active true;
type incompressible;
solver adjointSimple;
// manage objectives
//------------------
objectives
{
type incompressible;
objectiveNames
{
uniformity
{
weight 1.;
type uniformityPatch;
patches (outlet1 outlet2);
normalize true;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
consistent true;
residualControl
{
"pa.*" 1.e-6;
"Ua.*" 1.e-6;
}
}
}
vol
{
// choose adjoint solver
//----------------------
active true;
type null;
isConstraint true;
// manage objectives
//------------------
objectives
{
type geometric;
objectiveNames
{
vol
{
weight 1.;
type topOVolume;
percentage 0.1;
}
}
}
}
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 (outlet1 outlet2);
targetFractions (0.5 0.5);
normalize true;
target 1.e-5;
}
}
}
// ATC treatment
//--------------
ATCModel
{
ATCModel standard;
}
// solution control
//------------------
solutionControls
{
nIters 300;
consistent true;
residualControl
{
"pa.*" 1.e-6;
"Ua.*" 1.e-6;
}
}
}
}
}
}
optimisation
{
designVariables
{
type topO;
sensitivityType topO;
regularisation
{
regularise true;
growFromWalls true;
//meanRadiusMult 10;
radius 0.0380789;
function tanh;
b 20;
}
betaMaxType Darcy;
DarcyCoeffs
{
inletPatches (inlet);
}
maxInitChange 0.2;
}
updateMethod
{
method ISQP;
preconditioner ShermanMorrison;
includeExtraVars true;
// c 2;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name fixedWalls;
type faceSet;
action new;
source patchToFace;
patch fixedWalls;
}
{
name inlet;
type faceSet;
action new;
source faceToFace;
set fixedWalls;
}
{
name inlet;
type faceSet;
action subset;
source boxToFace;
sourceInfo
{
box (0.030 0.130 0.080) (0.070 0.170 0.120);
}
}
{
name inletZone;
type cellSet;
action new;
source faceToCell;
set inlet;
option any;
}
{
name outlet1;
type faceSet;
action new;
source faceToFace;
set fixedWalls;
}
{
name outlet1;
type faceSet;
action subset;
source boxToFace;
sourceInfo
{
box (0.199 0.088 0.02) (0.201 0.112 0.044);
}
}
{
name outlet1Zone;
type cellSet;
action new;
source faceToCell;
set outlet1;
option any;
}
{
name outlet2;
type faceSet;
action new;
source faceToFace;
set fixedWalls;
}
{
name outlet2;
type faceSet;
action subset;
source boxToFace;
sourceInfo
{
box (0.199 0.088 0.064) (0.201 0.112 0.088);
}
}
{
name outlet2Zone;
type cellSet;
action new;
source faceToCell;
set outlet2;
option any;
}
{
name allIO;
type cellSet;
action new;
source cellToCell;
sets (inletZone outlet1Zone outlet2Zone);
}
);
// ************************************************************************* //