Пример #1
0
 # Create the lake netCDF dataset and get the Profile object
 lake = lake_bub.get_lake_data()
 
 # Create the stratified plume model object
 spm = stratified_plume_model.Model(lake)
     
 # Create the dispersed phase particles
 sphere = dbm.InsolubleParticle(False, False, rho_p=15.)
 z0 = 46.
 particles = []
 
 # Small particle
 Q_N = 100. / 60. / 60. 
 de = 0.01
 lambda_1 = 0.7
 particles.append(stratified_plume_model.particle_from_Q(lake, z0, sphere, 
                  1., Q_N,  de, lambda_1, 273.15 + 20.))
 
 # Initialize a simulation
 R = 6.5 / 2.
 spm.simulate(particles, z0, R, maxit=5, delta_z = 0.2)
 
 # Save the model results
 spm.save_sim('../../test/output/spm_sphere.nc', 
     '../../test/output/lake.nc', 
     'Lake data from McGinnis et al. (2006) in ./test/output/lake.nc')
     
 # Demonstrate how to read the data back in from the hard drive
 spm.load_sim('../../test/output/spm_sphere.nc')
 spm.plot_state_space(1)
 
 # Plot the full suite of model variables
Пример #2
0
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)
Пример #3
0
 # Create the lake netCDF dataset and get the Profile object
 lake = lake_bub.get_lake_data()
 
 # Create the stratified plume model object
 spm = stratified_plume_model.Model(lake)
     
 # Create the dispersed phase particles
 sphere = dbm.InsolubleParticle(False, False, rho_p=15.)
 z0 = 46.
 particles = []
 
 # Small particle
 Q_N = 100. / 60. / 60. 
 de = 0.01
 lambda_1 = 0.7
 particles.append(stratified_plume_model.particle_from_Q(lake, z0, sphere, 
                  1., Q_N,  de, lambda_1, 273.15 + 20.))
 
 # Initialize a simulation
 R = 6.5 / 2.
 spm.simulate(particles, z0, R, maxit=5, delta_z = 0.2)
 
 # Save the model results
 spm.save_sim('../../test/output/spm_sphere.nc', 
     '../../test/output/lake.nc', 
     'Lake data from McGinnis et al. (2006) in ./test/output/lake.nc')
     
 # Demonstrate how to read the data back in from the hard drive
 spm.load_sim('../../test/output/spm_sphere.nc')
 spm.plot_state_space(1)
 
 # Plot the full suite of model variables
Пример #4
0
 
 # Create the stratified plume model object
 spm = stratified_plume_model.Model(lake)
 
 # Create the dispersed phase particles
 composition = ['oxygen', 'nitrogen', 'argon']
 yk = np.array([1.0, 0., 0.])
 o2 = dbm.FluidParticle(composition, isair=True)
 z0 = 46.
 bubbles = []
 
 # Small bubble
 Q_N = 30. / 60. / 60. 
 de = 0.001
 lambda_1 = 0.9
 bubbles.append(stratified_plume_model.particle_from_Q(lake, z0, o2, yk, 
                Q_N,  de, lambda_1, t_hyd=0.))
 
 # Medium bubble
 Q_N = 70. / 60./ 60.
 de = 0.002
 lambda_1 = 0.8
 bubbles.append(stratified_plume_model.particle_from_Q(lake, z0, o2, yk, 
               Q_N,  de, lambda_1, t_hyd=0.))
 
 # Initialize a simulation
 R = 6.5 / 2.
 spm.simulate(bubbles, z0, R, maxit=50, delta_z = 0.2)
 
 # Save the model results
 spm.save_sim('../../test/output/spm_gas.nc', '../../test/output/lake.nc', 
     'Lake data from McGinnis et al. (2006) in ./test/output/lake.nc')
Пример #5
0
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)
Пример #6
0
    # Create the dispersed phase particles
    composition = ['oxygen', 'nitrogen', 'argon']
    yk = np.array([1.0, 0., 0.])
    o2 = dbm.FluidParticle(composition, isair=True)
    z0 = 46.
    bubbles = []

    # Small bubble
    Q_N = 30. / 60. / 60.
    de = 0.001
    lambda_1 = 0.9
    bubbles.append(
        stratified_plume_model.particle_from_Q(lake,
                                               z0,
                                               o2,
                                               yk,
                                               Q_N,
                                               de,
                                               lambda_1,
                                               t_hyd=0.))

    # Medium bubble
    Q_N = 70. / 60. / 60.
    de = 0.002
    lambda_1 = 0.8
    bubbles.append(
        stratified_plume_model.particle_from_Q(lake,
                                               z0,
                                               o2,
                                               yk,
                                               Q_N,
                                               de,