def Run(self): """ Runs a simulation for a given couple (sy, n) and returns the (disp, force) couple. """ #MODEL DEFINITION n = self.n sy = self.sy E = self.settings['E'] nu = self.settings['nu'] inner_radius = self.settings['inner_radius'] outer_radius = self.settings['outer_radius'] disp = self.settings['displacement'] / 2. nFrames = self.settings['nFrames'] Nr = self.settings['Nr'] Nt = self.settings['Nt'] Na = self.settings['Na'] Ne = self.settings['Ne'] thickness = self.settings['thickness'] / 2. unloading = settings['unloading'] export_fields = settings['export_fields'] export_fields = False print E, nu, sy, n material = Hollomon(labels="SAMPLE_MAT", E=E, nu=nu, sy=sy, n=n) m = RingCompression(material=material, inner_radius=inner_radius, outer_radius=outer_radius, disp=disp, thickness=thickness, nFrames=nFrames, Nr=Nr, Nt=Nt, Na=Na, workdir=workdir, label=label, elType=elType, abqlauncher=abqlauncher, cpus=cpus, is_3D=is_3D, unloading=unloading, export_fields=export_fields) # SIMULATION m.MakeMesh() m.MakeInp() m.Run() m.PostProc() outputs = m.outputs force = -4. * outputs['history']['force'] disp = -2. * outputs['history']['disp'] self.disp = disp self.force = force
def Run(self): """ Runs a simulation for a given couple (sy, n) and returns the (disp, force) couple. """ #MODEL DEFINITION sy = self.sy n = self.n E = self.settings['E'] nu = self.settings['nu'] inner_radius = self.settings['inner_radius'] outer_radius = self.settings['outer_radius'] disp = self.settings['displacement']/2. nFrames = self.settings['nFrames'] Nr = self.settings['Nr'] Nt = self.settings['Nt'] Na = self.settings['Na'] Ne = self.settings['Ne'] thickness = self.settings['thickness'] print E, nu, sy, n material = Hollomon( labels = "SAMPLE_MAT", E = E, nu = nu, sy = sy, n = n) m = RingCompression( material = material , inner_radius = inner_radius, outer_radius = outer_radius, disp = disp, thickness = thickness, nFrames = nFrames, Nr = Nr, Nt = Nt, Na = Na, workdir = workdir, label = label, elType = elType, abqlauncher = abqlauncher, cpus = cpus, <<<<<<< HEAD is_3D = True)
if is_3D == False : Ne = Nt * Nr elType = "CPE4" #CPS4 for plane strain element, CPS4 for plane stress elements else: Ne = Nt * Nr * Na elType = "C3D8" displacement = 45. nFrames = 100 E = 64000. nu = .3 if compart == False: sy = 148.0 n = 0.088 material = Hollomon(labels = "SAMPLE_MAT", E = E, nu = nu, sy = sy, n = n) else: E_array = E * np.ones(Ne) # Young's modulus nu_array = nu * np.ones(Ne) # Poisson's ratio Ssat = 673.88 * np.ones(Ne) n = 511.18 * np.ones(Ne) sy_mean = 174.46 ray_param = sy_mean/1.253314 sy = np.random.rayleigh(ray_param, Ne) labels = ['mat_{0}'.format(i+1) for i in xrange(len(sy))] material = [materials.Bilinear(labels = labels[i], E = E_array[i], nu = nu_array[i], Ssat = Ssat[i], n=n[i], sy = sy[i]) for i in xrange(Ne)] workdir = "workdir/" label = "ringCompression"
from abapy.materials import Hollomon import matplotlib.pyplot as plt E = 1. # Young's modulus sy = 0.001 # Yield stress n = 0.15 # Hardening exponent nu = 0.3 eps_max = .1 # maximum strain to be computed # Number of points to be computed (30 is a low value useful for graphical reasons, in real simulations, 100 is a better value). N = 30 mat1 = Hollomon(labels='my_material', E=E, nu=nu, sy=sy, n=n) table1 = mat1.get_table(0, N=N, eps_max=eps_max) eps1 = table1[:, 0] sigma1 = table1[:, 1] sigma_max1 = max(sigma1) mat2 = Hollomon(labels='my_material', E=E, nu=nu, sy=sy, n=n, kind=2) table2 = mat2.get_table(0, N=N, eps_max=eps_max) eps2 = table2[:, 0] sigma2 = table2[:, 1] sigma_max2 = max(sigma2) plt.figure() plt.clf() plt.title('Hollomon tensile behavior: $n = {0:.2f}$, $\sigma_y / E = {1:.2e}$'. format(n, sy / E)) plt.xlabel('Strain $\epsilon$') plt.ylabel('Stress $\sigma$') plt.plot(eps1, sigma1, 'or-', label='Plasticity kind=1') plt.plot(eps2, sigma2, 'vg-', label='Plasticity kind=2') plt.plot([0., sy / E], [0., sy], 'b-', label='Elasticity')
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'])
from abapy.materials import Hollomon import matplotlib.pyplot as plt E = 1. # Young's modulus sy = 0.001 # Yield stress n = 0.15 # Hardening exponent nu = 0.3 eps_max = .1 # maximum strain to be computed N = 30 # Number of points to be computed (30 is a low value useful for graphical reasons, in real simulations, 100 is a better value). mat1 = Hollomon(labels = 'my_material', E=E, nu=nu, sy=sy, n=n) table1 = mat1.get_table(0, N=N, eps_max=eps_max) eps1 = table1[:,0] sigma1 = table1[:,1] sigma_max1 = max(sigma1) mat2 = Hollomon(labels = 'my_material', E=E, nu=nu, sy=sy, n=n, kind = 2) table2 = mat2.get_table(0, N=N, eps_max=eps_max) eps2 = table2[:,0] sigma2 = table2[:,1] sigma_max2 = max(sigma2) plt.figure() plt.clf() plt.title('Hollomon tensile behavior: $n = {0:.2f}$, $\sigma_y / E = {1:.2e}$'.format(n, sy/E)) plt.xlabel('Strain $\epsilon$') plt.ylabel('Stress $\sigma$') plt.plot(eps1, sigma1, 'or-', label = 'Plasticity kind=1') plt.plot(eps2, sigma2, 'vg-', label = 'Plasticity kind=2') plt.plot([0., sy / E], [0., sy], 'b-', label = 'Elasticity') plt.xticks([0., sy/E, eps_max], ['$0$', '$\epsilon_y$', '$\epsilon_{max}$'], fontsize = 16.)