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
nFrames = nFrames, Nr = Nr, Nt = Nt, Na = Na, unloading = unloading, export_fields = export_fields, workdir = workdir, label = label, elType = elType, abqlauncher = abqlauncher, cpus = cpus, is_3D = is_3D, compart = compart) # SIMULATION m.MakeMesh() if run_sim: m.MakeInp() m.Run() m.PostProc() # SOME PLOTS mesh = m.mesh outputs = load(workdir + label + '.pckl') if outputs['completed']: # Fields if export_fields == True : def field_func(outputs, step): """ A function that defines the scalar field you want to plot
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, compart=True) # SIMULATION model.MakeMesh() mesh = model.mesh centroids = mesh.centroids() nodes = mesh.nodes nodes_postion = np.array([nodes.x, nodes.y, nodes.z]).transpose() conn = np.array(mesh.connectivity) labels = nodes.labels # VORONOI CELL BUILDING # Bounding box xmin, xmax = nodes_postion[:, 0].min(), nodes_postion[:, 0].max() ymin, ymax = nodes_postion[:, 1].min(), nodes_postion[:, 1].max() zmin, zmax = nodes_postion[:, 2].min(), nodes_postion[:, 2].max() # Seeds
def Run(self): """ Runs a simulation for a given couple (sy, n) and returns the (disp, force) couple. """ #MODEL DEFINITION sy_mean = self.sy_mean * np.ones(settings['Ne']) n = self.n * np.ones(settings['Ne']) Ssat = self.Ssat * np.ones(settings['Ne']) 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 #TASKS run_sim = True plot = True print E[0], nu[0], Ssat[0], n[0], sy_mean[0] #print E[0], nu[0], n[0], sy_mean[0] 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[i], nu=nu[i], Ssat=Ssat[i], n=n[i], sy=sy[i]) for i in xrange(Ne) ] m = RingCompression(material=material, inner_radius=inner_radius, outer_radius=outer_radius, disp=disp, thickness=thickness, nFrames=nFrames, Nr=Nr, Nt=Nt, Na=Na, unloading=unloading, export_fields=export_fields, workdir=workdir, label=label, elType=elType, abqlauncher=abqlauncher, cpus=cpus, is_3D=is_3D, compart=compart) # SIMULATION m.MakeMesh() if run_sim: 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