Opensees-Snopt: Framework For Finite Element Based Optimization
Opensees-Snopt: Framework For Finite Element Based Optimization
Opensees-Snopt: Framework For Finite Element Based Optimization
Quan Gu
Joel P. Conte
Michele Barbato
Philip E. Gill
Frank McKenna
(Xiamen University)
(UCSD)
(LSU)
(UCSD)
(UCB)
Outline
1. Introduction to OpenSees-SNOPT framework
2. Application examples
3. TCL commands
4. How to record responses and modify model
parameters
OpenSees in China
Major Research Program of NSFC: Disaster
Evolution of Civil Infrastructure under Strong
Earthquake and Wind (DECISEW)
2008.1-2015.12
30 million UCD for 85 projects
Li Mingchu Li (DUT)
Li Chen (Tsinghua Univ.)
Quan Gu (Xiamen Univ.)
Yang Yang (DUT)
US collaborators
PI: Prof. Stephen Mahin (UCB)
Http://OpenSees.berkeley.edu
http://archt.xmu.edu.cn
Page 4
http://archt.xmu.edu.cn/opensees/opensees.html
Page 5
Outline
1. Introduction to OpenSees-SNOPT framework
2. Application examples
3. TCL commands
4. How to record responses and modify model
parameters
Reliability analysis
Reliability-based optimization
Reliability-based seismic design optimization
SNOPT
What is SNOPT ?
A Fortran software package for solving large-scale nonlinear
optimization problems (by Philip Gill, Walter Murray and Michael
Saunders)
Why SNOPT ?
Software Architecture
SNOPTClass
SNOPTClass
++ solve
solve ()()
++ userFunction(
userFunction( ))
DesignVariable(DV)
DesignVariable(DV)
Updated DV X
F and G
(+ gradients)
userFunction()
DV: design variable
ObjectiveFunction
ObjectiveFunction
ConstraintFunction
ConstraintFunction
F: objective function
G: constraint function
SNOPTReliability
SNOPTReliability
++ findDesignPoint()
findDesignPoint()
SNOPTOptimization
SNOPTOptimization
++ runOptAnalysis()
runOptAnalysis()
++ userFunction()
userFunction()
ReliabilityDomain
ReliabilityDomain
++ updateXFG()
updateXFG()
++ userFunction()
userFunction()
GFunEvaluator
GFunEvaluator
GradGEvaluator
GradGEvaluator
Domain
Domain
ObjectiveFunction
ObjectiveFunction
ProbabilityTransformation
ProbabilityTransformation
ConstraintFunction
ConstraintFunction
Function Details
Sending data
Inheritance or
polymorphism
ClassName
ClassName Class name
++ function()
function() Member function
Member variable
variable
variable
SNOPT
Class
ConstraintFunction
ConstraintFunction
MeritFunctionCheck
MeritFunctionCheck
SearchDirection
SearchDirection
New DV X
StepSizeRule
StepSizeRule
ConvergenceCheck
ConvergenceCheck
Aggregation
Inheritance
F and G
(+ gradients)
SNOPT
SNOPT
Optimization
Optimization
Analysis
Analysis
Domain
Domain
DesignVariable
DesignVariable
Communication with domain
class to get data or compute state
DesignVariablePositioner
DesignVariablePositioner
SNOPT
Class
GradGEvaluator
GradGEvaluator
GFunEvaluator
GFunEvaluator
FindDesignPoint
FindDesignPoint
Algorithm
Algorithm
MeritFunctionCheck
MeritFunctionCheck
SearchDirection
SearchDirection
New RV X
StepSizeRule
StepSizeRule
ConvergenceCheck
ConvergenceCheck
Aggregation
F and G
(+ gradients)
SNOPT
SNOPT
Reliability
Reliability
Reliability
Reliability
Analysis
Analysis
ReliabilityDomain
ReliabilityDomain
RandomVariable
RandomVariable
LimitStateFunction
LimitStateFunction
Reliability-based optimization
ObjectiveFunction
ObjectiveFunction
ConstraintFunction
ConstraintFunction
Reliability
Reliability
Analysis
Analysis
SNOPT
SNOPT
Optimization
Optimization
Analysis
Analysis
FindDesignPoint
FindDesignPoint
Algorithm
Algorithm
Reliability
Reliability
Domain
Domain
Domain
Domain
DesignVariable
DesignVariable
SNOPT
SNOPT
Reliability
Reliability
DesignVariablePositioner
DesignVariablePositioner
RandomVariablePositioner
RandomVariablePositioner
RandomVariable
RandomVariable
Outline
1. Introduction to OpenSees-SNOPT framework
2. Application examples
3. TCL commands
4. How to record responses and modify model
parameters
Application example 1:
Nonlinear Structural Optimization
Refer to: Gu Q., Michele B., Conte J.P, Gill P.E., and McKenna F. OpenSeesSNOPT Framework for Finite Element-Based Optimization of Structural and
Geotechnical Systems. Journal of Structural Engineering, Volume 138, Issue 6
(June 2012)
m
2.0
2.0m
y
G
G
2.0m
2.5m
30o
3.0m
[kPa ] 5
4
3.5m
6.0m
x 10
Fy,ext
C
A
4.0m
m
6.0
Fy,comp
-2
-4
-0.01
-0.005
[]
0.005
0.01
Design variables
(1) Cross-section Area A:
Optimal design
(1) A = 3.17e-3 m2, B = 3.51e-4 m2, C = 2.00e-4 m2
(2) Total volume = 0.274 m3 (compared with initial volume
of 1.20 m3)
400
200
100
Volume [m 3]
300
0.8
0.6
0.4
0.2
0
0
0
0.05
10
20
iteration #
30
0.1
40
0.15
Application example 2:
Nonlinear FE Model Updating
u0 (surface)
xz [kN ]
Mat. #1
40
Mat. #2
0
-20
-1
xz
Mat. #3
2
-3
x 10
u&&g
2
u&&g [m / s 2 ] 0
-2
0
10
Time [sec]
15
20
20 < i < ( i = 1, 2, 3 )
u
t
( j n j ( n ))
2 j=1 n =1
u&&j (tn )
F #stations time step
Exp
&&
&&
= ( u j (tn ) u j ( tn ) )
j=1 n =1
(a)
u&&g [m / s 2 ]
-2
0
2
Actual response
10
Simulated response
15
(b)
0
-2
0
10
Time[sec]
15
350
300
# points
250
F=
j =1
F 200
[kN]
#steps 1
u&&j ,ti u&&EXP
j ,t i
i =1 2
)
2
150
100
50
0
0
20
40
60
80
100
Iteration Step #
Algorithm using DDM converges MUCH FASTER than FFD !
Application example 3:
Structural Reliability Analysis
7.0
C
A
C
B
20
20
25
A
y
25
25
20
30
7.2
C
B
25
(unit: cm)
B
y
25
P/2
3.6
(unit: m)
20
7.0
z
20 20
C
y
Reliability:
P[kN] 150
u1 at DP
u1 at mean point
100
uroof at DP
uroof at mean point
50
0
0
0.05
0.1
u [m]
0.15
Outline
1. Introduction to OpenSees-SNOPT framework
2. Application examples
3. TCL commands
4. How to record responses and modify model
parameters
Example 1.
m
2.0
2.0m
y
G
G
2.0m
2.5m
30o
3.0m
[kPa ] 5
4
3.5m
6.0m
x 10
Fy,ext
C
A
4.0m
m
6.0
Fy,comp
-2
-4
-0.01
-0.005
[]
0.005
0.01
Go to source
files
Analysis ( in tclfiletorun.tcl)
Store the requested respones by F and G (and their gradient)
Main file
.
# ---------------------------------- optimization part ---------------optimization
designVariable 1 -name DV_A -startPt 8.0e-3
upperBound 1.6e-2
-lowerBound 8.0e-4 -
-lowerBound 3.0e-4 -
-lowerBound 2.0e-4 -
Main file
objectiveFunction 1 -name F -tclFile F.tcl -lowerBound 0.0 -upperBound
1.e20
array set uBound { 1 0.015 2 0.15 }
array set lBound { 1 0.0 2 0.00 }
constraintFunction 1 -name G
lowerBound lBound
Tclfiletorun.tcl
remove loadPattern 1
pattern Plain 1 "Constant" {
load 21 21.6506 12.5 0.0
load 22 21.6506 12.5 0.0
load 23 21.6506 12.5 0.0
load 24 21.6506 12.5 0.0
}
constraints Transformation
numberer RCM
test NormDispIncr 1.E-12 25
integrator LoadControl 1 1 1 1
algorithm Newton
system BandSPD
analysis Static
analyze 1
set temp1a [nodeDisp 23 1]
set temp2a [nodeDisp 23 2]
To be continued
Tclfiletorun.tcl
# =====================================
reset
remove loadPattern 1
# ----- LOADING ----------------------pattern Plain 1 "Constant" {
load 21 86.6024 50.0 0.0
load 22 86.6024 50.0 0.0
load 23 86.6024 50.0 0.0
load 24 86.6024 50.0 0.0
}
analyze 1
set temp1b [nodeDisp 23 1]
set temp2b [nodeDisp 23 2]
F.tcl
# F = L1*A1 +L2*A2+L3*A3
set F [expr $DV_A * 61.05735 + $DV_B * 192.3565 + $DV_C * 66.66667]
G.tcl
set G(1) [expr sqrt($temp1a*$temp1a+$temp2a*$temp2a)]
set G(2) [expr sqrt($temp1b*$temp1b+$temp2b*$temp2b)]
htot = 4h = 13.6 m
Ld
Ly
h = 3.4 m
1.5
BRB1 / y0
1.0
b = 8.0 m
1
F=
2
Dissipative
elastoplastic
segment
time step
n =1
0.5
0.0
-0.5
-1.0
Exp
&&
&&
u
(
t
)
u
( j n j ( tn ) )
-1.5
-0.01
Loma Prieta
0
0.01
Go to
source files
Main file
optimization
designVariable 1-name sigmaYC -startPt 454.75 -lowerBound 453.7 upperBound
535.4
designVariable 2 -name alphaT -startPt 0.75 -lowerBound 0.6 -upperBound 0.9
designVariable 3 -name alphaC -startPt 0.65 -lowerBound 0.4 -upperBound 0.9
designVariable 4 -name deltaT -startPt 0.4 -lowerBound 0.1 -upperBound 0.8
designVariable 5 -name deltaC -startPt 0.45 -lowerBound 0.1 -upperBound 0.8
Tclfiletorun.tcl
Wipe
.
uniaxialMaterial SteelBRB 11 [expr 2.1e5*$A1] [expr 275.0*$A1] [expr
453.75*$A1] $alphaT 0.01 $deltaT [expr $sigmaYC*$A1] $alphaC
0.015 $deltaC 1.0e-14
uniaxialMaterial SteelBRB 12 [expr 2.1e5*$A2] [expr 275.0*$A2] [expr
453.75*$A2] $alphaT 0.01 $deltaT [expr $sigmaYC*$A2] $alphaC
0.015 $deltaC 1.0e-14
uniaxialMaterial SteelBRB 13 [expr 2.1e5*$A3] [expr 275.0*$A3] [expr
453.75*$A3] $alphaT 0.01 $deltaT [expr $sigmaYC*$A3] $alphaC
0.015 $deltaC 1.0e-14
uniaxialMaterial SteelBRB 14 [expr 2.1e5*$A4] [expr 275.0*$A4] [expr
453.75*$A4] $alphaT 0.01 $deltaT [expr $sigmaYC*$A4] $alphaC
0.015 $deltaC 1.0e-14
.
recorder Node -file disp_f4.out
-time -node 5
-dof 1 disp;
F.tcl
# F = (u1-u1_0)^2+(u2-u2_0)^2+....
set fileId_1 [open "disp_f4_stand.out" "r"]
set fileId1 [open "disp_f4.out" "r"]
set F 0
while {[gets $fileId_1
tmp_1] >= 1} {
Outline
1. Introduction to OpenSees-SNOPT framework
2. Application examples
3. TCL commands
4. How to record responses and modify model
parameters
if ((strcmp(argv[1],"Element") == 0) || (strcmp(argv[1],"EnvelopeElement") == 0)
|| (strcmp(argv[1],"ElementEnvelope") == 0)) {}
if ((strcmp(argv[loc],"-ele") == 0) ||
(strcmp(argv[loc],"-eles") == 0) ||
(strcmp(argv[loc],"-element") == 0)) {}
}
This command specifies the elements to be recorded, and the detailed information
belonging to this element (such as sections, materials, etc.), such as:
Recorder Element -file $fileName -time ele 2
Question: how to write these detailed commands?
Difficulty: the commands are different for different element/section/material !
Need to check the source C++ code!
Example
http://archt.xmu.edu.cn/opensees/examples%20manual/example%20manual.html
Ex 3_2 Seismic response analysis of a nonlinear
2D frame modeled using fiber section
In the following, using Ex3_2.tcl as example:
Element:
element dispBeamColumn
Section:
section Fiber 1 { }
Material:
uniaxialMaterial Concrete01 .
Element::getResponse()
Section::setResponse()
Section ::getResponse()
Material::setResponse()
Material ::getResponse()
section
if (strcmp(argv[0],"forces") == 0 || strcmp(argv[0],"force") == 0
|| strcmp(argv[0],"globalForce") == 0 || strcmp(argv[0],"globalForces") == 0)
{ }
else if (strcmp(argv[0],"localForce") == 0 || strcmp(argv[0],"localForces") == 0)
{ }
else if (strcmp(argv[0],"basicForce") == 0 || strcmp(argv[0],"basicForces") == 0)
.
}
else if (strstr(argv[0],"section") != 0)
{
theResponse =
theSections[sectionNum-1]>setResponse(&argv[2], argc-2,
output);
}
Response*FiberSection2d::setResponse(co
nst char **argv, int argc, OPS_Stream
&output) Find the specified fiber with
{
mat 3 (steel01 material) and
else {
if (argc > 2 || strcmp(argv[0],"fiber") == 0)
{
passarg = 4;
theResponse = theMaterials[key]>setResponse(&argv[passarg], argcpassarg, output); }
}
}
This command specifies the parameter, and the parameter belonging to
different objects (such as elements, sections, materials, etc).
Question: how to write these detailed commands?
Difficulty: the commands are different for different element/section/material !
Example
http://archt.xmu.edu.cn/opensees/examples%20manual/example%20manual.html
Ex 3_2 Seismic response analysis of a nonlinear 2D frame
modeled using fiber section
Example:
1 2.0E8
2.6E4
material 3 fc
if (strcmp(argv[0],"E") == 0)
return param.addObject(1, this);
updateParameter
1 2.0E8
return 0;
}
material 3 CminStrain
http://archt.xmu.edu.cn
Page 4
Thank you!