the continuous adjoint turbulent solver for topology ...hani/kurser/os_cfd_2019/luis...final...
TRANSCRIPT
The Continuous Adjoint Turbulent Solver for Topology Optimization “adjointOptimisationFoam”Industrial Approach
MSc. Ing. Luis Fernando Garcia Rodriguez
University of São Paulo (USP) Brazil
CFD with OpenSource Software course, Final Presentation
Chalmers University, Sweden
November 27th, 2019
The Continuous Adjoint Turbulent Solver for Topology Optimization “adjointOptimisationFoam”Industrial Approach
Sponsors
CFD with OpenSource Software course, Final Presentation
University of Chalmers, Sweden
November 27th, 2019
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• Continous Adjoint Turbulent solver: “adjointOptimizationFoam”
• Turbulent Sensitivity Calculation
• How to use the solver?
• Modifications to the adjoint Turbulent sensitivity
3
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• “adjointOptimizationFoam” solver
• Sensitivity Calculation
• Modifications
4
RESEARCH CENTRE FOR GAS INNOVATION
Research Group
5
RESEARCH CENTRE FOR GAS INNOVATION
Research Group
6
• >300 researchers
• Research programmes: Natural Gas, Biogas, Hydrogen, Gas Transport and Monitoring, CO2 Abatement and CarbonCapture and Storage
• >45 Projects
RESEARCH CENTRE FOR GAS INNOVATION 7
Power consumed by aCO2 compressor ~ 5%of the plant rating, e.g.a 600 MW plant wouldrequire 30 MW or40.000 [hp]
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• “adjointOptimizationFoam” solver
• Sensitivity Calculation
• Modifications
8
RESEARCH CENTRE FOR GAS INNOVATION
Topology Optimization Method (TOM)
• Goal:
– Distribute material in a domain to minimize/maximize an objective function while keeping constraints satisfied
• In flows:
– Uses porosity field to represent solid regions
9
High permeability
Low permeability
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• “adjointOptimizationFoam” solver
• Sensitivity Calculation
• Modifications
10
RESEARCH CENTRE FOR GAS INNOVATION
Topology Optimization Formulation*
11
In compressible Navier Stokes equations in non-conservative form
𝛻 ∙ 𝒖 = 0
𝒖 ∙ 𝛻 𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻 = 0
Navier Stokes Modified Equations
𝛻 ∙ 𝒖 = 0
(𝒖 ∙ 𝛻)𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻 + 𝛼𝒖 = 0
RESEARCH CENTRE FOR GAS INNOVATION
Topology Optimization Formulation*
12
𝑀𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝐽 = −න𝛤
𝑝 +1
2𝑢2 𝒖 ∙ 𝒏 𝑑𝛤
𝑆𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜𝑅𝑢 = (𝒖 ∙ 𝛻)𝒖 +
1
𝜌𝛻𝑝 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻 + 𝛼𝒖 = 0
𝑅𝑝 = 𝛻 ∙ 𝒖 = 0𝛼𝑚𝑖𝑛 ≤ 𝛼 ≤ 𝛼𝑚𝑎𝑥
Objective Function
J. S. Romero and E. C. N. Silva, “A topology optimization approach applied to laminar flow machine rotor design,” Comput. Methods Appl. Mech. Eng., vol. 279, pp. 268–300, 2014.
RESEARCH CENTRE FOR GAS INNOVATION
Continuous Adjoint Differentiation – Frozen Turbulence
13
𝐿 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 + 𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 ; 𝑐𝑣𝑜𝑙 ∗=
𝜌𝑑Ω
𝑑Ω
1
𝑉𝑡𝑎𝑟𝑔𝑒𝑡− 1
2
𝐿𝑎𝑢𝑔 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 +𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 +න
Ω
𝑞𝑅𝑝 𝑑Ω +නΩ
𝒗𝑅𝒖 𝑑Ω
;𝜆𝑣𝑜𝑙 , 𝑞 and 𝑣 are Lagrange multipliers
*J. M. Verboom, “Department of Precision and Microsystems Engineering Design and Additive Manufacturing of Manifolds for Navier-Stokes Flow :,” 2017.
𝐿𝑎𝑔𝑟𝑎𝑛𝑔𝑒 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑒𝑟𝑠
𝐷𝑒𝑟𝑖𝑣𝑖𝑛𝑔 𝑤. 𝑟. 𝑡 𝑒𝑎𝑐ℎ 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒
𝛿𝐿 = 𝛿𝑢𝐿 + 𝛿𝑝𝐿 + 𝛿𝛼𝐿 ∴ 𝛿𝛼𝐿 = 0 ⋀ 𝛿𝑢𝐿 + 𝛿𝑝𝐿 = 0
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• “adjointOptimizationFoam” solver
• Sensitivity Calculation
• Modifications
14
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
15
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.C
16
(𝒖 ∙ 𝛻)𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻
+ 𝛼𝒖 = 0
State equations are included// Pressure-velocity SIMPLE
corrector
116 {
117 // Momentum predictor
118
119 tmp<fvVectorMatrix> tUEqn
120 (
121 fvm::div(phi, U)
122 + turbulence->divDevReff(U)
123 + fvm::Sp(alpha, U)
124 ==
125 fvOptions(U)
126 );
127 fvVectorMatrix& UEqn =
tUEqn.ref();
128
129 UEqn.relax();
130
131 fvOptions.constrain(UEqn);
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
17
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
Continuous Adjoint Differentiation Frozen Turbulence
18
𝛿𝐽
𝛿𝑢+න
Ω
𝑞𝛿 𝛻 ∙ 𝒖
𝛿𝑢𝑑Ω + න
Ω
𝒗𝛿 𝒖 ∙ 𝛻 𝒖 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻 + 𝛼𝒖
𝛿𝑢𝑑Ω
+𝛿𝐽
𝛿𝑝+න
Ω
𝒗𝛿
1𝜌 𝛻𝑝
𝛿𝑝𝑑Ω = 0
𝛿𝑢𝐿 + 𝛿𝑝𝐿 = 0
𝛿𝐽
𝛿𝑢+ න
Ω
𝑞𝛿𝑅𝑝
𝛿𝑢𝑑Ω + න
Ω
𝒗𝛿𝑅𝑢
𝛿𝑢𝑑Ω +
𝛿𝐽
𝛿𝑝+ න
Ω
𝑞𝛿𝑅𝑝
𝛿𝑝𝑑Ω + න
Ω
𝒗𝛿𝑅𝑢
𝛿𝑝𝑑Ω = 0
RESEARCH CENTRE FOR GAS INNOVATION
Continuous Adjoint Differentiation Frozen Turbulence
19
𝛿𝑢𝐿 + 𝛿𝑝𝐿 = 0
Adjoint NS−2D 𝒗 𝒖 − 𝛻 ∙ 2ν𝐷 𝒗 + 𝛼𝒗 = −𝛻𝑞
𝛻 ∙ 𝒗 = 0
Inlet and Wall BC
𝒗 ∙ 𝒖 + 𝑣𝑛𝑢𝑛 + ν 𝒏 ∙ 𝛻 𝑣𝑛 − 𝑞 +𝜕𝐽Γ𝜕𝑢𝑛
= 0
𝑢𝑛𝑣𝑡 + ν 𝒏 ∙ 𝛻 𝑣𝑡 +𝜕𝐽Γ𝜕𝑢𝑡
= 0
𝑣𝑡 = 0
𝑣𝑛 = −𝜕𝐽Γ𝜕𝑝
𝛻𝑞 ∙ 𝒏 = 0
Outlet BC
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.C
20
−2D 𝒗 𝒖 − 𝛻 ∙ 2ν𝐷 𝒗 + 𝛼𝒗 = −𝛻𝑞
Adjoint equations are included
// Adjoint Pressure-velocity
SIMPLE corrector
175 {
187 zeroCells(adjointTransposeConv
ection, inletCells);
188
189 tmp<fvVectorMatrix> tUaEqn
190 (
191 fvm::div(-phi, Ua)
192 - adjointTransposeConvection
193 + turbulence->divDevReff(Ua)
194 + fvm::Sp(alpha, Ua)
195 ==
196 fvOptions(Ua)
197 );
198 fvVectorMatrix& UaEqn =
tUaEqn.ref();
199
200 UaEqn.relax();
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
21
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.C
22
𝑁𝑜 𝑠𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦 𝑐𝑎𝑙𝑐𝑢𝑙𝑎𝑡𝑖𝑜𝑛
}
242
243 laminarTransport.correct();
244 turbulence->correct();
245
246 runTime.write();
247
248 runTime.printExecutionTime(Inf
o);
249 }
250
251 Info<< "End\n" << endl;
252
253 return 0;
254 }
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.C
23
𝛿𝛼𝐿 = 𝒖 ∙ 𝒗 V
Include the sensitivity calculation*
U. Nilsson, “Description of AdjointShapeOptimizationFoam and how to implement new cost functions,” pp. 1–40, 2013.
}
243 laminarTransport.correct();
244 turbulence->correct();
245 sens=(Ua&U)*vol
246 runTime.write();
247
248 runTime.printExecutionTime(Inf
o);
249 }
250
251 Info<< "End\n" << endl;
252
253 return 0;
254 }
RESEARCH CENTRE FOR GAS INNOVATION
Material Distribution
24
And 𝛼 represents material distribution* , 0 ≤ 𝜌 ≤ 1
𝛼 𝜌 = ത𝛼 + 𝛼 − ത𝛼 𝜌1 + 𝑞
𝜌 + 𝑞
Where 𝑞 controls grey level
𝜌 = 𝛾 the volumen fraction
And 𝛼 =2.5𝜇
1002and ത𝛼 =
2.5𝜇
0.012, are the mínimum and
máximum values of 𝛼
Navier Stokes Modified Equations
𝛻 ∙ 𝒖 = 0
(𝒖 ∙ 𝛻)𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 2𝜈𝑫 𝒖 + 𝛼𝒖 = 0
*T. Borrvall and J. Petersson, “Topology optimization of fluids in Stokes flow,” Int. J. Numer. Methods Fluids, vol. 41, no. 1, pp. 77–107, 2003.
RESEARCH CENTRE FOR GAS INNOVATION
Material Distribution
25
And 𝛼 represents material distribution* , 0 ≤ 𝜌 ≤ 1
𝛼 𝜌 = ത𝛼 + 𝛼 − ത𝛼 𝜌1 + 𝑞
𝜌 + 𝑞
Where 𝑞 controls grey level
𝜌 = 𝛾 the volumen fraction
And 𝛼 =2.5𝜇
1002and ത𝛼 =
2.5𝜇
0.012, are the mínimum and máximum
values of 𝛼
Navier Stokes Modified Equations
𝛻 ∙ 𝒖 = 0
(𝒖 ∙ 𝛻)𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 2𝜈𝑫(𝒖) + 𝛼𝒖 = 0
*T. Borrvall and J. Petersson, “Topology optimization of fluids in Stokes flow,” Int. J. Numer. Methods Fluids, vol. 41, no. 1, pp. 77–107, 2003.
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity Formulation – Frozen Turbulence
26
𝛿𝛼𝐿𝑎𝑢𝑔 = 𝛿𝛼 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 + 𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 +න
Ω
𝑞𝑅𝑝 𝑑Ω +නΩ
𝒗𝑅𝒖 𝑑Ω
𝛿𝑅𝑢
𝛿𝛼𝒖 ∙ 𝛻 𝒖 + 𝛻𝑝 − 𝛻 ∙ 2ν𝐷 𝒖 + 𝛼𝒖 = 𝒖
𝛿𝛼
𝛿𝜌
𝛿𝛼𝐿 = නΩ
𝒖 ∙ 𝒗 𝑑Ω𝜕𝛼
𝜕𝜌+ −𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙
𝛿𝑐𝑣𝑜𝑙𝛿𝛼
𝛿𝛼𝐿 = 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2 + −λ𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2
ത𝛼 Ω𝑑Ω
Ω
1 −𝛼ത𝛼𝑑Ω
Ω𝑑Ω
− V
𝛿𝐿
𝛿𝛼=𝛿𝐽
𝛿𝛼+න
Ω
𝑞𝛿𝑅𝑝
𝛿𝛼𝑑Ω +න
Ω
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω +න
Ω
−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙𝛿𝑐𝑣𝑜𝑙𝛿𝛼
𝑑Ω
𝑤ℎ𝑒𝑟𝑒
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.C
27
𝛿𝛼𝐿
= 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2
+ (−λ𝑣𝑜𝑙
Update the sensitivity calculation
}
243 laminarTransport.correct();
244 turbulence->correct();
245 sens=(Ua&U)*vol*((alphaMin-
alphaMax)*q*(1+q)/sqr(vf+q))*cte +
(-lvol+2*wf*sqr(1-(alpha/alphaMax)-
vf))*(2/(alphaMax*vol))*(1-
(alpha/alphaMax)-vf)*cte2
246 runTime.write();
247
248 runTime.printExecutionTime(Inf
o);
249 }
250
251 Info<< "End\n" << endl;
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
28
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
State Equations “adjointOptimizationFoam”
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
adjointShapeOptimizationFoam.CMaterial Distribution
29
𝛼𝑛+1 = 𝛼𝑛 + 𝛿𝛼𝐿 ∗ 𝑙𝑎𝑚𝑏𝑑𝑎
𝛼𝑛+1 = 𝛼𝑛 − 𝛿𝛼𝐿 ∗ 𝑙𝑎𝑚𝑏𝑑𝑎
𝛼𝑛+1 = 𝛼𝑛 − 𝒖 ∙ 𝒗 V ∗ 𝒍𝒂𝒎𝒃𝒅𝒂
1. Modify the “steepest descent algorithm”*
U. Nilsson, “Description of AdjointShapeOptimizationFoam and how to implement new cost functions,” pp. 1–40, 2013.
Info<< "\nStarting time loop\n" <<
endl;
while (simple.loop())
{
Info<< "Time = " <<
runTime.timeName() << nl << endl;
alpha +=
mesh.fieldRelaxationFactor("alpha
")
*(min(max(alpha - lambda*(Ua &
U), zeroAlpha), alphaMax) - alpha);
RESEARCH CENTRE FOR GAS INNOVATION
Material Distribution
30
𝛼𝑛+1 = 𝛼𝑛 − 𝛿𝛼𝐿 ∗ 𝑙𝑎𝑚𝑏𝑑𝑎
𝛼𝑛+1
= 𝛼𝑛 − 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2
+ (−λ𝑣𝑜𝑙
Update the “steepest descent algorithm”
Info<< "\nStarting time loop\n" <<
endl;
while (simple.loop())
{
Info<< "Time = " <<
runTime.timeName() << nl << endl;
alpha +=
mesh.fieldRelaxationFactor("alpha
")
*(min(max(alpha -
lambda*(Ua&U)*vol*((alphaMin-
alphaMax)*q*(1+q)/sqr(vf+q))*cte +
(-lvol+2*wf*sqr(1-(alpha/alphaMax)-
vf))*(2/(alphaMax*vol))*(1-
(alpha/alphaMax)-vf)*cte2,
zeroAlpha), alphaMax) - alpha);
RESEARCH CENTRE FOR GAS INNOVATION
createFields.H
31
𝛿𝛼𝐿 = 𝒖 ∙ 𝒗
Update the design variable sensitivity
volScalarField alpha
(
IOobject
(
"alpha",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE ),
lambda*max(Ua&U,zeroSensitivity)
);
RESEARCH CENTRE FOR GAS INNOVATION
createFields.H
32
𝛿𝛼𝐿
= 𝒖 ∙ 𝒗 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2
+ (−λ𝑣𝑜𝑙
Update the design variable sensitivity per cell definition
volScalarField alpha
(
IOobject
(
"alpha",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE ),
lambda*max(Ua&U,zeroSensitivity)
);
RESEARCH CENTRE FOR GAS INNOVATION
createFields.H
33
Define the variables to be used at the sensitivity calculation
//sensitivities variables
//domain volume
dimensionedScalar vol
(
"vol",
dimless,
laminarTransport
);
//minimum value of porosity
dimensionedScalar alphaMin
(
"alphaMin",
dimless/dimTime,
laminarTransport
);
.
RESEARCH CENTRE FOR GAS INNOVATION
createFields.H
34
Define the sensitivity calculation
volScalarField sens
(
IOobject
(
"sensitivity",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE ),
(Ua&U)*vol*((alphaMin-
alphaMax)*q*(1+q)/sqr(vf+q))*cte +
(-lvol+2*wf*sqr(1-(alpha/alphaMax)-
vf))*(2/(alphaMax*vol))*(1-
(alpha/alphaMax)-vf)*cte2
);
RESEARCH CENTRE FOR GAS INNOVATION
fvSolution
35
Include the new variables values at constant/transportProperties
transportModel Newtonian ;
nu 1e-5;
lambda 1 e5 ;
alphaMax 2 0 0 . 0 ;
alphaMin 2 0 0 . 0 ;
Vol 0.25 ;
q 0.01;
.
.
.
T. Borrvall and J. Petersson, “Topology optimization of fluids in Stokes flow,” Int. J. Numer. Methods Fluids, vol. 41, no. 1, pp. 77–107, 2003.
RESEARCH CENTRE FOR GAS INNOVATION
Examples
36
Cases tested
𝐿𝑎𝑚𝑖𝑛𝑎𝑟𝑢𝑖𝑛 = 1 𝑚/𝑠𝜈 = 1 𝑚2/𝑠 𝜌𝑑Ω
𝑑Ω= 25%
𝐹𝑟𝑜𝑧𝑒𝑛 𝑇𝑢𝑟𝑏𝑢𝑙𝑒𝑛𝑐𝑒𝑢𝑖𝑛 = 5 𝑚/𝑠𝜈 = 10−5 𝑚2/𝑠𝐼 = 1%𝑘𝜔 − 𝑆𝑆𝑇𝜌𝑑Ω
𝑑Ω= 25%
𝑏𝑒𝑛𝑐ℎ𝑚𝑎𝑟𝑘 𝑐𝑎𝑠𝑒 𝑀𝑜𝑑𝑖𝑓𝑖𝑒𝑑 𝑠𝑜𝑙𝑣𝑒𝑟
RESEARCH CENTRE FOR GAS INNOVATION
Examples
37
Cases tested
𝑏𝑒𝑛𝑐ℎ𝑚𝑎𝑟𝑘 case 𝑀𝑜𝑑𝑖𝑓𝑖𝑒𝑑 𝑠𝑜𝑙𝑣𝑒𝑟
𝐿𝑎𝑚𝑖𝑛𝑎𝑟𝑢𝑖𝑛 = 1 𝑚/𝑠𝜈 = 1 𝑚2/𝑠𝜌𝑑Ω
𝑑Ω= 50%
𝐹𝑟𝑜𝑧𝑒𝑛 𝑇𝑢𝑟𝑏𝑢𝑙𝑒𝑛ce𝑢𝑖𝑛 = 5 𝑚/𝑠𝜈 = 10−5 𝑚2/𝑠𝐼 = 1%𝑘𝜔 − 𝑆𝑆𝑇 𝜌𝑑Ω
𝑑Ω= 50%
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• Continous Adjoint Turbulent solver: “adjointOptimizationFoam”
• Sensitivity Calculation
• Modifications
38
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam Solver
39
• It is a functionality targeting automated gradient-based optimisation loop assisted
by the continuous adjoint method.
• Supports topology and shape optimization.
$FOAM _SOLVERS/incompressible/adjointOptimizationFoam
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam Solver Description
40
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
41
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H"
Fundamental tools for FV calculations
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
42
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H"
Abstract class for optimizationmethods. Declaration of
primalSolvers, adjointSolverManager,
updateDesignVariables, solverPrimalEquations, solveAdjointEquations,
computeSensitivities,updatePrimalBasedQuantities
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
43
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H"
Class declaration of theprimalSolver with
its member functions that
assigns the class use at each cellof the mesh domain.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
44
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H"
Class for managing theadjoint solvers, which are
suposed to be more tan oneper operating point. Define
the update function and clases for solving the adjoint
equations, agregatesensitivites, compute
sensitivities and so on.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
45
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H“
// * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H“
#include "createTime.H“
#include "createMesh.H“
#include "createFields.H"
The construction of anobject which setss the
correct path, créate thetime and the mesh.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
46
#include "fvCFD.H"
#include "optimisationManager.H“
#include "primalSolver.H"
#include "adjointSolverManager.H“
// * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H“
#include "createTime.H“
#include "createMesh.H“
#include "createFields.H" The declaration of theoptimization manager is
made.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
47
createFields.H:
autoPtr<optimisationManager>
optManagerPtr
(
optimisationManager::New(mesh)
);
optimisationManager& om =
optManagerPtr();
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
48
optimisationManager
* “OpenFOAM: API Guide: optimisationManager Class Reference.” [Online]. Available: https://www.openfoam.com/documentation/guides/latest/api/classFoam_1_1optimisationManager.html#ab753cbc2d71764526653cdc4eac7c397. [Accessed: 25-Nov-2019].
*
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
49
// * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n"
<< endl;
for (om++; !om.end(); om++)
{
Info<< "* * * * * *" << endl;
Info<< "Time = "
<<runTime.timeName() <<
endl;
Info<< "* * * * * * * * * * * * *
* * * * * *" << endl;
The time loop is defined, a for loop starts where three
statements aim to show thetimestep at the terminal
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
50
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
If update is stablished, thenthe update design variable
field is used, otherwise, theprimal equations solver is
called.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
51
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
Employ a line search to finda correction satisfying thestop convergence criteria
(not implemented yet)
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
52
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
Solve primal Equations, defined at
optimisationManager.C
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
53
optimizationManager.C
.
void Foam::optimisationManager::solvePrimalEquations()
{
// Solve all primal equations
forAll(primalSolvers_, psI)
{
primalSolvers_[psI].solve();
}
}
Solve primal Equations, defined at optimisationManager.C
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
54
primalSolvers
Sends the solver to solve the primal (state equations)
Incompressible Navier Stokes equations in non-conservativeform
𝛻 ∙ 𝒖 = 0
𝒖 ∙ 𝛻 𝒖 +1
𝜌𝛻𝑝 − 𝛻 ∙ 𝜈 𝛻𝒖 + 𝛻𝒖𝑻 = 0
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
55
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
om.updatePrimalBasedQuantities();
om.solveAdjointEquations();
om.computeSensitivities();
After that, an update of primal Based Quantities is
called.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
56
void
Foam::optimisationManager::updatePrimalBasedQuantities()
{
forAll(adjointSolverManagers_, amI)
{
PtrList<adjointSolver>& adjointSolvers =
adjointSolverManagers_[amI].adjointSolvers();
forAll(adjointSolvers, asI)
{
adjointSolvers[asI].updatePrimalBasedQuantities();
}
}
}
The update of primal Based Quantities is defined at optimisationManager.C
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
57
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
om.updatePrimalBasedQuantities();
om.solveAdjointEquations();
om.computeSensitivities();
Then , the adjoint equationsare requested to be solved
𝛿𝑢𝐿 + 𝛿𝑝𝐿 = 0
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
58
void Foam::optimisationManager::solveAdjointEquations()
{
// Solve all adjoint solver equations
forAll(adjointSolverManagers_, amI)
{
adjointSolverManagers_[amI].solveAdjointEquations();
}
}
the adjoint equations solver is defined at optimisationManager.C
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
59
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
om.updatePrimalBasedQuantities();
om.solveAdjointEquations();
om.computeSensitivities();
Finally the sensitivities are requested to be solved
𝛿𝛼𝐿 = 𝟎
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
60
void Foam::optimisationManager::computeSensitivities()
{
// Compute senstivities from all adjoint solvers
forAll(adjointSolverManagers_, amI)
{
adjointSolverManagers_[amI].computeAllSensitivities();
}
}
the adjoint equations solver is defined at optimisationManager.C
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimizationFoam.C Description
61
if (om.update())
{
om.updateDesignVariables();
}
else
{
om.solvePrimalEquations();
}
om.updatePrimalBasedQuantities();
om.solveAdjointEquations();
om.computeSensitivities();
}
Info<< "End\n" << endl;
return(0);
Ends with the loop of thesolver..
RESEARCH CENTRE FOR GAS INNOVATION
adjointSolverManager Description
62
void Foam::adjointSolverManager::solveAdjointEquations()
{ for (adjointSolver& solver : adjointSolvers_)
{
objectiveManager& objManager = solver.getObjectiveManager();
objManager.updateAndWrite();
solver.solve(); }}
Class for managing the adjoint solvers.
For example for managing the adjoint equations resolutions:
RESEARCH CENTRE FOR GAS INNOVATION
adjointSolverManager Description
63
void Foam::adjointSolverManager::computeAllSensitivities()
{
for (adjointSolver& adjSolver : adjointSolvers_)
{
adjSolver.clearSensitivities();
adjSolver.computeObjectiveSensitivities();
}}
Class for managing the adjoint solvers.
For computing the sensitivities calculation:
RESEARCH CENTRE FOR GAS INNOVATION
Core Solver: adjointSimple
64
Path for getting the core Solver:
The solver is being constructed for managing multiple objective functions andsensitivities calculation instead of a straight line solver, but at the end, what hasbeen implemented is in the “adjointSimple.C” file.
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
65
At “member functions” in solveIter() object frome the “adjointSimple” classcan be found the solver implementation:
void
Foam::adjointSimple::solveIter()
{
const Time& time = mesh_.time();
Info<< "Time = " <<
time.timeName() << "\n" << endl;
Starts by defining the time stepcalculation
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
66
At “memeber functions” in solveIter() object frome the “adjointSimple” classcan be found the solver implementation:
void
Foam::adjointSimple::solveIter()
{
const Time& time = mesh_.time();
Info<< "Time = " <<
time.timeName() << "\n" << endl;
// Grab primal references
const surfaceScalarField& phi =
primalVars_.phi();
Followed by taking the results ofthe state equations variablesand defined them as “phi”
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
67
At “memeber functions” in solveIter() object frome the “adjointSimple” classcan be found the solver implementation:
// Grab primal references
const surfaceScalarField& phi =
primalVars_.phi();
// Grab adjoint references
incompressibleAdjointVars&
adjointVars = getAdjointVars();
volScalarField& pa =
adjointVars.paInst();
volVectorField& Ua =
adjointVars.UaInst();
surfaceScalarField& phia =
adjointVars.phiaInst();
After that, the adjoint variablesto be used are defined
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
68
At “memeber functions” in solveIter() object frome the “adjointSimple” classcan be found the solver implementation:
.
.
.
autoPtr<incompressibleAdjoint::adj
ointRASModel>& adjointTurbulence =
adjointVars.adjointTurbulence();
const label& paRefCell =
solverControl_().pRefCell();
const scalar& paRefValue =
solverControl_().pRefValue();
The new term, the adjointTurbulence 𝑣𝑎 *
E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
Continuous Turbulent Adjoint Equations
69
𝛿𝑢𝐿 + 𝛿𝑝𝐿 + 𝛿෦𝑣𝑎𝐿 + 𝛿∆𝑎𝐿 = 0
𝑅𝑞 = −𝜕𝑢𝑗
𝜕𝑥𝑗= 0
𝑅𝑖𝑢 = 𝑢𝑗
𝜕𝑣𝑗
𝜕𝑥𝑖−𝜕 𝑣𝑗𝑢𝑖
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜐 + 𝜐𝑡
𝜕𝑢𝑖𝜕𝑥𝑗
+𝜕𝑢𝑗
𝜕𝑥𝑖+𝜕𝑞
𝜕𝑥𝑖+ 𝜈𝑎
𝜕𝜈
𝜕𝑥𝑖−
𝜕
𝜕𝑥𝑖𝜈𝑎𝜈
𝐶𝑌𝑌𝑒𝑚𝑗𝑘
𝜕𝑣𝑘𝜕𝑥𝑗
𝑒𝑚𝑙𝑖 +ต𝛼𝑢𝑖𝑇𝑎,𝑢
= 0
𝑅 𝑣𝑎
= −𝜕 𝑣𝑗 𝑣𝑎
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜐 +
𝑣
𝜎
𝜕 𝑣𝑎𝜕𝑥𝑗
+1
𝜎
𝜕 𝑣𝑎𝜕𝑥𝑗
𝜕 𝑣
𝜕𝑥𝑗+2𝑐𝑏2𝜎
𝜕
𝜕𝑥𝑗𝑣𝑎𝜕 𝑣
𝜕𝑥𝑗+ 𝑣𝑎 𝑣𝐶𝑣 +
𝜕𝑣𝑡
𝜕 𝑣
𝜕𝑢𝑖
𝜕𝑥𝑗×
𝜕𝑣𝑖
𝜕𝑥𝑗+𝜕𝑣𝑗
𝜕𝑥𝑖
+ −𝑃 + 𝐷 𝑣𝑎 + ต𝛼 𝑣𝑎𝑇𝑎,𝑣𝑎
= 0
𝑅∆𝑎 = −2𝜕
𝜕𝑥𝑗∆𝑎
𝜕∆
𝜕𝑥𝑗+ 𝑣 𝑣𝑎𝐶∆ = 0
Adjoint NS
E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
BC Continuous Turbulent Adjoint Equations
70
Inlet
E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
𝛿𝐹𝑎𝑢𝑔
𝛿𝑎𝑛= න
𝑆
𝐵𝐶𝑖𝑢 𝜕𝑣𝑖𝜕𝑎𝑛
𝑑𝑆 + න𝑆
𝑢𝑗𝑛𝑗 +𝜕𝐹𝑆𝑖𝜕𝑝
𝑛𝑖𝜕𝑝
𝜕𝑎𝑛𝑑𝑆 + න
𝑆
−𝑢𝑖𝑛𝑗 +𝜕𝐹𝑆𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝜕𝜏𝑖𝑗
𝜕𝑎𝑛𝑑𝑆
𝑢 𝑛 = 𝑢𝑗𝑛𝑗 = −𝜕𝐹𝑆𝐼,𝑖𝜕𝑝
𝑛𝑖
𝑢 𝑡𝐼 =
𝜕𝐹𝑆𝐼,𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝑡𝑖𝐼𝑛𝑗 +
𝜕𝐹𝑆𝐼,𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝑡𝑗𝐼𝑛𝑖
𝑢 𝑡𝐼𝐼 =
𝜕𝐹𝑆𝐼,𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝑡𝑖𝐼𝐼𝑛𝑗 +
𝜕𝐹𝑆𝐼,𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝑡𝑗𝐼𝐼𝑛𝑖
𝜕𝑣𝑖𝜕𝑎𝑛
= 0Outlet
Figure 3. Finite volume adjacent to the wall, where 𝒏 is the outwards normal unit vector, 𝒕𝐼 is parallel to the velocity velocity vector at first cell center P and 𝒕𝑰𝑰 =
𝑒𝑖𝑗𝑘𝑛𝑗𝑡𝑘𝐼 .
RESEARCH CENTRE FOR GAS INNOVATION
Modifications for Threating Turbulence
71
𝒌 − 𝝎 Turbulence model
𝛻 · (𝒖 𝑘) = 𝑻𝑡: 𝛻𝒖 − 𝛽∗𝜔𝑘 + 𝛻 · 𝜈 + 𝜎∗𝑘
𝜔𝛻𝑘 − 𝛼𝑘
𝛻 · 𝒖𝜔 =𝛼𝜔
𝑘𝑻𝑡: 𝛻𝒖 − 𝛽𝜔2 +
𝜎𝑑𝜔𝛻𝑘 · 𝛻𝜔 + 𝛻 · 𝜈 + 𝜎
𝑘
𝜔𝛻𝜔 + 𝛼(𝜔𝑏 − 𝜔)
Spalart Allmaras Turbulence model*
𝑢𝑗𝜕 ǁ𝜈
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜈 +
ǁ𝜈
𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗−𝑐𝑏2𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗
2
− ǁ𝜈𝑃 ǁ𝜈 + ǁ𝜈𝐷 ǁ𝜈 + 𝛼 ǁ𝜈 = 0
𝑇ℎ𝑒𝑛𝛿𝑅 𝑣
𝛿𝛼=𝛿𝛼
𝛿𝛼𝑣 + 𝛼
𝛿 𝑣
𝛿𝛼
*E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
BC Continuous Turbulent Adjoint Equations
72
E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
Wall
𝛿𝐹𝑎𝑢𝑔
𝛿𝑎𝑛= න
𝑆
𝐵𝐶𝑖𝑢 𝜕𝑣𝑖𝜕𝑎𝑛
𝑑𝑆 +න𝑆
𝑢𝑗𝑛𝑗 +𝜕𝐹𝑆𝑖𝜕𝑝
𝑛𝑖𝜕𝑝
𝜕𝑎𝑛𝑑𝑆 +න
𝑆
−𝑢𝑖𝑛𝑗 +𝜕𝐹𝑆𝑘𝜕𝜏𝑖𝑗
𝑛𝑘𝜕𝜏𝑖𝑗
𝜕𝑎𝑛𝑑𝑆
+න𝑆
𝐵𝐶෦𝑣𝑎𝜕 𝑣
𝜕𝑎𝑛𝑑𝑆 −න
𝑆
෦𝑣𝑎 𝑣 +𝑣
𝜎
𝜕
𝜕𝑎𝑛
𝜕 𝑣
𝜕𝑥𝑗𝑛𝑗 𝑑𝑆 + න
𝑆
2∆𝑎𝜕∆
𝜕𝑥𝑗𝑛𝑗
𝜕∆
𝜕𝑏𝑛𝑑𝑆
Spalart Allmaras Turbulence model*
𝑢𝑗𝜕 ǁ𝜈
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜈 +
ǁ𝜈
𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗−𝑐𝑏2𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗
2
− ǁ𝜈𝑃 ǁ𝜈 + ǁ𝜈𝐷 ǁ𝜈 + 𝛼 ǁ𝜈 = 0
𝑢 𝑛 = −𝜕𝐹𝑆𝑊,𝑖
𝜕𝑝𝑛𝑖 𝑎𝑛𝑑 𝑢𝜏
2 = 𝜈 + 𝜈𝑡𝜕𝑢𝑖𝜕𝑥𝑗
+𝜕𝑢𝑗
𝜕𝑥𝑖𝑛𝑗𝑡𝑖
𝐼 = 0
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
73
At “memeber functions” in solveIter() object frome the “adjointSimple” classcan be found the solver implementation:
.
.
.
autoPtr<incompressibleAdjoint::adj
ointRASModel>& adjointTurbulence =
adjointVars.adjointTurbulence();
const label& paRefCell =
solverControl_().pRefCell();
const scalar& paRefValue =
solverControl_().pRefValue();
The new term, the adjointTurbulence 𝑣𝑎 *
E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
74
At “memeber functions” in solveIter() object from the “adjointSimple” classcan be found the solver implementation:
// Momentum predictor
//~~~~~~~~~~~~~~~~~~~
tmp<fvVectorMatrix> tUaEqn
(
fvm::div(-phi, Ua)
+ adjointTurbulence-
>divDevReff(Ua)
+ adjointTurbulence-
>adjointMeanFlowSource()
==
200 fvOptionsAdjoint_(Ua)
);
fvVectorMatrix& UaEqn =
tUaEqn.ref();
Appears due to the differentiation of the turbulence model defined as:
nuTilda()*fvc::grad(nuaTi
lda() -
conservativeMomentumSourc
e());
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
75
After adding source terms of the adjoint equation:
if
(solverControl_().momentumPredicto
r())
{
Foam::solve(UaEqn == -
fvc::grad(pa));
fvOptionsAdjoint_.correct(Ua);
}
𝑈𝑎 = −𝛻𝑞
RESEARCH CENTRE FOR GAS INNOVATION
adjointSimple.C Description
76
Ending up with a proposed“adjoint” Pressure-VelocitySIMPLE corrector*
// Pressure Eq
//~~~~~~~~~~~~
{
volScalarField rAUa(1.0/UaEqn.A());
volVectorField
HabyA(constrainHbyA(rAUa*UaEqn.H(),
Ua, pa));
surfaceScalarField
phiaHbyA("phiaHbyA",
fvc::flux(HabyA));
adjustPhi(phiaHbyA, Ua, pa);
.
.
.
*F. Moukalled, L. Mangani, and M. Darwish, The finite volume method in computational fluid dynamics : An Advanced Introduction with OpenFOAM and Matlab, vol. 113. 2016.
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• Continous Adjoint Turbulent solver: “adjointOptimizationFoam”
• Turbulent Sensitivity Calculation
• Modifications
77
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
78
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
State Equations “adjointOptimizationFoam”
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity Formulation – Frozen Turbulence
79
𝛿𝛼𝐿𝑎𝑢𝑔 = 𝛿𝛼 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 + 𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 +න
Ω
𝑞𝑅𝑝 𝑑Ω +නΩ
𝒗𝑅𝒖 𝑑Ω
𝛿𝑅𝑢
𝛿𝛼𝒖 ∙ 𝛻 𝒖 + 𝛻𝑝 − 𝛻 ∙ 2ν𝐷 𝒖 + 𝛼𝒖 = 𝒖
𝛿𝛼
𝛿𝜌= 𝒖
𝛿𝛼𝐿 = නΩ
𝒖 ∙ 𝒗 𝑑Ω + −𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙𝛿𝑐𝑣𝑜𝑙𝛿𝛼
𝛿𝛼𝐿 = 𝒖 ∙ 𝒗 V + −λ𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2
ത𝛼 Ω𝑑Ω
Ω
1 −𝛼ത𝛼𝑑Ω
Ω𝑑Ω
− V
𝛿𝐿
𝛿𝛼=𝛿𝐽
𝛿𝛼+න
Ω
𝑞𝛿𝑅𝑝
𝛿𝛼𝑑Ω +න
Ω
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω +න
Ω
−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙𝛿𝑐𝑣𝑜𝑙𝛿𝛼
𝑑Ω
𝑤ℎ𝑒𝑟𝑒
RESEARCH CENTRE FOR GAS INNOVATION
Turbulent Sensitivity Formulation
80
𝐿 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 + 𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 ; 𝑐𝑣𝑜𝑙 =
𝜌𝑑Ω
𝑑Ω
1
𝑉𝑡𝑎𝑟𝑔𝑒𝑡− 1
2
𝐿𝑎𝑢𝑔 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 +𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 +න
Ω
𝑞𝑅𝑝 𝑑Ω +නΩ
𝒗𝑅𝒖 𝑑Ω + නΩ
෦𝑣𝑎 𝑅𝑣 𝑑Ω +න
Ω
∆𝑎𝑅∆ 𝑑Ω
𝐿𝑎𝑔𝑟𝑎𝑛𝑔𝑒 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑒𝑟𝑠
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼=𝛿𝐽
𝛿𝛼+ (−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙)
𝛿𝑐𝑣𝑜𝑙𝛿𝛼
+නΩ
𝑞𝛿𝑅𝑝
𝛿𝛼𝑑Ω𝛿𝑢 +න
Ω
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω +න
Ω
෦𝑣𝑎𝛿𝑅 𝑣
𝛿𝛼𝑑Ω
+නΩ
∆𝑎𝛿𝑅∆
𝛿𝛼𝑑Ω
𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑑𝑒𝑠𝑖𝑔𝑛 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝛼
*E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
*
RESEARCH CENTRE FOR GAS INNOVATION
Turbulent Sensitivity Formulation
81
𝐿 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 + 𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 ; 𝑐𝑣𝑜𝑙 =
𝜌𝑑Ω
𝑑Ω
1
𝑉𝑡𝑎𝑟𝑔𝑒𝑡− 1
2
𝐿𝑎𝑢𝑔 = 𝐽 − 𝜆𝑣𝑜𝑙𝑐𝑣𝑜𝑙 +𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2 +න
Ω
𝑞𝑅𝑝 𝑑Ω +නΩ
𝒗𝑅𝒖 𝑑Ω + නΩ
෦𝑣𝑎 𝑅𝑣 𝑑Ω +න
Ω
∆𝑎𝑅∆ 𝑑Ω
𝐿𝑎𝑔𝑟𝑎𝑛𝑔𝑒 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑒𝑟𝑠
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼=𝛿𝐽
𝛿𝛼+ (−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙)
𝛿𝑐𝑣𝑜𝑙𝛿𝛼
+නΩ
𝑞𝛿𝑅𝑝
𝛿𝛼𝑑Ω𝛿𝑢 +න
Ω
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω +න
Ω
෦𝑣𝑎𝛿𝑅 𝑣
𝛿𝛼𝑑Ω
+නΩ
∆𝑎𝛿𝑅∆
𝛿𝛼𝑑Ω
𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑑𝑒𝑠𝑖𝑔𝑛 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝛼
RESEARCH CENTRE FOR GAS INNOVATION
Modifications for Threating Turbulence
82
𝒌 − 𝝎 Turbulence model
𝛻 · (𝒖 𝑘) = 𝑻𝑡: 𝛻𝒖 − 𝛽∗𝜔𝑘 + 𝛻 · 𝜈 + 𝜎∗𝑘
𝜔𝛻𝑘 − 𝛼𝑘
𝛻 · 𝒖𝜔 =𝛼𝜔
𝑘𝑻𝑡: 𝛻𝒖 − 𝛽𝜔2 +
𝜎𝑑𝜔𝛻𝑘 · 𝛻𝜔 + 𝛻 · 𝜈 + 𝜎
𝑘
𝜔𝛻𝜔 + 𝛼(𝜔𝑏 − 𝜔)
Spalart Allmaras Turbulence model*
𝑢𝑗𝜕 ǁ𝜈
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜈 +
ǁ𝜈
𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗−𝑐𝑏2𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗
2
− ǁ𝜈𝑃 ǁ𝜈 + ǁ𝜈𝐷 ǁ𝜈 + 𝛼 ǁ𝜈 = 0
𝑇ℎ𝑒𝑛𝛿𝑅 𝑣
𝛿𝛼= 𝑣 + 𝛼
𝛿 𝑣
𝛿𝛼
*E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
Turbulent Sensitivity Formulation
83
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼= (−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙)
𝛿𝑐𝑣𝑜𝑙𝛿𝛼
+නΩ
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω + න
Ω
෦𝑣𝑎𝛿𝛼
𝛿𝛼𝑣 + 𝛼
𝛿 𝑣
𝛿𝛼𝑑Ω
𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑑𝑒𝑠𝑖𝑔𝑛 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝛼
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼
= 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2 + −λ𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2
ത𝛼 Ω𝑑Ω
Ω
1 −𝛼ത𝛼𝑑Ω
Ω𝑑Ω
− V
+නΩ
𝑣෦𝑣𝑎 𝑑Ω + නΩ
𝛼෦𝑣𝑎𝛿 𝑣
𝛿𝛼𝑑Ω
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity implementation: adjointSensitivityIncompressible.C
84
// Compute dxdb multiplier
flowTerm =
ATCModel->getFISensitivityTerm()
- fvc::grad(p) * Ua
- nuEff*(gradU & (gradUa +
T(gradUa)))
+ (- nuEff*(gradUa & (gradU +
T(gradU)))
+ fvc::grad(nuEff * Ua &
(gradU + T(gradU)))
+ (pa * gradU)
// from the adjoint turbulence model
+ turbulenceTerm.T()
// Term 7, term from objective
functions
+ objectiveContributions;
𝐴𝑇𝐶 + 𝛻𝑝 ∗ 𝑈𝑎 − 𝑣𝑒𝑓𝑓∗ 𝛻𝑢 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + (−𝑣𝑒𝑓𝑓∗ 𝛻𝑢𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝛻(𝑣𝑒𝑓𝑓∗ 𝑈𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝑝𝑎 ∗ 𝛻𝑢+ 𝑡𝑢𝑟𝑏𝑢𝑙𝑒𝑛𝑐𝑒𝑇𝑒𝑟𝑚+ 𝑜𝑏𝑗𝑒𝑐𝑡𝑖𝑣𝑒𝐶𝑜𝑛𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛𝑠
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity implementation: adjointSensitivityIncompressible.C
85
Contribution of turbulenceadjoint model
objectiveManager_.adjointSolverName(
)
).getATCModel();
// Compute dxdb multiplier
flowTerm =
ATCModel->getFISensitivityTerm()
- fvc::grad(p) * Ua
- nuEff*(gradU & (gradUa +
T(gradUa)))
+ term4
+ (pa * gradU)
// from the adjoint turbulence model
+ turbulenceTerm.T()
// Term 7, term from objective
functions
+ objectiveContributions;
𝐴𝑇𝐶 + 𝛻𝑝 ∗ 𝑈𝑎 − 𝑣𝑒𝑓𝑓∗ 𝛻𝑢 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + (−𝑣𝑒𝑓𝑓∗ 𝛻𝑢𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝛻(𝑣𝑒𝑓𝑓∗ 𝑈𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝑝𝑎 ∗ 𝛻𝑢+ 𝑡𝑢𝑟𝑏𝑢𝑙𝑒𝑛𝑐𝑒𝑇𝑒𝑟𝑚+ 𝑜𝑏𝑗𝑒𝑐𝑡𝑖𝑣𝑒𝐶𝑜𝑛𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛𝑠
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity implementation: adjointSensitivityIncompressible.C
86
Contribution of objectivefunction
objectiveManager_.adjointSolverName(
)
).getATCModel();
// Compute dxdb multiplier
flowTerm =
ATCModel->getFISensitivityTerm()
- fvc::grad(p) * Ua
- nuEff*(gradU & (gradUa +
T(gradUa)))
+ term4
+ (pa * gradU)
// from the adjoint turbulence model
+ turbulenceTerm.T()
// Term 7, term from objective
functions
+ objectiveContributions;
𝐴𝑇𝐶 + 𝛻𝑝 ∗ 𝑈𝑎 − 𝑣𝑒𝑓𝑓∗ 𝛻𝑢 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + (−𝑣𝑒𝑓𝑓∗ 𝛻𝑢𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝛻(𝑣𝑒𝑓𝑓∗ 𝑈𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝑝𝑎 ∗ 𝛻𝑢+ 𝑡𝑢𝑟𝑏𝑢𝑙𝑒𝑛𝑐𝑒𝑇𝑒𝑟𝑚+ 𝑜𝑏𝑗𝑒𝑐𝑡𝑖𝑣𝑒𝐶𝑜𝑛𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛𝑠
RESEARCH CENTRE FOR GAS INNOVATION
Sensitivity implementation: adjointSensitivityIncompressible.C
87
𝐴𝑇𝐶 + 𝛻𝑝 ∗ 𝑈𝑎 − 𝑣𝑒𝑓𝑓 ∗ 𝛻𝑢 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + (−𝑣𝑒𝑓𝑓 ∗ 𝛻𝑢𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇
+ 𝛻(𝑣𝑒𝑓𝑓 ∗ 𝑈𝑎 ∙ 𝛻𝑢𝑎 + 𝛻𝑢𝑇 + 𝑝𝑎 ∗ 𝛻𝑢 + 𝑡𝑢𝑟𝑏𝑢𝑙𝑒𝑛𝑐𝑒𝑇𝑒𝑟𝑚
+ 𝑜𝑏𝑗𝑒𝑐𝑡𝑖𝑣𝑒𝐶𝑜𝑛𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛𝑠
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼= 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞
1 + 𝑞
𝜌 + 𝑞 2+ −λ𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙
2
ത𝛼 Ω𝑑Ω
Ω
1 −𝛼ത𝛼𝑑Ω
Ω𝑑Ω
− V +නΩ
𝑣෦𝑣𝑎 𝑑Ω + නΩ
𝛼෦𝑣𝑎𝛿 𝑣
𝛿𝛼𝑑Ω
RESEARCH CENTRE FOR GAS INNOVATION
Flowchart for TOM
88
Initial guess
Solve Navier Stokes
Solve Adjoint Navier Stokes
Calculate sensitivities
Converged? End
Update material distribution
State Equations “adjointOptimizationFoam”
Yes
No
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• Continous Adjoint Turbulent solver: “adjointOptimizationFoam”
• Turbulent Sensitivity Calculation
• How to use the solver?
• Modifications
89
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
90
Tutorials path
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
91
Tutorials path
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
92
No Optimization
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
optimisationManager singleRun;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
93
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
optimisationManager singleRun;
primalSolvers{
op1
{
active true;
type incompressible;
solver simple;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
94
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
optimisationManager singleRun;
primalSolvers{
op1
{
active true;
type incompressible;
solver simple;
useSolverNameForFields false; false as default
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
95
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
primalSolvers
.
solutionControls
{
nIters 3000;
residualControl
{
"p.*" 1.e-6;
"U.*" 1.e-6;
"nuTilda.*" 1.e-6;
} } }}
Entries to manage the solutionprocess of the primal equations.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
96
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
There is the possibility ofdefine one adjoint Managerper primalSolver used.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
97
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
primalSolver op1;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
98
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
primalSolver op1;
operatingPointWeight 1;
Default value 1.
Weight factor of usingmultiple objective functions:
𝐽 =𝑖𝑤𝑖𝑜𝑝𝐽𝑗𝑜𝑝
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
99
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
primalSolver op1;
operatingPointWeight 1;
adjointSolvers
{
adjS1
List of dictionaries to set upthe adjointSolvers to be used.Multiple can be used.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
100
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
primalSolver op1;
operatingPointWeight 1;
adjointSolvers
{
// choose adjoint solver --//
active true; true set up as default
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
101
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
{
primalSolver op1;
operatingPointWeight 1;
adjointSolvers
{
// choose adjoint solver --//
active true;
type incompressible;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
102
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
// manage objectives //----
objectives
{
type incompressible;
objectiveNames
{ lift
Objective functionsimplemented: lift, drag andPtLosses
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
103
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Threatment of the Adjointtranspose convection term,which is in the adjointmomentum equations.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
104
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Entries avilable:
Standard (non-conservative)
𝑢𝑗𝜕𝑣𝑗
𝜕𝑥𝑖
UaGradU (conservative)
−𝑣𝑗𝜕𝑢𝑗
𝜕𝑥𝑖
cancel
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
105
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Default is zero.
Add/subtract the adjointconvection term this manytimes to add numericaldissipation.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
106
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Default value is zero.
Propagate the smoothing ofthe ATC
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
107
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Default is empty.
Zero the ATC next to patchesprovided. Available also forcell zones.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
108
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
//--------ATCModel
{
ATCModel standard;
extraConvection 0;
nSmooth 0;
zeroATCPatchTypes ();
maskType faceCells;
}
Default is faceCells, can bepointCells.
Define how the smoothing willbe executed at the types,either faces or points.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
109
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
adjointManagers
{
adjManager1
.
// solution control // --------
solutionControls
{
nIters 3000;
residualControl {
"pa.*" 1.e-6;
"Ua.*" 1.e-6;
"nuaTilda.*" 1.e-6;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
110
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
Optimisation
{ sensitivities
{
type surfacePoints;
patches (pressure);
includeSurfaceArea false;
includeDistance true;
includeMeshMovement true;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
Available options: “Surface”,“Surface points” and“sensitivtyMultiple”.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
111
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
Optimisation
{ sensitivities
{
type surfacePoints;
patches (lower );
includeSurfaceArea false;
includeDistance true;
includeMeshMovement true;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
112
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
Optimisation
{ sensitivities
{
type surfacePoints;
patches (lower );
includeSurfaceArea false;
includeDistance true;
includeMeshMovement true;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
Normal displacement of theboundary points
Available options: “Surface”,“Surface points” and“sensitivtyMultiple”.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
113
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
Optimisation
{ sensitivities
{
type surfacePoints;
patches (lower );
includeSurfaceArea false;
includeDistance true;
includeMeshMovement true;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
True (adjoint Spalart Allmaras)
Variable set as: 𝑑𝑎
BC: Inlet=outlet=fixedValue
Wall=zeroGradient
fcSchemes/divSchemes:𝑑𝑖𝑣(−𝑖𝑃ℎ𝑖, 𝑑𝑎)
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
114
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/system/optimisationDict
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
Optimisation
{ sensitivities
{
type surfacePoints;
patches (lower );
includeSurfaceArea false;
includeDistance true;
includeMeshMovement false;
includeObjectiveContribution true;
writeAllSurfaceFiles true;
Set as false for topologyoptimization.
RESEARCH CENTRE FOR GAS INNOVATION
adjointOptimisationFoam for TO
115
Tutorials path
$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
BC of adjointOptimisationFoam for TO
116
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
BC of adjointOptimisationFoam for TO
117
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
BC of adjointOptimisationFoam for TO
118
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
BC of adjointOptimisationFoam for TO
119
goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of ChemicalInformation and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
RESEARCH CENTRE FOR GAS INNOVATION
Contents
• Research Group
• Topology Optimization (TO)
• TO Formulation
• Frozen Turbulence TO solver
• Continous Adjoint Turbulent solver: “adjointOptimizationFoam”
• Turbulent Sensitivity Calculation
• How to use the solver?
• Modifications to the adjoint Turbulent sensitivity
120
RESEARCH CENTRE FOR GAS INNOVATION
Modifications for Threating Turbulence
121
𝒌 − 𝝎 Turbulence model
𝛻 · (𝒖 𝑘) = 𝑻𝑡: 𝛻𝒖 − 𝛽∗𝜔𝑘 + 𝛻 · 𝜈 + 𝜎∗𝑘
𝜔𝛻𝑘 − 𝛼𝑘
𝛻 · 𝒖𝜔 =𝛼𝜔
𝑘𝑻𝑡: 𝛻𝒖 − 𝛽𝜔2 +
𝜎𝑑𝜔𝛻𝑘 · 𝛻𝜔 + 𝛻 · 𝜈 + 𝜎
𝑘
𝜔𝛻𝜔 + 𝛼(𝜔𝑏 − 𝜔)
Spalart Allmaras Turbulence model*
𝑢𝑗𝜕 ǁ𝜈
𝜕𝑥𝑗−
𝜕
𝜕𝑥𝑗𝜈 +
ǁ𝜈
𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗−𝑐𝑏2𝜎
𝜕 ǁ𝜈
𝜕𝑥𝑗
2
− ǁ𝜈𝑃 ǁ𝜈 + ǁ𝜈𝐷 ǁ𝜈 + 𝛼 ǁ𝜈 = 0
𝑇ℎ𝑒𝑛𝛿𝑅 𝑣
𝛿𝛼=𝛿𝛼
𝛿𝛼𝑣 + 𝛼
𝛿 𝑣
𝛿𝛼
*E. M. Papoutsis-Kiachagias and K. C. Giannakoglou, “Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications,” Arch. Comput. Methods Eng., vol. 23, no. 2, pp. 255–299, 2016.
RESEARCH CENTRE FOR GAS INNOVATION
Turbulent Sensitivity Formulation
122
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼= (−𝜆𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙)
𝛿𝑐𝑣𝑜𝑙𝛿𝛼
+නΩ
𝒗𝛿𝑅𝑢
𝛿𝛼𝑑Ω + න
Ω
෦𝑣𝑎𝛿𝛼
𝛿𝛼𝑣 + 𝛼
𝛿 𝑣
𝛿𝛼𝑑Ω
𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑑𝑒𝑠𝑖𝑔𝑛 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝛼
𝛿𝐿𝑎𝑢𝑔
𝛿𝛼
= 𝒖 ∙ 𝒗 V 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2 + −λ𝑣𝑜𝑙 + 2𝑤𝑣𝑜𝑙𝑐𝑣𝑜𝑙2
ത𝛼 Ω𝑑Ω
Ω
1 −𝛼ത𝛼𝑑Ω
Ω𝑑Ω
− V
+ 𝛼 − ത𝛼 𝑞1 + 𝑞
𝜌 + 𝑞 2නΩ
𝑣෦𝑣𝑎 𝑑Ω +නΩ
𝛼෦𝑣𝑎𝛿 𝑣
𝛿𝛼𝑑Ω
RESEARCH CENTRE FOR GAS INNOVATION
References
[1] T. Borrvall and J. Petersson, “Topology optimization of fluids in Stokes flow,” Int. J. Numer. Methods Fluids, vol. 41, no. 1, pp. 77–107, 2003.
[2] J. S. Romero and E. C. N. Silva, “A topology optimization approach applied to laminar flow machine rotor design,” Comput. Methods Appl. Mech. Eng., vol. 279, pp. 268–300, 2014.
[3] OpenFOAM® v1906: New and improved numerics. (n.d.). Retrieved October 27, 2019, from https://www.openfoam.com/releases/openfoam-v1906/numerics.php#numerics-adjoint
[4] Papoutsis-Kiachagias, E. M., & Giannakoglou, K. C. (2016). Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications. Archives of Computational Methods in Engineering, 23(2), 255–299. https://doi.org/10.1007/s11831-014-9141-9
[5] Zymaris, A. S., Papadimitriou, D. I., Giannakoglou, K. C., & Othmer, C. (2010). Adjoint wall functions: A new concept for use in aerodynamic shape optimization. Journal of Computational Physics, 229(13), 5228–5245. https://doi.org/10.1016/j.jcp.2010.03.037
[6] goleman, daniel; boyatzis, Richard; Mckee, A. (2019). Manual adjointOptimisationFoam. Journal of Chemical Information and Modeling, 53(9), 1689–1699. https://doi.org/10.1017/CBO9781107415324.004
[7] F. Moukalled, L. Mangani, and M. Darwish, The finite volume method in computational fluid dynamics : An Advanced Introduction with OpenFOAM and Matlab, vol. 113. 2016.
[8] U. Nilsson, “Description of AdjointShapeOptimizationFoam and how to implement new cost functions,” pp. 1–40, 2013.
123
THANK YOU