# ----------------------- # FIRST EXEMPLE: AXISYMMETRIC INDENTATION # Model parameters # Indenter half angle, 70.3 degrees is equivalent to Berkovich indenter half_angle = 70.29 Na, Nb, Ns, Nf, l = 8, 8, 16, 2, 1. # E is the Young's modulus and nu is the Poisson's ratio. E, nu = 1., 0.3 ey = 0.01 * E max_disp = l / 3. * tan(radians(70.3)) / \ tan(radians(half_angle)) # Maximum displacement # Building model indenter = DeformableCone2D( half_angle=half_angle, rigid=True, Na=Na, Nb=Nb, Ns=Ns, Nf=Nf, l=l) # Indenter sample_mesh = IndentationMesh(Na=Na, Nb=Nb, Ns=Ns, Nf=Nf, l=l) # Sample Mesh # sample_mat = Elastic(labels = 'SAMPLE_MAT', E = E, nu= nu) # Sample material sample_mat = VonMises(labels='SAMPLE_MAT', E=E, nu=nu, sy=E * ey) # Sample material indenter_mat = Elastic(labels='INDENTER_MAT') # Indenter material steps = [ # Steps Step(name='preloading', nframes=50, disp=max_disp / 2.), Step(name='loading', nframes=50, disp=max_disp), Step(name='unloading', nframes=50, disp=0.), ] # Making INP file inp = MakeInp(indenter=indenter, sample_mesh=sample_mesh, sample_mat=sample_mat, indenter_mat=indenter_mat, steps=steps)
# Python post processing function: # Role: data extraction from odb is performed in Abaqus python but nothing more. A regular Python version featuring numpy/scipy and matplotlib is so much better to perform custom post processing. That's why we do it in two steps: what cannot be done out of abaqus is done in abaqus, everything else is performed outside. def pypostproc(data): if data['completed']: return data else: print '<Warning: Simulation aborted, check .msg file for explanations.>' return data #--------------------------------------- # Defining test parameters: Na, Nb, Ns, Nf = 16, 16, 16, 2 half_angle = 70.29 rigid_indenter = False # Sets the indenter rigid of deformable mesh = IndentationMesh(Na=Na, Nb=Nb, Ns=Ns, Nf=Nf) # Chosing sample mesh #indenter = RigidCone2D(half_angle = 70.3) # Chosing indenter indenter = DeformableCone2D(half_angle=half_angle, Na=Na, Nb=Nb, Ns=Ns, Nf=Nf, rigid=rigid_indenter) E = 1. # Young's modulus sy = E * .01 # Yield stress samplemat = VonMises(labels='SAMPLE_MAT', E=E, sy=sy) # Sample material indentermat = Elastic(labels='INDENTER_MAT', E=E) max_disp = .3 * tan(radians(70.3)) / tan(radians(half_angle)) nframes = 200 steps = [ # Steps Step(name='loading0', nframes=nframes, disp=max_disp / 2.),
from abapy.indentation import IndentationMesh from matplotlib import pyplot as plt Na = 2 Nb = 3 l, ltot = 1., 2 mesh = IndentationMesh(Na, Nb, l) xe, ye, ze = mesh.get_edges() plt.figure() plt.gca().set_aspect('equal') plt.plot(xe, ye, 'r-') plt.plot(mesh.nodes.x, mesh.nodes.y, 'ob') bbox = mesh.nodes.boundingBox() plt.xlim(bbox[0]) plt.ylim(bbox[1]) plt.show()
def preprocess(self): from abapy.indentation import IndentationMesh, Step, DeformableCone2D, DeformableCone3D from abapy.materials import VonMises, Elastic, DruckerPrager, Hollomon from math import tan, radians # Adjusting mesh size to max_disp mesh_l = 2 * max(self.max_disp, tan(radians(self.indenter_half_angle))) if self.three_dimensional: self.mesh = IndentationMesh( Na=self.mesh_Na, Nb=self.mesh_Nb, Ns=self.mesh_Ns, Nf=self.mesh_Nf, l=mesh_l).sweep( sweep_angle=self.sweep_angle, N=self.mesh_Nsweep) if self.sample_mesh_disp != False: field = self.mesh.nodes.eval_vectorFunction( self.sample_mesh_disp) self.mesh.nodes.apply_displacement(field) if self.indenter_mesh_Nf == 0: Nf_i = self.mesh_Nf self.indenter = DeformableCone3D( half_angle=self.indenter_half_angle, sweep_angle=self.sweep_angle, pyramid=self.indenter_pyramid, l=mesh_l, Na=self.mesh_Na * (self.indenter_mesh_Na == 0) + self.indenter_mesh_Na * (self.indenter_mesh_Na != 0), Nb=self.mesh_Nb * (self.indenter_mesh_Nb == 0) + self.indenter_mesh_Nb * (self.indenter_mesh_Nb != 0), Ns=self.mesh_Ns * (self.indenter_mesh_Ns == 0) + self.indenter_mesh_Ns * (self.indenter_mesh_Ns != 0), Nf=self.mesh_Nf * (self.indenter_mesh_Nf == 0) + self.indenter_mesh_Nf * (self.indenter_mesh_Nf != 0), N=self.mesh_Nsweep * (self.indenter_mesh_Nsweep == 0) + self.indenter_mesh_Nsweep * (self.indenter_mesh_Nsweep != 0), rigid=self.rigid_indenter) else: self.mesh = IndentationMesh( Na=self.mesh_Na, Nb=self.mesh_Nb, Ns=self.mesh_Ns, Nf=self.mesh_Nf, l=mesh_l) self.indenter = DeformableCone2D( half_angle=self.indenter_half_angle, l=mesh_l, Na=self.mesh_Na * (self.indenter_mesh_Na == 0) + self.indenter_mesh_Na * (self.indenter_mesh_Na != 0), Nb=self.mesh_Nb * (self.indenter_mesh_Nb == 0) + self.indenter_mesh_Nb * (self.indenter_mesh_Nb != 0), Ns=self.mesh_Ns * (self.indenter_mesh_Ns == 0) + self.indenter_mesh_Ns * (self.indenter_mesh_Ns != 0), Nf=self.mesh_Nf * (self.indenter_mesh_Nf == 0) + self.indenter_mesh_Nf * (self.indenter_mesh_Nf != 0), rigid=self.rigid_indenter) self.steps = [ Step(name='loading0', nframes=self.frames, disp=self.max_disp / 2., boundaries_3D=self.three_dimensional), Step(name='loading1', nframes=self.frames, disp=self.max_disp, boundaries_3D=self.three_dimensional), Step(name='unloading', nframes=self.frames, disp=0., boundaries_3D=self.three_dimensional)] if self.sample_mat_type == 'hollomon': self.sample_mat = Hollomon( labels='SAMPLE_MAT', E=self.sample_mat_args['young_modulus'], nu=self.sample_mat_args['poisson_ratio'], sy=self.sample_mat_args['yield_stress'], n=self.sample_mat_args['hardening']) if self.sample_mat_type == 'druckerprager': self.sample_mat = DruckerPrager( labels='SAMPLE_MAT', E=self.sample_mat_args['young_modulus'], nu=self.sample_mat_args['poisson_ratio'], sy=self.sample_mat_args['yield_stress'], beta=self.sample_mat_args['beta'], psi=self.sample_mat_args['psi'], k=self.sample_mat_args['k']) if self.sample_mat_type == 'vonmises': self.sample_mat = VonMises( labels='SAMPLE_MAT', E=self.sample_mat_args['young_modulus'], nu=self.sample_mat_args['poisson_ratio'], sy=self.sample_mat_args['yield_stress']) if self.sample_mat_type == 'elastic': self.sample_mat = Elastic( labels='SAMPLE_MAT', E=self.sample_mat_args['young_modulus'], nu=self.sample_mat_args['poisson_ratio']) if self.indenter_mat_type == 'elastic': self.indenter_mat = Elastic( labels='INDENTER_MAT', E=self.indenter_mat_args['young_modulus'], nu=self.indenter_mat_args['poisson_ratio'])
import matplotlib.pyplot as plt #--------------------------------------- # Python post processing function: # Role: data extraction from odb is performed in Abaqus python but nothing more. A regular Python version featuring numpy/scipy and matplotlib is so much better to perform custom post processing. That's why we do it in two steps: what cannot be done out of abaqus is done in abaqus, everything else is performed outside. def pypostproc(data): if data['completed']: return data else: print '<Warning: Simulation aborted, check .msg file for explanations.>' return data #--------------------------------------- # Defining test parameters: Na, Nb, Ns, Nf = 16,16, 16, 2 half_angle = 70.29 rigid_indenter = False # Sets the indenter rigid of deformable mesh = IndentationMesh(Na = Na, Nb = Nb, Ns = Ns, Nf = Nf) # Chosing sample mesh #indenter = RigidCone2D(half_angle = 70.3) # Chosing indenter indenter = DeformableCone2D(half_angle = half_angle, Na = Na, Nb = Nb, Ns=Ns, Nf=Nf, rigid = rigid_indenter) E = 1. # Young's modulus sy = E * .01 # Yield stress samplemat = VonMises(labels = 'SAMPLE_MAT', E = E, sy = sy) # Sample material indentermat = Elastic(labels = 'INDENTER_MAT', E = E) max_disp = .3 * tan(radians(70.3))/tan(radians(half_angle)) nframes = 200 steps = [ # Steps Step(name='loading0', nframes = nframes, disp = max_disp/2.), Step(name='loading1', nframes = nframes, disp = max_disp), Step(name = 'unloading', nframes = nframes, disp = 0.)] #--------------------------------------- # Directories: absolute pathes seems more secure to me since we are running some 'rm'. workdir = 'workdir/'
def pypostproc(data): if data['completed']: return data else: print( '<Warning: Simulation aborted, check .msg file for explanations.>') return data # --------------------------------------- # Defining test parameters: Na, Nb, Ns, Nf = 16, 16, 16, 2 half_angle = 70.29 rigid_indenter = False # Sets the indenter rigid of deformable # Chosing sample mesh mesh = IndentationMesh(Na=Na, Nb=Nb, Ns=Ns, Nf=Nf) # indenter = RigidCone2D(half_angle = 70.3) # Chosing indenter indenter = DeformableCone2D(half_angle=half_angle, Na=Na, Nb=Nb, Ns=Ns, Nf=Nf, rigid=rigid_indenter) E = 1. # Young's modulus sy = E * .01 # Yield stress samplemat = VonMises(labels='SAMPLE_MAT', E=E, sy=sy) # Sample material indentermat = Elastic(labels='INDENTER_MAT', E=E) max_disp = .3 * tan(radians(70.3)) / tan(radians(half_angle)) nframes = 200 steps = [ # Steps Step(name='loading0', nframes=nframes, disp=max_disp / 2.),