コード例 #1
0
ファイル: Grid.py プロジェクト: witekha3/MES
class Grid:
    nodes = []
    elements = []
    global_data = GlobalData()
    global_matrix_C = np.zeros((global_data.n_N, global_data.n_N))
    global_matrix_H = np.zeros((global_data.n_N, global_data.n_N))
    global_vector_P = np.zeros((global_data.n_N, 1))

    def __init__(self):
        Grid.fill_global_matrix()

    @staticmethod
    def fill_global_matrix():
        for element in Grid.elements:
            Grid.global_vector_P[element.id_array] += element.P_vector
            for i in range(0, 4):
                for j in range(0, 4):
                    Grid.global_matrix_H[element.id_array[i]][element.id_array[j]] += element.H_matrix[i][j]
                    Grid.global_matrix_C[element.id_array[i]][element.id_array[j]] += element.C_matrix[i][j]

    @staticmethod
    def print_nodes():
        for node in Grid.nodes:
            node.print_xy()

    @staticmethod
    def print_elements():
        for element in Grid.elements:
            element.print_id_array()
コード例 #2
0
def main():
    data = readDataFromFile("plik.txt")
    TO = int(data[0])
    time = int(data[1])
    dT = int(data[2])
    ambientT =int(data[3])
    alfa = int(data[4])
    conductivity = int(data[5])
    specificHeat = int(data[6])
    density = int(data[7])
    H = float(data[8])
    W = float (data[9])
    nH = int(data[10])
    nW = int(data[11])

    globalD = GlobalData(nH, nW, H, W,TO,dT,ambientT,alfa,conductivity,specificHeat,density,time)

    grid = Grid(globalD)
    ue = UniversalElement()
    jacob=Jacobian(grid)
    matrixH=MatrixH(jacob)
    matrixC=MatrixC(jacob)
    matrixH_BC = MatrixH_BC(grid)
    p=VektorP(matrixH_BC)
    calculations=Calculations(matrixC,matrixH,matrixH_BC,p)
コード例 #3
0
ファイル: Creator.py プロジェクト: witekha3/MES
 def __init__(self):
     global_data = GlobalData()
     self.H = global_data.H
     self.W = global_data.W
     self.n_H = global_data.n_H
     self.n_W = global_data.n_W
     self.lx = self.W / (self.n_W - 1)
     self.ly = self.H / (self.n_H - 1)
コード例 #4
0
 def __init__(self):
     Creator().create_nodes_for_grid()
     Creator().create_elements_for_grid()
     grid = Grid()
     global_data = GlobalData()
     self.H_matrix = grid.global_matrix_H
     self.C_matrix = grid.global_matrix_C
     self.P_vector = grid.global_vector_P
     self.init_temp = global_data.init_temp
     self.simulation_time = global_data.simulation_time
     self.simulation_step = global_data.simulation_step
コード例 #5
0
 def __init__(self, eta_array, ksi_array, x, y):
     super().__init__(eta_array, ksi_array, x, y)
     global_data = GlobalData()
     self.eta_array = eta_array
     self.ksi_array = ksi_array
     self.cp = global_data.cp
     self.ro = global_data.density
     self.N = []
     self.integral_points_x = []
     self.integral_points_y = []
     self.H = []
     self.C = []
     self.H_matrics_sum = []
     self.C_matrics_sum = []
     self.make_main_calculations()
コード例 #6
0
 def __init__(self, N_array, weight=None):
     if weight is None:
         weight = [1, 1]
     self.border_ksi_array = [[-1 / sqrt(3), 1 / sqrt(3)], [1, 1],
                              [1 / sqrt(3), -1 / sqrt(3)], [-1, -1]]
     self.border_eta_array = [[-1, -1], [-1 / sqrt(3), 1 / sqrt(3)], [1, 1],
                              [1 / sqrt(3), -1 / sqrt(3)]]
     global_data = GlobalData()
     self.alpha = global_data.alpha
     self.amb_temp = global_data.amb_temp
     self.N_array = N_array
     self.weight = weight
     self.N = self.calculate_border_N()
     self.jakobies = self.calculate_jakob()
     self.H_bc = []
     self.P_vector = []
コード例 #7
0
 def calculate_H(self):
     self.H.append(
         np.multiply(np.multiply(GlobalData().conductivity, self.det),
                     np.add(self.integral_points_x,
                            self.integral_points_y)))