-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
2,569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function k = calc_k_coeff (P0,Pa,gamma) | ||
%calc_k_coeff Summary of this function goes here | ||
% Detailed explanation goes here | ||
% P0 : vessel internal presure | ||
% Pa : atmospheric pressure | ||
% gamma : poisson's coefficient | ||
|
||
eval = ((gamma + 1) / 2 ) ^ (gamma / (gamma-1)) ; | ||
|
||
if ((P0/Pa) >= eval) | ||
% supersonic flow | ||
k = gamma * (2/(gamma+1)) ^ ((gamma+1)/(2*(gamma-1))); | ||
|
||
else | ||
% subsonic flow | ||
k = sqrt( ((2*gamma^2)/(gamma-1)) * (Pa/P0)^(2/gamma) * (1-( (Pa/P0)^((gamma-1)/gamma))) ) ; | ||
|
||
end | ||
|
||
|
||
end | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
function gas_outflow_function(V,P0,T0,Cd,Wg,Cv,gamma,Pa,d0,time_step) | ||
|
||
% Parameters | ||
max_len = 100 ; % initial size of array | ||
max_tolerable_len = 5000 ; % max len possible | ||
|
||
% Converting to SI | ||
P0 = P0 * 10^5 ; | ||
Pa = Pa * 10^5; % Bar to Pa | ||
d0 = d0 * 0.01 ; % cm to meter | ||
Cv = Cv * 1000 ; % Kj to J | ||
R = 8.314 ; % UNiversal gas constant | ||
Wg = Wg / 1000 ; % g/mol to kg/mol | ||
% Arrays | ||
M = zeros(1,max_len) ; | ||
t = zeros(1,max_len) ; | ||
T = zeros(1,max_len) ; | ||
Rho = zeros(1,max_len) ; | ||
P = zeros(1,max_len) ; | ||
P_Pa = zeros(1,max_len) ; | ||
q = zeros(1,max_len) ; | ||
delta_rho = zeros(1,max_len) ; | ||
delta_T = zeros(1,max_len) ; | ||
|
||
% Initialization | ||
T(1,1) = T0 ; | ||
P(1,1) = P0 ; | ||
t(1,1) = 0 ; | ||
Rho (1,1) = (P(1,1) * Wg) / (R * T(1,1)) ; | ||
A = (pi * d0^2)/4 ; | ||
P_Pa(1,1) = P(1,1) / Pa ; | ||
|
||
i = 1 ; | ||
|
||
|
||
while ( P_Pa(1,i) > 1 && i<= max_tolerable_len) | ||
M(1,i) = (P(1,i) * V) / (R*T(1,i)) * Wg ; | ||
K = calc_k_coeff(P(1,i),Pa,gamma) ; | ||
q(1,i) = A * Cd * P(1,i) * K * sqrt (Wg / ( gamma * R * T(1,i))) ; | ||
|
||
delta_rho(1,i) = (q(1,i)/V) * time_step ; | ||
delta_T(1,i) = (P(1,i) / ((Rho(1,i)^2)*Cv))*delta_rho(1,i) ; | ||
|
||
Rho(1,i+1) = Rho(1,i) - delta_rho(1,i) ; | ||
T(1,i+1) = T(1,i) - delta_T(1,i) ; | ||
P(1,i+1) = ( Rho(1,i+1) * R * T(1,i+1) ) / Wg ; | ||
t(1,i+1) = t(1,i) + time_step; | ||
P_Pa(1,i+1) = P(1,i+1) / Pa ; | ||
i=i+1; | ||
|
||
|
||
end | ||
|
||
|
||
i = i -1 ; | ||
|
||
|
||
M = M(1:i) ; | ||
t = t(1:i) ; | ||
T = T(1:i) ; | ||
Rho = Rho(1:i) ; | ||
P = P(1:i) ; | ||
q = q(1:i) ; | ||
delta_rho = delta_rho(1:i) ; | ||
delta_T = delta_T(1:i) ; | ||
P_Pa = P_Pa(1:i); | ||
|
||
if (P(1,i)> Pa && i == 1000) | ||
% memory overflow | ||
opts = struct('WindowStyle','modal',... | ||
'Interpreter','tex'); | ||
f = errordlg('Could not end the simulation. Try increasing the timestep. ','Memory overflow',opts); | ||
|
||
end | ||
|
||
|
||
Sim_array = zeros(i,9) ; | ||
Sim_array(:,1) = t(1,:); | ||
Sim_array(:,2) = M(1,:); | ||
Sim_array(:,3) = T(1,:); | ||
Sim_array(:,4) = Rho(1,:); | ||
Sim_array(:,5) = P(1,:); | ||
Sim_array(:,6) = P_Pa(1,:); | ||
Sim_array(:,7) = q(1,:); | ||
Sim_array(:,8) = delta_rho(1,:); | ||
Sim_array(:,9) = delta_T(1,:); | ||
|
||
Td = array2table(Sim_array,... | ||
'VariableNames',{'t','M','T','Rho','P','PovPa','q','D_RHO','D_T'}); | ||
writetable(Td,'temp.xls') | ||
|
||
|
||
|
||
f0 = figure; | ||
f0.Name = 'Graphs'; | ||
subplot(4,1,1); | ||
plot(t,P) | ||
hold on | ||
plot(t,Pa*ones(1,size(t,2))) | ||
grid on | ||
grid minor | ||
title('Pressure reduction over time inside the vessel ') | ||
ylabel('Pressure [Pa]') | ||
legend('P inside vessel','Atmospheric pressure') | ||
|
||
subplot(4,1,2); | ||
plot(t,q) | ||
grid on | ||
grid minor | ||
title('mass flow over time ') | ||
ylabel('Mass flow [Kg/s]') | ||
|
||
subplot(4,1,3); | ||
plot(t,T) | ||
grid on | ||
grid minor | ||
title('Temperature reduction over time inside the vessel ') | ||
ylabel('Temperature [K]') | ||
|
||
subplot(4,1,4); | ||
plot(t,M) | ||
grid on | ||
grid minor | ||
title('Mass reduction over time inside the vessel ') | ||
ylabel('Mass [Kg]') | ||
xlabel('time in seconds') | ||
|
||
|
||
f = figure; | ||
f.Resize = 'off'; | ||
f.Position(3) = 800; | ||
f.Position(4) = 500; | ||
f.ToolBar = 'none'; | ||
f.MenuBar = 'none'; | ||
f.Name = 'Data points'; | ||
uit = uitable(f,'Data',Sim_array,'Position',[f.Position(1)*0.1 f.Position(2)*0.2 f.Position(3)*0.85 f.Position(4)*0.8]); | ||
uit.ColumnName = {'t (s)','M (kg)','T(k)','Rho (kg/m3)','P(Pa)','P/Pa','q(Kg/s)','dRho', 'dT'}; | ||
|
||
c = uicontrol; | ||
c.String = 'Save'; | ||
c.Callback = @ButtonPushed; | ||
|
||
function ButtonPushed(~,~ ) | ||
path = uigetdir; | ||
path = strcat(path,'/data_array.xls' ) | ||
status = copyfile ('temp.xls' , path) ; | ||
|
||
|
||
end | ||
|
||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<deployment-project plugin="plugin.apptool" plugin-version="1.0"> | ||
<configuration build-checksum="859362945" file="/home/nazim/Bureau/source-code/fireball/Fireball.prj" location="/home/nazim/Bureau/source-code/fireball" name="Fireball" target="target.mlapps" target-name="Package App"> | ||
<param.appname>Fireball</param.appname> | ||
<param.authnamewatermark>YAKHOU Nazim</param.authnamewatermark> | ||
<param.email /> | ||
<param.company /> | ||
<param.icon>${PROJECT_ROOT}/Fireball_resources/icon_24.png</param.icon> | ||
<param.icons> | ||
<file>${PROJECT_ROOT}/Fireball_resources/icon_48.png</file> | ||
<file>${PROJECT_ROOT}/Fireball_resources/icon_24.png</file> | ||
<file>${PROJECT_ROOT}/Fireball_resources/icon_16.png</file> | ||
</param.icons> | ||
<param.summary>Modelize hydrocarbon fireballs and their effects</param.summary> | ||
<param.description>This application features empricial models for hydrocarbon fireballs modelization. | ||
Featured models include : TNO,Mudan, Solid flame model ... | ||
This application can compute geometrical properties of the fireball as well as heatflux values over distance (1D - 2D) and its effects (probabilities of death - injuries)</param.description> | ||
<param.screenshot>/tmp/tp4dfd2155_52a8_47bb_8a6c_f2ddc6e4399d.png</param.screenshot> | ||
<param.version>1.0</param.version> | ||
<param.products.name /> | ||
<param.products.id /> | ||
<param.products.version /> | ||
<param.platforms /> | ||
<param.output>/home/nazim/Bureau</param.output> | ||
<param.guid>b8ed3ccb-7691-418f-8e57-bd7353ea9185</param.guid> | ||
<unset> | ||
<param.email /> | ||
<param.company /> | ||
<param.version /> | ||
<param.products.name /> | ||
<param.products.id /> | ||
<param.products.version /> | ||
<param.platforms /> | ||
</unset> | ||
<fileset.main> | ||
<file>${PROJECT_ROOT}/fireball.mlapp</file> | ||
</fileset.main> | ||
<fileset.depfun> | ||
<file>${PROJECT_ROOT}/SEP_computation.m</file> | ||
<file>${PROJECT_ROOT}/batch_heat_flux_computation_1D.m</file> | ||
<file>${PROJECT_ROOT}/batch_heat_flux_computation_2D.m</file> | ||
<file>${PROJECT_ROOT}/batch_ppl_effect_computation_1D.m</file> | ||
<file>${PROJECT_ROOT}/batch_ppl_effect_computation_2D.m</file> | ||
<file>${PROJECT_ROOT}/burning_rate_computation.m</file> | ||
<file>${PROJECT_ROOT}/fit_get_distance.m</file> | ||
<file>${PROJECT_ROOT}/fit_get_heatflux.m</file> | ||
<file>${PROJECT_ROOT}/initial_mass_computation.m</file> | ||
<file>${PROJECT_ROOT}/max_parameters_computation_TNO.m</file> | ||
<file>${PROJECT_ROOT}/overall_effects_computation.m</file> | ||
<file>${PROJECT_ROOT}/plot1Dheatflux.m</file> | ||
<file>${PROJECT_ROOT}/plotHeatMap.m</file> | ||
<file>${PROJECT_ROOT}/plot_heatmap_injuries.m</file> | ||
<file>${PROJECT_ROOT}/plot_ppl_effects.m</file> | ||
<file>${PROJECT_ROOT}/ppl_effect_computation.m</file> | ||
<file>${PROJECT_ROOT}/return_distance.m</file> | ||
<file>${PROJECT_ROOT}/return_heatflux.m</file> | ||
<file>${PROJECT_ROOT}/single_heatflux_computation.m</file> | ||
<file>${PROJECT_ROOT}/transmissivity.m</file> | ||
<file>${PROJECT_ROOT}/view_factor_computation.m</file> | ||
</fileset.depfun> | ||
<fileset.resources /> | ||
<fileset.package /> | ||
<build-deliverables> | ||
<file location="/home/nazim" name="Bureau" optional="false">/home/nazim/Bureau</file> | ||
</build-deliverables> | ||
<workflow /> | ||
<matlab> | ||
<root>/omni/linux-software-bins/matlab2018rB</root> | ||
<toolboxes> | ||
<toolbox name="matlabcoder" /> | ||
<toolbox name="embeddedcoder" /> | ||
<toolbox name="gpucoder" /> | ||
<toolbox name="fixedpoint" /> | ||
<toolbox name="matlabhdlcoder" /> | ||
<toolbox name="polyspacebugfinder" /> | ||
<toolbox name="neuralnetwork" /> | ||
</toolboxes> | ||
<toolbox> | ||
<matlabcoder> | ||
<enabled>true</enabled> | ||
</matlabcoder> | ||
</toolbox> | ||
<toolbox> | ||
<embeddedcoder> | ||
<enabled>true</enabled> | ||
</embeddedcoder> | ||
</toolbox> | ||
<toolbox> | ||
<gpucoder> | ||
<enabled>true</enabled> | ||
</gpucoder> | ||
</toolbox> | ||
<toolbox> | ||
<fixedpoint> | ||
<enabled>true</enabled> | ||
</fixedpoint> | ||
</toolbox> | ||
<toolbox> | ||
<matlabhdlcoder> | ||
<enabled>true</enabled> | ||
</matlabhdlcoder> | ||
</toolbox> | ||
<toolbox> | ||
<polyspacebugfinder> | ||
<enabled>true</enabled> | ||
</polyspacebugfinder> | ||
</toolbox> | ||
<toolbox> | ||
<neuralnetwork> | ||
<enabled>true</enabled> | ||
</neuralnetwork> | ||
</toolbox> | ||
</matlab> | ||
<platform> | ||
<unix>true</unix> | ||
<mac>false</mac> | ||
<windows>false</windows> | ||
<win2k>false</win2k> | ||
<winxp>false</winxp> | ||
<vista>false</vista> | ||
<linux>true</linux> | ||
<solaris>false</solaris> | ||
<osver>4.15.0-58-generic</osver> | ||
<os32>false</os32> | ||
<os64>true</os64> | ||
<arch>glnxa64</arch> | ||
<matlab>true</matlab> | ||
</platform> | ||
</configuration> | ||
</deployment-project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function SEP = SEP_computation(Psv,burning_rate,combustion_heat) | ||
%% Summary : | ||
% SEP_computation computes the maximum surface emitting power of the fireball | ||
%% Reference : (FIRES, EXPLOSIONS,AND TOXIC GAS DISPERSIONS - 2010 - p 102 C-2.41) | ||
%% Input parameters : | ||
% Psv : vapour pressure inside the vessel in MPa | ||
% burning_rate %of flamable substance - kg/s | ||
% combustion_heat : heat of combustion of the flamable substance (Kj/Kg) | ||
%% Output parameters | ||
% SEP : surface emitting power in Kw/m² | ||
|
||
%% Code | ||
c6 = 0.00325 ; | ||
Fs = c6*((Psv*10^6)^0.32); % radiation fraction / TNO | ||
SEP = Fs*burning_rate*combustion_heat ; | ||
|
||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function [R_1D,heat_flux_batch1D] = batch_heat_flux_computation_1D(D_max,Resolution,fireball_height,Pow,RH,SEP ) | ||
%batch_heat_flux_computation computes heat flux for various distances | ||
|
||
|
||
radius = D_max/2 ; | ||
max_distance = 10 * radius ; | ||
%Res = Resolution ; | ||
Res = 500 ; | ||
step = max_distance / Res ; | ||
|
||
if(step<1) % step can't be less than 1 meter | ||
step = 1; | ||
end | ||
|
||
R_1D = 0:step:max_distance ; | ||
i = numel(R_1D) ; | ||
heat_flux_batch1D = ones(i,1); | ||
|
||
for c = 1:i | ||
F12 = view_factor_computation(D_max,fireball_height,R_1D(c)) ; | ||
trs = transmissivity(Pow,RH,R_1D(c),D_max); | ||
heat_flux_batch1D(c) = single_heatflux_computation(SEP,F12,trs); | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function [X,Y,heat_flux_batch2D] = batch_heat_flux_computation_2D(D_max,Resolution,fireball_height,Pow,RH,SEP ) | ||
%batch_heat_flux_computation computes heat flux for various distances | ||
|
||
radius = D_max/2 ; | ||
max_distance = 10 * radius ; | ||
step = max_distance / Resolution ; | ||
|
||
if(step<1) % step can't be less than 1 meter | ||
step = 1; | ||
end | ||
|
||
x =-max_distance:step:max_distance ; | ||
y =-max_distance:step:max_distance ; | ||
[X,Y] = meshgrid(x,y); | ||
R = sqrt(X.^2 + Y.^2) ; | ||
R = ceil(R) ; | ||
|
||
i = numel(x) ; | ||
heat_flux_batch2D = ones(i); | ||
|
||
|
||
for c = 1:i | ||
for r = 1:i | ||
F12 = view_factor_computation(D_max,fireball_height,R(r,c)) ; | ||
trs = transmissivity(Pow,RH,R(r,c),D_max); | ||
heat_flux_batch2D(r,c) = single_heatflux_computation(SEP,F12,trs); | ||
|
||
end | ||
end | ||
|
||
|
||
|
||
end | ||
|
Oops, something went wrong.