0% found this document useful (0 votes)
18 views16 pages

NumTech Report

This report details a coding assignment for the ME F485 course, focusing on numerical techniques for fluid flow and heat transfer. It covers five standard problems including heat conduction, flow over a backward-facing step, and mixed convection, detailing the numerical methods, discretization techniques, and results obtained. The report includes analysis and discussions on the implementation of various numerical methods such as the SIMPLE method and the vorticity stream function method.

Uploaded by

f20230991
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)
18 views16 pages

NumTech Report

This report details a coding assignment for the ME F485 course, focusing on numerical techniques for fluid flow and heat transfer. It covers five standard problems including heat conduction, flow over a backward-facing step, and mixed convection, detailing the numerical methods, discretization techniques, and results obtained. The report includes analysis and discussions on the implementation of various numerical methods such as the SIMPLE method and the vorticity stream function method.

Uploaded by

f20230991
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

Coding Assignment Report

Numerical Techniques for Fluid Flow and Heat Transfer

Samarth Subramanya Rao


f20230991@[Link]

November 16, 2025

Abstract
This report contains details regarding the ’Coding Assignment’ completed as a part of
the ME F485 (Numerical Techniques for Fluid Flow and Heat Transfer) course. The assign-
ment consisted of five standard problems - 2D steady state heat conduction, transient heat
conduction in a composite slab, flow past a backward-facing step, lid-driven cavity flow, and
mixed convection in a square cavity. The discretization details, along with the implementa-
tion of the vorticity stream function method, and the SIMPLE method, have been detailed
in the PDF uploaded along with the assignment codes.

1
Contents
1 Problem 1: Steady-State Heat Conduction in a Duct 3
1.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Numerical Method and Discretization . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Problem 2: Transient Heat Conduction in Composite 6


2.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Numerical Method and Discretization . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Forward Euler (FTCS) Scheme . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Crank-Nicolson Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.3 Interface Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Stability Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Problem 3: Flow Over a Backward-Facing Step 8


3.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Numerical Method and Discretization . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4 Problem 4: Lid-Driven Cavity Flow 10


4.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Numerical Method and Discretization . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

5 Problem 5: Mixed Convection in a Square Cavity 13


5.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2 Numerical Method and Discretization . . . . . . . . . . . . . . . . . . . . . . . . 13
5.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.3.1 Case 1: Gr = 100, Re = 400, P r = 0.71 . . . . . . . . . . . . . . . . . . . 13
5.3.2 Case 2: Gr = 106 , Re = 1000, P r = 10 . . . . . . . . . . . . . . . . . . . . 13

2
1 Problem 1: Steady-State Heat Conduction in a Duct
1.1 Problem Statement
The first problem involves finding the steady-state temperature distribution in a hollow square
duct of side length L = 500 cm. The exterior surfaces are maintained at T = 800◦ C and the
interior square surface (of side L/5) is maintained at T = 50◦ C. The problem is solved for two
different spatial discretizations: (a) ∆x = ∆y = 5 cm, and (b) ∆x = ∆y = 2.5 cm.

1.2 Numerical Method and Discretization


Under the given problem conditions, the governing equation for steady-state heat conduction is
the 2D Laplace equation:
∂2T ∂2T
+ =0
∂x2 ∂y 2
This partial differential equation is discretized using a central difference scheme (CDS) on a
uniform grid. For any interior node (i, j), the 5-point finite difference stencil is:

Ti+1,j − 2Ti,j + Ti−1,j Ti,j+1 − 2Ti,j + Ti,j−1


2
+ =0
(∆x) (∆y)2

Given ∆x = ∆y, the equation for Ti,j simplifies to:

1
Ti,j = (Ti+1,j + Ti−1,j + Ti,j+1 + Ti,j−1 )
4
Using the symmetry of the geometry, the problem was tackled by solving for only the upper
right quadrant with the appropriate Neumann-type BCs along the edges normal to the x and y
cutting planes.
In addition, Dirichlet BCs along the outer and inner boundaries were applied. The conver-
gence check was an L-infinity-based one with a tolerance of 10−6 . This linear system of algebraic
equations is solved iteratively using a simple Gauss-Jacobi algorithm for both the 2.5 cm and 5
cm cases.

1.3 Results and Discussion


The raw results from the solver were written into a text file. This text file was then uploaded
onto MATLAB online, where post-processing was performed. For both the 2.5 cm and 5 cm
grid spacing cases, heatmaps and contour plots were generated. Expected results were obtained,
which fairly match the analytical solution.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis.

3
Image Placeholder
Contour plot for ∆x = ∆y = 5 cm.

Figure 1: Steady-state temperature distribution for ∆x = ∆y = 5 cm.

4
Image

Placeholder
Contour plot for ∆x = ∆y = 2.5 cm.

Figure 2: Steady-state temperature distribution for ∆x = ∆y = 2.5 cm.

5
2 Problem 2: Transient Heat Conduction in Composite
2.1 Problem Statement
This problem involves modeling the 1D transient heat conduction across a multi-layered compos-
ite insulation. The slab consists of three layers (A, B, C) with different thermal properties. The
left boundary is held at 1000◦ C and the right at 50◦ C. The initial temperature of the insulation
is 35◦ C. The goal is to find the temporal evolution of the temperature distribution using two
schemes: (a) Forward Euler (FTCS) and (b) Crank-Nicolson.

2.2 Numerical Method and Discretization


The governing equation is the 1D transient heat equation:

∂T ∂2T
=α 2
∂t ∂x

2.2.1 Forward Euler (FTCS) Scheme


The explicit FTCS scheme is discretized as:

Tin+1 − Tin T n − 2Tin + Ti−1


n
= α i+1
∆t (∆x)2

This scheme is stable only for a specific time step size, F o ≤ 0.5, where F o = α∆t/(∆x)2 .

2.2.2 Crank-Nicolson Scheme


The implicit Crank-Nicolson scheme is unconditionally stable and discretized as:
" #
n+1 n+1 n+1
Tin+1 − Tin α Ti+1 − 2Ti + Ti−1 n − 2T n + T n
Ti+1 i i−1
= +
∆t 2 (∆x)2 (∆x)2

This results in a tri-diagonal system of equations which is solved at each time step.

2.2.3 Interface Handling


At the interfaces between materials, a harmonic mean of thermal conductivity (k) and a weighted
average of thermal diffusivity (α) must be used... Nam dui ligula, fringilla a, euismod sodales,
sollicitudin vel, wisi. Morbi auctor lorem non justo.

2.3 Results and Discussion


2.3.1 Stability Analysis
Given ∆x = 1 mm and the material properties, the most restrictive stability criterion comes
from material B (αB = 4αA ). The critical time step for the FTCS scheme was found to be...
Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at, tincidunt tristique,
libero.

6
Image Placeholder
Temporal evolution using Forward Euler scheme.

Figure 3: Temperature evolution (T(x, t)) using the Forward Euler scheme.

Image Placeholder
Temporal evolution using Crank-Nicolson scheme.

Figure 4: Temperature evolution (T(x, t)) using the Crank-Nicolson scheme.

7
3 Problem 3: Flow Over a Backward-Facing Step
3.1 Problem Statement
This problem models 2D steady, incompressible flow over a backward-facing step at a Reynolds
number of Re = 800. The inlet velocity profile is parabolic. The simulation is performed using
the stream function-vorticity (ψ − ω) approach.

3.2 Numerical Method and Discretization


The governing equations in the ψ − ω formulation are:

∂2ω ∂2ω
 
∂ω ∂ψ ∂ω ∂ψ ∂ω 1
+ − = +
∂t ∂y ∂x ∂x ∂y Re ∂x2 ∂y 2

∂2ψ ∂2ψ
+ = −ω
∂x2 ∂y 2
Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae lacus tincidunt ultrices.

3.3 Results and Discussion


The steady-state solution was obtained, and velocity profiles were extracted at three downstream
locations: x/h = 6, 14, and 30.

Image Placeholder
u-velocity profiles at x/h = 6, 14, 30. Compare with Erturk [1].

Figure 5: Horizontal (u) velocity profiles at downstream locations.

Fusce mauris. Vestibulum luctus nibh at lectus.

8
Image Placeholder
v-velocity profiles at x/h = 6, 14, 30. Compare with Erturk [1].

Figure 6: Vertical (v) velocity profiles at downstream locations.

Image Placeholder
Contour of X-velocity (u) for the steady-state solution.

Figure 7: Contour plot of horizontal (u) velocity.

9
4 Problem 4: Lid-Driven Cavity Flow
4.1 Problem Statement
This problem involves simulating steady-state incompressible flow in a square lid-driven cavity
at Re = 100. The top lid moves with a velocity U . The problem is solved using the SIMPLE
algorithm on a staggered grid for three mesh sizes: 20 × 20, 40 × 40, and 80 × 80.

4.2 Numerical Method and Discretization


The steady-state, incompressible Navier-Stokes equations are solved:
∇ · (u) = 0
1 2
(u · ∇)u = −∇p + ∇ u
Re
Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, laoreet vitae, arcu.
Aenean faucibus pede eu ante.

4.3 Results and Discussion


A grid independence study was performed. The velocity components u (along the vertical cen-
terline x = L/2) and v (along the horizontal centerline y = L/2) are plotted for all three meshes
and compared with the benchmark data from Ghia et al. [2].

Image Placeholder
u-velocity along x = L/2 for 20 × 20, 40 × 40, 80 × 80 grids.

Figure 8: Grid independence study: u-velocity along the vertical centerline.

Sed commodo posuere pede. Mauris ut est.


The contours for u-velocity, v-velocity, and pressure for the 80 × 80 grid are shown below.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Donec odio elit, dictum in, hendrerit sit amet, egestas sed, leo.

10
Image Placeholder
v-velocity along y = L/2 for 20 × 20, 40 × 40, 80 × 80 grids.

Figure 9: Grid independence study: v-velocity along the horizontal centerline.

11
u-velocity v-velocity

pressure

Figure 10: Contours of u-velocity, v-velocity, and pressure (p) for the 80 × 80 grid.

12
5 Problem 5: Mixed Convection in a Square Cavity
5.1 Problem Statement
This problem extends Problem 4 to include mixed convection. Buoyancy effects are introduced
via the Boussinesq approximation. The SIMPLE algorithm is used to solve the coupled Navier-
Stokes and thermal energy equations. Two cases are studied:

1. Case 1: Gr = 100, Re = 400, P r = 0.71

2. Case 2: Gr = 106 , Re = 1000, P r = 10

5.2 Numerical Method and Discretization


The governing equations are modified to include the thermal energy equation and the Boussinesq
buoyancy term in the y-momentum equation:
∂p 1 2 Gr
(u · ∇)v = − + ∇ v+ (T − Tref )
∂y Re Re2
1
(u · ∇)T = ∇2 T
Re · P r
Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio, nec commodo wisi enim eget
quam. Quisque libero justo, consectetuer a, feugiat vitae, porttitor eu, libero. Suspendisse sed
mauris vitae elit sollicitudin malesuada.

5.3 Results and Discussion


5.3.1 Case 1: Gr = 100, Re = 400, P r = 0.71
Suspendisse vitae elit. Aliquam arcu neque, ornare in, ullamcorper quis, commodo eu, libero.

5.3.2 Case 2: Gr = 106 , Re = 1000, P r = 10


Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus.

13
Image Placeholder
u, v, and T profiles along centerlines for Case 1. Compare with [3, 4].

Figure 11: Velocity and Temperature profiles for Case 1 (Re = 400, Gr = 100).

Velocity Contours Temp. Contours

Figure 12: Velocity and Temperature contours for Case 1 (Re = 400, Gr = 100).

14
Image Placeholder
Temperature profile along x = L/2 for Case 2. Compare with [3, 4].

Figure 13: Temperature profile along vertical centerline for Case 2 (Re = 1000, Gr = 106 ).

15
References
[1] Ercan Erturk. Numerical solutions of 2-d steady incompressible flow over a backward-facing
step, Part I: High Reynolds number solutions. Computers & Fluids, 37(6):633–655, 2008.

[2] U. Ghia, K.N. Ghia, and C.T. Shin. High-re solutions for incompressible flow using the navier-
stokes equations and a multigrid method. Journal of Computational Physics, 48(3):387–411,
1982.

[3] Reima Iwatsu, Jae Min Hyun, and Kunio Kuwahara. Mixed convection in a driven cavity
with a stable vertical temperature gradient. International Journal of Heat and Mass Transfer,
36(6):1601–1608, 1993.

[4] Hemanshul Garg, Atul K. Soti, and Rajneesh Bhardwaj. A sharp interface immersed bound-
ary method for vortex-induced vibration in the presence of thermal buoyancy. Physics of
Fluids, 30(2):023603, 02 2018.

16

Common questions

Powered by AI

Numerical discretization had a profound influence on results by determining the accuracy and stability of simulations. Uniform grid spacing simplified the application of central difference schemes for discretizing boundary conditions and Laplace equations, particularly in heat conduction, where domain symmetry was exploited for computational efficiency. In fluid flow problems, especially with staggered grids in the SIMPLE algorithm, it ensured that the discrete approximations of the equations captured essential flow physics accurately across varying grid resolutions, influencing convergence rates and solution precision .

The main challenges in simulating flow over a backward-facing step included handling the sudden expansion geometry and capturing the complex recirculation zones downstream of the step accurately. These were addressed by using the stream function-vorticity (ψ − ω) formulation, which is particularly effective for incompressible flow, and allows the decoupling of velocity and pressure fields. This approach enabled capturing the velocity profiles and recirculation zones accurately, as validated by comparing results at various downstream locations with established references .

In the lid-driven cavity flow simulation, mesh size played a critical role in the accuracy of results. The study used three mesh sizes: 20 × 20, 40 × 40, and 80 × 80. A grid independence study was performed to ensure that the numerical solution was independent of the grid used, verifying accuracy and stability of the solution. The velocity components u and v were compared with benchmark data along the vertical and horizontal centerlines, showing that as the mesh was refined, the results converged and became consistent with established benchmark data .

The steady-state heat conduction in a hollow square duct was described by the 2D Laplace equation, discretized using a central difference scheme with the finite difference stencil \( T_{i,j} = \frac{1}{4}(T_{i+1,j} + T_{i-1,j} + T_{i,j+1} + T_{i,j-1}) \). The problem was solved iteratively using the Gauss-Jacobi algorithm, which iterated over the algebraic system of linear equations until convergence was achieved with a tolerance of \( 10^{-6} \).

Interface handling is crucial in transient heat conduction in composites due to the different thermal properties of materials at the interfaces. Accurate modeling requires harmonically averaged thermal conductivity and diffusivity across interfaces to ensure continuity of temperature and heat flux. This was achieved by implementing a weighted average of thermal diffusivity and a harmonic mean for thermal conductivity to transition smoothly between layers, thereby maintaining stability and accuracy in the numerical model .

The vorticity-stream function approach simplifies the solution of flow problems like over a backward-facing step by eliminating the pressure term from the Navier-Stokes equations, focusing instead on vorticity and stream function, which directly describe the rotational and flow characteristics. This formulation reduces the number of equations and unknowns, leading to computational efficiency. It is particularly advantageous in handling complex boundaries and recirculating flow regions, providing clear insights into the flow pattern and aiding in accurate capture of recirculation zones .

Grid independence implies that the numerical results become consistent and do not change significantly with further refinement of the grid. This assures that the solution is a true representation of the physical problem rather than a numerical artifact. In the lid-driven cavity flow simulation, achieving grid independence verified that the velocities and pressures calculated were robust and not dependent on the mesh. This was confirmed by comparing results from different grid sizes, ensuring the solution's reliability and accuracy when compared with benchmark data .

The Crank-Nicolson scheme, being implicit, is unconditionally stable, offering greater accuracy at larger time steps compared to the explicit Forward Euler scheme, which requires smaller time steps for stability (Fo ≤ 0.5). While the Crank-Nicolson involves solving a tri-diagonal matrix, increasing computational cost per time step, it allows for fewer overall steps for equivalent accuracy compared to the Forward Euler scheme, which, despite its simplicity and ease of implementation, necessitates more time steps to maintain stability and achieve similar accuracy .

The SIMPLE (Semi-Implicit Method for Pressure Linked Equations) algorithm is significant in solving the mixed convection problem as it provides a way to handle the coupling between pressure and velocity fields in incompressible flow problems. The study explored two cases with different Grashof (Gr) and Reynolds numbers (Re): Case 1 with Gr = 100 and Re = 400, and Case 2 with Gr = 10^6 and Re = 1000. These variations influenced the flow dynamics significantly, where higher Grashof numbers enhanced buoyancy effects, and higher Reynolds numbers increased inertial forces, affecting velocity and temperature distributions .

The transient heat conduction problem in a composite slab was solved using two numerical schemes: the Forward Euler (explicit) scheme and the Crank-Nicolson (implicit) scheme. The Forward Euler scheme is discretized as \( T_{i}^{n+1} - T_{i}^{n} = \frac{\alpha \Delta t}{(\Delta x)^2} (T_{i+1}^{n} - 2T_{i}^{n} + T_{i-1}^{n}) \) and is conditionally stable with a time-step restriction of \( Fo \le 0.5 \). In contrast, the Crank-Nicolson scheme is unconditionally stable and discretized to form a tri-diagonal system of equations at each time step, offering stability advantages over the Forward Euler scheme .

You might also like