def test_pass(self):

        # path to the test library
        lib = os.environ['MGIS_TEST_BEHAVIOURS_LIBRARY']
        # reference values
        pref = [
            0, 1.3523277308229e-11, 1.0955374667213e-07, 5.5890770166084e-06,
            3.2392193670428e-05, 6.645865307584e-05, 9.9676622883138e-05,
            0.00013302758358953, 0.00016635821069889, 0.00019969195920296,
            0.00023302522883648, 0.00026635857194317, 0.000299691903777,
            0.0003330252373404, 0.00036635857063843, 0.00039969190397718,
            0.00043302523730968, 0.00046635857064314, 0.00049969190397646,
            0.00053302523730979, 0.00056635857064313
        ]
        # comparison criterion
        eps = 1.e-12

        b = mgis_bv.load(lib, 'Norton', mgis_bv.Hypothesis.Tridimensional)
        d = mgis_bv.BehaviourData(b)
        o = mgis_bv.getVariableOffset(b.isvs, 'EquivalentViscoplasticStrain',
                                      b.hypothesis)

        # strain increment per time step
        de = 5.e-5
        # time step
        d.dt = 180

        # setting the temperature
        mgis_bv.setExternalStateVariable(d.s1, 'Temperature', 293.15)

        # copy d.s1 in d.s0
        mgis_bv.update(d)
        d.s1.gradients[0] = de

        # equivalent plastic strain
        p = [d.s0.internal_state_variables[o]]

        # integrate the behaviour
        for i in range(0, 20):
            mgis_bv.integrate(d, b)
            mgis_bv.update(d)
            d.s1.gradients[0] += de
            p.append(d.s1.internal_state_variables[o])

        # check-in results
        for i in range(0, 20):
            self.assertTrue(abs(p[i] - pref[i]) < eps)

        pass
示例#2
0
    def test_pass(self):

        # path to the test library
        lib = os.environ['MGIS_TEST_MODELS_LIBRARY']
        # modelling hypothesis
        h = mgis_bv.Hypothesis.Tridimensional
        # loading the behaviour
        model = mgis.model.load(lib, 'ode_rk54', h)
        # default value of parameter A
        A = model.getParameterDefaultValue('A')
        # material data manager
        d = mgis_bv.BehaviourData(model)
        # index of x in the array of state variable
        o = mgis_bv.getVariableOffset(model.isvs, 'x', h)
        # time step increment
        d.dt = 0.1
        # type of storage
        mgis_bv.setExternalStateVariable(d.s1, 'Temperature', 293.15)
        # Initial value of x
        d.s1.internal_state_variables[o] = 1
        # copy d.s1 in d.s0
        mgis_bv.update(d)
        # values of  x
        xvalues = [d.s0.internal_state_variables[o]]
        # integration
        for i in range(0, 10):
            mgis_bv.integrate(d, model)
            mgis_bv.update(d)
            xvalues.append(d.s1.internal_state_variables[o])
        # checks
        # comparison criterion
        eps = 1.e-10
        t = 0
        for i in range(0, 11):
            x_ref = math.exp(-A * t)
            self.assertTrue(abs(xvalues[i] - x_ref) < eps)
            t = t + d.dt

        pass
    def test_pass(self):

        print(dir(mgis))
        # path to the test library
        lib = os.environ['MGIS_TEST_BEHAVIOURS_LIBRARY']
        # reference values
        pref = [
            0, 1.3523277308229e-11, 1.0955374667213e-07, 5.5890770166084e-06,
            3.2392193670428e-05, 6.645865307584e-05, 9.9676622883138e-05,
            0.00013302758358953, 0.00016635821069889, 0.00019969195920296,
            0.00023302522883648, 0.00026635857194317, 0.000299691903777,
            0.0003330252373404, 0.00036635857063843, 0.00039969190397718,
            0.00043302523730968, 0.00046635857064314, 0.00049969190397646,
            0.00053302523730979, 0.00056635857064313
        ]
        # modelling hypothesis
        h = mgis_bv.Hypothesis.Tridimensional
        # loading the behaviour
        b = mgis_bv.load(lib, 'Norton', h)
        # number of integration points
        nig = 100
        # material data manager
        m = mgis_bv.MaterialDataManager(b, nig)
        # index of the equivalent viscplastic strain in the array of
        # state variable
        o = mgis_bv.getVariableOffset(b.isvs, 'EquivalentViscoplasticStrain',
                                      h)
        # strain increment per time step
        de = 5.e-5
        # time step increment
        dt = 180
        # setting the temperature
        mgis_bv.setExternalStateVariable(m.s1, 'Temperature', 293.15)
        # copy d.s1 in d.s0
        mgis_bv.update(m)
        # index of the first integration point
        ni = 0
        # index of the last integration point
        ne = nig - 1
        # values of the equivalent plastic strain
        # for the first integration point
        pi = [m.s0.internal_state_variables[ni][o]]
        # values of the equivalent plastic strain
        # for the last integration point
        pe = [m.s0.internal_state_variables[ne][o]]
        # setting the gradient at the end of the first time step
        for i in range(0, nig):
            m.s1.gradients[i][0] = de
        # creating a thread pool for parallel integration
        p = mgis.ThreadPool(2)
        # integration
        for i in range(0, 20):
            it = mgis_bv.IntegrationType.IntegrationWithoutTangentOperator
            mgis_bv.integrate(p, m, it, dt)
            mgis_bv.update(m)
            for j in range(0, nig):
                m.s1.gradients[j][0] += de
            pi.append(m.s0.internal_state_variables[ni][o])
            pe.append(m.s0.internal_state_variables[ne][o])
        # checks
        # comparison criterion
        eps = 1.e-12
        for i in range(0, 21):
            self.assertTrue(abs(pi[i] - pref[i]) < eps)
            self.assertTrue(abs(pe[i] - pref[i]) < eps)

        pass