Programming and Computation in Physics - FTCS Method

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Programming and Computation in Physics

FTCS Method

Syeilendra Pramuditya

Physics Program
Institut Teknologi Bandung
1
2
Grid-based Computation
 Euler-type Methods
 Differential equations
 Temporal domain (variation in time)
 Initial conditions
 Finite Difference Methods
 Differential equations
 Spatial domain (variation in space)
 Dirichlet boundary conditions: value of solution
at boundaries
 Von Neumann boundary conditions: derivative
of solution at boundaries
3

Explicit FTCS Method


Forward Time Central Space
4
Explicit FTCS Method
 Time-dependent, 1D, heat diffusion (conduction)

 Flux  Amount of something passing through a unit area in a unit time


 Conservation  Total amount of something never changes regardless of its
motion from one region to another
5
Explicit FTCS Method

Fick’s Law

k = thermal conductivity (W/cm.K)


6
Explicit FTCS Method

 Rod length D is divided into an array od size jbar, and dx = D/jbar


 Flux between zones occurs at the walls, at points such as j+1/2 and j-1/2
 Proper handling of boundary conditions  zone 0 & zone jbar+1
7
Explicit FTCS Method
8
Explicit FTCS Method

dt General PDE:
T j
n 1
 T   2 T jn1  2T jn  T jn1 
j
n

dx T (r , t ) 
   2T (r , t )
t
9
Explicit FTCS Method
 Boundary conditions
10
Explicit FTCS Method
11
Explicit FTCS Method
12
Explicit FTCS Method
 Calculation parameters
 T initial = 0 C
 T left = 400 C
 T right = 0 C
 Sigma = 1 m2/sec
 dx = 1 m
 jbar = 50
 dt = 0.1 sec
13
Explicit FTCS Method
 Results
14
Explicit FTCS Method
 Results
15
Explicit FTCS Method
 You can make the code now, yes?
16

Implicit FTCS Method


Forward Time Central Space
17
Implicit FTCS Method
 Explicit  use current time step information (Tn) to
calculate next time step values (Tn+1)
 Explicit  use next time step guess (Tn+1) to calculate
actual next time step values (Tn+1)
 So why implicit calculation..??
18
Implicit FTCS Method
dt
2  j 1
T jn 1  T jn   T n  2T jn  T jn1 
dx
dt
  0.495
dx 2
19
Implicit FTCS Method
dt
2  j 1
T jn 1  T jn   T n  2T jn  T jn1 
dx
dt
  0.500
dx 2
20
Implicit FTCS Method
dt
2  j 1
T jn 1  T jn   T n  2T jn  T jn1 
dx
dt
  0.505
dx 2

Numerical instabilities.. Must always use small time step..


Computationally “expensive”
21
Root Finding Algorithms

 Newton Method
 Bisection Method
 Secant Method
 Regula-Falsi Method
 And many many more..
22
Root Finding by Newton Method
Taylor Series
f (a)( x  a) f (a)( x  a) 2 f (a)( x  a )3
f ( x)  f (a)    
1! 2! 3!

Linear approximation: the first two terms


f ( x )  f (a )  f ( a )( x  a )  0

f (a)
xa
f (a)
f ( xold )
xnew  xold 
f ( xold )
23
Implicit FTCS Method
24
Implicit FTCS Method
25
Implicit FTCS Method
 Result
dt
T jn 1  T jn  
dx 2
 T j
n
1  2T j
n
 T j
n
1 

dt
 2
 10
dx

Numerically stable!
26
Implicit FTCS Method
 Analytic solution
27
Implicit FTCS Method
 You can make the code now, yes?

You might also like