def create_input_file(self, params): node_coord_all = params['node_coord_all'] t = params['t'] m = params['m'] E = params['E'] nu = params['nu'] rho_s = params['rho_s'] input_data = {} #Assign the mode extraction method to its input data dictionary key input_data['eigr'] = self.eigr #Assign the number of modes input_data['M'] = self.M #Assign the frequency lower bound to its input data dictionary key input_data['F1'] = self.F1 #Assign each node coordinates to its corresponding node ID in the input data dictionary for i in range(len(node_coord_all)): input_data['x' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 0]) input_data['y' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 1]) input_data['z' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 2]) #Assign each thickness value to its corresponding ID in the input data dictionary for i in range(len(t)): input_data['t' + str(i + 1)] = print_float_8(t[i]) #Assign each mass value to its corresponding ID in the input data dictionary for i in range(len(m)): input_data['m' + str(i + 1)] = print_float_8(m[i]) #Assign the Young's modulus to its input data dictionary key input_data['E'] = print_float_8(E) #Assign the Poisson's ratio to its input data dictionary key input_data['nu'] = print_float_8(nu) #Assign the material density to its input data dictionary key input_data['rho_s'] = print_float_8(rho_s) #Read the input file template f = open(self.template_file, 'r') tmp = f.read() f.close() #Replace the input data contained in the dictionary onto the new input file new_file = tmp.format(**input_data) inp = open(self.input_filepath, 'w') inp.write(new_file) inp.close()
def create_input_file(self, params): f_node = params['f_node'] node_coord_all = params['node_coord_all'] t = params['t'] m = params['m'] nsm = params['nsm'] s = params['s'] Ix = params['Ix'] Iy = params['Iy'] a = params['a'] E = params['E'] nu = params['nu'] rho_s = params['rho_s'] n = params['n'] input_data = {} #Assign each force value to its corresponding node ID in the input data dictionary for i in range(len(f_node)): input_data['Fx' + self.node_id[i]] = print_float_8(f_node[i, 0]) input_data['Fy' + self.node_id[i]] = print_float_8(f_node[i, 1]) input_data['Fz' + self.node_id[i]] = print_float_8(f_node[i, 2]) #Assign each node coordinates to its corresponding node ID in the input data dictionary for i in range(len(node_coord_all)): input_data['x' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 0]) input_data['y' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 1]) input_data['z' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 2]) #Assign each thickness value to its corresponding ID in the input data dictionary for i in range(len(t)): input_data['t' + str(i + 1)] = print_float_8(t[i]) #Assign each mass value to its corresponding ID in the input data dictionary for i in range(len(m)): input_data['m' + str(i + 1)] = print_float_8(m[i]) #Assign each nonstructural mass value to its corresponding ID in the input data dictionary for i in range(len(nsm)): input_data['nsm' + str(i + 1)] = print_float_8(nsm[i]) #Assign each stringer section and bending inertias values to their corresponding ID in the input data dictionary for i in range(len(s)): input_data['s' + str(i + 1)] = print_float_8(s[i]) input_data['Ix' + str(i + 1)] = print_float_8(Ix[i]) input_data['Iy' + str(i + 1)] = print_float_8(Iy[i]) #Assign each rod section value to its corresponding ID in the input data dictionary for i in range(len(a)): input_data['a' + str(i + 1)] = print_float_8(a[i]) #Assign the Young's modulus to its input data dictionary key input_data['E'] = print_float_8(E) #Assign the Poisson's ratio to its input data dictionary key input_data['nu'] = print_float_8(nu) #Assign the material density to its input data dictionary key input_data['rho_s'] = print_float_8(rho_s) #Assign the negative of the load factor to its input data dictionary key input_data['n'] = print_float_8(n) #Read the input file template f = open(self.template_file, 'r') tmp = f.read() f.close() #Replace the input data contained in the dictionary onto the new input file new_file = tmp.format(**input_data) inp = open(self.input_filepath, 'w') inp.write(new_file) inp.close()
def create_input_file(self, params): f_node = params['f_node'] node_coord_all = params['node_coord_all'] t = params['t'] z0 = t/2. m = params['m'] E = params['E'] nu = params['nu'] rho_s = params['rho_s'] tp = params['tp'] V = params['V'] d31 = params['d31'] E_pzt = params['E_pzt'] nu_pzt = params['nu_pzt'] rho_pzt = params['rho_pzt'] input_data = {} #Assign each force value to its corresponding node ID in the input data dictionary for i in range(len(f_node)): input_data['Fx'+self.node_id[i]] = print_float_8(f_node[i, 0]) input_data['Fy'+self.node_id[i]] = print_float_8(f_node[i, 1]) input_data['Fz'+self.node_id[i]] = print_float_8(f_node[i, 2]) #Assign each node coordiantes to its corresponding node ID in the input data dictionary for i in range(len(node_coord_all)): input_data['x'+self.node_id_all[i]] = print_float_8(node_coord_all[i,0]) input_data['y'+self.node_id_all[i]] = print_float_8(node_coord_all[i,1]) input_data['z'+self.node_id_all[i]] = print_float_8(node_coord_all[i,2]) #Assign each thickness value to its corresponding ID in the input data dictionary for i in range(len(t)): input_data['t'+str(i+1)] = print_float_8(t[i]) #Assign each offset to its corresponding ID in the input data dictionary for i in range(len(z0)): input_data['z0'+str(i+1)] = print_float_8(z0[i]) #Assign each mass value to its corresponding ID in the input data dictionary for i in range(len(m)): input_data['m'+str(i+1)] = print_float_8(m[i]) #Assign the Young's modulus to its input data dictionary key input_data['E'] = print_float_8(E) #Assign the Poisson's ratio to its input data dictionary key input_data['nu'] = print_float_8(nu) #Assign the material density to its input data dictionary key input_data['rho_s'] = print_float_8(rho_s) #Assign the PZT Young's modulus to its input data dictionary key input_data['E_pzt'] = print_float_8(E_pzt) #Assign the PZT Poisson's ratio to its input data dictionary key input_data['nu_pzt'] = print_float_8(nu_pzt) #Assign the PZT density to its input data dictionary key input_data['rho_pzt'] = print_float_8(rho_pzt) #Assign the PZT constant to its input data dictionary key input_data['d31'] = print_float_8(d31) #Assign each PZT thickness value to its corresponding ID in the input data dictionary for i in range(len(tp)): input_data['tp'+str(i+1)] = print_float_8(tp[i]) #Assign each PZT voltage (temperature in nastran) to its corresponding ID in the input data dictionary for i in range(len(V)): input_data['V'+str(i+1)] = print_float_8(V[i]) #Read the input file template f = open(self.template_file,'r') tmp = f.read() f.close() #Replace the input data contained in the dictionary onto the new input file new_file = tmp.format(**input_data) inp = open(self.input_filepath,'w') inp.write(new_file) inp.close()
def create_input_file(self, params): f_node = params['f_node'] node_coord_all = params['node_coord_all'] t = params['t'] m = params['m'] E = params['E'] nu = params['nu'] rho_s = params['rho_s'] print(t) input_data = {} #Assign each force value to its corresponding node ID in the input data dictionary for i in range(len(f_node)): input_data['Fx' + self.node_id[i]] = print_float_8(f_node[i, 0]) input_data['Fy' + self.node_id[i]] = print_float_8(f_node[i, 1]) input_data['Fz' + self.node_id[i]] = print_float_8(f_node[i, 2]) #Assign each node coordiantes to its corresponding node ID in the input data dictionary for i in range(len(node_coord_all)): input_data['x' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 0]) input_data['y' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 1]) input_data['z' + self.node_id_all[i]] = print_float_8( node_coord_all[i, 2]) #Assign each thickness value to its corresponding ID in the input data dictionary for i in range(len(t)): input_data['t' + str(i + 1)] = print_float_8(t[i]) #Assign each mass value to its corresponding ID in the input data dictionary for i in range(len(m)): input_data['m' + str(i + 1)] = print_float_8(m[i]) #Assign the Young's modulus to its input data dictionary key input_data['E'] = print_float_8(E) #Assign the Poisson's ratio to its input data dictionary key input_data['nu'] = print_float_8(nu) #Assign the material density to its input data dictionary key input_data['rho_s'] = print_float_8(rho_s) #Read the input file template f = open(self.template_file, 'r') tmp = f.read() f.close() #Replace the input data contained in the dictionary onto the new input file new_file = tmp.format(**input_data) inp = open(self.input_filepath, 'w') inp.write(new_file) inp.close()