clc
clear all
%
% =========================================================================
%                                CONSTANTS
% =========================================================================
%
% Densities [kg/m3]
rho_h = 912.892;                    % Hot water (p = 1500000 Pa, T = 155 °C)
rho_c = 1.161;                      % Cold air (p = 100000 Pa, T = 26.85 °C)
%
% Specific heat capacities [J/kg*K]
cph = 4321.56;                      % Hot water (p = 1500000 Pa, T = 155 °C)
cpc = 1018.5;                       % Air (p = 100000 Pa, T = 126.85 °C)
%
% =========================================================================
%                              AIR COOLERS
% =========================================================================
% General data      
A = 74.6;               % Heat transfer area [m2]
Vh_tot = 3*0.0889;      % Hot side volume [m3]
Vc_tot = 3*0.1164;      % Cold side volume [m3]
N = 10;                 % Number of cells (NB! Fixed)
%
% Heat transfer coefficients [W/m2*K]
h_h	= 9796.0889611035;  % Hot side
h_c = h_h;              % Cold side
%
% Hot side
V_i_h = Vh_tot/N;	% Hot side cell volume [m3]
A_i_h = A/N;        % Hot side cell area [m2]
%
% Cold side
V_i_c = Vc_tot/N;	% Cold side cell volume [m3]
A_i_c = A/N;		% Cold side cell area [m2]
%
% Wall
V_w = A*0.005;      % Wall volume [m3] (assuming 5 mm thickness)
rho_w = 8030;       % Wall density [kg/m3] (AISI 304)
cp_w = 5030;        % Wall heat capacity [J/kg*K] (AISI 304)
V_i_w = V_w/N;		% Volume of a single wall segment [m3]
A_i_w = A/N;		% Area of a single wall segment [m2]
%
% =========================================================================
%                           INITIAL CONDITIONS
% =========================================================================
% Heat exchangers - Initial temperatures [°C]
Th0 = [179.9995017982525;
       179.9978988550480;
       179.9927414525910;
       179.9761477267318;
       179.9227581105082;
       179.7509792620025;
       179.1982880294907;
       177.4200271949783;
       171.6985476245686;
       153.2899273370997];
Tw0 = [179.9991482607482;
       179.9967613629721;
       179.9890816195972;
       179.9643723677413;
       179.8848713873733;
       179.6290803210826;
       178.8060833053065;
       176.1581249625912;
       167.6384301759173;
       140.2266699200330];
Tc0 = [127.1634125029664;
       163.5783127272660;
       174.8962227302042;
       178.4138785811225;
       179.5071813801628;
       179.8469846642383;
       179.9525970087506;
       179.9854217866033;
       179.9956238708962;
       179.9987947232439];