Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
136 views

Mathcad - Solution of ODEs

This document provides a tutorial on using Mathcad to solve ordinary differential equations (ODEs). It presents the equations of motion for a mass-spring-damper system and uses ODE solvers like Adams and RK to find the solution. It also discusses solving stiff systems and introduces solvers like BDF that are more suitable for stiff problems. Examples are given to demonstrate solving ODEs for non-stiff and stiff systems and comparing the solutions obtained from different solvers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views

Mathcad - Solution of ODEs

This document provides a tutorial on using Mathcad to solve ordinary differential equations (ODEs). It presents the equations of motion for a mass-spring-damper system and uses ODE solvers like Adams and RK to find the solution. It also discusses solving stiff systems and introduces solvers like BDF that are more suitable for stiff problems. Examples are given to demonstrate solving ODEs for non-stiff and stiff systems and comparing the solutions obtained from different solvers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Mathcad Tutorial on Solution of Ordinary Differential Equations

Vibration of a Mass-Spring-Damper System

d2 d
m x  c x  k x = f ( t) = sin ( 5 t)
2
dt dt

tf  40 m  1 c  0.3 k  4 ω  5

Given

d2 d
m x ( t)  c x ( t)  k x ( t) = sin ( ω t)
2
dt dt

x ( 0) = 0.1 x' ( 0) = 0.05

x  Odesolve t tf  
0.2

0.1

x ( t) 0

 0.1

 0.2
0 10 20 30 40
t
Other Solvers can as well be used such as

Adams, rkfixed, Rkadapt, Bulstoer, Radau


ODEs should be first order
d
Let x = y1 x ( t) = y2
dt
d
y1 ( t) = y2
dt

 
d 1
y2 ( t) =  sin ( ω t)  c y2 ( t)  k y1 ( t)
dt m

Middle East Technical University, METU, Ankara/TURKEY 1 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

0.1   x ( 0) = y1 ( 0) 
Initial Conditions IC     
 0.05   x' ( 0) = y2 ( 0) 
 
 y1 
Set of ODEs 
D ( t y)  1 
   sin ( ω t)  c y1  k y0 
m 
ts  0 tf  40 NN  500 The integer number of discretization intervals
(NN-1) used to interpolate the solution function.


S  Adams IC ts tf NN D 
X  S1 T  S0 X'  S2 t  ts ts  0.01  tf

0.2

0.1

X
0
x ( t)

 0.1

 0.2
0 10 20 30 40
T t

0.2

0.1

X
0
x ( t)

 0.1

 0.2
0 1 2 3 4 5
T t

Middle East Technical University, METU, Ankara/TURKEY 2 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

For Stiff Problems the Following Solvers can be Used

BDF, Radau, Stiffb, Stiffr


AdamsBDF : is a hybrid solver. It uses Adams for non-stiff problems and BDF for
stiff problems. It automatically determines whether a system is stiff or
non-stiff.

d f ( t)  
f ( t) = k  u ( t)   atanh 
d 1
Friction element given below can be represented by 
dt  dt α  μ N  
where f(t) is the friction force and u(t) is the input motion (x) to the friction element.

NN  1000

k  103 μ  1 N  600 u ( t)  1 sin ( t) α  104 Nn  103


d π f 
F ( t f )  k  u ( t)   tan  
1
 t0  0 f0  0 t1  15
 dt α  2 μ N  
d π f 
D ( t f )  k  u ( t)   tan  
1
 IC  0 ts  0 tf  15
 dt α  2 μ N  

S  rkfixed IC ts tf NN D  
S2  BDF IC ts tf NN D 
Y1  S1 T1  S0 Y2  S21 T2  S20

Middle East Technical University, METU, Ankara/TURKEY 3 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

3
110
Non-stiff Solver
Stiff Solver
Force

0 IC

 1103
0 5 10 15

Time

3
110
Non-stiff Solver
Stiff Solver
Force

0 IC

3
 110
1  0.5 0 0.5 1

Displacement
As can be seen from the solutions, the non-stiff solver "rkfixed" cannot detect the stick slip
transitions correctly. Therefore, one should use a stiff solver such as "BDF" in order to
obtain the correct solution of a stiff problem. For stiff problems, non-stiff solvers require
very small time steps which are not practical in most situations.

Middle East Technical University, METU, Ankara/TURKEY 4 Dr. Ender CİĞEROĞLU

You might also like