Пример #1
0
  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']
    lx = self.settings['lx']
    ly = self.settings['ly']
    lz = self.settings['lz']
    disp = self.settings['displacement']
    nFrames = self.settings['nFrames']
    Nx = self.settings['Nx']
    Ny = self.settings['Ny']
    Nz = self.settings['Nz']
    Ne = self.settings['Ne']
    #thickness = self.settings['thickness']
    
    #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 #mean = sigma*sqrt(Pi/2)
    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 = CuboidTest(lx =lx, ly = ly, lz = lz, Nx = Nx, Ny = Ny, Nz = Nz, abqlauncher = abqlauncher, label = label, workdir = workdir, material = material, compart = compart, disp = disp, elType = elType, is_3D = True, lateralbc = lateralbc, export_fields = export_fields, cpus = cpus)
    
    # SIMULATION
    m.MakeMesh()
    if run_sim:
      m.MakeInp()
      m.Run()
      m.PostProc()
      if m.outputs['completed']:
          # History Outputs
          disp =  np.array(m.outputs['history']['disp'].values()[0].data[0])
          force =  np.array(np.array(m.outputs['history']['force'].values()).sum().data[0])
          volume = np.array(np.array(m.outputs['history']['volume'].values()).sum().data[0])
          length = ly + disp
          surface = volume / length
          logstrain = np.log10(1. + disp / ly)
          linstrain = disp/ly
          strain = linstrain
          stress = force / surface 
    
      self.disp = disp
      self.force = force
      self.logstrain = logstrain
      self.stress = stress
      self.strain = strain
Пример #2
0
else:
  Ne = Nt * Nr * Na
  elType = "C3D8"
disp = 45.
nFrames = 100
thickness = 15.
E  = 64000. * np.ones(Ne) # Young's modulus
nu = .3 * np.ones(Ne) # Poisson's ratio
Ssat = 910. * np.ones(Ne)
n = 207. * np.ones(Ne)
sy_mean = 165.

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)]


workdir = "workdir/"
label = "ringCompression_compart"

filename = 'force_vs_disp_ring1.txt'

node = platform.node()
if node == 'serv2-ms-symme':
  cpus = 6
else:
  cpus = 1
if node ==  'lcharleux':      abqlauncher   = '/opt/Abaqus/6.9/Commands/abaqus' # Ludovic
if node ==  'serv2-ms-symme': abqlauncher   = '/opt/abaqus/Commands/abaqus' # Linux
if node ==  'epua-pd47': 
Пример #3
0
# MATERIALS CREATION
Ne = settings['Nx'] * settings['Ny']
if settings['is_3D']: Ne *= settings['Nz']
if settings['compart']:
    E = E * np.ones(Ne)  # Young's modulus
    nu = nu * np.ones(Ne)  # Poisson's ratio
    sy_mean = sy_mean * np.ones(Ne)
    sigma_sat = sigma_sat * np.ones(Ne)
    n = n * np.ones(Ne)
    sy = compmod.distributions.Rayleigh(sy_mean).rvs(Ne)
    labels = ['mat_{0}'.format(i + 1) for i in xrange(len(sy_mean))]
    settings['material'] = [
        materials.Bilinear(labels=labels[i],
                           E=E[i],
                           nu=nu[i],
                           Ssat=sigma_sat[i],
                           n=n[i],
                           sy=sy[i]) for i in xrange(Ne)
    ]
else:
    labels = 'SAMPLE_MAT'
    settings['material'] = materials.Bilinear(labels=labels,
                                              E=E,
                                              nu=nu,
                                              sy=sy_mean,
                                              Ssat=sigma_sat,
                                              n=n)

m = compmod.models.CuboidTest(**settings)
if run_simulation:
    m.MakeInp()
Пример #4
0
grain_volume = np.zeros(len(seed_flags))
for i in xrange(len(seed_flags)):
    flag = seed_flags[i]
    grain_volume[i] = ((elem_flags == flag) * elem_volume).sum()
grain_diameter = (grain_volume * 6. / np.pi)**(1. / 3.)
elem_grain_diameter = grain_diameter[elem_flags]

# Hall-Petch (not mandatory)
sy = sigma_0_hp + k_hp / elem_grain_diameter**.5
E = E * np.ones(Ne)  # Young's modulus
nu = nu * np.ones(Ne)  # Poisson's ratio
n = n * np.ones(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], n=n[i], sy=sy[i])
    for i in xrange(Ne)
]
model.material = material
sy_field = FieldOutput(labels=mesh.labels, data=sy, position="element")

if Run_simu:
    model.MakeInp()
    model.Run()
    model.MakePostProc()
    model.RunPostProc()
else:
    model.LoadResults()
# Plotting results
if model.outputs['completed']:
    U = model.outputs['field']['U'][0]
Пример #5
0
def Tensile_Test(settings):
  args = settings.copy()
  # MATERIALS CREATION
  Ne = settings['Nx'] * settings['Ny'] 
  if settings['is_3D']: Ne *= settings['Nz']
  if settings['compart']:
    E         = settings["E"] * np.ones(Ne) # Young's modulus
    nu        = settings["nu"]        * np.ones(Ne) # Poisson's ratio
    sy_mean   = settings["sy_mean"]   * np.ones(Ne)
    sigma_sat = settings["sigma_sat"] * np.ones(Ne)
    n_hol     = settings["n_hol"]     * np.ones(Ne)
    n_bil     = settings["n_bil"]     * np.ones(Ne)
    sy = compmod.distributions.Rayleigh(settings["sy_mean"]).rvs(Ne)
    labels = ['mat_{0}'.format(i+1) for i in xrange(len(sy_mean))]
    if args['material_type']  == "Bilinear":
      args['material'] = [materials.Bilinear(labels = labels[i], 
                                     E = E[i], nu = nu[i], Ssat = sigma_sat[i], 
                                     n=n_bil[i], sy = sy[i]) for i in xrange(Ne)]
    if args['material_type']  == "Hollomon":
      args['material'] = [materials.Hollomon(labels = labels[i], 
                                     E = E[i], nu = nu[i], n=n_hol[i], 
                                     sy = sy[i]) for i in xrange(Ne)]
  else:
    labels = 'SAMPLE_MAT'
    if args['material_type']  == "Bilinear":
      args['material'] = materials.Bilinear(labels = labels, 
                                    E = settings["E"], 
                                    nu = settings["nu"], 
                                    sy = settings["sy_mean"], 
                                    Ssat = settings["sigma_sat"],
                                    n = settings["n_bil"])
    if args['material_type']  == "Hollomon":
      args['material'] = materials.Hollomon(labels = labels, 
                                     E = settings["E"], 
                                    nu = settings["nu"], 
                                    sy = settings["sy_mean"], 
                                    n = settings["n_hol"])
         
  m = compmod.models.CuboidTest(**args)
  m.MakeInp()
  m.Run()
  m.MakePostProc()
  m.RunPostProc()
  m.LoadResults()
  # Plotting results
  if m.outputs['completed']:
    

    # History Outputs
    disp =  np.array(m.outputs['history']['disp'].values()[0].data[0])
    force =  np.array(np.array(m.outputs['history']['force'].values()).sum().data[0])
    volume = np.array(np.array(m.outputs['history']['volume'].values()).sum().data[0])
    length = settings['ly'] + disp
    surface = volume / length
    logstrain = np.log10(1. + disp / settings['ly'])
    linstrain = disp/ settings['ly']
    strain = linstrain
    stress = force / surface 
    output = {}
    output["force"] = force 
    output["disp"]  = disp 
    output["stress"] = stress
    output["strain"] = strain
    output["volume"] = volume
    output["length"] = length
    df = pd.DataFrame(output)
    df.to_csv("{0}{1}.csv".format(settings["workdir"], settings["label"]), index = False)
    df.to_excel("{0}{1}.xls".format(settings["workdir"], settings["label"]), index = False)
    inputs = pd.DataFrame(settings, index = [0])
    inputs.transpose().to_csv("{0}{1}_inputs.csv".format(settings["workdir"], settings["label"]))
Пример #6
0
if node == 'epua-pd45':
    abqlauncher = 'C:\SIMULIA/Abaqus/Commands/abaqus'
compart = True
run_simulation = True

if compart:
    E = 1. * np.ones(Ne)  # Young's modulus
    nu = .3 * np.ones(Ne)  # Poisson's ratio
    n = 0.01 * np.ones(Ne)  # Poisson's ratio
    sy_mean = .005
    sy = np.random.rayleigh(sy_mean, 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],
                           sy=sy[i],
                           n=n[i]) for i in xrange(Ne)
    ]
else:
    E = 1.
    nu = .3
    sy = .01
    n = 0.01
    labels = 'SAMPLE_MAT'
    material = materials.Bilinear(labels=labels, E=E, nu=nu, sy=sy, n=n)

m0 = CuboidTest_BC(lx=lx,
                   ly=ly,
                   Nx=Nx,
                   Ny=Ny,
Пример #7
0
    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