0% found this document useful (0 votes)
85 views3 pages

Assign Pro

This document outlines 6 programming assignments for a numerical methods course. The assignments involve: 1. Implementing a TDMA solver in Matlab and testing it. 2. Developing a Matlab code to simulate 1D steady-state heat conduction using a control volume approach. 3. Modifying the 1D conduction code to simulate transient conduction with temperature-dependent properties. 4. Implementing a 2D TDMA solver in Matlab and testing it. 5. Extending the 1D transient conduction code to 2D and including temperature-dependent properties. 6. Developing a Matlab code to simulate quasi-1D convection-diffusion and solving sample problems.

Uploaded by

Rajesh Shukla
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)
85 views3 pages

Assign Pro

This document outlines 6 programming assignments for a numerical methods course. The assignments involve: 1. Implementing a TDMA solver in Matlab and testing it. 2. Developing a Matlab code to simulate 1D steady-state heat conduction using a control volume approach. 3. Modifying the 1D conduction code to simulate transient conduction with temperature-dependent properties. 4. Implementing a 2D TDMA solver in Matlab and testing it. 5. Extending the 1D transient conduction code to 2D and including temperature-dependent properties. 6. Developing a Matlab code to simulate quasi-1D convection-diffusion and solving sample problems.

Uploaded by

Rajesh Shukla
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/ 3

Eng9977 - Programming Assignments 1

1. Using MatLab implement a TDMA solver. Write a main program to test the solver as de-
scribed in the Appendix to the notes. Write the solver using the aP , aE , aW and b coefficients
as shown in the notes. Confirm the solver works. Submit a print out of the main program
and solver. E-mail the m-files (in the same version as the print out) used to implement and
test the solver. (Due: January 26, 2017)

2. Using Matlab implement a code to simulate steady state one-dimensional heat conduction.
Use the profile assumptions, coefficient definitions and algorithm defined in the notes. Define
separate routines for each step in the algorithm. You can assume that control volume faces
are placed midway between the nodes in the domain. Define the boundary conditions at each
end of the domain using convection heat transfer as this will allow simulation of all three
types of boundary conditions. Assume the thermal conductivity, k, and source term, q̇, are
nonuniform and stored at each node. ( Due: February 2, 2017)

3. Modify your steady-state 1D conduction code to produce a method for quasi-1D, transient
conduction with temperature dependent thermal conductivity and source terms. (Due:
February 16, 2017)

• A true 1D solution uses a constant area (we have used an area of one), however, the
method can be modified by including areas at the control volume faces to evaluate the
rate of heat transfer in and out, and a volume can be calculated for use in the source
term. Also, to develop a more general implementation do not assume cv faces are midway
between the nodes.
• Use the factor fe = (δx)e+ /(δx)e to locate the cv faces, where fe can be different between
each pair of nodes and is defined in GRID. See pages 19 and 20 of the notes.
• There are many options available for determining the cv face areas and cv volume. Two
of which are: (1) use the known analytical values; or (2) define the area at the nodes
and then use piecewise linear approximations between nodes to determine the cv face
areas and two partial cv’s. Method 2 would be the more general method as a functional
relationship may not be available for area and volume for a given domain shape. So...set
it up as per method 2. Calculate/define the nodal areas in GRID, then determine the
face areas and volumes in COEFF.
• Modify the calculation procedure for interface thermal conductivities. See Eq. (78) of
the notes.
• Use convection boundary conditions.
• Use fully implicit time integration and allow for input of a time step, initial and final
times in your DATA routine.
• Allow for a linear dependence of thermal conductivity on temperature in GAMSOR.
• Allow for linear dependence of area on x in GRID.
• Linearize the source term as S = SC + SP T . Where the nodal values of SC and SP are
specified in GAMSOR.
• Be careful of the changes required to the overall solution algorithm.
• Include potential for under-relaxation of the discretized equation at each time step.
• You need to specify nodal values of ρ and cp (specific heat). This can be done in
GAMSOR.
• You will need a realistic initial T -field so that realistic k would be produced in the first
time step.
Eng9977 - Programming Assignments 2

• You will need to store the calculated T field after each time step as Told which is then
used in the b coefficient.
• The appropriate area will have to be used in the aE , aW coefficients, and in the aP and
b coefficients at the boundaries (in the convection terms).
• Within each time step you will have to allow iterations as k can be a function of T . You
will store Told after those iterations. These iterations can be done in a loop defined by
a maximum iteration of iter.

The result will be a very general program that can handle pretty much any 1D or quasi-
1D problem, i.e., steady or transient, uniform or nonuniform properties, single and multi-
materials, source or no source, and temperature dependent properties. All you have to do is
appropriately specify the domain discretization, time steps, and property relationships. Much
of this code can be tested using the steady state testing procedure defined in the Appendix.

4. Implement a 2D TDMA solver using the supplied skeleton code. Write a main code to test
the solver. Use an ”exact” solution of Tex = i ∗ j, with each neighbour coefficient equal to
2. The code is set up for n nodes in the i-direction (i.e. x) and m nodes in the j-direction
(i.e. y). For testing purposes use m = n = 21, and to tie the solution down overwrite the
coefficients at node i = j = 11. The code limits the iterations in the solver to iter, where the
iteration counter is it. For testing purposes set iter to 2000. Once you have a working test
code write a routine to calculate the residual at each node and for each iteration of the solver
store the sum of all residuals (ressum), the maximum residual (resmax), and the residual
ratio (current iteration ressum)/(ressum at entry to solver). Modify the while statement in
the solver to terminate iterations if (ressum ≤ ressumtest and resmax ≤ resmaxtest or it≥
iter). (Due: February 16, 2017)

5. Write a code to simulate 2D transient conduction heat transfer including temperature de-
pendent thermal conductivity and source terms. Assume the cv faces to be placed midway
between the nodes. Use convection boundary conditions. BE careful here as you want to be
able to specify different h’s and T∞ ’s on the top, bottom and side faces for the corner nodes.
Use fully implicit time integration and allow for input of a time step, initial and final times
in your DATA routine. Allow for a linear dependence of thermal conductivity on temper-
ature, ki = ko + β (Ti − Tref ) , in GAMSOR. Linearize the source term as S = SC + SP T .
Basically, you are extending the code for Assignment 3 to two dimensions. Interestingly, if
you set htop = hbottom = 0 you will not be providing for heat transfer out the top and bot-
tom sides of the domain. That means those surfaces are insulated. Therefore, you can solve
one-dimensional problems in x. Or you can set hlef t = hright = 0 and solve one-dimensional
problems in y. So...you can test your code with the previous 1D problems. You should get
the same solutions as your 1D codes. If not...debug! (Due: March 2, 2017)

6. Write a code for steady, quasi-1D convection-diffusion. You can extend your transient con-
duction code (Assignment 3 above) if you like...the test problems will be steady-state only.
Follow the general outline for the conduction program in Assignment 3. Use the exponential
scheme to determine fluxes at control volume faces and you may assume cv faces are midway
between nodes. Here, the velocity field would be known, so any velocity that is required in
your code would be available from the mass flow rate u = ṁ/ρA, and it would not change.
So, you can evaluate the velocity from the mass flow rate at the exact locations you require.
We will solve two test problems, for two different velocities (or mass flow rates). In both
problems, the governing equation is:
 
d (ρAuφ) d dφ
= ΓA +S
dx dx dx
Eng9977 - Programming Assignments 3

But, from continuity ρAu = ṁ = const, and assuming Γ = const, the governing equation is:
 
dφ d dφ
ṁ =Γ A +S
dx dx dx

Assuming the area varies linearly A = Ao + Bo x, and a φ distribution of φ = φo + Cx + Dx2 ,


the source term S can be determined as a function of location. This source term can then be
used in your code to try to regenerate the φ distribution. Solve the following two problems
with 0 ≤ x ≤ 0.5, 11 uniformly spaced nodes, ρ = 1, ṁ = 10−4 and 100, and set φo = 1,
C = 10 and D = 100 in the φ function. Plot φ vs x for both mass flow rates (include the exact
φ) on the same figure. Plot abs(error) in φ vs x for both mass flow rates on the same figure.
Print tables with the data for each figure. For both problems use specified value boundary
conditions at the inlet. For the low mass flow you will need to specify the exit boundary also.
For the high mass flow try not to specify anything at the outflow boundary. It should work!
If it doesn’t work you can specify the value at exit. (Due: March 9, 2017)

You might also like