% Startup data for ims-eik.m
% 27.12.02
% Gisle Otto Eikrem

conv_to_bara = 1e-5; % Factor for conversion from Pa to bar

% Inital values for the ims_eik simplified model
p_sep_bara = 105; % bara, Separator pressure
p_reservoir=370;

% Oil & gas

M = 0.028; %kg/mol Molmassen til nitrogengass

R0 = 8.31452; % J / K mol -  The universal gas constant
R1 = 8.31246e-5; % m3 bar / K mol - The universal gas constant
R2 = R0/M; % [J/K kg] specific gas constant for nitrogen

rho_water = 1000;
rho_oil = 750; 

% Universal constants
R = 8.314510/M;
g = 9.81;

T_pipeline = 323; % Temp annulus (K)
T_riser = 323; %293; % Temp tubing (K)

%m(:,1) = [50; 2500; 100; 7000];
%m(:,1) = [70.6; 4360; 261.6; 1484.4];
  

m(:,1)=  [0.3379    3.3445    1.8862    0.2941].*1.0e+004;
% % Estimating initial conditions
% %
% pipeline_liquid_holdup=0.005;
% riser_liquid_holdup=0.005;
% 
% rho_gas_riser_initial = p_sep_bara/(conv_to_bara*R2*T_riser);
% 
% p_riser_bottom_initial = p_sep_bara + conv_to_bara*rho_oil*g*riser_length*riser_liquid_holdup;
% 
% rho_gas_pipeline_initial = (p_sep_bara + p_riser_bottom_initial)/(conv_to_bara*R2*T_riser);
% 
% 
% m(1,1)= V_total_riser*(1-riser_liquid_holdup)*rho_gas_riser_initial; %m_gas_riser
% m(2,1)= V_total_riser*riser_liquid_holdup*rho_oil; %m_oil_riser 
% m(3,1)= V_total_pipeline*(1-pipeline_liquid_holdup)*rho_gas_pipeline_initial; %m_gas_pipeline 
% m(4,1)= V_total_pipeline*pipeline_liquid_holdup*rho_oil; %m_oil_pipeline
% 
% p_top_pipeline_initial = p_riser_bottom_initial;
% %p_reservoir=12*p_top_pipeline_initial;    % bara
% 
% for other than constant inflow conditions
prodi= (inflow_oil + inflow_gas)/(p_reservoir - 210);%p_top_pipeline_bara(1));
%m(:,1)