コード例 #1
0
def UniformKernel(z):
    n = z.shape[0]
    m = z.shape[0]
    kern = sp.lil_matrix((n, m), dtype=np.float64)
    temp = numerix.zeros(n)
    digits = len(str(n - 1))
    delete = "\b" * (digits + 1)
    for i in range(n):
        indices = np.where(z >= z[i])
        temp[indices] = 1. / z[z >= z[i]]
        kern[i] = temp
        temp = numerix.zeros(n)
        level = int((np.float(i) / np.float(n)) * 100)
        # print "{0}%\r".format((np.float(i)/np.float(n)*100))
    return kern
コード例 #2
0
ファイル: simulation.py プロジェクト: wd15/extremefill
 def dirac(x):
     value = numerix.zeros(mesh.numberOfCells, 'd')
     ID = numerix.argmin(abs(mesh.x - x))
     if mesh.x[ID] < x:
         ID = ID + 1
     value[ID] = 1. / dx
     return value
コード例 #3
0
    def Battery_cellvariables(self, neg_epsilon_e, sep_epsilon_e,
                              pos_epsilon_e, neg_a_s, pos_a_s, nx_neg, nx_sep,
                              nx_pos, j_battery_value, ce_initial,
                              phi_e_initial, neg_L, sep_L, pos_L, neg_De_eff,
                              sep_De_eff, pos_De_eff):
        self.Ce = CellVariable(mesh=self.axial_mesh,
                               value=ce_initial,
                               hasOld=True)
        self.phi_e = CellVariable(mesh=self.axial_mesh, value=phi_e_initial)

        self.epsilon_e_value = numerix.zeros(nx_neg + nx_sep + nx_pos)
        self.epsilon_e_value[0:nx_neg], self.epsilon_e_value[
            nx_neg:nx_neg + nx_sep] = neg_epsilon_e, sep_epsilon_e
        self.epsilon_e_value[nx_neg + nx_sep:] = pos_epsilon_e
        self.epsilon_e = CellVariable(mesh=self.axial_mesh,
                                      value=self.epsilon_e_value)

        self.epsilon_e_eff_value = numerix.zeros(nx_neg + nx_sep + nx_pos)
        self.epsilon_e_eff_value[0:nx_neg] = neg_epsilon_e**self.brug
        self.epsilon_e_eff_value[nx_neg:nx_neg +
                                 nx_sep] = sep_epsilon_e**self.brug
        self.epsilon_e_eff_value[nx_neg + nx_sep:] = pos_epsilon_e**self.brug
        self.epsilon_e_eff = CellVariable(mesh=self.axial_mesh,
                                          value=self.epsilon_e_eff_value)

        self.a_s_value = numerix.zeros(nx_neg + nx_pos + nx_sep)
        self.a_s_value[0:nx_neg] = neg_a_s
        self.a_s_value[nx_neg:nx_neg + nx_sep] = 0.0
        self.a_s_value[nx_neg + nx_sep:] = pos_a_s
        self.a_s = CellVariable(mesh=self.axial_mesh, value=self.a_s_value)

        self.L_value = numerix.zeros(nx_neg + nx_pos + nx_sep)
        self.L_value[0:nx_neg], self.L_value[nx_neg:nx_neg +
                                             nx_sep] = neg_L, sep_L
        self.L_value[nx_neg + nx_sep:] = pos_L
        self.L = CellVariable(mesh=self.axial_mesh, value=self.L_value)

        self.De_eff_value = numerix.zeros(nx_neg + nx_pos + nx_sep)
        self.De_eff_value[0:nx_neg], self.De_eff_value[
            nx_neg:nx_neg + nx_sep], self.De_eff_value[
                nx_neg + nx_sep:] = neg_De_eff, sep_De_eff, pos_De_eff
        self.De_eff = CellVariable(mesh=self.axial_mesh,
                                   value=self.De_eff_value)

        self.j_battery = CellVariable(mesh=self.axial_mesh,
                                      value=j_battery_value)
コード例 #4
0
 def _getFaceAreas(self):
     faceAreas = numerix.zeros(self.numberOfFaces, 'd')
     faceAreas[:self.numberOfHorizontalFaces] = self.dx
     faceAreas[self.numberOfHorizontalFaces:] = self.dy
     return faceAreas * self.getFaceCenters()[0]