コード例 #1
0
ファイル: Simulation.py プロジェクト: SysMo/SmoWeb
	def prepareSimulation(self, params = None):
		if params == None:
			params = AttributeDict({
				'absTol' : 1e-6, 
				'relTol' : 1e-6,
			})
		
		#Define an explicit solver 
		simSolver = CVode(self) 
		#Create a CVode solver
		#Sets the parameters 
		#simSolver.verbosity = LOUD
		simSolver.report_continuously = True
		simSolver.iter = 'Newton' #Default 'FixedPoint'
		simSolver.discr = 'BDF' #Default 'Adams'
		#simSolver.discr = 'Adams' 
		simSolver.atol = [params.absTol]	#Default 1e-6 
		simSolver.rtol = params.relTol 	#Default 1e-6		
		simSolver.problem_info['step_events'] = True # activates step events
		#simSolver.maxh = 1.0
		simSolver.store_event_points = True
		self.simSolver = simSolver
コード例 #2
0
ファイル: Simulation.py プロジェクト: birdol/SmoWeb
    def prepareSimulation(self, params=None):
        if params == None:
            params = AttributeDict({
                'absTol': 1e-6,
                'relTol': 1e-6,
            })

        #Define an explicit solver
        simSolver = CVode(self)
        #Create a CVode solver
        #Sets the parameters
        #simSolver.verbosity = LOUD
        simSolver.report_continuously = True
        simSolver.iter = 'Newton'  #Default 'FixedPoint'
        simSolver.discr = 'BDF'  #Default 'Adams'
        #simSolver.discr = 'Adams'
        simSolver.atol = [params.absTol]  #Default 1e-6
        simSolver.rtol = params.relTol  #Default 1e-6
        simSolver.problem_info['step_events'] = True  # activates step events
        #simSolver.maxh = 1.0
        simSolver.store_event_points = True
        self.simSolver = simSolver
コード例 #3
0
def func_set_system():
    ##############################################
    #% initial conditions
    P_0           = depth*9.8*2600.           #;      % initial chamber pressure (Pa)
    T_0           = 1200            #;       % initial chamber temperature (K)
    eps_g0        = 0.04            #;       % initial gas volume fraction
    rho_m0        = 2600            #;       % initial melt density (kg/m^3)
    rho_x0        = 3065            #;       % initial crystal density (kg/m^3)
    a             = 2000.            #;       % initial radius of the chamber (m)
    V_0           = (4.*np.pi/3.)*a**3.  #; % initial volume of the chamber (m^3)

    ##############################################
    ##############################################
    IC = np.array([P_0, T_0, eps_g0, V_0, rho_m0, rho_x0])  # % store initial conditions
    ## Gas (eps_g = zero), eps_x is zero, too many crystals, 50 % crystallinity,eruption (yes/no)
    sw0 = [False,False,False,False,False]

    ##############################################
    #% error tolerances used in ode method
    dt = 3e7*10.
    begin_time = 0  # ; % initialize time
    N  = int(round((end_time-begin_time)/dt))
    ##############################################

    #Define an Assimulo problem
    exp_mod = Chamber_Problem(depth=depth,t0=begin_time,y0=IC,sw0=sw0)
    exp_mod.param['T_S'] = 500.#+273.
    exp_mod.param['T_in'] = 1200.
    exp_mod.param['eps_g_in'] = 0.0    # Gas fraction of incoming melt - gas phase ..
    exp_mod.param['m_eq_in'] = 0.03    # Volatile fraction of incoming melt
    exp_mod.param['Mdot_in']    = mdot
    exp_mod.param['eta_x_max'] = 0.55                                     # Locking fraction
    exp_mod.param['delta_Pc']   = 20e6
    exp_mod.allow_diffusion_init = True
    exp_mod.radius = a
    exp_mod.permeability = perm_val
    exp_mod.R_steps = 1500
    exp_mod.dt_init = dt
    inp_func1 = inp.Input_functions_Degruyer()
    exp_mod.set_input_functions(inp_func1)
    exp_mod.get_constants()
    exp_mod.set_init_crust(material = 'Westerly_Granite')
    #################
    begin_time = exp_mod.set_init_crust_profile(T_0)
    exp_mod.tcurrent = begin_time
    P_0 = exp_mod.plith
    exp_mod.t0 = begin_time
    exp_mod.param['heat_cond'] = 1.                                             # Turn on/off heat conduction
    exp_mod.param['visc_relax'] = 1.                                          # Turn on/off viscous relaxation
    exp_mod.param['press_relax'] = 1.                                          ## Turn on/off pressure diffusion
    exp_mod.param['frac_rad_Temp'] =0.75
    exp_mod.param['vol_degass'] = 1.
    exp_mod.param['outflow_model'] = None  # 'huppert'
    IC = np.array([P_0, T_0, eps_g0, V_0, rho_m0, rho_x0])  # % store initial conditions
    exp_mod.y0 = IC

    #Define an explicit solver
    exp_sim = CVode(exp_mod) #Create a CVode solver
    # exp_sim = LSODAR(exp_mod) #Create a CVode solver

    #Sets the parameters
    exp_sim.store_event_points = True
    #exp_sim.iter = 'Newton'
    #exp_sim.discr = 'BDF'
    exp_sim.inith = 1e2
    #exp_sim.display_progress = True
    exp_sim.rtol = 1.e-7
    #exp_sim.maxh = 3e8*5. # 10 years
    exp_sim.atol = 1e-7
    #exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitvity method used
    #exp_sim.suppress_sens = True       #Dont suppress the sensitivity variables in the error test.
    #exp_sim.usesens = True
    #exp_sim.report_continuously = True
    return exp_mod,exp_sim,N