Example #1
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)
Example #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.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()
Example #3
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()
    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())
Example #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()
Example #6
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()
    def test_setup_history(self):
        H1 = history.History()
        self.model.populate_history(H1)
        self.model.init_history(H1)

        H2 = history.History()
        self.imodel.populate_history(H2)
        self.imodel.init_history(H2)

        self.assertTrue(np.allclose(np.array(H1), np.array(H2)))
Example #8
0
    def test_init_hist(self):
        H1 = history.History()
        self.model.populate_history(H1)
        self.model.init_history(H1)

        H2 = history.History()
        self.strengthmodel.populate_history(H2)
        self.strengthmodel.init_history(H2)

        self.assertTrue(np.allclose(np.array(H1), np.array(H2)))
    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()
Example #10
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()
Example #11
0
    def test_setup_history(self):
        model_hist = history.History()
        self.model.populate_history(model_hist)
        self.model.init_history(model_hist)

        manual_hist = history.History()
        for strength in self.strengths:
            Hs = history.History()
            strength.populate_history(Hs)
            strength.init_history(Hs)
            manual_hist.add_union(Hs)

        self.assertTrue(
            np.allclose(np.array(model_hist), np.array(manual_hist)))
Example #12
0
    def setUp(self):
        self.scalar1 = 2.0
        self.scalar2 = 3.0
        self.vector1 = tensors.Vector(np.array([1.0, 2.0, 3.0]))

        self.hist1 = history.History()
        self.hist1.add_scalar("a")
        self.hist1.set_scalar("a", self.scalar1)
        self.hist1.add_vector("b")
        self.hist1.set_vector("b", self.vector1)

        self.hist2 = history.History()
        self.hist2.add_scalar("c")
        self.hist2.set_scalar("c", self.scalar2)
Example #13
0
 def setUp(self):
     self.hist = history.History(False)
     self.hist.add_scalar("a")
     self.hist.add_scalar("b")
     self.hist.add_scalar("c")
     self.data = np.array([1.0, 2.0, 3.0])
     self.hist.set_data(self.data)
Example #14
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()
 def test_hist(self):
     test = history.History()
     self.model.populate_history(test)
     self.assertEqual(test.size, 1)
     self.assertEqual(test.items, ["whatever"])
     self.model.init_history(test)
     self.assertAlmostEqual(test.get_scalar("whatever"), 0.0)
Example #16
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
Example #17
0
 def setUp(self):
     self.hist = history.History()
     self.hist.add_scalar("a")
     self.hist.add_vector("b")
     self.hist.add_ranktwo("C")
     self.hist.add_symmetric("D")
     self.hist.add_skew("E")
     self.hist.add_orientation("q")
    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()
Example #19
0
 def setUp(self):
     self.hist = history.History()
     self.hist.add_scalar("a")
     self.hist.set_scalar("a", 1.0)
     self.hist.add_scalar("b")
     self.hist.set_scalar("b", 2.0)
     self.hist.add_scalar("c")
     self.hist.set_scalar("c", 3.0)
     self.hist.add_scalar("d")
     self.hist.set_scalar("d", 4.0)
Example #20
0
    def test_history_rate(self):
        reference = self.model.hist_rate(self.S, self.Q, self.H, self.L,
                                         self.T, self.fixed)
        combined = history.History()
        for strength in self.strengths:
            combined.add_union(
                strength.hist(self.S, self.Q, self.H, self.L, self.T,
                              self.model, self.fixed))

        self.assertTrue(np.allclose(reference, combined))
Example #21
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)
Example #22
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()
Example #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()
Example #24
0
    def test_hist_rate(self):
        h1 = self.model1.history_rate(self.S, self.Q, self.H, self.L, self.T,
                                      self.fixed)
        h2 = self.model2.history_rate(self.S, self.Q, self.H, self.L, self.T,
                                      self.fixed)
        h = self.model.history_rate(self.S, self.Q, self.H, self.L, self.T,
                                    self.fixed)

        h3 = history.History()
        h3.add_union(h1)
        h3.add_union(h2)

        self.assertTrue(np.allclose(np.array(h), np.array(h3)))
Example #25
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.hist = history.History()
        self.add_all(self.hist)
        self.set_all(self.hist)
Example #26
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
Example #27
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()
    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.strength = 35.0
        self.c = 10.0
        self.beta = 2.0

        self.H = history.History()

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

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

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

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

        self.strengthmodel = 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.slipmodel = sliprules.PowerLawSlipRule(self.strengthmodel,
                                                    self.g0, self.n)

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

        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.WorkPlaneDamage()
        self.nfunc = crystaldamage.SigmoidTransformation(self.c, self.beta)
        self.sfunc = crystaldamage.SigmoidTransformation(self.c, self.beta)

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

        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())
 def dfn(w):
     fixed = self.model.decouple(self.S, self.d, w, self.Q, self.H,
                                 self.L, self.T, history.History())
     return self.model.stress_rate(self.S, self.d, w, self.Q, self.H,
                                   self.L, self.T, fixed)
Example #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