コード例 #1
0
ファイル: spalling.py プロジェクト: axelvonderheide/scratch
    def get_sig_app(self, sctx, eps_app_eng ):
        sig_eng, D_mtx = self.get_corr_pred( sctx, eps_app_eng, 0, 0, 0 )
        sig_tensor = map3d_sig_eng_to_mtx( sig_eng )           
        # get the transformation matrix
        
        sctx.r_pnt = sctx.loc
        X_pnt = sctx.fets_eval.get_X_pnt( sctx )
        X, Y, Z = X_pnt
        
        L = sqrt( Y**2 + Z**2 )
        if L <= 1e-8:
            sig_another_one = 0.
            sa = 0.
            ca = 0.
        else:
            sa = Z / L
            ca = Y / L
            
            s_alpha = asin(Z / L)
            c_alpha = acos(Z / L)
    
            n = array([ 0, -sa, ca ],dtype='float_' )
            sig_another_one = tensordot( n, dot( n, sig_tensor ), [0,0] )

        T = array( [[1, 0, 0],
                    [0, ca, sa],
                    [0, -sa, ca]], dtype = 'float_' )
        sig_rotated = dot( T, dot( sig_tensor, T.T ) ) 
        return sig_rotated.flatten()
コード例 #2
0
ファイル: fets2D5.py プロジェクト: rosoba/simvisage
    def get_mtrl_corr_pred(self,
                           sctx,
                           eps_eng,
                           d_eps_eng,
                           tn,
                           tn1,
                           eps_avg=None):
        '''Overload the 3D material-corrector-predictor and 
        use the 2D material model instead. This requires to
        map the 3D strains into a 2D plane. This is performed
        employing the direction cosines at each integration
        point (ip). The direction cosines establish the link
        between the global and local coordinate system (the
        reference to the local coordinate system is indicated 
        by the underline character at the end of a variable
        name). 
        After employing the 2D material model the returned 
        stresses and stiffness are augmented with the z_-components
        and transformed into global coordinates. It is assumed
        that in global z-direction the material behaves linear-elastic.
        @todo: check for consistency: 
        
        var A: degenerated volume (assume plane strain eps_z_ == 0)
               for the evaluation of the 2D material model and the 
               damage in the in-plane elasticity components. 
               Then correct the stresses by adding the eps_z_ != 0 
               part. For the linear elastic regime this ends up to
               the standard 3D formulation.
               @todo: check for consistency:
               the damage functions have been obtained based on the 
               assumtion for plane stress (which corresponds to the 
               situation in the experiment). Can the 2D case be 
               reproduced with the choosen implementation? 
        
        '''

        # get the direction cosine at the ip:
        dircos_mtx = self.get_dircos_mtx(sctx)
        dircos_mtx_T = transpose(dircos_mtx)

        # get the Transformation matrices for switching between the
        # local and global coordinate system in 3D case:
        Trans_stress_from_loc_mtx = self.get_Trans_stress_from_loc_mtx(
            dircos_mtx)
        Trans_strain_to_loc_mtx = self.get_Trans_strain_to_loc_mtx(dircos_mtx)

        # switch from engineering notation to matrix notation:
        eps_mtx3D = map3d_eps_eng_to_mtx(eps_eng)
        d_eps_mtx3D = map3d_eps_eng_to_mtx(d_eps_eng)

        # transform strain from global to local coordinates (i.e. map strain into the 2D plane)
        eps_mtx3D_ = dot(dot(dircos_mtx_T, eps_mtx3D), dircos_mtx)
        d_eps_mtx3D_ = dot(dot(dircos_mtx_T, d_eps_mtx3D), dircos_mtx)

        # reduce 3D mtx to 2D mtx (neglecting the strains in local z_ direction!)
        eps_mtx2D_ = eps_mtx3D_[:2, :2]
        d_eps_mtx2D_ = d_eps_mtx3D_[:2, :2]
        #        print 'eps_mtx2D_: ', eps_mtx2D_

        # switch from matrix notation to engineering notation for the strains:
        eps_eng2D_ = map2d_eps_mtx_to_eng(eps_mtx2D_)
        d_eps_eng2D_ = map2d_eps_mtx_to_eng(d_eps_mtx2D_)
        #        print 'eps_eng2D_: ', eps_eng2D_

        ###
        #       # @todo: verify implementation with alternative variant using
        #                    Transformation matrix and engineering notation:
        #        eps_eng3D_   = dot( Trans_strain_to_loc_mtx,  eps_eng  )
        #        d_eps_eng3D_ = dot( Trans_strain_to_loc_mtx, d_eps_eng )
        ###

        # evaluate the 2D mtrl-model
        sig_eng2D_, D_mtx2D_ = self.mats_eval.get_corr_pred(
            sctx, eps_eng2D_, d_eps_eng2D_, tn, tn1)

        #------------------------------------------------------------------------
        # get predictor (D_mtx)
        #------------------------------------------------------------------------

        # Take the initial elastic isotropic matrix as an initial value
        # the submatrix returned by the 2D damage model shall be written
        # into the slice [0:2,0:2] and [5,5]
        #
        D_mtx3D_ = self.elastic_D_mtx3D
        D_mtx3D_[:2, :2] = D_mtx2D_[:2, :2]
        D_mtx3D_[5, 5] = D_mtx2D_[2, 2]
        #        print 'D_mtx3D_', D_mtx3D_

        # transform D_mtx3D from local to global coordinates
        D_mtx3D = dot(Trans_stress_from_loc_mtx,
                      dot(D_mtx3D_, Trans_strain_to_loc_mtx))
        #        print 'D_mtx3D', D_mtx3D

        # Alternative: use numpy functionality and 4th-order tensors
        # @todo: varify the numpy-alternative with the existing implementation
        #        dircos_tns4 = outer( dircos_mtx, dircos_mtx ).reshape(3,3,3,3)
        #        print 'dircos_tns4', dircos_tns4.shape
        #        D_tns4_3D_ = map3d_tns2_to_tns4 ( D_mtx3D_ )
        #        D_tns4_3D  = tensordot( dircos_tns4, tensordot( D_tns4_3D_, dircos_tns4, [[2,3],[2,3]] ), [[2,3],[0,1]] )
        #        D_mtx3D    = map3d_tns4_to_tns2( D_tns4_3D )

        #------------------------------------------------------------------------
        # get corrector (sig_eng)
        #------------------------------------------------------------------------

        # augment 2D matrices to the 3D-case:
        # the material behaves linear-elastic in out-of plane directions (xz, yz);

        # linear-elastic response (used for eps_zz_, eps_yz_, eps_xz_):
        eps_eng3D_ = map3d_eps_mtx_to_eng(eps_mtx3D_)
        sig_eng3D_ = dot(D_mtx3D_, eps_eng3D_)

        # replace the values for xx_, yy_, and xy_ based on the evaluation of mtrl2d:
        # and correct/superpose these values by the elastic response caused by eps_zz_:
        sig_eng3D_[0] = sig_eng2D_[0] + D_mtx3D_[0, 2] * eps_eng3D_[2]
        sig_eng3D_[1] = sig_eng2D_[1] + D_mtx3D_[1, 2] * eps_eng3D_[2]
        sig_eng3D_[5] = sig_eng2D_[2]

        # transform sig_mtx3D from local to global coordinates
        sig_mtx3D_ = map3d_sig_eng_to_mtx(sig_eng3D_)
        sig_mtx3D = dot(dot(dircos_mtx, sig_mtx3D_), dircos_mtx_T)

        # switch from matrix notations to engineering notations for the stresses:
        sig_eng3D = map3d_sig_mtx_to_eng(sig_mtx3D)

        return sig_eng3D, D_mtx3D
コード例 #3
0
ファイル: strain_norm3d.py プロジェクト: simvisage/simvisage
 def get_f_trial(self, epsilon, D_el, E, nu, kappa):
     sigma_I = linalg.eigh(map3d_sig_eng_to_mtx(dot(D_el,epsilon)))[0]#main stresses
     eps_eqv = linalg.norm(where(sigma_I >= 0., sigma_I, zeros(3)))/E#positive part and norm
     return eps_eqv  - kappa
コード例 #4
0
ファイル: fets2D5.py プロジェクト: sarosh-quraishi/simvisage
    def get_mtrl_corr_pred( self, sctx, eps_eng, d_eps_eng, tn, tn1, eps_avg = None ):
        '''Overload the 3D material-corrector-predictor and 
        use the 2D material model instead. This requires to
        map the 3D strains into a 2D plane. This is performed
        employing the direction cosines at each integration
        point (ip). The direction cosines establish the link
        between the global and local coordinate system (the
        reference to the local coordinate system is indicated 
        by the underline character at the end of a variable
        name). 
        After employing the 2D material model the returned 
        stresses and stiffness are augmented with the z_-components
        and transformed into global coordinates. It is assumed
        that in global z-direction the material behaves linear-elastic.
        @todo: check for consistency: 
        
        var A: degenerated volume (assume plane strain eps_z_ == 0)
               for the evaluation of the 2D material model and the 
               damage in the in-plane elasticity components. 
               Then correct the stresses by adding the eps_z_ != 0 
               part. For the linear elastic regime this ends up to
               the standard 3D formulation.
               @todo: check for consistency:
               the damage functions have been obtained based on the 
               assumtion for plane stress (which corresponds to the 
               situation in the experiment). Can the 2D case be 
               reproduced with the choosen implementation? 
        
        '''

        # get the direction cosine at the ip:
        dircos_mtx = self.get_dircos_mtx( sctx )
        dircos_mtx_T = transpose( dircos_mtx )

        # get the Transformation matrices for switching between the 
        # local and global coordinate system in 3D case:
        Trans_stress_from_loc_mtx = self.get_Trans_stress_from_loc_mtx( dircos_mtx )
        Trans_strain_to_loc_mtx = self.get_Trans_strain_to_loc_mtx( dircos_mtx )

        # switch from engineering notation to matrix notation:
        eps_mtx3D = map3d_eps_eng_to_mtx( eps_eng )
        d_eps_mtx3D = map3d_eps_eng_to_mtx( d_eps_eng )

        # transform strain from global to local coordinates (i.e. map strain into the 2D plane) 
        eps_mtx3D_ = dot( dot( dircos_mtx_T, eps_mtx3D ), dircos_mtx )
        d_eps_mtx3D_ = dot( dot( dircos_mtx_T, d_eps_mtx3D ), dircos_mtx )

        # reduce 3D mtx to 2D mtx (neglecting the strains in local z_ direction!)
        eps_mtx2D_ = eps_mtx3D_[:2, :2]
        d_eps_mtx2D_ = d_eps_mtx3D_[:2, :2]
#        print 'eps_mtx2D_: ', eps_mtx2D_

        # switch from matrix notation to engineering notation for the strains:
        eps_eng2D_ = map2d_eps_mtx_to_eng( eps_mtx2D_ )
        d_eps_eng2D_ = map2d_eps_mtx_to_eng( d_eps_mtx2D_ )
#        print 'eps_eng2D_: ', eps_eng2D_

        ###
#       # @todo: verify implementation with alternative variant using
#                    Transformation matrix and engineering notation:
#        eps_eng3D_   = dot( Trans_strain_to_loc_mtx,  eps_eng  )
#        d_eps_eng3D_ = dot( Trans_strain_to_loc_mtx, d_eps_eng )
        ###

        # evaluate the 2D mtrl-model
        sig_eng2D_, D_mtx2D_ = self.mats_eval.get_corr_pred( sctx, eps_eng2D_, d_eps_eng2D_, tn, tn1 )

        #------------------------------------------------------------------------
        # get predictor (D_mtx)        
        #------------------------------------------------------------------------

        # Take the initial elastic isotropic matrix as an initial value
        # the submatrix returned by the 2D damage model shall be written
        # into the slice [0:2,0:2] and [5,5]
        #
        D_mtx3D_ = self.elastic_D_mtx3D
        D_mtx3D_[:2, :2] = D_mtx2D_[:2, :2]
        D_mtx3D_[5, 5] = D_mtx2D_[2, 2]
#        print 'D_mtx3D_', D_mtx3D_

        # transform D_mtx3D from local to global coordinates 
        D_mtx3D = dot( Trans_stress_from_loc_mtx, dot( D_mtx3D_, Trans_strain_to_loc_mtx ) )
#        print 'D_mtx3D', D_mtx3D

        # Alternative: use numpy functionality and 4th-order tensors
        # @todo: varify the numpy-alternative with the existing implementation
#        dircos_tns4 = outer( dircos_mtx, dircos_mtx ).reshape(3,3,3,3) 
#        print 'dircos_tns4', dircos_tns4.shape
#        D_tns4_3D_ = map3d_tns2_to_tns4 ( D_mtx3D_ )
#        D_tns4_3D  = tensordot( dircos_tns4, tensordot( D_tns4_3D_, dircos_tns4, [[2,3],[2,3]] ), [[2,3],[0,1]] )
#        D_mtx3D    = map3d_tns4_to_tns2( D_tns4_3D )        


        #------------------------------------------------------------------------
        # get corrector (sig_eng)        
        #------------------------------------------------------------------------

        # augment 2D matrices to the 3D-case: 
        # the material behaves linear-elastic in out-of plane directions (xz, yz);

        # linear-elastic response (used for eps_zz_, eps_yz_, eps_xz_):
        eps_eng3D_ = map3d_eps_mtx_to_eng( eps_mtx3D_ )
        sig_eng3D_ = dot( D_mtx3D_, eps_eng3D_ )

        # replace the values for xx_, yy_, and xy_ based on the evaluation of mtrl2d:
        # and correct/superpose these values by the elastic response caused by eps_zz_: 
        sig_eng3D_[0] = sig_eng2D_[0] + D_mtx3D_[0, 2] * eps_eng3D_[2]
        sig_eng3D_[1] = sig_eng2D_[1] + D_mtx3D_[1, 2] * eps_eng3D_[2]
        sig_eng3D_[5] = sig_eng2D_[2]

        # transform sig_mtx3D from local to global coordinates
        sig_mtx3D_ = map3d_sig_eng_to_mtx( sig_eng3D_ )
        sig_mtx3D = dot( dot( dircos_mtx, sig_mtx3D_ ), dircos_mtx_T )

        # switch from matrix notations to engineering notations for the stresses:
        sig_eng3D = map3d_sig_mtx_to_eng( sig_mtx3D )

        return sig_eng3D, D_mtx3D
コード例 #5
0
 def get_f_trial(self, epsilon, D_el, E, nu, kappa):
     sigma_I = linalg.eigh(map3d_sig_eng_to_mtx(dot(
         D_el, epsilon)))[0]  #main stresses
     eps_eqv = linalg.norm(where(sigma_I >= 0., sigma_I,
                                 zeros(3))) / E  #positive part and norm
     return eps_eqv - kappa