Beispiel #1
0
            species_dict = pickle.load(f)
        with open(filename + '_equations.pickle', 'rb') as f:
            equations = pickle.load(f)

    print("Ready to run simulation")
    #pdb.set_trace()

    # Now load the numpy arrays generated in the parsing script for use in the simulations. Again, these are named to
    # match this particular code. However the ordering is not important.
    RO2_indices = numpy.load(filename + '_RO2_indices.npy')
    #-------------------------------------------------------------------------------------
    # Define initial concentrations, in pbb, of species using names from KPP file
    species_initial_conc = dict()
    species_initial_conc['O3'] = 18.0
    species_initial_conc['APINENE'] = 30.0

    # Save this information to a dictionary to pass to ODE solver
    input_dict = dict()
    input_dict['species_dict'] = species_dict
    input_dict['species_dict2array'] = species_dict2array
    input_dict['species_initial_conc'] = species_initial_conc
    input_dict['equations'] = equations

    #Do you want to save the output from the simulation as a .npy file?
    save_output = True
    #-------------------------------------------------------------------------------------
    #3) Run the simulation
    run_simulation(filename, start_time, save_output, temp, RH, RO2_indices,
                   H2O, input_dict, simulation_time, batch_step)
    #-------------------------------------------------------------------------------------
    input_dict['R_gas_other'] = R_gas_other
    input_dict['cp'] = cp
    input_dict['sigma'] = sigma
    input_dict['NA'] = NA
    input_dict['kb'] = kb
    input_dict['Lv_water_vapour'] = Lv_water_vapour
    input_dict['ignore_index'] = ignore_index
    input_dict['ignore_index_fortran'] = ignore_index_fortran
    input_dict['ycore_asnumpy'] = numpy.array(y_core)
    input_dict['core_density_array_asnumpy'] = numpy.array(core_density_array)
    input_dict['y_cond_initial'] = y_cond
    input_dict['num_bins'] = num_bins
    input_dict['core_molw_asnumpy'] = numpy.array(core_mw)
    input_dict['core_dissociation'] = core_dissociation
    input_dict['N_perbin'] = N_perbin
    input_dict['include_index'] = include_index

    RO2_indices = numpy.load(filename + '_RO2_indices.npy')

    #pdb.set_trace()

    #Do you want to save the output from the simulation as a .npy file?
    save_output = True
    plot_mass = True
    #-------------------------------------------------------------------------------------
    # 11) Run the simulation
    run_simulation(filename, save_output, start_time, temp, RH, RO2_indices,
                   H2O, PInit, y_cond, input_dict, simulation_time, batch_step,
                   plot_mass)
    #-------------------------------------------------------------------------------------