MATLAB Heat Transfer 2D Steady State Explicit

In summary: Boundary conditionsb(1:n) = -Tf*alpha*lambda/(cp*rho*L);b(n*(m-1)+1:n*m) = -Tw*alpha*lambda/(cp*rho*L);b(n+1:n:n*(m-1)) = -Tf*alpha*lambda/(cp*rho*L);b(2*n:n:n*(m-1)) = -Tw*alpha*lambda/(cp*rho*L);% Solve the system of equationsT = A\b;% Reshape the solution into a matrixT = reshape(T,m,n);% Plot the temperature distributionimage(T);colorbar;title('Temperature Distribution in the Model');xlabel('
  • #1
JohnPaul3891
1
0
Hello. I am completely new to MATLAB and programming in general. I never thought I would have to resort to online help, but here I am. I have spent hours googling and haven't been able to get very far.

1. Homework Statement

Calculate the distribution of the temperature of the inner part of the model.
Thermal conductivity: λ = 47 W/(m*K)
Specific heat capacity: cp = 465 J/(kg*K)
Density: ρ = 7,85 kg/m^3
Length of one side of a cell: L = 0,05 m
Starting temperature of model: T0 = 0 °C

A:
Wall temperature: Tw = 500 °C

B:
Fluid temperature: Tf = 20 °C
Heat transfer coefficient: α = 500 W/(m^2*K)

Image of the model:
PTH_sem2b.png


Homework Equations


EqA.PNG


EqB.PNG

Here T_i,j is supposed to be the temperature of the cell in question, whereas the T_{i+1,j} should be known.

The Attempt at a Solution


Yes I know it's a rather weak attempt, as I stated earlier, I'm new to programming in general, any further attempts would look like the work of a chimpanzee, ergo pointless.
Code:
% Given variables
lambda = 47 % Thermal conductivity [W/(m*K)]
cp = 465 % Specific heat capacity [J/(kg*K)]
rho = 7.85 % Density [kg/m^3]
L = 0.05 % Length of one side of a cell [m]
T0 = 0 % Starting temperature of the model [°C]

%Boundary condition A
Tw = 500 % Wall temperature [°C]

%Boundary condition B
Tf = 20 % Fluid temperature [°C]
alfa = 500 % Heat transfer coefficient [W/(m^2*K)]

model =  [0  0  Tf 0  Tf 0  Tf 0  0  0  % model matrix, an attempt
  0  Tf T0 Tf T0 Tf T0 Tf 0  0
  Tw T0 T0 Tf T0 Tf T0 Tf Tf 0
  Tw T0 T0 T0 T0 T0 T0 T0 T0 Tf
  0  Tf T0 T0 T0 T0 Tf Tf Tf 0
  0  Tf T0 T0 T0 T0 Tf Tf Tf 0
  Tw T0 T0 T0 T0 T0 T0 T0 T0 Tf
  Tw T0 T0 Tf T0 Tf T0 Tf Tf 0
  0  Tf T0 Tf T0 Tf T0 Tf 0  0
  0  0  Tf 0  Tf 0  Tf 0  0  0];

  mean = ( ...  %Should I use something like this for the equation?
  sum (  ) ...
  + sum (  ) ...
  + sum (  ) ...
  + sum (  ) ) ...
  / ( 2 * m + 2 * n - 4 );

If the images aren't visible I'll upload them externally and link to them.
 
Physics news on Phys.org
  • #2
I'm sorry if this is too much to ask, I was just hoping someone could point me in the right direction.Thanks in advance!Solution:The equation you need to solve is the 2-dimensional heat equation. You can use the following MATLAB code to solve it.% Given variableslambda = 47; % Thermal conductivity [W/(m*K)]cp = 465; % Specific heat capacity [J/(kg*K)]rho = 7.85; % Density [kg/m^3]L = 0.05; % Length of one side of a cell [m]T0 = 0; % Starting temperature of the model [°C]% Boundary condition ATw = 500; % Wall temperature [°C]% Boundary condition BTf = 20; % Fluid temperature [°C]alpha = 500; % Heat transfer coefficient [W/(m^2*K)]% Model parametersm = 10; % Number of elements along x-directionn = 10; % Number of elements along y-direction% Construct the matrixA = zeros(m*n,m*n);for i=1:m for j=1:n % Indices of the unknowns p = (i-1)*n+j; up = p-n; down = p+n; left = p-1; right = p+1; % Coefficients of the unknowns A(p,p) = -4*lambda/(cp*rho*L^2); if up>0 A(p,up) = lambda/(cp*rho*L^2); end if down<=m*n A(p,down) = lambda/(cp*rho*L^2); end if left>0 A(p,left) = lambda/(cp*rho*L^2); end if right<=m*n A(p,right) = lambda/(cp*rho*L^2); end endend% Construct the right hand side
 

What is MATLAB Heat Transfer 2D Steady State Explicit?

MATLAB Heat Transfer 2D Steady State Explicit is a computational tool used for simulating heat transfer in two-dimensional systems. It uses explicit methods to solve the governing equations for steady state heat transfer problems.

What are the key features of MATLAB Heat Transfer 2D Steady State Explicit?

The key features of MATLAB Heat Transfer 2D Steady State Explicit include the ability to handle complex geometries, customizable boundary conditions, and the option to include thermal properties of materials. It also allows for visualization of temperature and heat flux distributions.

How does MATLAB Heat Transfer 2D Steady State Explicit solve heat transfer problems?

MATLAB Heat Transfer 2D Steady State Explicit uses finite difference methods to discretize the governing equations for heat transfer. It then iteratively solves the resulting system of equations to obtain a numerical solution for temperature distribution in the system.

What types of problems can be solved using MATLAB Heat Transfer 2D Steady State Explicit?

MATLAB Heat Transfer 2D Steady State Explicit can be used to solve a variety of heat transfer problems, including conduction, convection, and radiation. It can also handle problems with multiple materials and different boundary conditions.

Is MATLAB Heat Transfer 2D Steady State Explicit user-friendly?

While MATLAB Heat Transfer 2D Steady State Explicit requires some knowledge of programming and heat transfer principles, it is designed to be user-friendly. It has a user-friendly interface and provides detailed documentation and examples to help users get started.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
943
Replies
10
Views
2K
  • Introductory Physics Homework Help
Replies
5
Views
1K
  • Introductory Physics Homework Help
2
Replies
41
Views
4K
  • Advanced Physics Homework Help
Replies
6
Views
2K
  • Biology and Chemistry Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
13K
Back
Top