def changeMatProp(myModel): mdb.models[myModel].materials['PM_INTERFACE_HMG'].Plastic( table=((0.0065, 0.0), )) mdb.models[myModel].materials['PM_INTERFACE_HMG'].elastic.setValues( table=((1.715, 0.3), ), type=ISOTROPIC) mdb.models[myModel].materials for mat in mdb.models[myModel].materials.keys(): myMat = mdb.models[myModel].materials[mat] if mat.startswith('PMGS'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = rho*conversion_factory nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) if mat.startswith('PM_CEMENT'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = cementMod nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) #mdb.models[myModel].steps['loading_step'].setValues(nlgeom=ON) jobname = myModel + '_ABAQUS' myJob = mdb.Job(model=myModel, name=jobname) myJob.setValues(numCpus=8,numDomains=8,multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name)
def changeMatProp(myModel): #abaqusTools.deleteDefaultModel() mdb.models[myModel].materials for mat in mdb.models[myModel].materials.keys(): myMat = mdb.models[myModel].materials[mat] if mat.startswith('PMGS'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = rho*conversion_factory nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) if mat.startswith('PM_CEMENT'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = 2.45*percentageChange nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) #mdb.models[myModel].steps['loading_step'].setValues(nlgeom=ON) jobname = myModel + '_ABAQUS' myJob = mdb.Job(model=myModel, name=jobname) myJob.setValues(numCpus=noCPU,memory=mem,numDomains=noDomain,multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name)
def runJob(modelname): from abaqusConstants import * from abaqus import * import step jobname = modelname + '_ABAQUS' myJob = mdb.Job(model=modelname, name=jobname) myJob.setValues(numCpus=8,numDomains=8,multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name) print >> sys.__stdout__, jobname mdb.models[modelname].steps['loading_step'].setValues(initialInc=0.1, minInc=0.0001, maxInc=1) myJob.submit(consistencyChecking=OFF) #wait for job to complete before opening the odb and checking the stiffness myJob.waitForCompletion()
def runJob(modelname): from abaqusConstants import * from abaqus import * import step jobname = modelname + '_ABAQUS' myJob = mdb.Job(model=modelname, name=jobname) myJob.setValues(numCpus=8, numDomains=8, multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name) print >> sys.__stdout__, jobname mdb.models[modelname].steps['loading_step'].setValues(initialInc=0.1, minInc=0.0001, maxInc=1) myJob.submit(consistencyChecking=OFF) #wait for job to complete before opening the odb and checking the stiffness myJob.waitForCompletion()
def changeMatProp(myModel): mdb.models[myModel].materials['PM_INTERFACE_HMG'].elastic.setValues( table=((E1, E2, E3, v, v, v, G, G, G), ), type=ENGINEERING_CONSTANTS) mdb.models[myModel].parts['PART-1'].MaterialOrientation( additionalRotationField='', additionalRotationType=ROTATION_NONE, angle=0.0, axis=AXIS_1, flipNormalDirection=False, flipPrimaryDirection=False, normalAxisDefinition=SURFACE, normalAxisDirection=AXIS_3, normalAxisRegion=mdb.models[myModel].parts['PART-1']. surfaces['INT_SURF'], orientationType=DISCRETE, primaryAxisDefinition=VECTOR, primaryAxisDirection=AXIS_1, primaryAxisVector=(0.0, 0.0, 1.0), region=mdb.models[myModel].parts['PART-1'].sets['PT_INTERFACE'], stackDirection=STACK_3) mdb.models[myModel].materials for mat in mdb.models[myModel].materials.keys(): myMat = mdb.models[myModel].materials[mat] if mat.startswith('PMGS'): rho = int(myMat.density.table[0][0]) if rho < 1: rho = 1 E = rho * conversion_factory nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) if mat.startswith('PM_CEMENT'): rho = int(myMat.density.table[0][0]) if rho < 1: rho = 1 E = cementMod nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) #mdb.models[myModel].steps['loading_step'].setValues(nlgeom=ON) jobname = myModel + '_ABAQUS' myJob = mdb.Job(model=myModel, name=jobname) myJob.setValues(numCpus=8, numDomains=8, multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name)
def changeMatProp(myModel): mdb.models[myModel].materials['PM_INTERFACE_HMG'].elastic.setValues( table=((E1,E2,E3,v,v,v,G,G,G), ), type= ENGINEERING_CONSTANTS) mdb.models[myModel].parts['PART-1'].MaterialOrientation( additionalRotationField='', additionalRotationType=ROTATION_NONE, angle=0.0 , axis=AXIS_1, flipNormalDirection=False, flipPrimaryDirection=False, normalAxisDefinition=SURFACE, normalAxisDirection=AXIS_3, normalAxisRegion= mdb.models[myModel].parts['PART-1'].surfaces['INT_SURF'] , orientationType=DISCRETE, primaryAxisDefinition=VECTOR, primaryAxisDirection=AXIS_1, primaryAxisVector=(0.0, 0.0, 1.0), region= mdb.models[myModel].parts['PART-1'].sets['PT_INTERFACE'] , stackDirection=STACK_3) mdb.models[myModel].materials for mat in mdb.models[myModel].materials.keys(): myMat = mdb.models[myModel].materials[mat] if mat.startswith('PMGS'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = rho*conversion_factory nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) if mat.startswith('PM_CEMENT'): rho = int(myMat.density.table[0][0]) if rho<1:rho=1 E = cementMod nu = 0.3 del myMat.elastic myMat.Elastic(table=((E, nu), )) #mdb.models[myModel].steps['loading_step'].setValues(nlgeom=ON) jobname = myModel + '_ABAQUS' myJob = mdb.Job(model=myModel, name=jobname) myJob.setValues(numCpus=8,numDomains=8,multiprocessingMode=THREADS) myJob.writeInput() mdb.saveAs(myJob.name)
def output_results(self, output_params): """Output the results of the analysis. Args: output_params(OutputParams): Special namedtuple describing the parameters for outputting the results of modeling and analysis. See class for full description of options. Raises: RuntimeError: If the job has not been completed. ValueError: If output_params.export_ribbon_width has not been specified but STL or STP export is requested. AbaqusException: Various exceptions raised by the Abaqus API. """ logger.debug('Exporting results.') if self.job.status != COMPLETED: raise RuntimeError( 'The job has not been completed.' + ' Output is only possible after completion of analysis.') # Make a directory for storing results. # This is also done in main.main(). # TODO: check. folder_path = helper.return_results_folder_path( self.name, output_params.result_folder_name) if os.path.isdir(folder_path): raise RuntimeError( "'%s' already exists. Delete it before proceeding." % folder_path) else: os.makedirs(folder_path) logger.debug('Created the folder for analysis results: %s', folder_path) logger.debug('Opening the Odb.') odb = openOdb(path=self.odb_path) output_table = postprocessing.get_numerical_output(obj=self, odb=odb) postprocessing.write_single_numerical_output(output_table, self.name, folder_path) odb.close() if output_params.save_job_files: #TODO: add function that uses shutil.move and shutil.copy2 in case of exception. os.rename(os.path.join(os.getcwd(), self.job.name + '.inp'), os.path.join(folder_path, self.job.name + '.inp')) os.rename(os.path.join(os.getcwd(), self.job.name + '.msg'), os.path.join(folder_path, self.job.name + '.msg')) #os.rename( os.path.join(os.getcwd(), self.job.name + '.log'), #investigate access error. # os.path.join(folder_path, self.job.name + '.log')) sta_string = '' if os.path.isfile(os.path.join(os.getcwd(), self.job.name + '.sta')): sta_string = ', and sta.' os.rename(os.path.join(os.getcwd(), self.job.name + '.sta'), os.path.join(folder_path, self.job.name + '.sta')) logger.debug('Saved job files to the folder: inp, msg, log%s.', sta_string) if output_params.save_odb: new_odb_path = os.path.join(folder_path, self.job.name + '.odb') os.rename(self.odb_path, new_odb_path) self.odb_path = new_odb_path logger.debug('Saved the Odb to the folder.') if output_params.export_stl or output_params.export_stp: # Create the exportable part. This operation is destructive # and the mdb should not be saved afterwards. #TODO FIXME: but it is. fix this. see if you can restore the originals. if output_params.export_ribbon_width is None: raise ValueError( 'output_params.export_ribbon_width must be specified for STL or STP export.' ) self.assemble_structure(for_3dprint=True, output_params=output_params, delete_all=True) if output_params.export_stl: postprocessing.export_part_stl(self, folder_path) if output_params.export_stp: self.part_3dprint.writeStepFile( fileName=os.path.join(folder_path, self.name + '.stp')) logger.debug('Exported the part in the STP format.') if output_params.save_cae: # This is done last so the 3D model is also saved. # The abaqus module cannot be imported in the GUI code, # so only import it when running. from abaqus import mdb mdb.saveAs(os.path.join(folder_path, self.name)) logger.debug('Saved the Mdb to the folder.') self.results_folder_path = folder_path logger.debug('Exported the requested results.')