def setUp(self):
        self.shear = [200.0, 400.0, -400.0, 150.0]
        self.sliprate = [1.0e-3, 5.0e-2, -1.0e-1, 1.0e-3]
        self.normal = 100.0
        self.damage = 0.5

        self.model = crystaldamage.WorkPlaneDamage()
    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()
    imodel = inelasticity.AsaroInelasticity(slipmodel)

    base_kin = kinematics.StandardKinematicModel(emodel, imodel)
    base_cp_model = singlecrystal.SingleCrystalModel(base_kin, lattice)
    base_model = polycrystal.TaylorModel(base_cp_model,
                                         orientations,
                                         nthreads=nthreads)

    base_kin = kinematics.StandardKinematicModel(emodel, imodel)
    base_cp_model = singlecrystal.SingleCrystalModel(base_kin, lattice)
    base_model = polycrystal.TaylorModel(base_cp_model,
                                         orientations,
                                         nthreads=nthreads)

    dmodel = crystaldamage.WorkPlaneDamage()
    func = crystaldamage.SigmoidTransformation(c, beta)
    dmg_fun = crystaldamage.PlanarDamageModel(dmodel, func, func, lattice)
    dmg_kin = kinematics.DamagedStandardKinematicModel(emodel, imodel, dmg_fun)
    dmg_cp_model = singlecrystal.SingleCrystalModel(dmg_kin, lattice)
    dmg_model = polycrystal.TaylorModel(dmg_cp_model,
                                        orientations,
                                        nthreads=nthreads)

    res = drivers.uniaxial_test(base_model,
                                erate,
                                emax=emax,
                                nsteps=nsteps,
                                verbose=False)
    res2 = drivers.uniaxial_test(dmg_model,
                                 erate,
    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())