def run_VIS(act,test,geomcmd,i,*popt): PROCS = 8 geomcmd[21] = MU.write_viscomatfile(str(i),popt[0],popt[1:],True) U.run_cmd(geomcmd) RT.run_abq('test_visco.inp','.',PROCS,str(i)) if RT.run_post('test_visco.inp','.',str(i)): try: results = np.loadtxt(path.join('test_visco-'+str(i),'data.rpt'),skiprows=4) except Exception: print '********************************************************************' print ' Failed to load data.rpt file, skipping dataset.' print '********************************************************************' return [] if len(results.shape)==1: return [] if test=='U': results = results[:,[1,4]] # Pressure, Z-displacement. results[:,1] = -1.0*results[:,1] elif act=='bnd' and test=='U': L = results[0,-1] - results[0,-2] # Initial length of the actuator. angles = np.degrees(np.arctan(-results[:,3]/(L-results[:,4]))) angles[angels<0.0] = angles[angles<0.0] + 180 results = results[:,[1,2]] results[:,1] = angles elif act=='lin' and test=='F': results = results[:,[1,4]] # Pressure, Z-Force. elif act=='bnd' and test=='F': results = results[:,[1,3]] # Pressure, Y-Force. results = results[abs(results[:,1])<100.0] # Filter out results from blow-ups. return results return []
def run_MAT(geomcmd,A,L,model,density,i,*popt): PROCS = 4 matfile = MU.write_matfile(model,str(i),'up',popt,[],density) U.run_cmd(geomcmd+[matfile]) RT.run_abq('test_hyper.inp','.',PROCS,str(i)) results = dict() if RT.run_post('test_hyper.inp','.',str(i)): try: R = np.loadtxt(path.join('test_hyper-'+str(i),'data.rpt'),skiprows=4) except Exception: print '********************************************************************' print ' Failed to load data.rpt file, skipping dataset.' print '********************************************************************' return dict() if len(R.shape)==1: return dict() R = R[:,[2,1]] # Length, Force. R[:,0] = R[:,0] / (0.5*L) # Calculate engineering strain (with symmetry). R[:,1] = R[:,1] / A # Calculate nominal stress. R = R[abs(R[:,1])<100.0] # Filter out results from blow-ups. results['mat'] = R return dict()
def run_ACT(act,test,dist_to_force,geomcmd,i): PROCS = 8 try: U.run_cmd_screen(geomcmd) # Create the test. except Exception: U.print_error('Failed to create geometry! Non-physical dimensions?',False) return dict() results = dict() RT.run_abq('test_geom-'+act+test+'.inp','.',PROCS,str(i)) # Run the test. if RT.run_post('test_geom-'+act+test+'.inp','.',str(i)): # Postprocess the test. try: data = np.loadtxt(path.join('test_geom-'+act+test+'-'+str(i),'data.rpt'),skiprows=4) except Exception: U.print_error('Failed to load data.rpt file, skipping dataset.',False) return dict() if len(data.shape)==1: return dict() if act=='lin' and test=='U': data = data[:,[1,4]] # Pressure, Z-displacement. data[:,1] = -1.0*data[:,1] elif act=='bnd' and test=='U': L = data[0,-1] - data[0,-2] # Initial length of the actuator. angles = np.degrees(np.arctan(-data[:,3]/(L-data[:,4]))) angles[angels<0.0] = angles[angles<0.0] + 180 data = data[:,[1,2]] data[:,1] = angles elif act=='lin' and test=='F': data= data[:,[1,4]] # Pressure, Z-Force. elif act=='bnd' and test=='F': # Need to calculate the force perpendicular to the plate. alpha = np.radians(dist_to_force) beta = np.radians(90 - dist_to_force) f_normal = np.abs(data[:,3]*np.cos(alpha)) + np.abs(data[:,4]*np.cos(beta)) data = data[:,[1,2]] data[:,1] = f_normal # Pressure, Normal-Force. results[act+test] = data try: # strains are time (same indices as pressure), nominal strain. strains = np.loadtxt(path.join('test_geom-'+act+test+'-'+str(i),'data-strain.csv'),delimiter=',') strains[:,0] = data[:,0] results[act+test+'--strain'] = strains except: pass return results
def run_viscotest(cmd, A, L, i, *args): PROCS = 4 cmd = cmd + map(str, args) U.run_cmd(cmd) if RT.run_abq('test_visco.inp', '.', PROCS, str(i)): if RT.run_post('test_visco.inp', '.', str(i)): results = np.loadtxt(path.join('test_visco-' + str(i), 'data.rpt'), skiprows=3) results = results[:, 1:] results[:, 0] = results[:, 0] / A # Calculate nominal stress. results[:, 1] = results[:, 1] / ( 0.5 * L) # Calculate engineering strain (with symmetry). return results return []