Assignment Codes

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Apply the following two methods (a), (b), (c) to solve a BVP with the given IC & BCs.

Use mesh sizes in x and t

h = k = 1/20.

 2U i  3U n i 1  2U i  U i 1 )
n n n n n
a) U (i, n  1)  U in  t[v(U i 1 U
)  c x ( i 1 ]
4x x 2

b) U (i, n  1)  n
 t[v (
U n i 1  U i  2U n i 1
n
U
)  c x ( i 1
 2U i  U i 1 )
n n n

U i
3x x 2
]

c) Beam Warming Method

3U n i  4U i 1  U n i  2  2U i 1  U i  2 )
n n n n
U
U (i, n  1)  U i  t[v ( )  cx ( i
n
]
2x 2x 2

 ( 0.5t ) 2
0.25
BCs: u (0, t )  e 0.00125 0.04t

0.0252  0.02t

 (1.5 t ) 2
0.25
u (1, t )  e 0.00125 0.04t

0.0252  0.02t

 ( x  0.5 ) 2
IC: u ( x,0)  e 0.00125

 ( x  0.5 t ) 2
0.25
Exact: u ( x, t )  e 0.00125 0.04t

0.0252  0.02t

Write mat lab code and plot solution graphs.

2) Derive FDM for 2D heat equation and write a code

Submission date- Next Monday


Now we take the value v= cx=1. This method is explicit

n U n i +1 + 2U i n 3U n i 1 U i +1n 2U i n + U i 1
n
)
A, U (i, n + 1) = U i [(
4
) 20( ]

1
U (i, n + 1) = (
4

b) U (i, n  1)  n
 t[v (
U n i 1  U i  2U n i 1
n
U
)  c x ( i 1
 2U i  U i 1 )
n n n

U i
3x x 2
]

You might also like