def write_input_files(self, N_batches=1): 'Write ABAQUS input files and batch script(s)' # Open list of batch files batchfiles = [] for b in range(N_batches): fname = '{0:s}/_run_{1:d}.bat'.format(self.out_dir, b) batchfiles.append(open(fname, 'w')) pp_script = open('{0:s}/_postproc.bat'.format(self.out_dir), 'w') b = 0 for jobname, j in self.db.iterrows(): w = self.wheel_from_row(j) mm = ModeMatrix(w) # Apply tension if j['spk_T'] == 0.: w.apply_tension(0.001) else: w.apply_tension(j['spk_T']) # Choose total radial displacement if j['sim_u2'] == 'auto': # Estimate radial displacement to failure for truss wheel Pc_est = mm.calc_lat_stiff() * w.rim.radius u_rad = 1.5 * Pc_est / mm.calc_rad_stiff() else: u_rad = j['sim_u2'] # Write ABAQUS input files write_abaqus_pre(self.out_dir + '/' + jobname + '_preT.inp', w, j) write_abaqus_exp(self.out_dir + '/' + jobname + '_collapse.inp', w, j, u_rad) # Write to batch file bf = batchfiles[b] bf.write('call abaqus interactive ') bf.write('job={0:s}_preT input={0:s}_preT.inp\n'.format(jobname)) bf.write('call abaqus interactive ') bf.write( 'job={0:s}_collapse input={0:s}_collapse.inp oldjob={0:s}_preT\n' .format(jobname)) # Next batchfile b = (b + 1) % N_batches # Write entry to postprocess script pp_script.write('call abaqus python postproc_rad_buckling.py ' + '{0:s}_collapse.odb\n'.format(jobname)) # Close batch files for f in batchfiles: f.close()
def extract_results(self): 'Extract results and calculated quantities from ABAQUS output' def spoke_buckle_load(pd_data): 'Get load at which spokes start to buckle' return pd_data.RF3[np.nonzero(pd_data.n_buckled)[0][0]] for i in self.db.index: print('.', end='') j = self.db.loc[i] w = self.wheel_from_row(j) mm = ModeMatrix(w) try: # Buckling tension Tc, nc = calc_buckling_tension(w) self.db.at[i, 'Tc'] = Tc self.db.at[i, 'nc'] = nc # Get load-deflection data if j['sim_type'] == 'exp': pd_fname = self.out_dir + '/' + j.name + '_collapse_Pd.csv' elif j['sim_type'] == 'riks': pd_fname = self.out_dir + '/' + j.name + '_riks_Pd.csv' pd_data = pd.read_csv(pd_fname) pd_data.columns = ['Time', 'U3', 'RF3', 'n_buckled'] # Stiffness w.apply_tension(0.01) K_lat_0 = mm.calc_lat_stiff(smeared_spokes=True, coupling=False) K_rad_0 = mm.calc_rad_stiff(smeared_spokes=False, coupling=False) self.db.at[i, 'K_lat_0'] = K_lat_0 self.db.at[i, 'K_rad_0'] = K_rad_0 # Critical loads self.db.at[i, 'Pc_max'] = max(pd_data.RF3) self.db.at[i, 'Pc_spk'] = spoke_buckle_load(pd_data) except Exception as e: print('Error on {0:s}: {1:s}'.format(j.name, str(e))) continue
def extract_results(self): 'Extract results and calculated quantities from ABAQUS output' def buckling_load_southwell(pd_data): 'Get critical buckling load from Southwell plot' pass def buckling_load_nonlin(pd_data): 'Get critical buckling from departure from linearity' # Fit straight line to first 5% of data N = int(np.ceil(0.05 * len(pd_data))) pf = np.polyfit(pd_data['U2'][:N], pd_data['RF2'][:N], 1) err = (np.polyval(pf, pd_data['U2']) - pd_data['RF2']) /\ np.mean(pd_data['RF2']) return pd_data['RF2'][np.argmax(np.abs(err) > 0.02)] def calc_T_nb(w, K_lat_0, K_rad_0, Tc, form=1): 'Calculate minimum spoke tension for no spoke buckling' R = w.rim.radius EA = w.spokes[0].EA alpha = w.spokes[0].alpha ls = w.spokes[0].length if form == 2: # Quadratic approximation for K_lat(T) x = K_rad_0 * Tc * ls / (2 * EA * K_lat_0 * R * np.cos(alpha)) return np.sqrt(1 + x**2) - x else: # Linear approximation for K_lat(T) return 1.0 / (1 + K_rad_0 * ls * Tc / (K_lat_0 * R * EA * np.cos(alpha))) def calc_P_nb(w, K_lat_0, K_rad_0, Tc, form=1): 'Critical load at the critical no-buckling tension' R = w.rim.radius EA = w.spokes[0].EA alpha = w.spokes[0].alpha ls = w.spokes[0].length if form == 2: # Quadratic approximation for K_lat(T) x = K_rad_0 * Tc * ls / (2 * EA * K_lat_0 * R * np.cos(alpha)) T_nb = np.sqrt(1 + x**2) - x return K_lat_0 * R * (1 - T_nb**2) else: # Linear approximation for K_lat(T) return K_lat_0 * R / (1 + EA / Tc * K_lat_0 / K_rad_0) for i in self.db.index: print('.', end='') j = self.db.loc[i] w = self.wheel_from_row(j) mm = ModeMatrix(w) try: # Buckling tension Tc, nc = calc_buckling_tension(w) self.db.at[i, 'Tc'] = Tc self.db.at[i, 'nc'] = nc # Get load-deflection data pd_data = pd.read_csv(self.out_dir + '/' + j.name + '_collapse_Pd.csv') pd_data.columns = ['Time', 'U2', 'RF2', 'U3', 'n_buckled'] # Stiffness at zero tension w.apply_tension(0.01) K_lat_0 = mm.calc_lat_stiff(smeared_spokes=True, coupling=False) K_rad_0 = mm.calc_rad_stiff(smeared_spokes=False, coupling=False) w.apply_tension(j['spk_T']) K_lat = mm.calc_lat_stiff(smeared_spokes=True, coupling=False) self.db.at[i, 'K_lat_0'] = K_lat_0 self.db.at[i, 'K_rad_0'] = K_rad_0 self.db.at[i, 'K_lat'] = K_lat # Radial buckling load self.db.at[i, 'Pc_max'] = max(pd_data.RF2) self.db.at[i, 'Pc_nonlin'] = buckling_load_nonlin(pd_data) self.db.at[i, 'T_nb'] = calc_T_nb(w, K_lat_0, K_rad_0, Tc) self.db.at[i, 'Pc_nb'] = calc_P_nb(w, K_lat_0, K_rad_0, Tc) self.db.at[i, 'T_nb_2'] = calc_T_nb(w, K_lat_0, K_rad_0, Tc, form=2) self.db.at[i, 'Pc_nb_2'] = calc_P_nb(w, K_lat_0, K_rad_0, Tc, form=2) except Exception as e: print('Error on {0:s}: {1:s}'.format(j.name, str(e))) continue