def apply_plasticity_enr(self, mask_mesh, delta_t):
        """
        Apply plasticity treatment if criterion is activated :

        - compute yield stress
        - tests plasticity criterion
        - compute plastic strain rate for plastic cells
        """
        mask = np.logical_and(self.plastic_enr_cells, mask_mesh)
        if not mask.any():
            return
        # Right part : right part of enriched cells is plastic ? => self.plastic_enr_cells
        invariant_j2_el = np.sqrt(
            compute_second_invariant(self.enr_deviatoric_stress_new[mask]))
        yield_stress = self.enr_yield_stress.new_value[mask]
        shear_modulus = self.enr_shear_modulus.new_value[mask]
        radial_return = self._compute_radial_return(invariant_j2_el,
                                                    yield_stress)
        dev_stress = self._enr_deviatoric_stress_new[mask]
        self._enr_plastic_strain_rate[mask] = \
            self._compute_plastic_strain_rate_tensor(radial_return, shear_modulus,
                                                     delta_t, dev_stress)
        self._enr_equivalent_plastic_strain_rate[mask] = \
            self._compute_equivalent_plastic_strain_rate(invariant_j2_el, shear_modulus,
                                                         yield_stress, delta_t)
        self._enr_deviatoric_stress_new[mask] *= radial_return[np.newaxis].T
Esempio n. 2
0
    def check_criterion(self, cells):
        """
        Return the mask of the cells where the VonMises plasticity criterion is verified

        :param cells: cells on which to check the criterion
        :return: the mask of the cells where the VonMises plasticity criterion is verified
        """
        return (compute_second_invariant(cells.deviatoric_stress_new) >
                cells.yield_stress.new_value**2)
Esempio n. 3
0
 def test_apply_plastic_correction_on_enriched_deviatoric_stress_tensor(self):
     """
     Test of the method apply_plastic_correction_on_enriched_deviatoric_stress_tensor
     """
     deviatoric_stress_new = np.array([[5., -2.5, -2.5], ])
     j2 = np.sqrt(compute_second_invariant(deviatoric_stress_new))
     yield_stress = np.array([10.])
     exact_deviator_plastic_right = np.array([[6.666667, -3.333333, -3.333333]])
     radial_return = self.my_cells._compute_radial_return(j2, yield_stress)
     deviatoric_stress_new *= radial_return[np.newaxis].T
     np.testing.assert_allclose(deviatoric_stress_new, exact_deviator_plastic_right, rtol=1.e-5)
Esempio n. 4
0
    def check_criterion_on_right_part_cells(cells):
        """
        Return the mask of the cells where the VonMises plasticity criterion is verified

        :param cells: cells on which to check the criterion
        :return: the mask of the cells where the VonMises plasticity criterion is verified
        """
        if not cells.enriched.any():
            return
        return (compute_second_invariant(cells.enr_deviatoric_stress_new) >
                cells.enr_yield_stress.new_value**2)
Esempio n. 5
0
    def test_compute_enriched_equivalent_plastic_strain_rate(self):
        """
        Test of the method compute_enriched_equivalent_plastic_strain_rate
        """
        dt = 1.  # pylint: disable=invalid-name
        exact_equivalent_plastic_strain_rate_right = np.array([0.33333333333333331])
        deviatoric_stress_new = np.array([[4, -2., -2.]])
        j2 = np.sqrt(compute_second_invariant(deviatoric_stress_new))
        shear_modulus = np.array([4.])
        yield_stress = np.array([2.])

        res = self.my_cells._compute_equivalent_plastic_strain_rate(j2, shear_modulus, yield_stress, dt)

        np.testing.assert_allclose(res, exact_equivalent_plastic_strain_rate_right)
Esempio n. 6
0
 def test_apply_plastic_corrector_on_deviatoric_stress_tensor(self):
     """
     Test of the method apply_plastic_corrector_on_deviatoric_stress_tensor
     """
     mask = np.array([True, True, False, False])
     deviatoric_stress_new = np.array([[8e+9, -4e+9, -4e+9],
                                       [5e+8, -2.5e+8, -2.5e+8],
                                       [1.e+2, -5e+1, -5e+1],
                                       [4e+9, -2e+9, -2e+9]])
     j2 = np.sqrt(compute_second_invariant(deviatoric_stress_new))
     yield_stress = np.ones(
         self.nbr_cells
     ) * self.test_data.material_target.initial_values.yield_stress_init
     radial_return = self.my_cells._compute_radial_return(j2, yield_stress)
     deviatoric_stress_new[mask] *= radial_return[mask][np.newaxis].T
     expected_value = np.array(
         [[8.000000e+07, -4.000000e+07, -4.000000e+07],
          [8.000000e+07, -4.000000e+07, -4.000000e+07],
          [1.e+2, -5e+1, -5e+1], [4e+9, -2e+9, -2e+9]])
     np.testing.assert_allclose(deviatoric_stress_new, expected_value)
Esempio n. 7
0
 def test_compute_equivalent_plastic_strain_rate(self):
     """
     Test of the method compute_equivalent_plastic_strain_rate
     """
     mask = np.array([True, True, False, False])
     delta_t = 1.
     deviatoric_stress = np.array([[8e+9, -4e+9, -4e+9],
                                   [5e+8, -2.5e+8, -2.5e+8],
                                   [1.e+2, -5e+1, -5e+1],
                                   [4e+9, -2e+9, -2e+9]])
     j2 = np.sqrt(compute_second_invariant(deviatoric_stress))
     shear_modulus = np.ones(
         self.nbr_cells
     ) * self.test_data.material_target.initial_values.shear_modulus_init
     yield_stress = np.ones(
         self.nbr_cells
     ) * self.test_data.material_target.initial_values.yield_stress_init
     obtained = self.my_cells._compute_equivalent_plastic_strain_rate(
         j2[mask], shear_modulus[mask], yield_stress[mask], delta_t)
     np.testing.assert_allclose(obtained,
                                np.array([0.08301887, 0.00440252]),
                                rtol=1.e-5)
Esempio n. 8
0
    def apply_plasticity(self, mask, delta_t):
        """
        Apply plasticity treatment if criterion is activated :
        - compute yield stress
        - tests plasticity criterion
        - compute plastic strain rate for plastic cells

        :param mask: boolean array to identify cells to be computed
        :param dt: time step
        """
        invariant_j2_el = np.sqrt(
            compute_second_invariant(self.deviatoric_stress_new[mask, :]))
        yield_stress = self.yield_stress.new_value[mask]
        shear_modulus = self.shear_modulus.new_value[mask]
        radial_return = self._compute_radial_return(invariant_j2_el,
                                                    yield_stress)
        dev_stress = self.deviatoric_stress_new[mask]
        self._plastic_strain_rate[
            mask] = self._compute_plastic_strain_rate_tensor(
                radial_return, shear_modulus, delta_t, dev_stress)
        self._equivalent_plastic_strain_rate[
            mask] = self._compute_equivalent_plastic_strain_rate(
                invariant_j2_el, shear_modulus, yield_stress, delta_t)
        self._deviatoric_stress_new[mask] *= radial_return[np.newaxis].T