Clear Filters
Clear Filters

Can somebody run this code for me, It's taking too much time for me

2 views (last 30 days)
clc;
clear all;
T2_0 = 320.1;
tspan = [0 50];
[t2sol,T2sol] = ode45(@(t,T2) heat2(t,T2), tspan, T2_0);
plot(t2sol,T2sol)
grid on
xlabel('t')
ylabel('T2')
title('Solutions of Heat Balance on Tank-2')
This is a code that I modelled to study about Stirred Tank Heater Performance
function dT2 = heat2(t,T2)
% Inputs
A2 = 7.854e-05; %Cross-Sectional Area Tank 2
Tc = 303; %Cooling Water Temp
T1 = 325.4; %Tank 1 Temp
Ta = 298; %Atmospheric Temp
h2 = 0.41; %Level h2
R2 = 0.05; %Radius Tank 2
rho_w = 1000; %Density in kg/m3
Cp = 4182; %Cp value in J/KgK
U = 235.1043; %Heat Transfer Coeff
u1 = 0.45; %Flow F1
F1_A = 8.0368e-11;
F1_B = 456.85e-11;
F1_C = 42379e-11;
F1 = F1_A*(u1^3)-F1_B*(u1^2)+F1_C*(u1);
u2 = 0.45; %Flow F2
F2_A = 1.2943e-11;
F2_B = 190.64e-11;
F2_C = 8796.8e-11;
F2_D = 196620e-11;
F2 = -F2_A*(u2^4)+F2_B*(u2^3)-F2_C*(u2^2)+F2_D*(u2);
u3 = 0.45; %Flow F3
Fr_A = (1/1800)*1e-03;
Fr = Fr_A*u3;
u5 = 0.45; %Heat Input Q2
Q2_A = 14.4;
Q2_B = 0.96;
Q2_C = 0.008;
Q2 = Q2_A*(u5)-Q2_B*(u5^2)-Q2_C*(u5^3);
dT2 = (F1*(T1-T2)+F2*(Tc-T2)-Fr*(T2-T1)+(Q2-(2*pi*R2*h2*U*(T2-Ta)))/rho_w*Cp)/(A2*h2);
end
And this is the function "heat2" shown in code. Can Anybdody what output this shows. Since it's taking a really long time for and my laptop is heating up and switching off before it completes
Thank you

Accepted Answer

Ameer Hamza
Ameer Hamza on 7 Oct 2020
Use a stiff solve, ode15s()
[t2sol,T2sol] = ode15s(@(t,T2) heat2(t,T2), tspan, T2_0);

More Answers (0)

Tags

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!