Download Numerical Integration Overview

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

System of polynomial equations wikipedia , lookup

Multidisciplinary design optimization wikipedia , lookup

System of linear equations wikipedia , lookup

False position method wikipedia , lookup

Expectation–maximization algorithm wikipedia , lookup

Transcript
SECTION 6
NUMERICAL INTEGRATION
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 1
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 2
NUMERICAL INTEGRATION
• What’s in this section:
– Basic Concept
– Explicit Methods
• Overview
• Error Estimation
• Explicit Methods in Adams/Solver
– Implicit Methods
• Overview
• DEBUG/EPRINT Output
• Steps in Detail
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 3
NUMERICAL INTEGRATION: BASIC IDEA
• Initial Value Problem:
dy

 f (t , y )
 y  y ' 
dt

 y t 0   y 0
• Looking for an approximation to the solution of a differential equation at a
sequence of discrete points t0, t1,…
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 4
NUMERICAL INTEGRATION: EXPLICIT METHODS
• A simple explicit (aka forward) Euler
integration algorithm will calculate
subsequent values of y according to
the formula:
yt  t  y t h  yt
Slope = y t
yt  t
yt
h
• Example:
y  2 y 2  0
t
t  t
2
– The explicit formula gives: yt  t  2 yt h  y t
Note that
yt  t
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
can be solved directly from known values yt and h
S6 - 5
NUMERICAL INTEGRATION: EXPLICIT METHODS
Error Estimation:
• Global Error (eG)
– The difference between the current solution
and the true solution
y
eG
eL
• Local Truncation Error (eL)
– The error introduced in a single step
yo
• RKF (explicit) integrator compares
solutions with higher- and lower-order
predictions to gauge local error.
y2
y1
t
to
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 6
t1
t2
NUMERICAL INTEGRATION: EXPLICIT METHODS
• Adams/Solver (Fortran) has explicit integrators:
– INTEGRATOR/RKF45 (constant order)
– INTEGRATOR/ABAM (variable order)
• Adams/Solver (C++) does not implement RKF or ABAM
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 7
NUMERICAL INTEGRATION: IMPLICIT METHODS
•
A simple implicit (aka backward) Euler integration algorithm will calculate
subsequent values of y according to the recursion formula:
yt  t  y t  t h  yt
Slope =
y t  t
yt  t
yt
• Example:
y  2 y 2  0
h
t
t  t
h  yt
– The implicit formula gives: y t  t  2 y
– Here y
cannot be solved directly and the solution requires iteration
2
t  t
t  t
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 8
NUMERICAL INTEGRATION: IMPLICIT METHODS
Implicit Method Overview:
y
1. Predict forward using past
information:
y2
3
yn1  yn  hyn
yo
y1
1
2. Form a new problem comprised of
past values and assumed current
values (backward Euler):
yn1  yn  hyn 1
t
3. Iterate to solve implicit problem,
‘correcting’ the initial estimate.
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
to
S6 - 9
t1
t2
NUMERICAL INTEGRATION: IMPLICIT METHODS
Integration step No.
193,
Order = 2
Cumulative iterations of
From 8.850000000E-01, Step = 1.25000E-03
the corrector:
440
Iteration Residual (or equation error)
Change in the Variable Jacobian
count
Maximum Element/ID Equation
Maximum Element/ID Variable new?
___
________ ______________________ ________ ______________________ ___
1
-1.9E+05 Part/10 Theta Torque
-5.6E+00 PlnJnt/6 LAM
yes
2
1.6E+02 Contact/42 Y Torque
-1.1E-01 Contact/26 Z Torque
no
3
-3.0E+00 Contact/50 Y Torque
-4.7E-03 Contact/26 Z Torque
no
Integration step No.
194,
Order = 2
Cumulative iterations of
From 8.862500000E-01, Step = 3.75000E-03
the corrector:
443
Iteration Residual (or equation error)
Change in the Variable Jacobian
count
Maximum Element/ID Equation
Maximum Element/ID Variable new?
___
________ ______________________ ________ ______________________ ___
1
-3.8E+05 Part/10 Theta Torque
-2.6E+02 Contact/598 X Torque
yes
2
7.3E+02 Contact/50 Z Torque
3.7E-01 Contact/50 X Force
no
3
-2.1E+01 Contact/42 Y Torque
-3.3E-02 Contact/26 Z Torque
no
4
-8.7E-01 Contact/42 Y Torque
-1.4E-03 Field/10 X Torque
no
Predictor information:
- Predicting polynomial order
- Current simulation time
- Projection time step size
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 10
NUMERICAL INTEGRATION: IMPLICIT METHODS
Integration step No.
193,
Order = 2
Cumulative iterations of
From 8.850000000E-01, Step = 1.25000E-03
the corrector:
440
Iteration Residual (or equation error)
Change in the Variable Jacobian
count
Maximum Element/ID Equation
Maximum Element/ID Variable new?
___
________ ______________________ ________ ______________________ ___
1
-1.9E+05 Part/10 Theta Torque
-5.6E+00 PlnJnt/6 LAM
yes
2
1.6E+02 Contact/42 Y Torque
-1.1E-01 Contact/26 Z Torque
no
3
-3.0E+00 Contact/50 Y Torque
-4.7E-03 Contact/26 Z Torque
no
Integration step No.
194,
Order = 2
Cumulative iterations of
From 8.862500000E-01, Step = 3.75000E-03
the corrector:
443
Iteration Residual (or equation error)
Change in the Variable Jacobian
count
Maximum Element/ID Equation
Maximum Element/ID Variable new?
___
________ ______________________ ________ ______________________ ___
1
-3.8E+05 Part/10 Theta Torque
-2.6E+02 Contact/598 X Torque
yes
2
7.3E+02 Contact/50 Z Torque
3.7E-01 Contact/50 X Force
no
3
-2.1E+01 Contact/42 Y Torque
-3.3E-02 Contact/26 Z Torque
no
4
-8.7E-01 Contact/42 Y Torque
-1.4E-03 Field/10 X Torque
no
Corrector information:
- Equation with largest residual error
- Element being altered by what correction
- Should converge quadratically
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 11
NUMERICAL INTEGRATION: IMPLICIT METHODS
• Specifics: implicit (aka Backward Euler) integration is a four-step process:
(1) Predict the solution, (2) Correct the solution, (3) Evaluate the solution, and
(4) Prepare for the next step.
Step 1: Predict the Solution
– When taking a new step, the integrator fits a polynomial of a given order
through the past values of the states, and then extrapolates them to make a
prediction for the next step
– This prediction is done using an explicit integration algorithm (for example a
Taylor series technique for GSTIFF and a Newton Divided Differences
technique for WSTIFF).
k
Taylor series algorithm:
ynp1 

i 0
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
h i yn ( i )
, k=integration order
i!
S6 - 12
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 1: Predict the Solution (continued)
• The degree of the polynomial is the order of the integrator and determines
how many past values will be used (e.g., a cubic will use the last 4 values).
The higher the order, the more accurate the prediction typically.
• The predictor is simply looking at past values to guess the solution at the next
time. The governing equations G are not satisfied.
• This is simply a good starting point for the next phase. Example:
G y, y , t   y  2 y 2  0
y0  y0  2
h  0.01
 
2
y 0  2 y0   2 2 2  8
Solve for
using the explicit Euler integration formula to solve for y1:
y1  y 0 h  y0   80.01  2  1.92
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 13
(predicted value)
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 2: Correct the Solution
• The corrector uses an implicit integration algorithm to determine the next
state values. Since the routine is implicit, Newton-Raphson iteration is
required.
• Using the implicit Euler formulation G can be made a function of only y and
possibly t:
y1  y1h  y0
implies
Thus in our example: G  y1  

y1  y 0
 2 y12  0 and
h
Using Newton-Raphson with the
predicted value of y1(0) = 1.92:
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
y1



G y, y , t  G y1 , 
y1(1)  y1( 0) 
S6 - 14
h
y0 
, t1   0
h 
G
1
 G y   4 y1  0
y
h
1
(0)


G
y
1
(0)
G y  y1 
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 2: Correct the Solution (continued)
y11  1.925824666
y1 2   1.925824036
.
.
.
Continue until convergence
criteria is met
y1(n) = corrected value
 This example was done using simple implicit Euler. In general a higher
k
order formula of the type yn1 
resulting in:
 y
i n i 1  h  0 yn 1
i 1

yn 1  1
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
h 0
S6 - 15
 y
n 1
will be used,
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 2: Correct the Solution (continued)
• The mathematical formulation of the corrector step is sometimes given as
G
0  G ( y, y , t )  G  y , y , t  
y
k 
k 
G
y 
y  k  , y  k 
y
y  k  , y  k 
y
• Substituting y /0h for y then allows for one to solve for y and add it to
the current value of y to obtain a better value. The cycle is then repeated
until convergence is achieved (this amounts to Newton-Raphson iteration).
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 16
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 2: Correct the Solution (continued)
• Pendulum system example using implicit Euler:
Unknowns
u x 
u 
 y
u 

 
xx
 
y
 
 
 1 
2 
Motion Equations
System Jacobian
mu x  1  0
mu y  2  mg  0
  1 L sin   2 L cos  0
  Ju  0
u x  x  0
u y  y  0
u    0
x  L cos  0
y  L sin   0
*
m
h

0

0

0
G 
Gx 

x  1

0

0

0

0
0
0
0
0
0
1
m
h
0
0
0
0
0
0
0
0
0
0
T
L sin 
0
J
1
h
1
0
0
0
0
0
0
0
1

h
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
h
L sin 
0
0
0
0
1
 L cos

1
h

0
0
0
where T  1 L cos  2 L sin 
* Note for example u n 1  u n 1h  u n so we have substituted u 
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
0
S6 - 17
u  u prev
h
.



1


 L cos 


0

0



0


0


0

0

0
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 3: Evaluate the Solution
• After corrector convergence, the integrator estimates the local integration
error. This is usually a function of the difference between the predicted
and corrected values, the step size, and the order of the integrator.
• Estimate local truncation error:
 yc (i)  y p (i) 
D  C (k )   

*
max(
1
,
y
(
i
))
i 1 

c

2
ne
• If D  Error
– Accept solution. Go to Step 4
• If D  Error
– Reject solution
– Repeat step with new step size
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 18
NUMERICAL INTEGRATION: IMPLICIT METHODS
Step 4: Prepare for the Next Step
• Update higher order derivatives using BDF formula
– Used in prediction for the next step
• Determine step-size h and order k for next step
– Estimate factor R by which step size can be increased without violating
local truncation error at:
•
current order-1:
•
current order:
•
current order+1:
r-1
r
r+1
– Pick order corresponding to R = max(r-1 , r , r+1 )
– Limit value of R: R  10
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 19
NUMERICAL INTEGRATION: IMPLICIT METHODS
Example:
• Go through example DEBUG/EPRINT output with file:
\More_Examples\Debug_Eprint\message_file_with_comments.doc
ADM703b, Section 6, February 2013
Copyright© 2013 MSC.Software Corporation
S6 - 20