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_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 []
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()
print 'Tasks to run:', len(args.inp) for inp in args.inp: print '\t', inp # Run tasks. jobs = list() for inp in args.inp: if args.cluster: r, jobfile = run_slurm(inp, cp, args.qtime, args.outdir, args.nodes, np, args.descr) tC += r tA += 1 # Submit the job. if args.array < 0: # log = utility.run_cmd(['sbatch','--qos=debug',jobfile]) log = utility.run_cmd(['sbatch', jobfile]) print log.rstrip(), '--', jobfile else: jobs.append(jobfile) else: if args.all or args.run: tC += run_abq(inp, args.outdir, np, args.descr) tA += 1 if args.all or args.post: tC += run_post(inp, args.outdir, args.descr) tA += 1 # Submit array job if requested. if args.array >= 0: run_array(args.outdir, jobs, args.array, cp, args.qtime, args.nodes, np, args.descr)