• CFD, Fluid Flow, FEA, Heat/Mass Transfer

Textbook Solutions: Fluid Mechanics, Heat & Mass Transfer, Aerodynamics

FM, HTX, MTX, AERO, COMBUSTION

This page is being continuously updated with complex (text-book type) problems in Fluid Mechanics, Heat Transfer, Aerodynamics, Mass Transfer, Combustion and Thermodynamics. The solutions to compressible flows including sub-sonic, sonic and supersonic flows inside a converging-diverging nozzle will be presented.


Table of Contents:

Buoyancy \-\ Plug Flow between Parallel Plates \-\ Flow through Pipe Branches forming Tee or Wye Network \-\ Equation of State: Soave-Redlick-Kwong Equation \-\ Half Filled Rotating Tube \+\ Thermal Network Example Calculations \=\ Steps to Create a Thermal Network Solver

Summary of Hydrostatics

  • For a plane surface immersed in a liquid in any orientation, the total normal pressure over the surface is P = A * ρ * g * h where h is the vertical depth of the centre of the gravity of the surface from free surface of the liquid, A is area of the surface.
  • A plane surface immersed in a liquid is acted upon by a system of parallel forces which can be reduced to act on a single point of the surface known as centre of pressure.
  • A curved surface immersed in a liquid is not acted upon a "system of parallel forces" and hence in general they cannot be reduced to a single force.

Centre of pressure of vertical rectangular plate

This is a very useful case which has frequent engineering applications.

Centre of Pressure - Rectangular plate

From the definition of centre of pressure, the value can be calculated as:

Centre of Pressure - Rectangular plate

Similarly, for a triangular plate with base horizontal and at depth of Y2 and vertex up at depth of Y1, the centre of pressure is given by:

Centre of Pressure - Triangular plate

Note that if the triangular plate is with base horizontal and at depth of Y1 and vertex down at depth of Y2, the centre of pressure can be obtained by interchanging Y1 and Y2 in above expression. Thus:

Centre of Pressure - Triangular plate


Centre of pressure of vertical circular plate

Centre of Pressure - Circular plate

Centre of Pressure - Circular plate

Even though the complicated definite integration is possible analytically, this is the time the introduce a simple method based on properties of sections. Note that the numerator of expression for centre of pressure is the "Second Moment of Inertia" or simply the Moment of Inertia about a "chosen axis" - typically the free surface of the liquid. The denominator is the "Moment of Area" about the same axis as chosen above - also known as "Statical Moment". Thus:

Centre of Pressure - Circular plate

For the circular plate:

Centre of Pressure - Circular plate

Note about location of centre of pressure in the coordinate direction perpendicular to the depth of liquid column:
  • If the area has axis of symmetry about the vertical axis, the centre of pressure will fall on it.
  • Conversely, the centre of pressure will fall on the medial line, the vertical axis passing through the centre of gravity on the horizontal axis.
  • The position of the centre of pressure is always below the centre of gravity of a surface.

Buoyancy - Example Problem

A metallic block is floating along with a wooden block as shown in the figure below. If this metallic block falls into the tank, calculate the new depth of floatation and height of water level in the tank.

buoyancy

Volume of liquid: VLIQ = A* H – a * L = constant. Total weight of wooden and metallic block = weight of displaced liquid. Thus:

buoyancy

Similarly, when upper block of mass m is removed:

buoyancy

Now, change in H due to smaller block falling into the tank:

buoyancy


Analogy Between Fluid Flow, HTX and MTX

The method of relating two phenomena with some come feature is a powerful tool to both understand and remember the concepts. Following table summarizes key parameters which are analogous in the field of fluid flow (momentum transfer), heat transfer and mass transfer.

Analogy - MTX / HTX


1D Heat Transfer with Convective Boundaries and Heat Generation

The designs of heat exchangers are the most predominant application of conductive heat transfer with such boundary conditions. The temperature profile in walls of a water-cooled internal combustion engine is also subject to this combination of boundary conditions though heat generation is not present in this application. Some applications can be current carrying conductor cooled by convection on both inner and outer diameters, nuclear fission in a annular cross-section cooled by convection on both the inner and outer radii. The governing equation and general solution of the differential equation is given by

Convective BC with Heat Generation

Heat flow is assumed positive from left to right. Hence, the convective heat transfer on left face is negative if ambient temperature is < wall temperature on the left face!

Convective BC with Heat Generation
Finally, the temperature distribution function is expressed as:
Convective BC with Heat Generation

Plug Flow between Parallel Plates

Plug Flow

Flow in an Annular Passage

Annular Duct
Annular Duct

Flow through Pipe Branches forming Tee or Wye Network

Tee - Pipe Network

Note velocities in pipe branches 1-2, 2-3 and 3-4 are not known in advance and hence the loss coefficients KMN cannot be adjusted to same velocity. Note that the junction losses at node 2 can be incorporated either in K12 or in K23 and K24. It is more convenient to club the node loss in K12 as appropriate assignment into K23 and K24 will involve extra calculations.

Tee - Pipe Network

Denoting the pressures in terms of head of water column:
Tee - Pipe Network

Simplifying further:
Tee - Pipe Network

This is a non-linear equation in V23 and needs to be solved using trial-and-error or iterative approaches. Microsoft Excel Goal Seek utility can be used to solve this equation as well. A good initial guess would be required.

A more compact approach in terms of fluid resistances can be used as demonstrated below.


Tee - Pipe Network

Thus, we have 3 equations and 3 unknowns – but they are still non-linear and needs to be solved using iterative method.


Force on a curved pipe with varying cross-section

Fluid Force - curved pipe

A reducing bend having diameters D upstream and d downstream, has water flowing through it at the rate of m [kg/s] under a pressure of p1 bar. Neglecting any loss is head for friction calculate, the horizontal and vertical components of force exerted by the water on the bend.

Newton's Law of Motion applied to Fluid Elements:
F = m [u2 - u1]

Newton's Third Law Applied to Pipe:

This is the force acting on the fluid and only means to apply the force on the fluid is the walls of the pipe. Hence, from Newton’s third law, and equation and opposite force will act on the pipe.

ΔΓX = m * [u2X - u1X] = FΓX. Thus: FΓX = m * [u2 cos(θ) - u1]

ΔΓY = m * [u2Y - u1Y] = FΓY. Hence, FΓY = m * [u2 sin(θ) - 0] = m * u2 sin(θ)
Force on fluid element due to pressure at boundaries
FpX = p1A1 - p2A2cos(θ)
FpY = 0 - p2A2sin(θ)

Use Bernoulli’s equation to find p2 in terms of other known parameters:

Bernoulli’s equation - curved pipe

From mass balance at inlet and outlet: u2 = u1 * A1 / A2. Thus, we get components of force on fluid elements:

Flow in curved pipe

As stated earlier, the force on the pipe will be equation in magnitude but opposite in direction. Hence, components of force on pipe are:
Flow in curved pipe

If pipe is straight
θ = 0

Flow in curved pipe


Equation of State: Soave-Redlick-Kwong Equation

or gases at very high pressure and those in liquid state such as Liquified Petrolium Gas (LPG), the accuracy of ideal gas equation falls sharply. Many improvizations have been made and SRK equation is one such method. The approach is demonstrated using following sample problem:

A gas cylinder with a volume of 5.0 m3 contains 44 kg of carbon dioxide at T = 273 K. estimate the gas pressure in [atm] using the SRK equation of state. Critical properties of CO2 and Pitzer acentric factor are: Tc = 304.2 K, pc = 72.9 atm, and ω = 0.225.

General cubic equation of state is given by following equation

EOS SRK
ROS SRK

Alternatively, the equation can be solved using Newton's method as described below.

ROS SRK

Iterate till the difference in vnew and vold falls to desired accuracy.
The equation of equilibrium of fluid particles rotating about any fixed axis (say Z-axis) and acted about forces in 3 directions is given by:

dp = ρ . {FX dx + FY dy + FZ dz + ω2(xdx + ydy)} where FX is the force per unit volume is X-direction. Alternatively, dp = ρ . {FX dx + FY dy + FZ dz + ω2rdr}. Any point where liquid separates is the location where pressure vanishes i.e. p = 0. Latus rectum of free surface = 2g/ω2.

Latus-Rectum

Half Filled Rotating Tube: A circular tube is half full of liquid and is made to revolve around a vertical tangent line with angular velocity ω. If radius of the tube is R, calculate the angle between horizontal and diameter passing through the free surface of the liquid.

Rotating Tube

The tube is rotating about red line and the liquid level is shown by yellow zone. Point 'D' is the lower most point of free surface, θ is the angle which needs to be calculated.

The pressure at any location is given by: dp = ρ (ω2r.dr + gdz) where r is the distance of the point from the axis of rotation and z is the distance of the point from the origin. The point 'D' is rotating at radius r = R(1-cosθ), z = R.sinθ and is at p = 0. Another known point 'C' is at pressure zero, r = R(1+cosθ), z = -Rsinθ. Note that +z is along the downward direction (this is only a convention).

Rotating Tube Equation

From boundary conditions at point 'C'.

Rotating Tube Angle of Free Surface

Liquid filled in rotating conical pot: A conical pot of height H and vertical (full cone) angle θ contains liquid k-times (x < 1) the volume of full cone. Find out the minimum angular velocity at which shall prevent liquid overflowing the cone.

Rotating Conical Pot

CD = depth of lowest point of free surface = H - h = z. Volume of water (yellow portion) = Volume of cone * k, shape of free surface is a paraboloid of revolution ⇒ π/3*R2H - π/2*R2z = k.π/3*R2H ⇒ 2R2H - 3R2z = 2k.R2H.

Thus; z = (1-k).2H/3 ... [1] Also, from paraboloid of revolution (latus rectum): 2g/ω2 = R2/z ⇒ z = ω2.R2/2/g ... [2]

To prevent overflow: z ≤ (1-k).2H/3

From equations [1] and [2], ω2.R2/2/g ≤ (1-k).2H/3 ⇒ ω ≤ [4g/3.(1-k).H/R2]1/2

R = H . tan(α) ⇒ ω ≤ [4g/3H.(1-k)]1/2.cot(α), thus if k = 0.5, ω ≤ [2g/3H]1/2.cot(α)
A closed circular cylinder is just filled with water and rotates about a vertical. Find the ratio of total thrust on the bottom to that on the top when the angular velocity is ω, H is the height and R the radius of the cylinder.

completely filled rotating Cylinder

Let's assume origin of axis is at the top face and vertically downwards. This location is chosen because here p = 0, r = 0, and z = 0 Pressure at any point is given by: dp = ρ (ω2 r dr + g dz) where ρ is the density of the fluid and z is vertical distance along gravity direction.

equation rotating Cylinder

On the upper surface, z = 0:

Trhust Top Face

Similarly, at z = H:

Thrust Bottom Face


Fluid Pressure in Rotating Reference Frame
Bernoulli’s equation in the rotating frame where rotation is around z-axis: p(r, z) + ρgz + V(r) = p(r, z) + ρgz − ρω2r2. For a container open to atmosphere, gauge pressure at all points on the interface is zero i.e. p(r, z) = 0. Elevation of the free surface to the radial location: z = ω2r2/2/g.

For a container rotating cylindrical about its axis: the shape of the free surface is a parabola and fluid inside the rotating cylinder forms a paraboloid of revolution, whose volume is one-half of the volume of the "circumscribing cylinder". To calculate angular velocity at which the liquid at the center reaches the bottom of the cylinder just as the liquid at the curved wall reaches the top of the cylinder: ωspill = (2gH)0.5/R.

Ball in rotating tube

ball in a Rotating Tube

If density of the ball is less than density of the fluid in the rotating tube, the ball or radius R and density ρB shall get pushed towards the inner radius of the tube and vice-versa. p(r) = p(r = r0) + 1/2.ρFω2r2

The centroid of a hemi-sphere is at 3R/8 from the base. Using this value, pressure on the left half of the ball = 1/2.ρF ω2(r-3R/8)2. The pressure on the right half of the ball = 1/2.ρF ω2(r+3R/8)2. Net force acting on the ball towards the axis of rotation = 1/2.ρF ω2(4.r.3R/8)2 × π*R2 where projected area = π*R2.

Net force due to fluid pressure towards axis of rotation, FF = 1/2.πR2F ω2(r.3R/2) = 3/4πR3F ω2r

Centrifugal force due to own mass of the ball, FB = 4/3.πR3B ω2r

The position of the ball can be estimated using inequality FB ≤ FF. Will the ball get pushed towards inner radius for all densities of the ball? This method yeilded incorrect conclusion as the pressure on the surface of spherical ball was assumed to be varying linearly with radius instead of parabolic variation as per formula p(r) = p(r = r0) + 1/2.ρFω2r2. The correct derivation of net fluid forces acting on the ball are given below:

Sphere-Parabolic-Pressure

The negative value of FX means force is acting towards the axis of rotation as expected. As can be derived, FBF = -FXB which means that FX is higher in magnitude than FB is density of the ball is less than that of the fluid. Thus, a bollon filled with Helium in a rotating cylinder with air shall be pushed towards inner radius and a bollon filled with Argon gas shall stick to the outer radius.

A circular cylinder of radius 'a' whose axis is vertical, is filled to depth h with homogeneous liquid of density ρ. Find the pressure as function of radial and vertical positions. Also, find the forces acting on the top lid if closed.

Cylinder-Vertical

From equation: dp = ρ . {FX dx + FY dy + FZ dz + ω2rdr} and FX = 0 = FY, FZ = -g,

dp = ρ{-g.dz + ω2rdr} -> p = ρ{-g.z + 1/2.ω2r2} + C

Applying boundary condition at centre of top surface, p = 0 at r = 0 and z = h, C = ρgh. Thus, p = ρ{-g.z + 1/2.ω2r2} + ρgh and pressure at any point on top lid can be found by z = h. The thrust on the top lid is:

Thrust-Cylinder-Lid


A hollow cone nearly filled with water, rotates uniformly about its axis which is vertical, the vertex being uppermost. Find the total thrust on the base of the cone. 'a' is the radius of the base and 2α the vertical angle of the cone.

Rotating-Cone

From equation: dp = ρ . {FX dx + FY dy + FZ dz + ω2rdr} and boundary conditions: FX = 0 = FY, FZ = -g, p = 0 at r = 0 and z = h:

p = ρ{-g.z + 1/2.ω2r2} + ρgh

At the base of the cone, z = 0. Thus, p(z=0) = ρ{1/2.ω2r2} + ρgh

Thrust-Cone-Base

Practice Questions:

  1. A hollow sphere of radius 'R' is half-filled with liquid and is rotating at angular velocity ω about its vertical diameter. Find out the value of ω at which the lowest point of the sphere is just exposed. Answer: [2g/R]1/2.[2-41/3]-1/2. Hint: volume of water remains constant.
  2. A narrow annular horizontal tube of radius R containing liquid is filled to half of its circumference and is rotating about the vertical diameter with angular velocity ω. Calculate the value of angular velocity at which liquid will just separate. Answer: [2g/R]1/2. Hint: pressure will become zero at lowest point when liquid separates.
  3. A vertical inverted conical vessel (base at the top) of height 'h' and cone angle 2θ is half-filled with a liquid oil. Find out the maximum angular velocity ω at which the oil shall not overflow. Answer: [2g/3h]1/2.cot(θ) Hint: use latus rectum as defined earlier.

Steps to Create a Thermal Network Solver

Step-0: Define problem set-up: Steady or Transient, Initial Temperature, Total Run Time, Time Step Solution, Time Step Data Save.

Step-1: Define input table for the network. For Steady state cases, Cp and Mass shall be neglected.

FD-FV-1D

Note that: NND = number of nodes, NCV = Number of control volumes = NND+1, XND[0] = XCV[0] = 0, XCV[i] = (XND[i+1] + XND[i] ) / 2 for i = 1 to NND-1, XCV[NCV] = XND[NND]. LCV[0] = XND[1]/2, LCV[i] = XCV[i] - XCV[i-1], LCV[NCV] = 0.5 x (XND[NND] - XND[NND-1])

NodeTARXCpMassConnected Nodes
[No.][C][m2][J/kg-K][kg][No.]
100.0127000.1023-
200.0112000.05134
3400.0112000.02152
400.015000.013--
........................

Step-2: Define resistance table. All information can be supplied as CSV file in following order (use negative number for boundary nodes). Here, Tref can be used to specified reference temperature for nodes with HTC boundary conditions as well as nodes with known or fixed temperatures. Value of 0 for Temperature or Tref indicate unknown or optional. There are some limitations to define the nodes such as a node must be placed where there is step change of cross-section. The node numbering must start with 1 and increase sequentially without any gap.

R_ID, s_node, e_node, xLen,  xAr,      k,     Cp,    Den 
R01,  1,      2,      0.050, 0.0005, 200.0, 500.0, 2700.0
R02,  2,      3,      0.025, 0.0005, 200.0, 500.0, 2700.0
R03,  2,      4,      0.025, 0.0005, 200.0, 500.0, 2700.0
R04,  2,      5,      0.125, 0.0005, 200.0, 500.0, 2700.0
R05,  5,      6,      0.025, 0.0005, 200.0, 500.0, 2700.0
R06,  5,      7,      0.025, 0.0005, 200.0, 500.0, 2700.0
R07,  5,      8,      0.025, 0.0005, 200.0, 500.0, 2700.0
R08,  8,      9,      0.025, 0.0005, 200.0, 500.0, 2700.0
R09,  9,     10,      0.025, 0.0005, 200.0, 500.0, 2700.0
Use one line function to calculation thermal resistance and thermal inertia (capacitance) - lambda functions can also be used.
def calcThermalRes(xL, xA, xk):
  return xL/xA/xk
def calcThermalIntertia(xL, xA, xDen, xCp):
  return xDen * (xL * xA) * xCp
Inputs for nodes, note that symbol Tref is used both for specified node temperature and reference temperature in case of convective boundary conditions.
NN stands for Node Number
-------------------------
NN,   Qdot,  HTC,    Tref
 1,    0,     0,     288
 2,   50,     0,     0
 3,   50,     0,     0
 4,   50,     0,     0
 5,    0,     0,     0
 6,    0,     0,     323
 7,    0,    10,     298
 8,    0,    10,     298
 9,    0,     0,     0
10,    0,     0,     373
 
import csv
def csvToColumnLists(csv_file):
  '''
  Reads a CSV file and returns a dictionary where keys are column headers
  and values are lists containing the data for each column. First non empty
  row is assumed to be header containing strings without spaces. Header names
  are case-sensitive.
  '''
  column_data = {}
  with open(csv_file, 'r', newline='') as file_csv:
    reader = csv.reader(file_csv)
    headers = next(reader)
    headers = [header.strip() for header in headers]
    # Initialize empty list for each header and append data
    for header in headers:
      column_data[header] = []
    for row in reader:
      for i, value in enumerate(row):
        column_data[headers[i]].append(value.strip())
  return column_data
#
data_r = csvToColumnLists('thermal_r.csv')
node_col_1 = data_r['s_node']
node_col_2 = data_r['e_node']
node_col_1 = [int(NN) for NN in node_col_1]
node_col_2 = [int(NN) for NN in node_col_2]
xL = data_r['xLen']

# Find names of nodes as union of sets from column 2 and 3
NNU = list(set(node_col_1) | (set(node_col_2)))
NNU = [int(N) for N in NNU]
NNU.sort()

NNL = node_col_1 + node_col_2
max_n = int(max(set(NNL), key=NNL.count))
NNR = len(data_r['R_ID'])
NMAT = [[0] * max_n] * NNR

Create thermal resistance 2D array

def createRTH(xLen, xAr, xk, node_i, node_j):
  '''
  Create thermal resistance as 2D matrix, the size of matrix is 1 greater than
  the maximum node number in the network. Note that node numbering starts from
  1 and increase sequentially without any gap or step.
  '''
  NTH = int(max(max(node_i), max(node_j)))
  NR = len(node_i)
  RTH = []
  for _ in range(NTH):
    row = [0] * NTH
    RTH.append(row)
    
  for i in range(0, NR):
    m = int(node_i[i]) - 1
    n = int(node_j[i]) - 1
    RTH[m][n] = float(xLen[i]) / float(xAr[i]) / float(xk[i])
    RTH[n][m] = RTH[m][n]
  return RTH

Step-3: Define governing equations using energy balance at each nodes with unknown temperatures and nodes with known temperatures.

For node-1 above: (T1 - T2)/R12 + (T1 - T3)/R13 = Qdot1

or

A1 T1 + B12T2 + B13T3 = Qdot1 where the second values in the subscripts correspond to entry under "Connected Nodes".

For node-2 above: (T2 - T1)/R12 + (T2 - T3)/R23 + (T2 - T4)/R24 = Qdot2

or

A2 T2 + B21T1 + B23T3 + B24T4 = Qdot2 where the second values in the subscripts correpond to entry under "Connected Nodes".

Step-4: Convert the individual equations into equivalent index notation (subscripts converted into indices of arrays).

Step-5: Define variables and arrays. NND = number of nodes, 1D arrays: XND[NND], XCV[NCV] Qdot[NND], Cp[NND], mass[NND], cond[NND], XAR[NND], LCV[NND]. 2D arrays: coeff_a[NND, NND], coeff_b[NND, NND], coeff_c[NND, NND], th_res[NND, 10], con_nodes(NND, 10). Each node is assumed to be connected to maximum 10 nodes.

Write functions to approximate differential equations

Difference Schemes

explicit FD oneD

explicit OneD Radiation

For steady state 1D heat conduction with volumetric heat generation and convective heat loss:

thermal Network Energy balance

Refer examples at people.math.sc.edu/.../fd1d_heat_explicit.html for sample Python codes.

Another example from web:

OneD-Thermal-Net

Training Project: Development of thermal network model and validation of results with 3D CFD simulations using ANSYS Fluent or OpenFOAM is a good internship project. This will impart not only programming skills but also help the engineer gain insight into heat transfer and matrix algebra.


Thermal Network Example Hand Calculations

Assume all heat flowing into a node is positive and all nodes around it are at higher temperatures. Final result will amend this assumption to correct values.
q'[100W]----->[1]-------[2]--------[3]== T [300 K]
                  L: 0.10 [m]
                  A: 5E-4 [m2]
                  k: 50.0 [W/m-K]
Thermal Resistance: R12 = R23 = k/L/A = 4.0 [K/W]
Node-1: 
 1/R12 * [T2 - T1]                     = q'
Node-2:
 1/R12 * [T2 - T1] + 1/R23 * [T2 - T3] = 0
-1/R12 * [T1] + [1/R12 + 1/R23] * [T2] = T3/R23
-1/R12 * [T1] + [1/R12 + 1/R23] * [T2] = T3/R23

Matrix to solve

-1/R12 * [T1] + 1/R12           * [T2] = q'
-1/R12 * [T1] + [1/R12 + 1/R23] * [T2] = T3/R23

Some other configurations that can serve as validation for any thermal network solver are:

q'[100 W]----->[1]-------[2]--------[3]== T [300 K]
                          |
                          |
                         [4]
                      q' [50 W]


                      HTC: 20 [W/m2-K], TREF=300 [K]
                         [5]
                          |
                          |
q'[100 W]----->[1]-------[2]--------[3]== T [300 K]
                          |
                          |
                         [4]
                       q' [50 W]

Generic node in a thermal network:

                [s]   [r]   [p]
              .'  \    |   /
             '     \   |  /
            '        *[n]'--------  [m]
            '          |
             ` ,       |
                 ` - =[u]
Assuming heat 'q' [W] is generated at node 'n' and all surrounding nodes are at lower temperatures:

[Tn - Tm]/RTH[n,m] + [Tn - Tp]/RTH[n,p] + ... + [Tn - Tu]/RTH[n,u] + h.A.[Tn - Tref] = q

{1/RTH[n,m] + 1/RTH[n,p] + ... + 1/RTH[n,u] + h.A}*Tn - 1/RTH[n,m]*Tm - ... - 1/RTH[n,u]*Tu = q + h.A.Tref

Σj(1/RTH[n, j]) . Tn - {Σj[1/RTH[n,j] . Tj} = q + h.A.Tref ... ... ...[1]

In terms of thermal conductances:

Σj(CTH[n, j]) . Tn - {Σj[CTH[n,j] . Tj} = q + h.A.Tref ... ... ...[2]

Next step: create thermal resistance 2d array. RTH[j,k] are calculated earlier and known for all j and k - sparse symmetric matrix, RTH[j, k] = -RTH[k, j] and diagonal entries = 0. Note that thermal resistances by definition are always positive, a negative value is used to indicate direction of heat transfer.

Thermal Resistance Array:
       1 |     2 |     3 |     4 |     5 |     6 |     7 |     8 |     9 |    10 |
 --------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
 1     0 |  0.50 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 2  0.50 |     0 |  0.25 |  0.25 |  1.25 |     0 |     0 |     0 |     0 |     0 | 
 3     0 |  0.25 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 4     0 |  0.25 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 5     0 |  1.25 |     0 |     0 |     0 |  0.25 |  0.25 |  0.25 |     0 |     0 | 
 6     0 |     0 |     0 |     0 |  0.25 |     0 |     0 |     0 |     0 |     0 | 
 7     0 |     0 |     0 |     0 |  0.25 |     0 |     0 |     0 |     0 |     0 | 
 8     0 |     0 |     0 |     0 |  0.25 |     0 |     0 |     0 |  0.25 |     0 | 
 9     0 |     0 |     0 |     0 |     0 |     0 |     0 |  0.25 |     0 |  0.25 | 
10     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |  0.25 |     0 |
The thermal conductance matrix is:
       1 |     2 |     3 |     4 |     5 |     6 |     7 |     8 |     9 |    10 |
 --------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
 1     0 |   2.0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 2   2.0 |     0 |   4.0 |   4.0 |   0.8 |     0 |     0 |     0 |     0 |     0 | 
 3     0 |   4.0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 4     0 |   4.0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 | 
 5     0 |   0.8 |     0 |     0 |     0 |   4.0 |   4.0 |   4.0 |     0 |     0 | 
 6     0 |     0 |     0 |     0 |   4.0 |     0 |     0 |     0 |     0 |     0 | 
 7     0 |     0 |     0 |     0 |   4.0 |     0 |     0 |     0 |     0 |     0 | 
 8     0 |     0 |     0 |     0 |   4.0 |     0 |     0 |     0 |   4.0 |     0 | 
 9     0 |     0 |     0 |     0 |     0 |     0 |     0 |   4.0 |     0 |   4.0 | 
10     0 |     0 |     0 |     0 |     0 |     0 |     0 |     0 |   4.0 |     0 |

Next step: find out nodes with known temperature.

data_n = csvToColumnLists('thermal_n.csv')
node_nnum = data_n['NN']
node_nnum = [int(NN) for NN in node_nnum]
node_hgen = data_n['Qdot']
node_hgen = [float(x) for x in node_hgen]
node_htc  = data_n['HTC']
node_htc  = [float(x) for x in node_htc]
node_Tref = data_n['Tref']
node_Tref = [float(x) for x in node_Tref]
node_known_T = [
  item_1 for item_1, item_2, item_3 in zip(node_nnum, node_htc, node_Tref)
  if item_2 == 0 and item_3 != 0
]
Next step: create node connectivity matrix. The matrix of each node and connected nodes (the indices for summation over index i in equation above) except for those with known/specified temperatures, can be estimated as follows.
Node connectivity array:
    2 |     1 |     3 |     4 |     5 | 
    3 |     2 |     0 |     0 |     0 | 
    4 |     2 |     0 |     0 |     0 | 
    5 |     2 |     6 |     7 |     8 | 
    7 |     5 |     0 |     0 |     0 | 
    8 |     5 |     9 |     0 |     0 | 
    9 |     8 |    10 |     0 |     0 | 

           [3]      [6]
            |        |
            |        |
[1]--------[2]------[5]-------[8]-------[9]-------[10]
            |        |
            |        |
           [4]      [7]

Using Σj(CTH[n, j]) . Tn - {Σj[CTH[n,j] . Tj} = q + h.A.Tref ... ... ...[2]

Node-2: Generic internal Node connected with more than 1 node.
(C[2, 1] + C[2, 3] + C[2, 4] + C[2, 5]) * T[2] 
                              - C[2, 3] * T[3] 
                              - C[2, 4] * T[4] 
                              - C[2, 5] * T[5] 
                              = C[2, 1] * T[1] + q[2] + h[2] * A[2] * (T[2] - Tref[2])

A[0, 1]*T[2] + A[0, 2]*T[3] + A[0, 3]*T[4] + A[0, 4]*T[5] = B[1]
Node-3: Boundary Internal Node connected with 1 node but also to a virtual node due to HTC boundary conditions.
C[3, 2] * (T[3] - T[2]) = q[3] + h[3] * A[3] * (T[3] - Tref[3])

A[1, 0]*T[2] + A[1, 2]*T[3]                               = B[2]

Node-4: convection node

C[4, 2] * (T[4] - T[2]) = q[4] + h[4] * A[4] * (T[4] - Tref[4])

A[2, 0]*T[2]                + A[2, 3]*T[4]                = B[3]
Node-5:
(C[5, 2] + C[5, 6] + C[5, 7] + C[5, 8]) * T[5] 
                              - C[2, 5] * T[2] 
                              - C[7, 5] * T[7] 
                              - C[8, 5] * T[8] 
                              = C[7, 5] * T[7] + q[5] + h[5] * A[5] * (T[5] - Tref[5])
A[3, 0]*T[2] +                             + A[3, 4]*T[5] + A[3, 6]*T[7] + A[3, 7]*T[8] = B[4]

Next step: generate coefficient matrix as per equation [1] above. Compute the number of nodes with unknown temperature from node connectivity matrix. The coefficient matrix A[i, j] would be of size N x N where N is number of rows in node connectivity array defined above. phi_T = [row[0] for row in node_con_array] to get first column which contains node numbers for which temperature needs to be calculated.

Note:

  • Arrays start with index zero but the lowest item in node connectivity matrix may be any number ≥ 1
  • Coefficient matrix cannot have any element on diagonal row = zero
  • The thermal resistance values are linked to node numbers and stored as rows and columns defined by connected nodes
  • Thermal resistance matrix contains 0 values and hence a check is required to calculate the inverse of thermal resistances
Outer Loop: for i in range(0, max_nn) - Note that even though coefficient matrix A shall have number of rows = number of unknowns, it is better to generate coefficient matrix as row and column defined with respect to node numbers.

  Get first column of each row as center node: row_i = node_con_mat[i]; n_num = row_i[0]

Inner Loop Loops over second item onwards on each row

   Calculate diagonal item of coefficient matrix A[i, i]

The initial coefficient matrix is as follows. Note that the rows and columns corresponding to nodes with specified temperature are all not required for final matrix inversion (solution of temperature values). Also, the coefficient matrix need not be symmetric.
 10.8 |  -4.0 |  -4.0 |  -0.8 |   0.0 |   0.0 |   0.0 | 
 -4.0 |   4.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 
 -4.0 |   0.0 |   4.0 |   0.0 |   0.0 |   0.0 |   0.0 | 
 -0.8 |   0.0 |   0.0 |  12.8 |  -4.0 |  -4.0 |   0.0 | 
  0.0 |   0.0 |   0.0 |  -4.0 | 3.995 |   0.0 |   0.0 | 
  0.0 |   0.0 |   0.0 |  -4.0 |   0.0 | 7.995 |  -4.0 | 
  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -4.0 |   8.0 | 

Computed value of {b} excluding for those with known T:

{b} = [626.0, 50.0, 50.0, 1292.0, 1.49, 1.49, 1492.0]

Computed temperatures in [K]: for nodes in first column of node connectivity matrix above. Validation of result with hand calculation is in progress though values are very close to results produced by TNSolver (without HTC boundary conditions).

288.0
356.2
368.7
368.7
339.1
323.0
339.9
350.9
362.0
373.0

TNSolver Examples

From user guide: plane wall with fixed temperature and convection boundary conditions.
Begin Solution Parameters
  title   = Simple Wall Model
  type    = steady
  units   = SI
  T units = C            !Default is 'C', other options K, F, R
End Solution Parameters

Begin Conductors
! label  type       nd_i   nd_j   parameters
  wall   conduction in     out    2.3  1.2  1.0   ! k L A
  fluid  convection out    Tinf   2.3  1.0        ! h A
End Conductors

Begin Boundary Conditions
! type      parameter   node(s)
  fixed_T   21.0        in                       ! Inner wall T
  fixed_T    5.0        Tinf                     ! Fluid T
End Boundary Conditions
Detailed output is in *.out file. The *.rst file contains:
 time = 0
    in  21
   out  12.2727
  Tinf  5
*.csv files contain
"label", "type", "nd_i", "nd_j", "T_i (C)", "T_j (C)", "Q (W)", "U (W/m^2-K)", "A (m^2)"
"wall",  "conduction", "in",  "out",  21, 12.2727, 16.7273, 1.91667, 1
"fluid", "convection", "out", "Tinf", 12.2727, 5,  16.7273, 2.3, 1
and
"label", "material", "volume (m^3)", "temperature (C)"
"in",    "N/A", 0, 21
"out",   "N/A", 0, 12.2727
"Tinf",  "N/A", 0, 5

Solution of this sample case in TNSolver without convection at nodes: note that TN solver has option of specified temperature, heat flux, heat source and volumetric heat source at nodes. Convection can be specified on resistors only. Thus, tip convection can be applied using additional node to represent T or the reference temperature for HTC.

Begin Solution Parameters
  title   = Simple Wall Model
  type    = steady
  units   = SI
  T units = K            !Default is 'C', other options K, F, R
End Solution Parameters

Begin Conductors
! label  type       nd_i   nd_j   parameters
  R01    conduction N_01   N_02   200  0.050  0.0005   ! k L A
  R02    conduction N_02   N_03   200  0.025  0.0005   ! k L A
  R03    conduction N_02   N_04   200  0.025  0.0005   ! k L A
  R04    conduction N_02   N_05   200  0.125  0.0005   ! k L A
  R05    conduction N_05   N_06   200  0.025  0.0005   ! k L A
  R06    conduction N_05   N_07   200  0.025  0.0005   ! k L A
  R07    conduction N_05   N_08   200  0.025  0.0005   ! k L A
  R08    conduction N_08   N_09   200  0.025  0.0005   ! k L A
  R09    conduction N_09   N_10   200  0.025  0.0005   ! k L A
End Conductors

Begin Boundary Conditions
! type      parameter   node(s)
  fixed_T   288         N_01
  fixed_T   323         N_06
  fixed_T   373         N_10
End Boundary Conditions

Begin Sources
  ! type  parameter(s)  node(s)
    Qsrc  50.0          N_02
    Qsrc  50.0          N_03
    Qsrc  50.0          N_04
End Sources
Calculated temperature values in [K] are:
 time = 0
 N_01  288.0
 N_02  355.9
 N_03  368.4
 N_04  368.4
 N_05  338.2
 N_06  323.0
 N_07  338.2
 N_08  349.8
 N_09  361.4
 N_10  373.0

Example taken from "TNSolver: An Open Source Thermal Network Solver for Octave or MATLAB" by Bob Cochran at Thermal & Fluids Analysis Workshop (TFAWS) 2016

TN-Solver-radiation

Begin Solution Parameters
  title = Radiation Heat Transfer Experiment - Black Target
  type  = steady
  nonlinear convergence = 1.0e-8
  maximum nonlinear iterations = 50
End Solution Parameters

Begin Conductors
  ! Conduction through the beaker wall, 0.1" thick pyrex glass
    t-bbin conduction targ bbin 0.14 0.00254 0.024829 ! k L A
  
  ! Convection from beaker to water
  ! label type        nd_i nd_j    mat     L       A
    t-w   ENChplateup bbin water   water   0.04445 0.02483
  
  ! Convection from target to air
  ! label type          nd_i   nd_j   mat  L       A
    t-air ENChplatedown targ   env    air  0.0889  0.0248

  ! Convection from outer shield to air
  ! label type          nd_i   nd_j   mat  H       L       theta  A
    s-air ENCiplateup   s_out  env    air  0.0508  0.0508  48.0   0.056439

  ! Conduction from inner to outer side of shield
    shield conduction s_in  s_out  steel  0.001   0.056439
End Conductors
  
Begin Radiation Enclosure
  ! surf   emiss  A        Fij
    htr    0.92   0.06701  0.0      0.1264   0.68415  0.0     0.1893
    targ   0.95   0.02482  0.34132  0.0      0.00603  0.1031  0.5494
    s_in   0.28   0.05643  0.81231  0.00265  0.12278  0.0     0.0622
    s_out  0.28   0.05643  0.0      0.0453   0.0      0.0     0.9546
    env    1.00   0.11840  0.10711  0.1151   0.02965  0.4547  0.2933
End Radiation Enclosure

Begin Boundary Conditions
  ! type     Tb     Node(s)
    fixed_T  23.0   env
    fixed_T  88.3   water
    fixed_T  515.0  htr
End Boundary Conditions
Output from *.rst file:
time = 0
bbin   93.4466
env    23
htr    515
s_in   272.032
s_out  271.956
targ   175.252
water  88.3
Contact us
Disclaimers and Policies

The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.