def get_sim_data(): """ Get the input data to the `params.Scales` object Create an `ambient.Profile` object and a list of `stratified_plume_model.Particle` objects as the required input for the `params.Scales` object. Returns ------- profile : `ambient.Profile` object profile object from the BM54 CTD data disp_phases: list list of `stratified_plume_model.Particle` objects describing the blowout dispersed phases. z0 : float depth at the plume model origin (m) """ # Get the netCDF file nc = test_sbm.make_ctd_file() # Create a profile object with all available chemicals in the CTD data profile = ambient.Profile(nc, chem_names='all') # Create the stratified plume model object spm = stratified_plume_model.Model(profile) # Set the release conditions T0 = 273.15 + 35. # Release temperature in K R = 0.15 # Radius of leak source in m # Create the gas phase particles composition = ['methane', 'ethane', 'propane', 'oxygen'] yk = np.array([0.93, 0.05, 0.02, 0.0]) gas = dbm.FluidParticle(composition) z0 = 1000. disp_phases = [] # Larger free gas bubbles mb0 = 8. # total mass flux in kg/s de = 0.025 # bubble diameter in m lambda_1 = 0.85 disp_phases.append( stratified_plume_model.particle_from_mb0(profile, z0, gas, yk, mb0, de, lambda_1, T0)) # Smaller free gas bubbles (note, it is not necessary to have more than # one bubble size) mb0 = 2. # total mass flux in kg/s de = 0.0075 # bubble diameter in m lambda_1 = 0.9 disp_phases.append( stratified_plume_model.particle_from_mb0(profile, z0, gas, yk, mb0, de, lambda_1, T0)) # Liquid hydrocarbon. This could either be a dissolving phase (mixture # of liquid phases) or an inert phase. We demonstrate here the simple # case of an inert oil phase oil = dbm.InsolubleParticle(True, True, rho_p=890., gamma=30., beta=0.0007, co=2.90075e-9) mb0 = 10. # total mass flux in kg/s de = 0.004 # bubble diameter in m lambda_1 = 0.9 disp_phases.append( stratified_plume_model.particle_from_mb0(profile, z0, oil, np.array([1.]), mb0, de, lambda_1, T0)) # Return the simulation data return (profile, disp_phases, z0)
T0 = 273.15 + 35. # Release temperature in K R = 0.15 # Radius of leak source in m # Create the gas phase particles composition = ['methane', 'ethane', 'propane', 'oxygen'] yk = np.array([0.93, 0.05, 0.02, 0.0]) gas = dbm.FluidParticle(composition) z0 = 1000. disp_phases = [] # Larger free gas bubbles mb0 = 8. # total mass flux in kg/s de = 0.025 # bubble diameter in m lambda_1 = 0.85 disp_phases.append( stratified_plume_model.particle_from_mb0(ctd, z0, gas, yk, mb0, de, lambda_1, T0)) # Smaller free gas bubbles (note, it is not necessary to have more than # one bubble size) mb0 = 2. # total mass flux in kg/s de = 0.0075 # bubble diameter in m lambda_1 = 0.9 disp_phases.append( stratified_plume_model.particle_from_mb0(ctd, z0, gas, yk, mb0, de, lambda_1, T0)) # Liquid hydrocarbon. This could either be a dissolving phase (mixture # of liquid phases) or an inert phase. We demonstrate here the simple # case of an inert oil phase oil = dbm.InsolubleParticle(True, True,
def get_sim_data(): """ Create the data needed to initialize a simulation Performs the steps necessary to set up a stratified plume model simulation and passes the input variables to the `Model` object and `Model.simulate()` method. Returns ------- profile : `ambient.Profile` object Return a profile object from the BM54 CTD data particles : list of `PlumeParticle` objects List of `PlumeParticle` objects containing the dispersed phase initial conditions z : float Depth of the release port (m) R : float Radius of the release port (m) maxit : float Maximum number of iterations to converge between inner and outer plumes toler : float Relative error tolerance to accept for convergence (--) delta_z : float Maximum step size to use in the simulation (m). The ODE solver in `calculate` is set up with adaptive step size integration, so in theory this value determines the largest step size in the output data, but not the numerical stability of the calculation. """ # Get the ambient CTD data profile = get_profile() # Specify the release location and geometry and initialize a particle # list z0 = 300. R = 0.15 particles = [] # Add a dissolving particle to the list composition = ['oxygen', 'nitrogen', 'argon'] yk = np.array([1.0, 0., 0.]) o2 = dbm.FluidParticle(composition) Q_N = 150. / 60. / 60. de = 0.005 lambda_1 = 0.85 particles.append( stratified_plume_model.particle_from_Q(profile, z0, o2, yk, Q_N, de, lambda_1)) # Add an insoluble particle to the list composition = ['inert'] yk = np.array([1.]) oil = dbm.InsolubleParticle(True, True) mb0 = 50. de = 0.01 lambda_1 = 0.8 particles.append( stratified_plume_model.particle_from_mb0(profile, z0, oil, [1.], mb0, de, lambda_1)) # Set the other simulation parameters maxit = 2 toler = 0.2 delta_z = 1.0 # Return the results return (profile, particles, z0, R, maxit, toler, delta_z)
# Set the release conditions T0 = 273.15 + 35. # Release temperature in K R = 0.15 # Radius of leak source in m # Create the gas phase particles composition = ['methane', 'ethane', 'propane', 'oxygen'] yk = np.array([0.93, 0.05, 0.02, 0.0]) gas = dbm.FluidParticle(composition) z0 = 1000. disp_phases = [] # Larger free gas bubbles mb0 = 8. # total mass flux in kg/s de = 0.025 # bubble diameter in m lambda_1 = 0.85 disp_phases.append(stratified_plume_model.particle_from_mb0(ctd, z0, gas, yk, mb0, de, lambda_1, T0)) # Smaller free gas bubbles (note, it is not necessary to have more than # one bubble size) mb0 = 2. # total mass flux in kg/s de = 0.0075 # bubble diameter in m lambda_1 = 0.9 disp_phases.append(stratified_plume_model.particle_from_mb0(ctd, z0, gas, yk, mb0, de, lambda_1, T0)) # Liquid hydrocarbon. This could either be a dissolving phase (mixture # of liquid phases) or an inert phase. We demonstrate here the simple # case of an inert oil phase oil = dbm.InsolubleParticle(True, True, rho_p=890., gamma=30., beta=0.0007, co=2.90075e-9) mb0 = 10. # total mass flux in kg/s
def get_sim_data(): """ Create the data needed to initialize a simulation Performs the steps necessary to set up a stratified plume model simulation and passes the input variables to the `Model` object and `Model.simulate()` method. Returns ------- profile : `ambient.Profile` object Return a profile object from the BM54 CTD data particles : list of `PlumeParticle` objects List of `PlumeParticle` objects containing the dispersed phase initial conditions z : float Depth of the release port (m) R : float Radius of the release port (m) maxit : float Maximum number of iterations to converge between inner and outer plumes toler : float Relative error tolerance to accept for convergence (--) delta_z : float Maximum step size to use in the simulation (m). The ODE solver in `calculate` is set up with adaptive step size integration, so in theory this value determines the largest step size in the output data, but not the numerical stability of the calculation. """ # Get the ambient CTD data profile = get_profile() # Specify the release location and geometry and initialize a particle # list z0 = 300. R = 0.15 particles = [] # Add a dissolving particle to the list composition = ['oxygen', 'nitrogen', 'argon'] yk = np.array([1.0, 0., 0.]) o2 = dbm.FluidParticle(composition) Q_N = 150. / 60. / 60. de = 0.005 lambda_1 = 0.85 particles.append(stratified_plume_model.particle_from_Q(profile, z0, o2, yk, Q_N, de, lambda_1)) # Add an insoluble particle to the list composition = ['inert'] yk = np.array([1.]) oil = dbm.InsolubleParticle(True, True) mb0 = 50. de = 0.01 lambda_1 = 0.8 particles.append(stratified_plume_model.particle_from_mb0(profile, z0, oil, [1.], mb0, de, lambda_1)) # Set the other simulation parameters maxit = 2 toler = 0.2 delta_z = 1.0 # Return the results return (profile, particles, z0, R, maxit, toler, delta_z)
def get_sim_data(): """ Get the input data to the `params.Scales` object Create an `ambient.Profile` object and a list of `stratified_plume_model.Particle` objects as the required input for the `params.Scales` object. Returns ------- profile : `ambient.Profile` object profile object from the BM54 CTD data disp_phases: list list of `stratified_plume_model.Particle` objects describing the blowout dispersed phases. z0 : float depth at the plume model origin (m) """ # Get the netCDF file nc = test_sbm.make_ctd_file() # Create a profile object with all available chemicals in the CTD data profile = ambient.Profile(nc, chem_names='all') # Create the stratified plume model object spm = stratified_plume_model.Model(profile) # Set the release conditions T0 = 273.15 + 35. # Release temperature in K R = 0.15 # Radius of leak source in m # Create the gas phase particles composition = ['methane', 'ethane', 'propane', 'oxygen'] yk = np.array([0.93, 0.05, 0.02, 0.0]) gas = dbm.FluidParticle(composition) z0 = 1000. disp_phases = [] # Larger free gas bubbles mb0 = 8. # total mass flux in kg/s de = 0.025 # bubble diameter in m lambda_1 = 0.85 disp_phases.append(stratified_plume_model.particle_from_mb0(profile, z0, gas, yk, mb0, de, lambda_1, T0)) # Smaller free gas bubbles (note, it is not necessary to have more than # one bubble size) mb0 = 2. # total mass flux in kg/s de = 0.0075 # bubble diameter in m lambda_1 = 0.9 disp_phases.append(stratified_plume_model.particle_from_mb0(profile, z0, gas, yk, mb0, de, lambda_1, T0)) # Liquid hydrocarbon. This could either be a dissolving phase (mixture # of liquid phases) or an inert phase. We demonstrate here the simple # case of an inert oil phase oil = dbm.InsolubleParticle(True, True, rho_p=890., gamma=30., beta=0.0007, co=2.90075e-9) mb0 = 10. # total mass flux in kg/s de = 0.004 # bubble diameter in m lambda_1 = 0.9 disp_phases.append(stratified_plume_model.particle_from_mb0(profile, z0, oil, np.array([1.]), mb0, de, lambda_1, T0)) # Return the simulation data return (profile, disp_phases, z0)