clear all;

% Nominal values of input parameters

hgas  = 3000;    % TBC-gas heat transfer coef. (W/(m^2 K))
Tgas  = 1500;    % Mixed gas temperature (K)
ktbc  = 1;       % TBC   thermal conduct. (W/mK)
km    = 20;      % Metal thermal conduct. (W/mK)
Lm    = 0.003;   % Metal thickness (m)
hcool = 1000;    % Coolant-metal heat transfer coef. (W/(m^2 K))
Tcool =  600;    % Coolant temperature (K)

% Ltbc min, mpp, and max values
Ltbc_min = 0.00025;
Ltbc_mpp = 0.00030;
Ltbc_max = 0.00075;

% Number of Monte Carlo trials
N = 100;
Ltbc = zeros(N,1);
Tmh = Ltbc;

for n = 1:N,
  
  % generate Ltbc values using a triangular distribution
  Ltbc(n) = mytrirnd(Ltbc_min,Ltbc_mpp,Ltbc_max);

  % Solve heat transfer problem

  [Ttbc, Tmh(n), Tmc, q] = blade1D(hgas, Tgas, ...
				   ktbc, Ltbc(n), ...
				   km, Lm, ...
				   hcool, Tcool);

end

fprintf('Mean Tmh = %f\n',mean(Tmh));
fprintf('Sdev Tmh = %f\n',std(Tmh));

figure;
subplot(211);
hist(Ltbc,20);
xlabel('Ltbc (m)');
subplot(212);
hist(Tmh,20);
xlabel('Tmh (C)');

