示例#1
0
 def setUp(self):
   self.A = rotations.Orientation(31.0, 59.0, 80.0, angle_type = "degrees",
       convention = "bunge")
   self.a = np.copy(self.A.quat)
   n = np.array([1,2.0,3])
   n /= la.norm(n)
   self.B = rotations.Orientation(n, np.pi/3, angle_type = "radians")
   self.b = np.copy(self.B.quat)
示例#2
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.nslip = self.L.ntotal

        self.static = 20.0

        self.H = history.History()

        self.T = 300.0

        self.s0 = [self.static] * self.nslip

        self.model = slipharden.FixedStrengthHardening(self.s0)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.fixed = history.History()
示例#3
0
  def test_set_active(self):
    q = rotations.Orientation(15.0,50.0,60.0, angle_type = "degrees")
    h = self.model.init_store()

    self.model.set_active_orientation(h, q)
    self.assertTrue(np.allclose(q.quat, 
      self.model.get_active_orientation(h).quat))
    def setUp(self):
        self.strength = 35.0
        self.H = history.History()
        self.H.add_scalar("strength")
        self.H.set_scalar("strength", self.strength)
        self.H.add_scalar("whatever")
        self.H.set_scalar("whatever", 0.5)

        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.strengthmodel = slipharden.VoceSlipHardening(
            self.tau_sat, self.b, self.tau0)

        self.g0 = 1.0
        self.n = 3.0
        self.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel,
                                                    self.g0, self.n)

        self.imodel = inelasticity.AsaroInelasticity(self.slipmodel)

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.T = 300.0

        self.mu = 29000.0
        self.E = 120000.0
        self.nu = 0.3

        self.emodel = elasticity.CubicLinearElasticModel(
            self.E, self.nu, self.mu, "moduli")

        self.dn = np.array([[4.1, 2.8, -1.2], [3.1, 7.1, 0.2], [4, 2, 3]])
        self.dn = 0.5 * (self.dn + self.dn.T)
        self.d = tensors.Symmetric(self.dn)

        self.wn = np.array([[-9.36416517, 2.95527444, 8.70983194],
                            [-1.54693052, 8.7905658, -5.10895168],
                            [-8.52740468, -0.7741642, 2.89544992]])
        self.wn = 0.5 * (self.wn - self.wn.T)
        self.w = tensors.Skew(self.wn)

        self.dmodel = crystaldamage.NilDamageModel()

        self.model = kinematics.DamagedStandardKinematicModel(
            self.emodel, self.imodel, self.dmodel)

        self.fspin = self.model.spin(self.S, self.d, self.w, self.Q, self.H,
                                     self.L, self.T, history.History())

        self.fixed = self.model.decouple(self.S, self.d, self.w, self.Q,
                                         self.H, self.L, self.T,
                                         history.History())
示例#5
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))
        self.strength = 35.0
        self.H = history.History()
        self.H.add_scalar("strength")
        self.H.set_scalar("strength", self.strength)

        self.T = 300.0

        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.strengthmodel = slipharden.VoceSlipHardening(
            self.tau_sat, self.b, self.tau0)
        self.strengths = [self.strengthmodel]

        self.static = self.tau0

        self.strength_values = [self.strength + self.static]

        self.g0 = 1.0
        self.n = 3.0
        self.model = sliprules.PowerLawSlipRule(self.strengthmodel, self.g0,
                                                self.n)

        self.tau = 33.0

        self.fixed = history.History()
示例#6
0
  def setUp(self):
    self.mu = 29000.0
    self.E = 120000.0
    self.nu = 0.3
    self.T = 325.0

    self.Q = rotations.Orientation(31.0, 59.0, 80.0, angle_type = "degrees",
        convention = "bunge")
    self.Q_cube = rotations.Orientation(90.0, 0.0, 0.0, angle_type = "degrees",
        convention = "bunge") 

    self.model = elasticity.CubicLinearElasticModel(self.E, 
        self.nu, self.mu, "moduli")

    self.v1 = tensors.Vector(np.array([1.0,0.0,0]))
    self.v2 = tensors.Vector(np.array([0.0,1.0,0]))
示例#7
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.nslip = self.L.ntotal

        self.current = -35.0

        self.H = history.History()
        for i in range(self.nslip):
            self.H.add_scalar("strength" + str(i))
            self.H.set_scalar("strength" + str(i), self.current)

        self.T = 300.0

        self.s = np.array([self.current] * self.nslip)

        self.k = 1000.0
        self.sat = 40.0

        self.model = slipharden.FASlipHardening([self.k] * self.nslip,
                                                [self.sat] * self.nslip)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.fixed = history.History()
示例#8
0
    def setUp(self):
        self.scalar = 2.5
        self.vector = tensors.Vector(np.array([1.0, 2.0, 3.0]))
        self.ranktwo = tensors.RankTwo(
            np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]))
        self.symmetric = tensors.Symmetric(np.eye(3))
        q = np.array([[1.0, 2.0, 3.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]])
        q = 0.5 * (q - q.T)
        self.skew = tensors.Skew(q)
        self.orientation = rotations.Orientation(30.0,
                                                 60.0,
                                                 80.0,
                                                 angle_type="degrees")

        self.hist1 = history.History()
        self.hist2 = history.History(store=False)

        self.add_all(self.hist1)
        self.add_all(self.hist2)

        self.storage = np.zeros((self.hist2.size, ))
        self.hist2.set_data(self.storage)

        self.set_all(self.hist1)
        self.set_all(self.hist2)
示例#9
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))
        self.strength0 = 15.0
        self.strength1 = 20.0
        self.strength2 = 20.0
        self.H = history.History()
        self.H.add_scalar("strength_#0")
        self.H.add_scalar("strength_#1")
        self.H.add_scalar("strength_#2")
        self.H.set_scalar("strength_#0", self.strength0)
        self.H.set_scalar("strength_#1", self.strength1)
        self.H.set_scalar("strength_#2", self.strength2)

        self.T = 300.0

        self.tau0_1 = 10.0
        self.tau_sat_1 = 50.0
        self.b_1 = 2.5

        self.tau0_2 = 15.0
        self.tau_sat_2 = 55.0
        self.b_2 = 3.0

        self.tau0_3 = 10.0
        self.tau_sat_3 = 45.0
        self.b_3 = 5.0

        self.backstrength = slipharden.VoceSlipHardening(
            self.tau_sat_1, self.b_1, self.tau0_1)
        self.isostrength = slipharden.VoceSlipHardening(
            self.tau_sat_2, self.b_2, self.tau0_2)
        self.flowresistance = slipharden.VoceSlipHardening(
            self.tau_sat_3, self.b_3, self.tau0_3)
        self.strengths = [
            self.backstrength, self.isostrength, self.flowresistance
        ]

        self.strength_values = [
            self.strength0 + self.tau0_1, self.strength1 + self.tau0_2,
            self.strength2 + self.tau0_3
        ]

        self.g0 = 1.0
        self.n = 3.0
        self.model = sliprules.KinematicPowerLawSlipRule(
            self.backstrength, self.isostrength, self.flowresistance, self.g0,
            self.n)

        self.tau = 80.0

        self.fixed = history.History()
示例#10
0
  def setUp(self):
    self.mu = 29000.0
    self.K = 64000.0
    self.T = 325.0

    self.Q = rotations.Orientation(31.0, 59.0, 80.0, angle_type = "degrees",
        convention = "bunge")

    self.model = elasticity.IsotropicLinearElasticModel(self.mu, 
        "shear", self.K, "bulk")
示例#11
0
  def setUp(self):
    self.a = 1.3
    self.lattice = crystallography.CubicLattice(self.a)

    self.S = np.array([[20.0,-15.0,12.0],[-15.0,-40.0,5.0],[12.0,5.0,60.0]])
    self.ST = tensors.Symmetric(self.S)
    self.Q = rotations.Orientation(30.0,43.0,10.0, angle_type = "degrees")
    self.QM = self.Q.to_matrix()

    self.lattice.add_slip_system([1,1,0],[1,1,1])
示例#12
0
  def setUp(self):
    self.q = rotations.Orientation(30.0, 60.0, 80.0, angle_type = "degrees")
    self.Q = self.q.to_matrix()
    self.v = np.array([1.2,-2.0,3.0])
    self.Tv = tensors.Vector(self.v)

    self.A = np.array([[4.1,2.8,-1.2],[3.1,7.1,0.2],[4,2,3]])
    self.TA = tensors.RankTwo(self.A)

    self.S = np.array([[4.1,2.8,-1.2],[3.1,7.1,0.2],[4,2,3]])
    self.S = 0.5*(self.S + self.S.T)
    self.TS = tensors.Symmetric(self.S)

    self.W = np.array([[4.1,2.8,-1.2],[3.1,7.1,0.2],[4,2,3]])
    self.W = 0.5*(self.W - self.W.T)
    self.TW = tensors.Skew(self.W)

    self.R1 = np.array([[[[ 7.09627147,  9.22330744, -1.36602973],
             [-7.86118175, -1.6342633 , -5.75516189],
             [ 2.61734248,  6.40678382,  3.37981603]],
            [[ 5.65100254, -7.88797059,  7.31396665],
             [-6.35471595,  5.67698069, -8.18795178],
             [ 9.10447016,  8.91183436, -6.65254333]],
            [[ 3.20429862,  2.99308849,  4.0035241 ],
             [-4.02440197, -4.39975872, -4.33542791],
             [ 9.36746226, -2.91156335,  4.51572032]]],
           [[[-9.23675199,  8.63546962,  6.83448027],
             [ 4.35044123,  2.24508666,  9.80054664],
             [ 0.30835223, -4.05208575,  5.68966326]],
            [[ 6.40300092, -8.25998136,  5.63566553],
             [-5.02801101,  5.64005224, -7.39586166],
             [ 5.90893633,  6.02074669,  1.37112738]],
            [[-2.68485216, -4.67660156,  3.52618441],
             [-2.52484812, -0.08561168,  3.39072868],
             [ 9.11295675,  2.63102786, -4.82285415]]],
           [[[ 8.31973154,  4.76081593,  4.38377207],
             [ 6.22896742, -3.83995097,  5.37501029],
             [-0.16770967,  7.9453854 , -4.95548491]],
            [[-5.67884611, -8.44970885, -7.42037867],
             [-5.19908193, -7.87006493,  1.65949787],
             [-3.25934672,  6.27340198,  5.98643056]],
            [[-4.20166968, -2.38276224,  3.04551936],
             [ 3.68445989, -5.84357996,  3.61183543],
             [ 1.54886677,  3.3659842 ,  6.43067337]]]])
    self.TR1 = tensors.RankFour(self.R1)

    self.SS1 = np.array([
      [ 5.99159801, -2.24342348,  0.26667281, -0.95466199,  3.98931478, -0.10846981],
      [ 1.86468226, -4.32391908, -7.82738638, -7.45008989,  5.89874777, 0.45820648],
      [-5.92565398,  2.4862829 , -6.02112389,  6.75455965,  4.65183463, 9.96900579],
      [ 0.60378883, -3.72189328, -7.63388446, -5.76559403, -0.3119789 , -1.1527258 ],
      [ 4.56813135, -6.06783828, -6.18341368,  8.06169686, -9.56928844, 9.08114655],
      [-8.25516614,  6.30663846,  7.2084381 , -7.38280703, -5.96279902, 8.9935982 ]])
    self.SSS1 = ms2ts(self.SS1)
    self.TSS1 = tensors.SymSymR4(self.SS1)
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.nslip = self.L.ntotal

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]])) * 2

        self.static = 20.0
        self.s0 = [self.static] * self.nslip

        self.k = 1000.0
        self.sat = 40.0
        self.m = 1.5

        self.hmodel = slipharden.VocePerSystemHardening(
            self.s0, [self.k] * self.nslip, [self.sat] * self.nslip,
            [self.m] * self.nslip)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.hmodel, self.g0,
                                                   self.n)

        self.T = 300.0

        self.c = 10.0
        self.beta = 2.0

        self.dmodel = crystaldamage.WorkPlaneDamage()
        self.nfunc = crystaldamage.SigmoidTransformation(self.c, self.beta)
        self.sfunc = crystaldamage.SigmoidTransformation(self.c, self.beta)

        self.model = crystaldamage.PlanarDamageModel(self.dmodel, self.sfunc,
                                                     self.nfunc, self.L)

        self.huse = history.History()
        self.hmodel.populate_history(self.huse)
        self.model.populate_history(self.huse)

        for i in range(12):
            self.huse.set_scalar("strength" + str(i), 2.0)

        for j in range(4):
            self.huse.set_scalar("slip_damage_" + str(j), self.c * 0.4)

        self.hbase = self.huse.subset(["strength" + str(i) for i in range(12)])
        self.hdmg = self.huse.subset(
            ["slip_damage_" + str(i) for i in range(4)])

        self.fixed = history.History()
示例#14
0
  def test_correctly_integrates(self):
    # So we are rotating about x where t is the rotation in radians
    R = lambda t: np.array([[1.0,0,0],[0,np.cos(t),-np.sin(t)],[0,np.sin(t), np.cos(t)]])
    q0 = rotations.Orientation(R(0.0))

    spin = tensors.Skew(np.array([
      [0,0,0],
      [0,0,-1.0],
      [0,1.0,0]]))
    
    nsteps = 1000 # Well it's not the most accurate integration
    ang = np.pi/4.0

    qf = rotations.Orientation(R(ang))
    
    q = q0
    for i in range(nsteps):
      q = rotations.wexp(spin * ang/nsteps) * q

    self.assertTrue(np.allclose(q.quat, qf.quat))
示例#15
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]])) * 3

        self.H = history.History()

        self.T = 300.0

        E = 160000.0
        nu = 0.31

        self.g0 = 1.0e-4
        self.n = 10.0

        K = E / 50.0
        s0 = 75.0

        M = matrix.SquareMatrix(self.L.ntotal,
                                type="dense",
                                data=[K] * (self.L.ntotal * self.L.ntotal))

        self.isostrength = slipharden.GeneralLinearHardening(M, [s0 / 2] *
                                                             self.L.ntotal,
                                                             absval=False)
        self.flowresistance = slipharden.GeneralLinearHardening(M, [s0 / 2] *
                                                                self.L.ntotal,
                                                                absval=False)
        self.backstrength = slipharden.GeneralLinearHardening(M, [0] *
                                                              self.L.ntotal,
                                                              absval=False)

        self.strengths = [
            self.backstrength, self.isostrength, self.flowresistance
        ]

        self.model = sliprules.KinematicPowerLawSlipRule(
            self.backstrength, self.isostrength, self.flowresistance, self.g0,
            self.n)

        self.model.populate_history(self.H)
        self.model.init_history(self.H)

        self.strength_values = np.linspace(0, 10, 36) + 5.0
        self.H.copy_data(self.strength_values)

        self.fixed = history.History()
示例#16
0
def project_ipf(q, lattice, direction, 
    sample_symmetry = crystallography.symmetry_rotations("222"), 
    x = [1,0,0], y = [0,1,0]):
  """
    Project a single sample direction onto a crystal

    Parameters:
      q:                 lattice orientation
      lattice:           lattice object describing the crystal system
      direction:         sample direction 
    
    Keyword Args:
      sample_symmetry:   sample symmetry operators
      x:                 x direction (crystallographic) of the projection
      y:                 y direction (crystallographic) of the projection
  """
  xv = lattice.miller2cart_direction(x).normalize()
  yv = lattice.miller2cart_direction(y).normalize()

  if not np.isclose(xv.dot(yv),0.0):
    raise ValueError("Lattice directions are not orthogonal!")

  zv = xv.cross(yv)
  
  trans = rotations.Orientation(np.vstack((xv.data,yv.data,zv.data)))
  
  d = tensors.Vector(direction).normalize()

  pts = []
  for srot in sample_symmetry:
    # Sample directions
    spt = srot.apply(d)
    
    # Crystal coordinates
    cpt = q.apply(spt)

    # Lattice symmetry
    for op in lattice.symmetry.ops:
      cppt = op.apply(cpt)

      # Into the right coordinates
      fpt = trans.apply(cppt)

      pts.append(fpt.data)
  
  # By convention just keep the points in the upper hemisphere
  pts = np.array(pts)
  pts = pts[pts[:,2]>0]
  
  return pts
示例#17
0
    def setUp(self):
        self.model = inelasticity.NoInelasticity()

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.T = 300.0

        self.H = history.History()

        self.fixed = history.History()
示例#18
0
  def test_Fe(self):
    Qc = rotations.Orientation(12.0,35.0,61.0, angle_type = "degrees")

    h = self.model.init_store()
    h[:4] = Qc.quat
    h[4:8] = self.Q.quat
    h[8] = self.strength_np1

    Fe1 = self.model.Fe(self.stress_np1, h, self.T)

    Re = (Qc * self.Q.inverse()).to_matrix()
    E = common.usym(np.array(self.emodel.S_tensor(self.T, Qc
      ).dot(self.S_np1).data)) + np.eye(3)
    Fe2 = la.inv(np.dot(E, Re))

    self.assertTrue(np.allclose(Fe1,Fe2, rtol = 1e-3))
示例#19
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))
        self.strength_0 = 35.0
        self.strength_1 = -5.0
        self.H = history.History()
        self.H.add_scalar("strength0")
        self.H.set_scalar("strength0", self.strength_0)
        self.H.add_scalar("strength1")
        self.H.set_scalar("strength1", self.strength_1)

        self.T = 300.0

        self.tau0_1 = 10.0
        self.tau_sat_1 = 50.0
        self.b_1 = 2.5

        self.tau0_2 = 5.0
        self.tau_sat_2 = -25.0
        self.b_2 = 1.5

        self.static = self.tau0_1 + self.tau0_2
        self.strength = self.strength_0 + self.strength_1

        self.model1 = slipharden.VoceSlipHardening(self.tau_sat_1, self.b_1,
                                                   self.tau0_1)
        self.model2 = slipharden.VoceSlipHardening(self.tau_sat_2, self.b_2,
                                                   self.tau0_2)

        self.model = slipharden.SumSlipSingleStrengthHardening(
            [self.model1, self.model2])

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.fixed = history.History()

        self.nye = tensors.RankTwo([[1.1, 1.2, 1.3], [2.1, 2.2, 2.3],
                                    [3.1, 3.2, 3.3]])

        self.nye_part = 0.0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.nslip = self.L.ntotal

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.static = 20.0
        self.s0 = [self.static] * self.nslip

        self.k = 1000.0
        self.sat = 40.0
        self.m = 1.5

        self.hmodel = slipharden.VocePerSystemHardening(
            self.s0, [self.k] * self.nslip, [self.sat] * self.nslip,
            [self.m] * self.nslip)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.hmodel, self.g0,
                                                   self.n)

        self.T = 300.0

        self.model = crystaldamage.NilDamageModel()

        self.huse = history.History()
        self.hmodel.populate_history(self.huse)
        self.model.populate_history(self.huse)

        for i in range(12):
            self.huse.set_scalar("strength" + str(i), 25.0)

        self.huse.set_scalar("whatever", 0.5)

        self.hbase = self.huse.subset(["strength" + str(i) for i in range(12)])
        self.hdmg = self.huse.subset(["whatever"])

        self.fixed = history.History()
示例#21
0
    def setUp(self):
        self.strength_0 = 35.0
        self.H = history.History()
        self.H.add_scalar("strength0")
        self.H.set_scalar("strength0", self.strength_0)

        self.strength_1 = 25.0
        self.H.add_scalar("strength1")
        self.H.set_scalar("strength1", self.strength_1)

        self.tau0_0 = 10.0
        self.tau_sat_0 = 50.0
        self.b_0 = 2.5

        self.tau0_1 = 5.0
        self.tau_sat_1 = 25.0
        self.b_1 = 1.0

        self.strengthmodel = slipharden.SumSlipSingleStrengthHardening([
            slipharden.VoceSlipHardening(self.tau_sat_0, self.b_0,
                                         self.tau0_0),
            slipharden.VoceSlipHardening(self.tau_sat_1, self.b_1, self.tau0_1)
        ])

        self.g0 = 1.0
        self.n = 3.0
        self.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel,
                                                    self.g0, self.n)

        self.model = inelasticity.AsaroInelasticity(self.slipmodel)

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.T = 300.0

        self.fixed = history.History()
示例#22
0
    def setUp(self):
        self.vname = "strength"

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))
        self.strength = 35.0
        self.H = history.History()
        self.H.add_scalar("strength")
        self.H.set_scalar("strength", self.strength)

        self.T = 300.0

        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.static = self.tau0

        self.k = 1.2

        self.model = slipharden.VoceSlipHardening(self.tau_sat,
                                                  self.b,
                                                  self.tau0,
                                                  k=self.k)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.nye = tensors.RankTwo([[1.1, 1.2, 1.3], [2.1, 2.2, 2.3],
                                    [3.1, 3.2, 3.3]])
        self.nye_part = self.k * np.sqrt(
            la.norm(self.nye.data.reshape((3, 3)), ord='fro'))

        self.fixed = history.History()
        self.fixed.add_ranktwo("nye")
        self.fixed.set_ranktwo("nye", self.nye)
示例#23
0
    def setUp(self):
        self.A = 1.0e-5
        self.n = 3.1

        self.model1 = inelasticity.PowerLawInelasticity(self.A, self.n)

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.T = 300.0

        self.strength = 35.0
        self.H = history.History()
        self.H.add_scalar("strength")
        self.H.set_scalar("strength", self.strength)

        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.strengthmodel = slipharden.VoceSlipHardening(
            self.tau_sat, self.b, self.tau0)

        self.g0 = 1.0
        self.n = 3.0
        self.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel,
                                                    self.g0, self.n)

        self.model2 = inelasticity.AsaroInelasticity(self.slipmodel)

        self.model = inelasticity.CombinedInelasticity(
            [self.model1, self.model2])

        self.fixed = history.History()
示例#24
0
  def setUp(self):
    self.N = 10

    self.tau0 = 10.0
    self.tau_sat = 50.0
    self.b = 2.5

    self.strengthmodel = slipharden.VoceSlipHardening(self.tau_sat, self.b, self.tau0)
    
    self.g0 = 1.0
    self.n = 3.0
    self.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel, self.g0, self.n)

    self.imodel = inelasticity.AsaroInelasticity(self.slipmodel)

    self.L = crystallography.CubicLattice(1.0)
    self.L.add_slip_system([1,1,0],[1,1,1])
    
    self.Q = rotations.Orientation(35.0,17.0,14.0, angle_type = "degrees")

    self.mu = 29000.0
    self.E = 120000.0
    self.nu = 0.3

    self.emodel = elasticity.CubicLinearElasticModel(self.E, 
        self.nu, self.mu, "moduli")

    self.kmodel = kinematics.StandardKinematicModel(self.emodel, self.imodel)

    self.model = singlecrystal.SingleCrystalModel(self.kmodel, self.L, 
        miter = 120)

    self.orientations = rotations.random_orientations(self.N)

    self.D = np.array([0.01,-0.002,-0.003,0.012,-0.04,0.01])
    self.W = np.array([0.02,-0.02,0.03])

    self.T = 300.0
    self.dt = 2.0
示例#25
0
    def setUp(self):
        self.vname = "wee"

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))
        self.strength = 35.0
        self.H = history.History()
        self.H.add_scalar(self.vname)
        self.H.set_scalar(self.vname, self.strength)

        self.T = 300.0

        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.static = self.tau0

        self.model = slipharden.VoceSlipHardening(self.tau_sat, self.b,
                                                  self.tau0)

        self.model.set_varnames([self.vname])

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.fixed = history.History()

        self.nye = tensors.RankTwo([[1.1, 1.2, 1.3], [2.1, 2.2, 2.3],
                                    [3.1, 3.2, 3.3]])

        self.nye_part = 0.0
示例#26
0
    def setUp(self):
        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")
        self.S = tensors.Symmetric(
            np.array([[100.0, -25.0, 10.0], [-25.0, -17.0, 15.0],
                      [10.0, 15.0, 35.0]]))

        self.nslip = self.L.ntotal

        self.static = 20.0
        self.current = 25.0

        self.H = history.History()
        for i in range(self.nslip):
            self.H.add_scalar("strength" + str(i))
            self.H.set_scalar("strength" + str(i), self.current)

        self.T = 300.0

        self.M = matrix.SquareMatrix(self.nslip,
                                     type="block",
                                     data=[0.1, 0.2, 0.3, 0.4],
                                     blocks=[6, 6])

        self.s0 = [self.static] * self.nslip

        self.model = slipharden.GeneralLinearHardening(self.M,
                                                       self.s0,
                                                       absval=False)

        self.g0 = 1.0
        self.n = 3.0
        self.sliprule = sliprules.PowerLawSlipRule(self.model, self.g0, self.n)

        self.fixed = history.History()
示例#27
0
  def setUp(self):
    self.q = rotations.Orientation(30.0, 60.0, 80.0, angle_type = "degrees")

    self.W = np.array([[4.1,2.8,-1.2],[3.1,7.1,0.2],[4,2,3]])
    self.W = 0.5*(self.W - self.W.T)
    self.TW = tensors.Skew(self.W)
示例#28
0
 def setUp(self):
   self.q = rotations.Orientation(30.0, 60.0, 80.0, angle_type = "degrees")
示例#29
0
 def setUp(self):
   self.x = tensors.Vector([0.0,0.0,1.0])
   self.y = tensors.Vector([1.0,0.0,0.0])
   self.q = rotations.Orientation(self.x,self.y)
示例#30
0
    def setUp(self):
        self.tau0 = 10.0
        self.tau_sat = 50.0
        self.b = 2.5

        self.strengthmodel = slipharden.VoceSlipHardening(
            self.tau_sat, self.b, self.tau0)

        self.g0 = 1.0
        self.n = 3.0
        self.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel,
                                                    self.g0, self.n)

        self.imodel = inelasticity.AsaroInelasticity(self.slipmodel)

        self.L = crystallography.CubicLattice(1.0)
        self.L.add_slip_system([1, 1, 0], [1, 1, 1])

        self.Q = rotations.Orientation(35.0, 17.0, 14.0, angle_type="degrees")

        self.mu = 29000.0
        self.E = 120000.0
        self.nu = 0.3

        self.emodel = elasticity.CubicLinearElasticModel(
            self.E, self.nu, self.mu, "moduli")

        self.kmodel = kinematics.StandardKinematicModel(
            self.emodel, self.imodel)

        self.model = singlecrystal.SingleCrystalModel(self.kmodel,
                                                      self.L,
                                                      initial_rotation=self.Q)
        self.model_no_rot = singlecrystal.SingleCrystalModel(
            self.kmodel,
            self.L,
            initial_rotation=self.Q,
            update_rotation=False,
            verbose=False)

        self.T = 300.0
        self.stress_n = np.array([120.0, -60.0, 170.0, 35.0, 80.0, -90.0])
        self.stress_np1 = np.array([15.0, -40.0, 120.0, 70.0, -10.0, -50.0])

        self.d = np.array([0.1, -0.2, 0.25, 0.11, -0.05, 0.075])
        self.w = np.array([0.1, 0.2, -0.2])

        self.strength_n = 25.0
        self.strength_np1 = 30.0

        self.S_np1 = tensors.Symmetric(common.usym(self.stress_np1))
        self.S_n = tensors.Symmetric(common.usym(self.stress_n))

        self.D = tensors.Symmetric(common.usym(self.d))
        self.W = tensors.Skew(common.uskew(self.w))

        self.strength_n = 25.0
        self.strength_np1 = 30.0

        self.H_n = history.History()

        self.H_n.add_scalar("strength")
        self.H_n.set_scalar("strength", self.strength_n)

        self.H_np1 = history.History()

        self.H_np1.add_scalar("strength")
        self.H_np1.set_scalar("strength", self.strength_np1)

        self.dt = 2.0

        self.fixed = self.kmodel.decouple(self.S_n, self.D, self.W, self.Q,
                                          self.H_n, self.L, self.T,
                                          history.History())

        self.ts = singlecrystal.SCTrialState(self.D, self.W, self.S_n,
                                             self.H_n, self.Q, self.L, self.T,
                                             self.dt, self.fixed)

        self.x = np.zeros((self.model.nparams, ))
        self.x[:6] = self.stress_np1
        self.x[6] = self.strength_np1

        self.Ddir = np.array([0.01, -0.005, -0.003, 0.01, 0.02, -0.003]) * 2
        self.Wdir = np.array([0.02, -0.03, 0.01]) * 2

        self.nsteps = 10