def sensitivity(self, scenario, value, ranges): self.data.max_P = [] self.data.max_T = [] self.data.max_conversion = [] self.data.max_vent = [] for i in tqdm(ranges): if value == "Rupture Disc Diameter": scenario.D_RD = i elif value == "Rupture Disc Burst Pressure": scenario.P_RD = i elif value == "Backpressure Regulator Set-Point": scenario.P_BPR = i elif value == "Hydrogen Peroxide Concentration": scenario.XH2O2 = i / 100 elif value == "Reactor Charge": scenario.mR = i elif value == "Contamination Factor": scenario.kf = i elif value == "Reaction Temperature": scenario.rxn_temp = i ode = ODE.ODE(scenario) ode.initialize_heatup() ode.integrate() tc = ode.termination_code() # if self.data.RD is True and tc == "Process Finished Successfully (Rupture disc burst)": ode.initialize_vent(integrator='vode') ode.integrate() self.data.max_P.append(ode.max_P()) self.data.max_T.append(ode.max_T()) self.data.max_conversion.append(ode.max_conversion()) self.data.max_vent.append(ode.max_vent())
def main_functions(): inputData = input() m1 = inputData.get('m1') m2 = inputData.get('m2') L1 = inputData.get('L1') L2 = inputData.get('L2') theta1 = inputData.get('theta1') theta2 = inputData.get('theta2') g = inputData.get('g') t = inputData.get('t') temp = ODE(theta1, theta2, m1, m2, L1, L2, g, t) output(temp[0], temp[1], temp[2]) plot(temp[0], temp[1], temp[2])
def run_scenario_menu(self): if None in [self.data.VR, self.data.RD, self.data.kf]: print(' ') print( 'Scenario not fully specified. Update scenario configuration and try again' ) print(' ') input("Press [Enter] to continue...") else: answers = self.setup_plot_rt_q() plot_rt = answers.get("plot_rt") scen = Scenario(self.data.VR, self.data.rxn_temp, self.data.rxn_time, self.data.XH2O2, self.data.mR, self.data.D_RD, self.data.P_RD, self.data.P_BPR, self.data.D_BPR, self.data.BPR_max_Cv, self.data.P0, self.data.kf, self.data.T0, self.data.Ux, self.data.AR, self.data.MAWP, self.data.max_rate, self.data.Kp, self.data.Ki, self.data.Kd, self.data.flow_regime, self.data.BPR, self.data.RD, self.data.cool_time, self.data.TF) ode1 = ODE.ODE(scen) ode1.initialize_heatup() print('Integrating Heatup...') print(' ') ode1.integrate(plot_rt) tc = ode1.termination_code() print(' ') print(tc) print(' ') if self.data.RD is True and ode1.tc == 1: print('Integrating ERS...') print(' ') ode1.initialize_vent(integrator='vode') ode1.integrate(plot_rt) tc = ode1.termination_code() print(' ') print(tc) print(' ') self.data.ode = ode1 self.summary_stats_menu()
0.70541941, # HypoWCCn 0.03008159, # HyperWCCn 0.08212058, # aWCC 0., # laWCC 0., # vvdm 0., # VVDc 0., # VVDn 0. ]) # WVC frq_ind = 2 period = 21.62451 ##### Below is example solving and plotting frq mRNA for Tseng's model ##### ModTseng = ODE('Tseng\'s Model', frq_ind, Y, p, p_add, dY, Y0, period, findQ=False) tot_time = 100 t_test = np.linspace(0, tot_time, 100 * tot_time) sol_test = ModTseng.solve(ModTseng.lim_cyc_vals, t_test) frq_sol = sol_test[:, frq_ind] plt.plot(t_test, frq_sol)
qD = sympy.Symbol('qD') # Parameters as additive pulses p_add = [qA, qB, qC, qD] # Symbolic ODE RHS dA = k3*D**m/(K**m+D**m) - k4*A # frq mRNA dB = k5*A - k6*B + k7*C - k8*B*D # FRQ Protein dC = k8*B*D - k7*C - k9*C # WC-1:FRQ complex dD = k1 - k2*D + k7*C - k8*B*D # WC-1 protein dY = sympy.Matrix([dA, dB, dC, dD]) # Vector ODE RHS # Initial values on the limit cycle at frq mRNA max. Y0 = np.array([0.958658, # A0 0.7892854, # B0 0.3232268, # C0 0.5296776]) # D0 frq_ind = 0 period = 22. ##### Below is example solving and plotting frq mRNA for the simple model ##### ModSimple = ODE('The Simple Model',frq_ind,Y,p,p_add,dY,Y0,period,findQ=False) tot_time=100 t_test = np.linspace(0,tot_time, 100*tot_time) sol_test = ModSimple.solve(ModSimple.lim_cyc_vals, t_test) frq_sol = sol_test[:,frq_ind] plt.plot(t_test, frq_sol)
0.0110685024, # Fn0 3.70361114, # Mw0 0.00666226484, # Wc0 0.924361228, # Wn0 0.0820481701, # FWn0 0.05214823, # Mc0 1.93780501 ]) # C0 frq_ind = 0 period = 22.3934820284 ##### Below is example solving and plotting frq mRNA for Dovzhenok's model ##### ModDovzhenok = ODE('The Dovzhenok Model', frq_ind, Y, p, p_add, dY, Y0, period, findQ=False) tot_time = 100 t_test = np.linspace(0, tot_time, 100 * tot_time) sol_test = ModDovzhenok.solve(ModDovzhenok.lim_cyc_vals, t_test) frq_sol = sol_test[:, frq_ind] plt.plot(t_test, frq_sol)