Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views2 pages

CFD Exercise - Algorithm

Uploaded by

manishindian979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

CFD Exercise - Algorithm

Uploaded by

manishindian979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CFD EXERCISE PROBLEM

1. Algorithm of the Program

4.1 The algorithm of the program is as follows:-

(a) Read the variables from input file “Input Data.dat”. The variables defined
in the input file are as follows (in same sequence):-
(i) Length, L (in m)
(ii) Thermal Diffusivity, α (in m2/s)
(iii) Number of Grid Points, NX
(iv) Initial Time (corresponding to Initial Condition), t0
(v) Final Time (maximum time for simulation), tn
(vi) Boundary Condition 1: Temperature at t > t0 & x = 0
(vii) Boundary Condition 2: Temperature at t > t0 & x = L
(viii) Time step, Δt (in s)
(ix) Acceptable error in Temperature (for convergence check)
(x) Total number of time steps for which Temperature Profile is to be
plotted, nt_pl.
(xi) 1st Time for which temperature profile is to be plotted.
(xii) 2nd Time for which temperature profile is to be plotted.
……….
(x+nt_pl=i') nt_plth Time for which temperature profile is to be plotted.
(ii’) Total number of grid point locations for which Time Series of
Temperature is to be plotted, nx_pl.
(iii’) 1st Grid Point Location for Time Series Plot.
(iv’) 2nd Grid Point Location for Time Series Plot.
………..
(ii’+nx_pl) nx_plth Grid Point Location for Time Series Plot.
(b) Calculation of space step, grid point locations (space vector) and time
vector, and allocation of Temperature matrix (nt X nx)

(c) Initialization. Set all the values of temperature for 0th time step i.e.
all columns of Temperature matrix for 1st row = Initial Temperature, i.e.
𝑇(1,1: 𝑛𝑥) = 𝑇0

(d) Application of Boundary Conditions.


(i) Set all the values of temperature for t>t0 and x = 0 as Tx0, i.e.
𝑇(2: 𝑛𝑡, 1) = 𝑇𝑥0
(ii) Set all the values of temperature for t>t0 and x = L as TL, i.e.
𝑇(2: 𝑛𝑡, 𝑛𝑥) = 𝑇𝐿

(e) Discretization & Solution. Use for loops for n=1 to nt-1 and for
i=2 to nx-1 and apply the FTCS scheme as follows:-
𝑇(𝑛 + 1, 𝑖) = 𝑇(𝑛, 𝑖) + 𝜗 [ 𝑇(𝑛, 𝑖 + 1) − 2 𝑇(𝑛, 𝑖) + 𝑇(𝑛, 𝑖 − 1) ]

1
(f) Convergence check. For every nth loop, check the maximum
residual of temperature (Tnew – Told) and compare it with the acceptable error.
Also, compare it with residual of previous time step to check if the scheme
diverges at any point.

(g) Plotting. Plot the following in three different figures:-


(i) Time history of residual to check the convergence pattern
(t vs residual).
(ii) Temperature profiles at times specified in input file
[x vs T(n_pl,1:nx)].
(iii) Time History of Temperature at locations specified in input file
[t vs T(1:nt, i_pl)].

You might also like