コード例 #1
0
    def __init__(self, theta, params, cq='volume', comm=None):
        # initialize base class
        cardiovascular0Dbase.__init__(self, theta, comm=comm)

        # number of degrees of freedom
        self.numdof = 4

        # parameters
        self.R = params['R']
        self.C = params['C']
        self.Z = params['Z']
        self.L = params['L']
        self.p_ref = params['p_ref']

        self.cq = cq
        self.switch_V, self.switch_Q = 1, 0

        self.cname = 'V'

        self.v_ids = [0]
        self.c_ids = [2]

        if self.cq == 'volume':
            pass  # 'volume' is default
        elif self.cq == 'flux':
            self.switch_V, self.switch_Q = 0, 1
            self.cname = 'Q'
        else:
            raise NameError("Unknown coupling quantity!")

        # set up arrays
        self.setup_arrays()

        # set up symbolic equations
        self.equation_map()

        # symbolic stiffness matrix
        self.set_stiffness()

        # make Lambda functions out of symbolic expressions
        self.lambdify_expressions()
コード例 #2
0
    def __init__(self, params, cq=['volume'], comm=None):
        # initialize base class
        cardiovascular0Dbase.__init__(self, comm=comm)

        # parameters
        self.C = params['C']
        self.R = params['R']
        self.p_ref = params['p_ref']

        self.cq = cq
        self.switch_V, self.switch_Q, self.switch_p = 1, 0, 0

        self.vname, self.cname = 'p', 'V'

        self.v_ids = [0]
        self.c_ids = [0]

        if self.cq[0] == 'volume':
            pass  # 'volume' is default
        elif self.cq[0] == 'flux':
            self.switch_V, self.switch_p = 0, 0
            self.cname = 'Q'
            self.vname = 'p'
        elif self.cq[0] == 'pressure':
            self.switch_V, self.switch_p = 0, 1
            self.cname = 'p'
            self.vname = 'Q'
        else:
            raise NameError("Unknown coupling quantity!")

        # set up arrays
        self.setup_arrays()

        # set up symbolic equations
        self.equation_map()

        # symbolic stiffness matrix
        self.set_stiffness()

        # make Lambda functions out of symbolic expressions
        self.lambdify_expressions()
コード例 #3
0
    def __init__(self, theta, params, chmodels, prescrpath=None, have_elast=False, cq='volume', valvelaw=['pwlin_pres',0], comm=None):
        # initialize base class
        cardiovascular0Dbase.__init__(self, theta, comm=comm)

        # parameters
        # circulatory system parameters: resistances (R), compliances (C), inertances (L), impedances (Z)
        self.R_ar_sys = params['R_ar_sys']
        self.C_ar_sys = params['C_ar_sys']
        self.L_ar_sys = params['L_ar_sys']
        self.Z_ar_sys = params['Z_ar_sys']
        self.R_ven_sys = params['R_ven_sys']
        self.C_ven_sys = params['C_ven_sys']
        self.L_ven_sys = params['L_ven_sys']
        self.R_ar_pul = params['R_ar_pul']
        self.C_ar_pul = params['C_ar_pul']
        self.L_ar_pul = params['L_ar_pul']
        self.Z_ar_pul = params['Z_ar_pul']
        self.R_ven_pul = params['R_ven_pul']
        self.C_ven_pul = params['C_ven_pul']
        self.L_ven_pul = params['L_ven_pul']
        
        # ventricular elastances (for 0D ventricles)
        self.E_v_max_l = params['E_v_max_l']
        self.E_v_min_l = params['E_v_min_l']
        self.E_v_max_r = params['E_v_max_r']
        self.E_v_min_r = params['E_v_min_r']

        # atrial elastances (for 0D atria)
        self.E_at_max_l = params['E_at_max_l']
        self.E_at_min_l = params['E_at_min_l']
        self.E_at_max_r = params['E_at_max_r']
        self.E_at_min_r = params['E_at_min_r']

        # valve resistances
        self.R_vin_l_min = params['R_vin_l_min']
        self.R_vin_l_max = params['R_vin_l_max']
        self.R_vin_r_min = params['R_vin_r_min']
        self.R_vin_r_max = params['R_vin_r_max']
        self.R_vout_l_min = params['R_vout_l_min']
        self.R_vout_l_max = params['R_vout_l_max']
        self.R_vout_r_min = params['R_vout_r_min']
        self.R_vout_r_max = params['R_vout_r_max']
        
        # end-diastolic and end-systolic timings
        self.t_ed = params['t_ed']
        self.t_es = params['t_es']
        self.T_cycl = params['T_cycl']
        
        # unstressed compartment volumes (for post-processing)
        self.V_at_l_u = params['V_at_l_u']
        self.V_at_r_u = params['V_at_r_u']
        self.V_v_l_u = params['V_v_l_u']
        self.V_v_r_u = params['V_v_r_u']
        self.V_ar_sys_u = params['V_ar_sys_u']
        self.V_ar_pul_u = params['V_ar_pul_u']
        self.V_ven_sys_u = params['V_ven_sys_u']
        self.V_ven_pul_u = params['V_ven_pul_u']
        
        self.chmodels = chmodels
        self.valvelaw = valvelaw[0]
        self.epsvalve = valvelaw[1]
        
        self.prescrpath = prescrpath
        self.have_elast = have_elast
        
        self.cq = cq

        # set up arrays
        self.setup_arrays()

        # setup chambers
        self.set_chamber_interfaces()
        
        # set up symbolic equations
        self.equation_map()
        
        # symbolic stiffness matrix
        self.set_stiffness()

        # make Lambda functions out of symbolic expressions
        self.lambdify_expressions()
コード例 #4
0
    def __init__(
            self,
            params,
            chmodels,
            cq=['volume', 'volume', 'volume', 'volume'],
            valvelaws={
                'av': ['pwlin_pres', 0],
                'mv': ['pwlin_pres', 0],
                'pv': ['pwlin_pres', 0],
                'tv': ['pwlin_pres', 0]
            },
            comm=None):
        # initialize base class
        cardiovascular0Dbase.__init__(self, comm=comm)

        # parameters
        # circulatory system parameters: resistances (R), compliances (C), inertances (L), impedances (Z)
        self.R_ar_sys = params['R_ar_sys']
        self.C_ar_sys = params['C_ar_sys']
        self.L_ar_sys = params['L_ar_sys']
        self.Z_ar_sys = params['Z_ar_sys']
        self.R_ven_sys = params['R_ven_sys']
        self.C_ven_sys = params['C_ven_sys']
        self.L_ven_sys = params['L_ven_sys']
        self.R_ar_pul = params['R_ar_pul']
        self.C_ar_pul = params['C_ar_pul']
        self.L_ar_pul = params['L_ar_pul']
        self.Z_ar_pul = params['Z_ar_pul']
        self.R_ven_pul = params['R_ven_pul']
        self.C_ven_pul = params['C_ven_pul']
        self.L_ven_pul = params['L_ven_pul']

        # ventricular elastances (for 0D ventricles)
        self.E_v_max_l = params['E_v_max_l']
        self.E_v_min_l = params['E_v_min_l']
        self.E_v_max_r = params['E_v_max_r']
        self.E_v_min_r = params['E_v_min_r']

        # atrial elastances (for 0D atria)
        self.E_at_max_l = params['E_at_max_l']
        self.E_at_min_l = params['E_at_min_l']
        self.E_at_max_r = params['E_at_max_r']
        self.E_at_min_r = params['E_at_min_r']

        # valve resistances
        self.R_vin_l_min = params['R_vin_l_min']
        self.R_vin_l_max = params['R_vin_l_max']
        self.R_vin_r_min = params['R_vin_r_min']
        self.R_vin_r_max = params['R_vin_r_max']
        self.R_vout_l_min = params['R_vout_l_min']
        self.R_vout_l_max = params['R_vout_l_max']
        self.R_vout_r_min = params['R_vout_r_min']
        self.R_vout_r_max = params['R_vout_r_max']

        # valve inertances
        try:
            self.L_vin_l = params['L_vin_l']
        except:
            self.L_vin_l = 0
        try:
            self.L_vin_r = params['L_vin_r']
        except:
            self.L_vin_r = 0
        try:
            self.L_vout_l = params['L_vout_l']
        except:
            self.L_vout_l = 0
        try:
            self.L_vout_r = params['L_vout_r']
        except:
            self.L_vout_r = 0

        # end-diastolic and end-systolic timings
        self.t_ed = params['t_ed']
        self.t_es = params['t_es']
        self.T_cycl = params['T_cycl']

        # unstressed compartment volumes (for post-processing)
        self.V_at_l_u = params['V_at_l_u']
        self.V_at_r_u = params['V_at_r_u']
        self.V_v_l_u = params['V_v_l_u']
        self.V_v_r_u = params['V_v_r_u']
        self.V_ar_sys_u = params['V_ar_sys_u']
        self.V_ar_pul_u = params['V_ar_pul_u']
        self.V_ven_sys_u = params['V_ven_sys_u']
        self.V_ven_pul_u = params['V_ven_pul_u']

        self.chmodels = chmodels
        self.valvelaws = valvelaws

        # number of systemic venous inflows (to right atrium)
        try:
            self.vs = self.chmodels['ra']['num_inflows']
        except:
            self.vs = 1

        # number of pulmonary venous inflows (to left atrium)
        try:
            self.vp = self.chmodels['la']['num_inflows']
        except:
            self.vp = 1

        self.cq = cq

        # set up arrays
        self.setup_arrays()

        # setup chambers
        self.set_chamber_interfaces()

        # set up symbolic equations
        self.equation_map()

        # symbolic stiffness matrix
        self.set_stiffness()

        # make Lambda functions out of symbolic expressions
        self.lambdify_expressions()