You are on page 1of 7

Roll No.

18113038

TERM PROJECT

Numerical Methods
Term Project

Piyush Pastor
Roll No. 18113038
Semester: 5th
B.Tech
Chemical Engineering

National Institute of Technology, Raipur


Page |2

Problem Statement

Parabolic equation

Same as Example 8.8/483

Find the temperature as a function of time for a steel plate that is 2 cm. Assume heat flow is at
only one direction. For steel, k= 0.13 cal/(s.cm. oC, specific heat cp= 0.11 cal/g.oC and density
ρ=7.8 g/cm3 . Consider only one dimensional flow of heat. Initially the temperature at x=0 and
x=2 cm are given by relation

T(x) = 100x for x = 0 to 1, T(x) = 200-100x for x = 1 to 2,

α c p ρΔx 2
Take Δx=0.33, α =0.5 and 1. The value of Δt =
k

Note: α = 1, Crank Nikolson formula

Solution.
Given, the boundary conditions, at x=0and at x =2, are u=0 ℃ for all values of time.

Δx=0.333

Initially at time t=0, we have the temperature function defined as

100 x , 0 ≤∧x ≤ 1
T ( x )= {200−100 x ,1 ≤∧x ≤ 0
Now, the value for Δt depends on the value we take for α and is given by the relation

α c p ρΔx 2
Δt =
k
g
where, density , ρ=7.8
cm3

specific h eat , c p=0.11 cal/g ℃

k =0.13 cal / s . cm. ℃

step¿ ∆ x =0.333 cm
Page |3

Case (1): For α = 0.5

Using equation (2),

( 0.5 )( 0.11 )( 7.8 ) (0.333)2


Δt = =0.36 sec
0.13

The Schmidt explicit formula is given by

uij+1=α∗( ui+j 1+u i−1


j
)+ (1−2 α )∗uij

Here α = 0.5 hence the formula reduces to Bendre-Schmidt recurrence relation

uij+1=0.5∗( u i+1
j j
+ui−1 )

The values of u at the internal mesh points are found by using above formula and with the help

i→
t↓ 0 1 2 3 4 5 6
j↓
0 0 0 33.3 66.6 100 66.6 33.3 0
0.36 1 0 33.3 66.6 66.6 66.6 33.3 0
0.72 2 0 33.3 50 66.6 50 33.3 0
1.08 3 0 25 50 49.9 50 25 0
1.46 4 0 25 37.51 49.9 37.5 25 0
1.83 5 0 18.75 37.5 37.5 37.5 18.75 0

Case (2) : For α = 1

we have,

( 1 ) ( 0.11 ) ( 7.8 ) (0.333)2


Δt = =0.7332 sec
0.13

The Schmidt explicit formula is given by equation as


Page |4

uij+1=α∗( ui+j 1+u i−1


j
)+ (1−2 α )∗uij

Putting α = 1 in the above equation we have,

uij+1=1∗( uij+1+ ui−1


j
) + ( 1−2∗1 )∗uij

The values of u at the internal mesh points are found by using above formula and with the help
of boundary conditions.

We get the following table:

x→ 0 0.333 0.666 1 1.333 1.666 2


t↓ i→
0 1 2 3 4 5 6
j↓
0 0 0 33.3 66.6 100 66.6 33.3 0
0.7332 1 0 33.3 66.6 33.32 66.67 33.3 0
1.4664 2 0 33.34 -0.0002 100.0002 -0.0002 33.3 0
2.1996 3 0 -33.36 133.3338 -100.001 133.33 -33.36 0

C++ Program for the given problem

Employing Schmidt Explicit Method for the value of α between 0 to 0.5

The program is as follows:

/*Solution of parabolic equations by Bendre Schmidt method*/

#include <iostream>

#include <iomanip>

using namespace std;

int main()
Page |5

int i,j, tend;

float uint,uend,alpha, u[50][50];

for (i=0;i<1;i++)

{for (j=0;j<=6;j++)

{u[i][j]=j*0.3333;

for (i=1;i<2;i++)

{for (j=0;j<=3;j++)

{u[i][j]=100*u[i-1][j];

for (j=4;j<=6;j++)

{u[i][j]=200-100*u[i-1][j];

cout<<"Enter the value of alpha"<<endl;

cin>>alpha;

cout<<"Enter the number of time steps"<<endl;

cin>>tend;
Page |6

cout<<"Enter u(0,t)"<<endl;

cin>>uint;

cout<<"Enter u(2,t)"<<endl;

cin>>uend;

for(i=1;i<=tend+2;i++)

{for(j=0;j<1;j++)

{u[i][j]=uint;

for(i=1;i<=tend+2;i++)

{for(j=6;j<7;j++)

{u[i][j]=uend;

for(i=2;i<=tend+2;i++)

{for(j=1;j<6;j++)

{u[i][j]= alpha*(u[i-1][j-1]+u[i-1][j+1]) + (1-2*alpha)*u[i-1][j];

for(i=0;i<=tend+2;i++)
Page |7

{for(j=0;j<7;j++){

cout<<setw(10)<<setprecision(5)<<u[i][j];

cout<<endl;

return 0;

}The output is as follows:

You might also like