MATLAB: Window Heat Transfer problem

In summary, the program is calculating the heat transfer between a single pane window using various equations and inputs. The calculated values for q1 and q3 are reasonable, but q2 is coming out to be a very large number, possibly due to the thickness of the window. The programmer is seeking assistance with this issue.
  • #1
webster7
3
0

Homework Statement


I am currently writing a program that will calculate the heat transfer between a single pane window. All the qs I calculated were supposed to come out the same but q2 seems to be massive.


Homework Equations


Contained in the program.


The Attempt at a Solution



clear
AirTemperature = 100:50:500;
AirDynamicViscosityMatrix = [0.6924 1.0283 1.3289 1.488 1.893 2.075 2.286 2.484 2.671];
AirKinematicViscosityMatrix = [1.923 4.343 4.49 9.49 15.68 20.76 25.9 28.86 37.9];
AirDensityMatrix = [3.601 2.3675 1.7684 1.4128 1.774 0.998 0.8826 0.7833 0.7048];
KAirMatrix = [0.009246 0.013735 0.01809 0.02227 0.02624 0.03003 0.03365 0.03707 0.04038];
PrAirMatrix = [0.770 0.753 0.739 0.722 0.708 0.697 0.689 0.683 0.680];
WindowHeight = 1.8542;
WindowWidth = 0.762;
WindowArea= WindowHeight*WindowWidth;
WindowThickness = 0.00635;
Ti = 294.261111;
KWindow = 0.96;
OutsideWind = 6.7056;
Gravity = 9.81;
InsideAirTemperature = 294.26111;
i = 0;
NumberOfWindows = 11;
Rate = 0.09;
Season = input ('Please enter 1 for summer and 2 for winter ');
if (Season == 1)
OutsideAirTemperature = 308.15;
else
OutsideAirTemperature = 266.4833;
end
InsideTemperatureWindow = input ('Guess the temperature of the inside of the window (K) : ');
OutsideTemperatureWindow = input ('Guess the temperature of the outside of the window (K) : ');
TestTemperature1 =1;
TestTemperature2 = 1;
while abs(TestTemperature1-OutsideTemperatureWindow) > 0.001 || abs(TestTemperature2-InsideTemperatureWindow) > 0.001
i = i + 1;
disp (['Loop number ' num2str(i)])
Tfo = (OutsideAirTemperature+OutsideTemperatureWindow)/2;
Tfi = (InsideAirTemperature+InsideTemperatureWindow)/2;
disp (['The value of Tfo is ' num2str(Tfo) ' K'])
disp (['The value of Tfi is ' num2str(Tfi) ' K'])
InsideAirKinematicViscosity = (interp1(AirTemperature, AirKinematicViscosityMatrix, Tfi))*(10^(-6));
InsideAirDynamicViscosity = (interp1(AirTemperature, AirDynamicViscosityMatrix, Tfi))*(10^(-5));
InsideAirDensity = interp1(AirTemperature, AirDensityMatrix, Tfi);
InsideKAir = interp1(AirTemperature, KAirMatrix, Tfi);
InsidePrAir = interp1(AirTemperature, PrAirMatrix, Tfi);
OutsideAirKinematicViscosity = (interp1(AirTemperature, AirKinematicViscosityMatrix, Tfo))*(10^(-6));
OutsideAirDynamicViscosity = (interp1(AirTemperature, AirDynamicViscosityMatrix, Tfo))*(10^(-5));
OutsideAirDensity = interp1(AirTemperature, AirDensityMatrix, Tfo);
OutsideKAir = interp1(AirTemperature, KAirMatrix, Tfo);
OutsidePrAir = interp1(AirTemperature, PrAirMatrix, Tfo);
OutsideReynold = OutsideWind*WindowHeight/OutsideAirKinematicViscosity;
OutsideAirBeta = 1/Tfo;
InsideAirBeta = 1/Tfi;
OutsideGrashofPr = Gravity*OutsideAirBeta*(OutsideTemperatureWindow-OutsideAirTemperature)*(WindowHeight^3)*OutsidePrAir/(OutsideAirKinematicViscosity^2);
disp (['The value of OutsideGrashofPr is ' num2str(OutsideGrashofPr)])
InsideGrashofPr = Gravity*InsideAirBeta*(InsideTemperatureWindow-InsideAirTemperature)*(WindowHeight^3)*InsidePrAir/(InsideAirKinematicViscosity^2);
disp (['The value of InsideGrashofPr is ' num2str(InsideGrashofPr)])
if (OutsideGrashofPr < 10000)
cOutside = 0.59;
mOutside = 0.25;
elseif (10000 <= OutsideGrashofPr < 1000000000)
cOutside = 0.021;
mOutside =0.4;
else
disp('GrPr value is outside of range');
Stop
end
if (InsideGrashofPr < 10000)
cInside = 0.59;
mInside = 0.25;
elseif (10000 <= OutsideGrashofPr < 1000000000)
cInside = 0.021;
mInside =0.4;
else
disp('GrPr value is outside of range');
Stop
end
OutsideNusselt = cOutside*(OutsideGrashofPr^mOutside);
disp (['The value of OutsideNusselt is ' num2str(OutsideNusselt)])
InsideNusselt = cInside*(InsideGrashofPr^mInside);
disp (['The value of InsideNusselt is ' num2str(InsideNusselt)])
ho = OutsideNusselt*OutsideKAir/WindowHeight;
hi = InsideNusselt*InsideKAir/WindowHeight;
Sigma = 5.669*(10^-8);
OutsideEmissivity = 0.96;
InsideEmissivity = 0.96;
R1 = (1/((ho*WindowArea)+(OutsideEmissivity*Sigma*(OutsideAirTemperature+OutsideTemperatureWindow)*((OutsideAirTemperature^2)+(OutsideTemperatureWindow^2))*WindowArea)));
R2 = WindowThickness/(KWindow*WindowArea);
R3 = (1/((hi*WindowArea)+(InsideEmissivity*Sigma*(InsideAirTemperature+InsideTemperatureWindow)*((InsideAirTemperature^2)+(InsideTemperatureWindow^2))*WindowArea)));
q = (OutsideAirTemperature-InsideAirTemperature)/(R1+R2+R3);
NewOutsideTemperatureWindow = (q*R1)+OutsideAirTemperature;
NewInsideTemperatureWindow = (q*R3)+InsideAirTemperature;
TestTemperature1 = OutsideTemperatureWindow;
TestTemperature2 = InsideTemperatureWindow;
OutsideTemperatureWindow = NewOutsideTemperatureWindow;
InsideTemperatureWindow = NewInsideTemperatureWindow;
q1 = (OutsideAirTemperature-OutsideTemperatureWindow)/R1;
q2 = (OutsideTemperatureWindow-InsideTemperatureWindow)/R2;
q3 = (InsideTemperatureWindow-InsideAirTemperature)/R3;
q = (OutsideAirTemperature-InsideAirTemperature)/(R1+R2+R3);
disp (['The value of q1 is ' num2str(q1) ' W'])
disp (['The value of q2 is ' num2str(q2) ' W'])
disp (['The value of q3 is ' num2str(q3) ' W'])
disp (['The overall value of q is ' num2str(q) ' W'])
end
Rv = (OutsideAirTemperature-InsideAirTemperature)/(q/WindowArea);
Cost = q*0.09*30*24*3600*NumberOfWindows/1000;
disp (['The value of q1 is ' num2str(q1) ' W'])
disp (['The value of q2 is ' num2str(q2) ' W'])
disp (['The value of q3 is ' num2str(q3) ' W'])
disp (['The overall value of q is ' num2str(q) ' W'])
disp (['The money lost this month is $' num2str(Cost)])
disp (['The value of Rv is ' num2str(Rv)])
 
Physics news on Phys.org
  • #2
disp (['The value of the inside temperature of the window is ' num2str(InsideTemperatureWindow)]) disp (['The value of the outside temperature of the window is ' num2str(OutsideTemperatureWindow)]) The issue is with q2, it is coming out to be a very large number. I think it is because of the window thickness I have used, but I'm not sure. Any help would be greatly appreciated.
 

FAQ: MATLAB: Window Heat Transfer problem

1. What is the purpose of using MATLAB for a window heat transfer problem?

MATLAB is a powerful scientific computing software that allows for efficient and accurate numerical analysis. It can be used to solve complex heat transfer problems, such as the transfer of heat through a window, by using advanced mathematical algorithms and simulations.

2. How can I model heat transfer through a window using MATLAB?

There are multiple ways to model heat transfer through a window using MATLAB, depending on the specific problem and desired outcomes. One approach is to use the finite difference method, which involves dividing the window into small grid cells and solving for the temperature at each cell using numerical approximations. Another approach is to use the finite element method, which involves dividing the window into smaller elements and solving for the temperature at each element using mathematical equations.

3. Can I incorporate different types of materials in my window heat transfer model?

Yes, MATLAB allows for the incorporation of various materials with different thermal properties into the window heat transfer model. This can be achieved by defining the material properties, such as thermal conductivity and specific heat, for each material and incorporating them into the heat transfer equations.

4. How can I validate my window heat transfer model using MATLAB?

It is important to validate the accuracy of any heat transfer model before using it for further analysis. In MATLAB, this can be done by comparing the results of the model with experimental data or analytical solutions for similar problems. Additionally, sensitivity analysis can be performed to determine the impact of changing different model parameters on the results.

5. Are there any helpful resources for learning how to use MATLAB for window heat transfer problems?

Yes, there are various online tutorials, forums, and documentation available for learning how to use MATLAB for heat transfer problems. The official MATLAB website offers tutorials and examples specifically for heat transfer applications. Additionally, there are many online communities and forums where users can ask for help and share tips and tricks for using MATLAB for heat transfer simulations.

Back
Top