Example #1
0
    def __init__(self, a_props, a_time=-1, a_n_e = None, u_per_cc = False, a_r=[]):
        """
        INPUTS
        a_props  : 2D array of properties. Rows are
                   0: r1
                   1: r2
                   2: rho
                   3: T_gas
                   4: p_gas
                   5: v
                   6: u_gas (assumed in erg/gram unless u_per_cc set to True)
                   (7): cs  -- optional
        a_n_e    : electron density per cell -- optional input
        u_per_cc : whether units of a_props[6] are erg/cc (True) or erg/g (False)
        a_r      : average radius to use per cell 
        """

        self.time = a_time 

        self.r1    = a_props[0]
        self.r2    = a_props[1]

        if np.any( (self.r1-self.r2) == 0.0 ):
            raise RuntimeError('Increased precision in the ray file is required.');

        if len(a_r)!=len(self.r1):
            self.r = CKtools.calc_zone_r(self.r1,self.r2)
        else:
            self.r = np.array(a_r)

        self.rho   = a_props[2]
        self.T_gas = a_props[3]
        self.p_gas = a_props[4]
        self.v     = a_props[5]

        if not u_per_cc:
            self.u_gas = a_props[6] * self.rho
        else:
            self.u_gas = a_props[6]

        if len(a_props)==8:
            self.cs = a_props[7]
        else:
            self.cs = np.zeros(len(self.r1))

        self.n_e = a_n_e
Example #2
0
    def __init__(self, a_r1=0.0, a_r2=0.0, a_rho=0.0, a_T_gas=0.0, 
                 a_p_gas=0.0, a_v=0.0, a_u_gas=0.0, a_c_s=0.0, a_n_e=-1, a_i=-1   ):
        """
        INPUTS
        a_r1  : (float) lower radial bound of cell
        a_r2  : (float) upper ...
        a_rho : (float) den
        """
        if a_r1==a_r2 and a_r1!=0.0: 
            print( "Warning: zero-volume cell")

        self.r1 = a_r1
        self.r2 = a_r2
        self.r  = CKtools.calc_zone_r(r1,r2)
        self.T_gas = a_T_gas
        self.p_gas = a_p_gas
        self.v     = a_v
        self.u_gas = a_u_gas
        self.cs    = a_c_s
        self.n_e   = a_n_e
        self.i     = a_i