当前位置: 首页>>代码示例>>Python>>正文


Python Physics.mu_plot方法代码示例

本文整理汇总了Python中Physics.mu_plot方法的典型用法代码示例。如果您正苦于以下问题:Python Physics.mu_plot方法的具体用法?Python Physics.mu_plot怎么用?Python Physics.mu_plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Physics的用法示例。


在下文中一共展示了Physics.mu_plot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: model_curves

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import mu_plot [as 别名]
def model_curves(p, time,LDH_0,prim_stab_0):                                   # remove LDH_0 as a dynamic parameter
    from numpy import linspace, array, append, squeeze, zeros
    from scipy.integrate import odeint
    from model_parameters import unpack_parameters

    plot_vals = {}
    C,components = add_component(Adjust_Kinetics.components)
    C['LDH'] = LDH_0
    C['ps'] = prim_stab_0
    components.append('LDH')
    components.append('ps')
    #unpack parameter values from parameter structure
    para = unpack_parameters(p)
    k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12,k13, k14, k15, UA ,pas_0, mu_0, E, q = para

    C['pas'] = pas_0
    components.append('pas')
    n = 5

    # Reactions( can be edited and rest will take care of itself. just remember to adjust paramters, limits and initials in Adjust_parameters.py!!!)

    kinetic_params = k3,k4,k5,k6,k7,k8,k12,k13,n
    reactions = rxns(kinetic_params)
   
    # temperature curve parameters
    R = 8.314
    
    # initial temperatures
    T_0 = 125.
    Tm_0 = 200.

    from Physics import mu, torque, dTdt,dTmdt


# define ode function
    import numpy
    names = []
    initials = numpy.zeros(len(C))
    for i,name in enumerate(C):
        names.append(name)
        initials[i] = C[name]
    initials = list(initials)
    initials.append(T_0)
    initials.append(Tm_0)

    def odesys(var,time):
        C = {}
        for i,name in enumerate(names):
            C[name] = var[i]
        Nc = len(names)
        T = var[Nc]
        Tm = var[Nc+1]
        del_T = dTdt(T, mu_0, E, UA, k9, k10, k14, k15, k11, C)
        del_Tm = dTmdt(T,Tm,k2)
        delta = mol_bal(components, reactions, C)
        del_comps = numpy.zeros(len(names))

        for i, name in enumerate(names):
            del_comps[i] = delta[name]

        to_return = list(del_comps)
        to_return.append(del_T)
        to_return.append(del_Tm)
        return to_return
#   integrate differential equations
    solved = odeint(odesys, initials, time)
    sol2 = solved.T
    C_vals = {}
    for i,name in enumerate(names):
        C_vals[name] = sol2[i]
    T_index = len(sol2) - 2
    plot_vals.update(C_vals)
    plot_vals['T'] = sol2[T_index]
    plot_vals['Tm'] = sol2[T_index + 1]
    import Physics
    plot_vals['mu'] = Physics.mu_plot(mu_0, E, R, plot_vals['T'], k9, k10, k14, k15, C_vals,q)
    plot_vals['Torq'] = Physics.Torq_plot(plot_vals['mu'],k1)
    return plot_vals
开发者ID:GregLaycock,项目名称:Unified_PVC_Degradation,代码行数:80,代码来源:Simulation.py


注:本文中的Physics.mu_plot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。