CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > System Analysis

Transient Heat Transfer | Simple One-Layer Wall

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 14, 2022, 03:37
Default Transient Heat Transfer | Simple One-Layer Wall
  #1
Member
 
Khan
Join Date: Jul 2018
Posts: 35
Rep Power: 6
HumanistEngineer is on a distinguished road
Hello All,

I try to build a transient heat transfer model for a simple one-layer wall by use of the Resistance-Capacitance (RC) approach. However, the transient temperature distribution shows weird numbers in time. Would you please check my approach and code?



Heat balance for each capacitance can be written as:



Forward-Euler Discretization (one-dimensional) gives:



At each time step this calculation procedure is run:



Here is the Python code to calculate the temperature distribution in time:

Code:
import numpy as np

""" Input Parameters """
# Wall
height_w = 3        # [m]       height of the wall
wide_w = 5          # [m]       wide of the wall
thick_w = 0.3       # [m]       thickness of the wall
volume_w = height_w * wide_w * thick_w  # [m3] volume of the wall
area_w= height_w * wide_w               # [m2] wall area

# Room
deep_r = 4          # [m]       deepness of room
volume_r = height_w * wide_w * deep_r # [m3] volume of the room air

# Initial Temperature
T_in = 20           # [°C]      indoor temperature
T_out = 2           # [°C]      outdoor temperature

# Thermal
h_in = 8           # [W/m2K]   heat transfer coefficient (indoor)
h_out = 15          # [W/m2K]   heat transfer coefficient (outdoor)

# see: Balaji NC et al. Thermal performance of the building walls
k_w = 0.811         # [W/mK]    thermal conductivity (brick)
rho_w = 1820        # [kg/m3]   density (brick)
Cp_w = 880          # [J/kgK]   specific heat capacity (brick)

# Air
rho_a = 1.204       # [kg/m3]   density (air at 20 °C)
Cp_a = 1006         # [J/kgK]   specific heat capacity (air at 20 °C)

""" Preliminary Calculations """

delta_t = 1         # [s] 

C_a = rho_a * Cp_a * volume_r   # [J/K]
C_w = rho_w * Cp_w * volume_w   # [J/K]
 
R_in = 1 / (h_in * area_w)      # [K/W]
R_out = 1 / (h_out * area_w)    # [K/W]

R_w = thick_w / (k_w * area_w)  # [K/W]

# print('R_in = ',R_in)
# print('R_out = ',R_out)
# print('R_w = ',R_w)

""" Numeric Constants """

A = np.zeros( (4, 4) )

A[0][0]=1+delta_t/(C_a*R_in)
A[0][1]=-delta_t/(C_a*R_in)

A[1][0]=4*delta_t/(C_w*R_in)
A[1][1]=1-4*delta_t/C_w*(1/R_in+2/R_w)
A[1][2]=8*delta_t/(C_w*R_w)

A[2][1]=4*delta_t/(C_w*R_w)
A[2][2]=1-2*delta_t/C_w*(2/R_w+2/R_w)
A[2][3]=4*delta_t/(C_w*R_w)

A[3][2]=8*delta_t/(C_w*R_w)
A[3][3]=1-4*delta_t/C_w*(2/R_w+1/R_out)

B = np.zeros((4,1))
B[3][0]=4*delta_t*T_out/(C_w*R_out)

""" Numerical Simulation """

T_init=np.ones((4,1))*15

for i in range(1):
    
    T=np.matmul(A,T_init)+B
    
    T_init=T

Last edited by HumanistEngineer; January 15, 2022 at 05:21.
HumanistEngineer is offline   Reply With Quote

Old   January 15, 2022, 05:54
Default
  #2
Member
 
Khan
Join Date: Jul 2018
Posts: 35
Rep Power: 6
HumanistEngineer is on a distinguished road
I found the error:

The first heat balance shall be replaced with:

C_in*(dT_in/dt)=- (T_in - T_w1) / R_in
HumanistEngineer is offline   Reply With Quote

Old   July 29, 2022, 20:03
Default
  #3
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Fuenlabrada
Posts: 304
Rep Power: 13
agustinvo is on a distinguished road
If you are using Python you could use Scipy to solve your state-space equations.
agustinvo is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Heat transfer between wall and air in Fluent jimmy871013 FLUENT 6 April 27, 2018 02:00
heat transfer through rotating metal wall groonm CFX 0 September 12, 2016 10:20
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Radiation interface hinca CFX 15 January 26, 2014 17:11
Inverse and Transient Heat Transfer Problem on commercial software: is it possible? rogbrito CFX 1 January 29, 2012 17:48


All times are GMT -4. The time now is 02:47.