def run(self, work_dir = 'workdir/', abqlauncher = '/opt/Abaqus/6.9/Commands/abaqus'): print '# Running {0}: id={1}, frames = {2}'.format(self.__class__.__name__, self.id, self.frames) self.preprocess() from abapy.indentation import Manager import numpy as np from copy import copy simname = self.__class__.__name__ + '_{0}'.format(self.id) # Creating abq postproc script f = open('{0}{1}_abqpostproc.py'.format(work_dir,self.__class__.__name__),'w') name = self.__class__.__name__ + '_' + str(self.id) out = self.abqpostproc_byRpt().replace('#FILE_NAME', name) f.write(out) f.close() abqpostproc = '{0}_abqpostproc.py'.format(self.__class__.__name__) #--------------------------------------- # Setting simulation manager m = Manager() m.set_abqlauncher('/opt/Abaqus/6.9/Commands/abaqus') m.set_workdir(work_dir) m.set_simname(self.__class__.__name__ + '_{0}'.format(self.id)) m.set_abqpostproc(abqpostproc) m.set_samplemesh(self.mesh) m.set_samplemat(self.sample_mat) m.set_indentermat(self.indenter_mat) m.set_friction(self.friction) m.set_steps(self.steps) m.set_indenter(self.indenter) m.set_is_3D(self.three_dimensional) m.set_pypostprocfunc(lambda data: data) # Here we just want to get back data #--------------------------------------- # Running simulation and post processing m.erase_files() # Workdir cleaning m.make_inp() # INP creation m.run_sim() # Running the simulation m.run_abqpostproc() # First round of post processing in Abaqus data = m.run_pypostproc() # Second round of custom post processing in regular Python #m.erase_files() # Workdir cleaning #--------------------------------------- if data['completed']: print '# Simulation completed.' # Storing raw data self.completed = True sweep_factor = 1. # This factor aims to modify values that are affected by the fact that only a portion of the problem is solved due to symmetries. if self.three_dimensional: sweep_factor = 360. / self.sweep_angle self.force_hist = - sweep_factor * data['history']['force'] self.disp_hist = -data['history']['disp'] self.elastic_work_hist = sweep_factor * data['history']['allse'] self.plastic_work_hist = sweep_factor * data['history']['allpd'] self.friction_work_hist = sweep_factor * data['history']['allfd'] self.total_work_hist = sweep_factor * data['history']['allwk'] self.tip_penetration_hist = data['history']['tip_penetration'] self.disp_field = data['field']['U'] self.ind_disp_field = data['field']['Uind'] self.stress_field = data['field']['S'] self.total_strain_field = data['field']['LE'] self.elastic_strain_field = data['field']['EE'] self.plastic_strain_field = data['field']['PE'] self.equivalent_plastic_strain_field = data['field']['PEEQ'] self.contact_data = data['history']['contact'] # Updating data self.Load_prefactor(update = True) self.Irreversible_work_ratio(update = True) self.Plastic_work_ratio(update = True) self.Tip_penetration(update = True) self.Contact_area(update = True) self.Unloading_fit() #--------------------------------------- else: print '# Simulation not completed.'
def run(self, work_dir='workdir/', abqlauncher='/opt/Abaqus/6.9/Commands/abaqus'): print('# Running {0}: id={1}, frames = {2}'.format( self.__class__.__name__, self.id, self.frames)) self.preprocess() from abapy.indentation import Manager import numpy as np from copy import copy simname = self.__class__.__name__ + '_{0}'.format(self.id) # Creating abq postproc script f = open('{0}{1}_abqpostproc.py'.format( work_dir, self.__class__.__name__), 'w') name = self.__class__.__name__ + '_' + str(self.id) out = self.abqpostproc_byRpt().replace('#FILE_NAME', name) f.write(out) f.close() abqpostproc = '{0}_abqpostproc.py'.format(self.__class__.__name__) # --------------------------------------- # Setting simulation manager m = Manager() m.set_abqlauncher('/opt/Abaqus/6.9/Commands/abaqus') m.set_workdir(work_dir) m.set_simname(self.__class__.__name__ + '_{0}'.format(self.id)) m.set_abqpostproc(abqpostproc) m.set_samplemesh(self.mesh) m.set_samplemat(self.sample_mat) m.set_indentermat(self.indenter_mat) m.set_friction(self.friction) m.set_steps(self.steps) m.set_indenter(self.indenter) m.set_is_3D(self.three_dimensional) # Here we just want to get back data m.set_pypostprocfunc(lambda data: data) # --------------------------------------- # Running simulation and post processing m.erase_files() # Workdir cleaning m.make_inp() # INP creation m.run_sim() # Running the simulation m.run_abqpostproc() # First round of post processing in Abaqus data = m.run_pypostproc() # Second round of custom post processing in regular Python # m.erase_files() # Workdir cleaning # --------------------------------------- if data['completed']: print('# Simulation completed.') # Storing raw data self.completed = True sweep_factor = 1. # This factor aims to modify values that are affected by the fact that only a portion of the problem is solved due to symmetries. if self.three_dimensional: sweep_factor = 360. / self.sweep_angle self.force_hist = - sweep_factor * data['history']['force'] self.disp_hist = -data['history']['disp'] self.elastic_work_hist = sweep_factor * data['history']['allse'] self.plastic_work_hist = sweep_factor * data['history']['allpd'] self.friction_work_hist = sweep_factor * data['history']['allfd'] self.total_work_hist = sweep_factor * data['history']['allwk'] self.tip_penetration_hist = data['history']['tip_penetration'] self.disp_field = data['field']['U'] self.ind_disp_field = data['field']['Uind'] self.stress_field = data['field']['S'] self.total_strain_field = data['field']['LE'] self.elastic_strain_field = data['field']['EE'] self.plastic_strain_field = data['field']['PE'] self.equivalent_plastic_strain_field = data['field']['PEEQ'] self.contact_data = data['history']['contact'] # Updating data self.Load_prefactor(update=True) self.Irreversible_work_ratio(update=True) self.Plastic_work_ratio(update=True) self.Tip_penetration(update=True) self.Contact_area(update=True) self.Unloading_fit() # --------------------------------------- else: print('# Simulation not completed.')
#--------------------------------------- # Directories: absolute pathes seems more secure to me since we are running some 'rm'. workdir = 'workdir/' abqlauncher = '/opt/Abaqus/6.9/Commands/abaqus' simname = 'indentation' abqpostproc = 'abqpostproc.py' #--------------------------------------- # Setting simulation manager m = Manager() m.set_abqlauncher(abqlauncher) m.set_workdir(workdir) m.set_simname(simname) m.set_abqpostproc(abqpostproc) m.set_samplemesh(mesh) m.set_samplemat(samplemat) m.set_indentermat(indentermat) m.set_steps(steps) m.set_indenter(indenter) m.set_pypostprocfunc(pypostproc) #--------------------------------------- # Running simulation and post processing #m.erase_files() # Workdir cleaning m.make_inp() # INP creation #m.run_sim() # Running the simulation #m.run_abqpostproc() # First round of post processing in Abaqus data = m.run_pypostproc( ) # Second round of custom post processing in regular Python #--------------------------------------- if data['completed']:
#--------------------------------------- # Directories: absolute pathes seems more secure to me since we are running some 'rm'. workdir = 'workdir/' abqlauncher = '/opt/Abaqus/6.9/Commands/abaqus' simname = 'indentation' abqpostproc = 'abqpostproc.py' #--------------------------------------- # Setting simulation manager m = Manager() m.set_abqlauncher(abqlauncher) m.set_workdir(workdir) m.set_simname(simname) m.set_abqpostproc(abqpostproc) m.set_samplemesh(mesh) m.set_samplemat(samplemat) m.set_indentermat(indentermat) m.set_steps(steps) m.set_indenter(indenter) m.set_pypostprocfunc(pypostproc) #--------------------------------------- # Running simulation and post processing #m.erase_files() # Workdir cleaning m.make_inp() # INP creation #m.run_sim() # Running the simulation #m.run_abqpostproc() # First round of post processing in Abaqus data = m.run_pypostproc() # Second round of custom post processing in regular Python #--------------------------------------- if data['completed']: # Ploting results