예제 #1
0
 def compute_Ts(self, PD_deck, PD_problem):
     Ts = np.zeros((int(PD_deck.Num_Nodes)))
     for x_i in range(0, self.len_x):
         index_x_family = PD_problem.get_index_x_family(x_i)
         for x_p in index_x_family:
             Ts[x_i] = Ts[x_i] + self.T[x_i, x_p] - self.T[x_p, x_i]
         Ts[x_i] = Ts[x_i] * PD_deck.Volume
     self.Ts = Ts
예제 #2
0
    def compute_ext_state(self, PD_deck, PD_problem, y):
        # Initialization for e
        e = np.zeros((int(PD_deck.Num_Nodes), int(PD_deck.Num_Nodes)))

        for x_i in range(0, len(PD_problem.x)):
            index_x_family = PD_problem.get_index_x_family(x_i)
            for x_p in index_x_family:
                e[x_i, x_p] = np.absolute(
                    y[x_p] - y[x_i]) - np.absolute(PD_problem.x[x_p] - PD_problem.x[x_i])
        self.e = e
예제 #3
0
 def weighted_function(self, PD_problem, PD_deck, x, x_i):
     Horizon = PD_problem.compute_horizon(PD_deck)
     index_x_family = self.get_index_x_family(x_i)
     Delta_V = PD_deck.Volume
     Influence_Function = PD_deck.Influence_Function
     result = 0
     for x_p in index_x_family:
         result = result + Influence_Function * \
             (PD_problem.exp_init_positions[x_p] - PD_problem.exp_init_positions[x_i]) ** 2 * Delta_V
     return result
예제 #4
0
    def compute_T(self, PD_deck, PD_problem, y):
        w = PD_deck.Influence_Function
        M = PD_problem.compute_m(PD_deck.Num_Nodes, y)
        tscal = np.zeros((int(PD_deck.Num_Nodes), int(PD_deck.Num_Nodes)))
        for x_i in range(0, self.len_x):
            index_x_family = PD_problem.get_index_x_family(x_i)
            for x_p in index_x_family:
                tscal[x_i,
                      x_p] = (w / PD_problem.weighted_function(PD_deck,
                                                               PD_problem.x,
                                                               x_i)) * self.Modulus * self.e[x_i,
                                                                                             x_p]
        self.tscal = tscal

        T = np.zeros((int(PD_deck.Num_Nodes), int(PD_deck.Num_Nodes)))
        for x_i in range(0, self.len_x):
            index_x_family = PD_problem.get_index_x_family(x_i)
            for x_p in index_x_family:
                T[x_i, x_p] = tscal[x_i, x_p] * M[x_i, x_p]
        self.T = T
예제 #5
0
def main(argv):
    """
    Main
    """
    types = ['elastic', 'elastic_dic']
    path = ''
    output = ''
    materialType = -1
    helpText = "__init__.py -i <inputfile> -o <outputfile> -t <type> \n" \
        "Help text"
    print sys.argv
    if len(sys.argv) != 7:
        print(helpText)
        sys.exit(1)

    try:
        opts, args = getopt.getopt(
            argv, "hi:o:t:", ["ifile=", "ofile=", "type="])
    except getopt.GetoptError:
        print(helpText)
        sys.exit(0)

    for opt, arg in opts:
        if opt == '-h':
            print(helpText)
            sys.exit(0)
        elif opt in ("-i", "--ifile"):
            path = arg
        elif opt in ("-o", "--ofile"):
            output = arg
        elif opt in ("-t", "--type"):
            materialType = arg
    if materialType not in types:
        print("Error: Only elastic and elastic_dic types are supported")
        sys.exit(1)

    if materialType == "elastic":
        data = PD_deck(path)
        problem = PD_problem(data)
        problem.quasi_static_solver(problem.x, data)
        problem.strain_energy_from_force(data)
        problem.plot_energy(
            problem.remove_additional_points(data, problem.strain_energy_from_force),
            data.time_steps,
            problem.x[:len(problem.x)-2],
            output + "/elastic_")

    elif materialType == "elastic_dic":
        data = PD_deck(path)
        problem = PD_problem(data)
        problem.read_csv_from_dic("data/tracking_results.csv")
        print "Experimental displacements:"
        print problem.exp_displacement
        print "Initial positions:"
        print problem.exp_init_positions
        exp_w_all = []
        for t_n in range(0, data.N_Steps_t):
            elastic_dic = elastic_material_dic(data, problem, t_n)
            exp_w_all.append(elastic_dic.exp_W)
        problem.plot_energy(
            exp_w_all,
            problem.exp_times,
            problem.exp_init_positions,
            output + "/elastic_dic_")