Optimisation of triple-ring-electrodes on piezoceramic ... · Piezoelectric transducers are used as...
Transcript of Optimisation of triple-ring-electrodes on piezoceramic ... · Piezoelectric transducers are used as...
Optimisation of triple-ring-electrodes onpiezoceramic transducers using algorithmic
differentiation
Benjamin Jurgelucks 1 Leander Claes 2
1Research group Mathematics and its Applications, Paderborn University
2Measurement Engineering Group, Paderborn University
7th International Conference on Algorithmic DifferentiationOxford, United Kingdom
15.09.2016
B. Jurgelucks & L. Claes 1 / 23 AD2016
Outline
Outline
1 Motivation2 Physical model & Sensitivity Evaluation3 Applying ADOL-C to CFS++4 Finite Differences & Algorithmic Differentiation
for Sensitivity Evaluation5 Optimisation6 Conclusion
B. Jurgelucks & L. Claes 2 / 23 AD2016
Motivation
Motivation• Piezoelectric transducers are used as hardware components
(i.e. accelerometer in smartphones), many are ceramic-based• For simulation and development of piezoceramics precise
knowledge about material parameters is indispensable• Correct material parameter data of piezoelectric ceramics can
differ up to 20% from data given by manufacturer• Existing parameter estimation methods may be inaccurate or
expensive
• Idea: formulate parameter estimation problem as inverseproblem with impedance as measurable quantity and solve(Lahmer, 2008)
• Problem: for some parameters sensitivity of impedance withrespect to material parameters is low→ Cannot solve inverse problem→ Increase sensitivity
B. Jurgelucks & L. Claes 3 / 23 AD2016
Motivation
Motivation• Piezoelectric transducers are used as hardware components
(i.e. accelerometer in smartphones), many are ceramic-based• For simulation and development of piezoceramics precise
knowledge about material parameters is indispensable• Correct material parameter data of piezoelectric ceramics can
differ up to 20% from data given by manufacturer• Existing parameter estimation methods may be inaccurate or
expensive• Idea: formulate parameter estimation problem as inverse
problem with impedance as measurable quantity and solve(Lahmer, 2008)
• Problem: for some parameters sensitivity of impedance withrespect to material parameters is low→ Cannot solve inverse problem→ Increase sensitivity
B. Jurgelucks & L. Claes 3 / 23 AD2016
Motivation
• Usually, electrode plates completely covering top and bottom ofpiezoceramic are used to excite the piezoceramic
• Studies have shown that sensitivity with respect to materialparameters can be increased by attaching triple-ring electrodes
• Sensitivity of impedance with respect to parameters of ceramicdepends on (ring) geometry
• Many configurations show low to zero sensitivity• Identify configurations with high sensitivity→ optimisation problem
• Finite differences→ a lot of locally optimal points→ investigate with AD
B. Jurgelucks & L. Claes 4 / 23 AD2016
Motivation
Triple-ring electrodes in real
B. Jurgelucks & L. Claes 5 / 23 AD2016
Applying ADOL-C to CFS++
Coupled Field Simulation in C++http://lse14.e-technik.uni-erlangen.de/forschung/
laufende-projekte/finite-element-loser-cfs/
• Mainly developed at• Vienna University of Technology• Friedrich-Alexander-Universitat Erlangen-Nurnberg• Alpen-Adria-Universitat Klagenfurt
• About 30 developers (many Ph.D. students)• Approx. 750 source files (.cc .hh), 310k lines (230k .cc & 80k .hh)• “Code-accessible” for academic purposes but not quite open source• Heavy use of templating, macros and generally use of object oriented
programming style
B. Jurgelucks & L. Claes 6 / 23 AD2016
Applying ADOL-C to CFS++
ADCFSThree implementations of ADOL-C into CFS++
• Prototype for heat equation based on “type insertion”• Implementation for branch “08/10 Optimization Master”→ Full
electrode inverse problems by Tom Lahmer with “typedef”approach
• Implementation for current CFS++ version (“typedef” approach),handles triple-ring electrodes
Main challenges:• Combination of templates, template metaprogramming and
inheritance→ complexity of source changes needed→ see 14th EuroAD workshop talk (also in Oxford)
• String arithmetic, OO programming and MuParser (akaMathParser)→ (indirectly) limited to use of ADOL-C’s traceless(forward) mode
• Linear algebra externalisation with ADOL-C traceless mode
B. Jurgelucks & L. Claes 7 / 23 AD2016
Applying ADOL-C to CFS++
Strings and MuParser• Legitimate idea: Let the user prescribe more general relations by
providing formulae as input via string• Example:
<charge name="electrode1" value="1.0*spike(2e-7,t-1e-7)"/>
• Unmodified ADOL-C leads to the error message:MathParser reports:
-------------------
Message: Misplaced colon at position 10
Formula:
((((Value:5.31482e-09ADValues(1):0(a))*(Value:6.12323e-17ADValues(1):0(a))))+[...]
⇒ MuParser is trying to evaluate strings of adoubles �⇒ MuParser is using “string arithmetic” (concatenation of strings) �
Derivative calculation is being bypassed!
B. Jurgelucks & L. Claes 8 / 23 AD2016
Applying ADOL-C to CFS++
String arithmetic and OO programmingMain timestepping loop:for ( actTimeStep = s ta r t S te p ; actTimeStep <= endStep ; actTimeStep += 1 , count ++)
{mathParser −>SetValue ( MathParser : : GLOB HANDLER, ” t ” , actTime ) ;mathParser −>SetValue ( MathParser : : GLOB HANDLER, ” d t ” , d t ) ;mathParser −>SetValue ( MathParser : : GLOB HANDLER, ” step ” , actTimeStep ) ;
/ / [ . . . ]ptPDE −>GetSolveStep()−>PreStepTrans ( ) ;ptPDE −>GetSolveStep()−>SolveStepTrans ( ) ;ptPDE −>GetSolveStep()−>PostStepTrans ( ) ;
/ / [ . . . ]}
• String arithmetic interferes again (possible to deal with)• Main methods (and submethods) are pure virtual and take no
arguments→ How to reuse trace here?
• Tracing whole procedure is too expensive→ Cancel traced mode run after ≈10 hours and 400 Gb traceafter only a few timesteps finished
B. Jurgelucks & L. Claes 9 / 23 AD2016
Applying ADOL-C to CFS++
Solutions:• Use ADOL-C’s traceless mode instead of traced mode
• Only use externalisation where it is advantageous (deep memorycopy in traceless mode)
• Parallelisation inside CFS++ ?• Dealing with strings:
• Heavy string arithmetic usage in at least one folder full of coreclasses + MuParser calls→ Rewriting is unlikely (newly introduced feature)
• Formulae are not long. Use analytical derivatives ?
• Overall solution: Change code to make exactly my case work
B. Jurgelucks & L. Claes 10 / 23 AD2016
FD vs. AD
Runtimes# timesteps 1 2 5 10 20 50 100 200 500 1000
primal 0.71 0.71 0.741 0.763 0.834 1.09 1.27 1.933 3.427 6.363FD (= 2× primal) 1.42 1.42 1.482 1.526 1.668 2.18 2.54 3.866 6.854 12.726
AD w/o ext. 1.50 1.56 1.71 1.95 2.53 4.22 6.90 12.38 28.78 56.22AD with ext. 1.538 1.565 1.644 1.801 2.22 3.441 5.422 9.413 21.53 41.818
Ratio AD/FD 1.08 1.10 1.11 1.18 1.33 1.58 2.13 2.43 3.14 3.29
Table : Runtime (in sec) of single FEM simulation for CFS configurations vs.number of timesteps.
Mesh element size 0.00006 0.00005 0.00004 0.00003 0.00002 0.00001
FD (6 processors) 8.857 14.06 22.6 40.38 110.23 606.757AD (3 processors) 45.72 67.59 108.96 208.02 510.91 3457.95
Ratio (3·AD)/(6·FD) 2.58 2.40 2.41 2.58 2.32 2.85
Table : Runtime (in sec) for full sensitivity evaluation vs. mesh size.
B. Jurgelucks & L. Claes 11 / 23 AD2016
FD vs. AD
Finite Differences
Picture source:https://en.wikipedia.org/wiki/Numerical_
differentiation
• Forward differences:
f ′(x) ≈ f (x + h)− f (x)h
for small h
• Theory of finite differences states(i.e. (Griewank, Walther 2008))∃hopt optimal stepwidth dependingon given x.
• hopt is known neither a-priori nora-posteriori (without referencevalue given analytically or by AD)
• AD usually precise up to machineaccuracy (Griewank, Walther2008)
B. Jurgelucks & L. Claes 12 / 23 AD2016
FD vs. AD
10 -8 10 -6 10 -4 10 -2 10 0 10 2 10 4
γ = h/x ("normed stepwidth")
10 -4
10 -3
10 -2
10 -1
10 0
10 1
rel. d
iffe
rence
rel. difference fd vs ad
B. Jurgelucks & L. Claes 13 / 23 AD2016
FD vs. AD
γ=h/x "normed stepwidth"
10-8 10-6 10-4 10-2 100 102 104
rel. d
iff
10-4
10-3
10-2
10-1
100
101
102rel.diff. over stepwidth
default config
r16
r33
r4
B. Jurgelucks & L. Claes 14 / 23 AD2016
FD vs. AD
radius×10 -3
0 0.5 1 1.5 2 2.5 3 3.5 4
sensitiv
ity (
unscale
d)
×10 12
3
4
5
6
7
8
9sensitivity over radius
fd good stepwidth
fd bad stepwidth
ad
• AD and FD matchvery well for a “good”stepwidth
• Even in non-extremalcases: accuracy ofFD is unclear andcan vary for differentelectrodeconfigurations
• Goal: Eliminate FDfrom the simulationcompletely bysubstituting AD forFD
B. Jurgelucks & L. Claes 15 / 23 AD2016
Optimisation with AD
OptimisationFD optimisation using commercial tool (more details in Kulshreshthaet. al, 2015):Use derivative-free optimisation method LINCOA (Powell 2014)
• Extension to Powell’s trust-region optimiser BOBYQA• Incorporates linear constraints
Final optimisation problem:
min~r∈R4
J(~r) s.t. A~r ≤ b
with
J(~r) :=1
‖WS∇z(~r)‖2 [now J(~r) := −‖WS∇z(~r)‖2 ]
with diagonal matrices S, W ∈ R10×10 for scaling and adding weight toparameters.
B. Jurgelucks & L. Claes 16 / 23 AD2016
Results
Initial configurationsUse barely feasable configurations as initial points:
−5 0 5−2
0
2
−5 0 5−2
0
2
−5 0 5−2
0
2
B. Jurgelucks & L. Claes 17 / 23 AD2016
Results
Initial configurationsparam. gain ratio case1 gain ratio case2 gain ratio case3c11 1.2434 0.9293 1.1830c33 1.4205 0.8531 2.3508c44 5.3202 1.1749 4.3539c12 1.0125 0.5684 2.6384c13 1.0978 0.8933 1.3414ε33 1.3629 0.6659 2.5290e31 1.1556 1.0677 1.2714e33 1.8522 0.9212 2.4383ε11 2.8385 1.2864 2.0128e15 3.2481 1.4586 1.8070• Initial and optimised sensitivities are still relatively small• every optimisation converges to a different end configuration→ many locally optimal points
B. Jurgelucks & L. Claes 17 / 23 AD2016
Results
Optimisation using CFS++ with AD:Points evaluated
Consider optimisation fmincon with only one material parameter:
0 1 2 3 4 5 6
r(1)
-10
0
10
r(2
)
0 1 2 3 4 5 6
r(3)
-10
0
10
r(4
)
0 1 2 3 4 5 6
r(1)
-10
0
10
r(2
)
0 1 2 3 4 5 6
r(3)
-10
0
10
r(4
)
⇒ Different starting points (blue) now run into the same end points (red)
B. Jurgelucks & L. Claes 18 / 23 AD2016
Results
Optimisation using CFS++ with AD:Function iterations
1 1.5 2 2.5 3
Iteration number
-160
-140
-120
-100
-80
-60
Fu
ncti
on
valu
e
Iterations of optimisation procedure
1 2 3 4
Iteration number
-170
-160
-150
-140
-130
-120
-110
-100
-90
Functi
on v
alu
e
Iterations of optimisation procedure
Note: Optimisation configured to stop at ∆~r ≤ 10−5
B. Jurgelucks & L. Claes 19 / 23 AD2016
Results
Optimisation using CFS++ with FD:Points evaluated
r(1)
0 1 2 3 4 5 6
r(2
)
-2
0
2
4
6
8
r(3)
0 1 2 3 4 5 6
r(4
)
-2
0
2
4
6
8
0 1 2 3 4 5 6
r(1)
-10
0
10
r(2
)
0 1 2 3 4 5 6
r(3)
-10
0
10
r(4
)
⇒ Different starting points (blue) do not run into the same end points (red)
B. Jurgelucks & L. Claes 20 / 23 AD2016
Results
Optimisation using CFS++ with FD:Function iterations
1 1.5 2 2.5 3
Iteration number
-85
-80
-75
-70
-65
-60
Functi
on v
alu
e
Iterations of optimisation procedure
1 1.5 2 2.5 3
Iteration number
-94.2
-94
-93.8
-93.6
-93.4
-93.2
-93
-92.8
Functi
on v
alu
e
Iterations of optimisation procedure
Note: Optimisation configured to stop at ∆~r ≤ 10−5
B. Jurgelucks & L. Claes 21 / 23 AD2016
Conclusion
Conclusions:• Optimisation with FD feasable, many locally optimal points• Cost function using AD is easier to optimise• Finally possible optimisation of triple-ring case with AD
Challenges:• Computationally expensive simulation• Find globally optimal point if possible• Further fine tuning of weights is necessary→ Pareto optimality?
Ongoing work:• Optimisation for all material parameters• Eliminate FD from simulation and optimisation• ADOL-C’s traceless higher order vector mode make
derivative-based optimisation possible. Final implementationongoing
B. Jurgelucks & L. Claes 22 / 23 AD2016
Bibliography
Bibliography
Kulshreshtha, K., Jurgelucks, B.,Bause, F., Rautenberg, J. and Unverzagt, C.: Increasing thesensitivity of electrical impedance to piezoelectric material parameters with non-uniformelectrical excitation. In: Journal of Sensors and Sensor Systems, Vol. 4, No. 1, pp. 217-227,2015
Lahmer, T.: Forward and inverse problems in piezoelectricity, PhD thesis, University ofErlangen-Nuremberg, 2008
Powell, M.: Derivative Free Optimization, Tech. Rep. 2014:02, Linkping University,Optimization, http://liu.diva-portal.org/smash/get/diva2:697412/FULLTEXT03.pdf
Unverzagt, C., Rautenberg, J. and Henning, B.: Sensitivitatssteigerung bei der inversenMaterialparameterbestimmung fur Piezokeramiken. In: tm - Technisches Messen, 82(2), pp.102-109, from doi:10.1515/teme-2014-0008, 2015
Thank you for your attention.
B. Jurgelucks & L. Claes 23 / 23 AD2016