def getTangentStiffness(self, elemdat):

        sData = getElemShapeData(elemdat.coords)

        kin = Kinematics(3, 6)

        elemdat.outlabel.append(["s11", "s22", "s33", "s23", "s13", "s12"])

        elemdat.outdata = zeros(shape=(len(elemdat.nodes), 6))

        for iData in sData:

            b = self.getBmatrix(iData.dhdx)

            kin.strain = dot(b, elemdat.state)
            kin.dstrain = dot(b, elemdat.Dstate)

            sigma, tang = self.mat.getStress(kin)

            elemdat.stiff += dot(b.transpose(), dot(tang, b)) * iData.weight
            elemdat.fint += dot(b.transpose(), sigma) * iData.weight

            elemdat.outdata += outer(ones(len(elemdat.nodes)), sigma)

        elemdat.outdata *= 1.0 / len(sData)
 def getKinematics(self, dphi, elstate):
     kin = Kinematics(2, 3)
     kin.F = eye(2)
     for i in range(len(dphi)):
         for j in range(2):
             for k in range(2):
                 kin.F[j, k] += dphi[i, k] * elstate[2 * i + j]
     # kin.E = 0.5 * (dot(kin.F.transpose(), kin.F) - eye(2))
     # kin.strain[0] = kin.E[0, 0]
     # kin.strain[1] = kin.E[1, 1]
     # kin.strain[2] = 2.0 * kin.E[0, 1]
     return kin
Exemple #3
0
  def __init__ ( self, elnodes , props ):
    Element.__init__( self, elnodes , props )

    self.rank = props.rank

    if self.rank == 2:
      self.dofTypes = [ 'u' , 'v' , 'temp' ]
      self.nstr = 3
    elif self.rank == 3:
      self.dofTypes = [ 'u' , 'v' , 'w' , 'temp' ]
      self.nstr = 6

    self.kin = Kinematics(self.rank,self.nstr)
    
    self.D     = self.material.heatConductivity*eye(self.rank)
    self.capac = self.material.heatCapacity
    
    self.alpha = self.material.alpha*ones(self.nstr)
    
    if self.rank == 2:
      self.alpha[2] = 0.;
      self.labels = [ "qx" , "qy" ]
    elif self.rank == 3:
      self.alpha[3:] = 0.;
      self.labels = [ "qx" , "qy" , "qz" ]    

    
    self.transient = True
    self.theta = 1.0
 def getTangentStiffness(self, element_data):
     sData = getElemShapeData(element_data.coords)
     kinematic = Kinematics(2, 3)
     element_data.outlabel.append("stresses")
     element_data.outdata = zeros(shape=(len(element_data.nodes), 3))
     for iData in sData:
         B_matrix = self.getBmatrix(iData.dhdx)
         kinematic.strain = dot(B_matrix, element_data.state)
         kinematic.dstrain = dot(B_matrix, element_data.Dstate)
         sigma, tangent_moduli = self.mat.getStress(kinematic)
         element_data.stiff += dot(B_matrix.transpose(),
                                   dot(tangent_moduli,
                                       B_matrix)) * iData.weight
         element_data.fint += dot(B_matrix.transpose(),
                                  sigma) * iData.weight
         element_data.outdata += outer(ones(len(element_data.nodes)), sigma)
     element_data.outdata *= 1.0 / len(sData)
Exemple #5
0
    def getDissipation(self, elemdat):

        rot = self.getRotation(elemdat.coords, elemdat.state)

        sData = getElemShapeData(elemdat.coords[:2, :],
                                 method=self.intMethod,
                                 elemType="Line2")

        kin = Kinematics(2, 2)

        for iData in sData:
            B = self.getBmatrix(iData.h, rot)
            kin.strain = dot(B, elemdat.state)

            sigma, tang = self.mat.getStress(kin)

            elemdat.fint += dot(B.transpose(), kin.dgdstrain) * iData.weight
            elemdat.diss += kin.g * iData.weight
Exemple #6
0
    def __init__(self, elnodes, props):

        Element.__init__(self, elnodes, props)

        if props.rank != 2:
            print("Error")

        self.dofTypes = ['u', 'v']

        self.kin = Kinematics(3, 6)
Exemple #7
0
  def getInternalForce ( self, elemdat ):
   
    rot = self.getRotation( elemdat.coords , elemdat.state )

    sData = getElemShapeData( elemdat.coords[:2,:] , method = self.intMethod , elemType = "Line2" )
    
    elemdat.outlabel.append(["tn","ts","vn","vs"])
    elemdat.outdata  = zeros( shape=(len(elemdat.nodes),4) )

    kin = Kinematics(2,2)

    for (i,iData) in enumerate(sData):
      B              = self.getBmatrix( iData.h , rot )
      kin.strain     = dot( B , elemdat.state )

      sigma,tang = self.mat.getStress( kin )
     
      elemdat.fint  += dot ( B.transpose() , sigma ) * iData.weight
      
      elemdat.outdata += outer( self.m[i:i+4], hstack([sigma,kin.strain]) )
Exemple #8
0
  def getInternalForce ( self, elemdat ):
   
    rot = self.getRotation( elemdat.coords , elemdat.state )

    sData = getElemShapeData( elemdat.coords[:2,:] , method = self.intMethod , elemType = "Line2" )
    
    elemdat.outlabel.append("tractions")
    elemdat.outdata  = zeros( shape=(len(elemdat.nodes),2) )

    kin = Kinematics(2,2)

    for iData in sData:
      B              = self.getBmatrix( iData.h , rot )
      kin.strain     = dot( B , elemdat.state )

      sigma,tang = self.mat.getStress( kin )
     
      elemdat.fint  += dot ( B.transpose() , sigma ) * iData.weight
      
      elemdat.outdata += outer( ones(len(elemdat.nodes)), sigma )
    def getInternalForce(self, elemdat):

        sData = getElemShapeData(elemdat.coords)

        kin = Kinematics(3, 6)

        elemdat.outlabel.append(["s11", "s22", "s33", "s23", "s13", "s12"])

        elemdat.outdata = zeros(shape=(len(elemdat.nodes), 6))

        for iData in sData:
            b = self.getBmatrix(iData.dhdx)

            kin.strain = dot(b, elemdat.state)
            kin.dstrain = dot(b, elemdat.Dstate)

            sigma, tang = self.mat.getStress(kin)

            elemdat.fint += dot(b.transpose(), sigma) * iData.weight

            self.appendNodalOutput(self.mat.outLabels(), self.mat.outData())
  def getInternalForce ( self, elemdat ):
      
    sData = getElemShapeData( elemdat.coords )

    elemdat.outlabel.append("stresses")
    elemdat.outdata  = zeros( shape=(len(elemdat.nodes),3) )

    kin = Kinematics(2,3)

    for iData in sData:
      b = self.getBmatrix( iData.dhdx )

      kin.strain  = dot ( b , elemdat.state )
      kin.dstrain = dot ( b , elemdat.Dstate )

      sigma,tang = self.mat.getStress( kin )

      elemdat.fint    += dot ( b.transpose() , sigma ) * iData.weight
      elemdat.outdata += outer( ones(len(self)), sigma )
      
    elemdat.outdata *= 1.0 / len(sData)  
Exemple #11
0
    def getInternalForce(self, elemdat):

        sData = getElemShapeData(elemdat.coords)

        elemdat.outlabel.append("stresses")
        elemdat.outdata = zeros(shape=(len(elemdat.nodes), 3))

        kin = Kinematics(2, 3)

        for iData in sData:
            b = self.getBmatrix(iData.dhdx)

            kin.strain = dot(b, elemdat.state)
            kin.dstrain = dot(b, elemdat.Dstate)

            sigma, tang = self.mat.getStress(kin)

            elemdat.fint += dot(b.transpose(), sigma) * iData.weight
            elemdat.outdata += outer(ones(len(self)), sigma)

        elemdat.outdata *= 1.0 / len(sData)
Exemple #12
0
    def __init__(self, elnodes, props):

        self.method = "TL"

        Element.__init__(self, elnodes, props)

        if props.rank != 2:
            print("Error")

        self.dofTypes = ['u', 'v']
        self.nstr = 6

        self.kin = Kinematics(self.rank, self.nstr)
 def getInternalForce(self, element_data):
     sData = getElemShapeData(element_data.coords)
     element_data.outlabel.append("stresses")
     element_data.outlabel.append("stress_elements")
     element_data.stress_elements = zeros(shape=(len(element_data.nodes),
                                                 3),
                                          dtype=float)
     element_data.outdata = zeros(shape=(len(element_data.nodes), 3))
     kinematic = Kinematics(2, 3)
     for iData in sData:
         B_matrix = self.getBmatrix(iData.dhdx)
         kinematic.strain = dot(B_matrix, element_data.state)
         kinematic.dstrain = dot(B_matrix, element_data.Dstate)
         sigma, tangentModuli = self.mat.getStress(
             kinematic)  #  Original code
         #sigma = self.mat.mat.sigma  # Minh's modification code
         element_data.fint += dot(B_matrix.transpose(),
                                  sigma) * iData.weight
         element_data.outdata += outer(ones(len(self)), sigma)
         element_data.stress_elements += outer(ones(len(self)), sigma)
     element_data.outdata *= 1.0 / len(sData)
     element_data.stress_elements *= 1.0 / len(sData)
Exemple #14
0
    def __init__(self, elnodes, props):
        Element.__init__(self, elnodes, props)

        param = SLSparameters(len(elnodes))

        self.kinematic = SLSkinematic(param)
        self.layers = LayerData(props)

        param.nLay = len(self.layers)
        self.stresscont = StressContainer(param)

        self.condman = CondensationManager(24, 28)
        self.kin = Kinematics(3, 6)
Exemple #15
0
    def getInternalForce(self, elemdat):

        rot = self.getRotation(elemdat.coords, elemdat.state)

        sData = getElemShapeData(elemdat.coords[:2, :],
                                 method=self.intMethod,
                                 elemType="Line2")

        elemdat.outlabel.append("tractions")
        elemdat.outdata = zeros(shape=(len(elemdat.nodes), 2))

        kin = Kinematics(2, 2)

        for iData in sData:
            B = self.getBmatrix(iData.h, rot)
            kin.strain = dot(B, elemdat.state)

            sigma, tang = self.mat.getStress(kin)

            elemdat.fint += dot(B.transpose(), sigma) * iData.weight

            elemdat.outdata += outer(ones(len(elemdat.nodes)), sigma)
Exemple #16
0
    def getTangentStiffness(self, elemdat):

        rot = self.getRotation(elemdat.coords, elemdat.state)

        sData = getElemShapeData(elemdat.coords[:2, :],
                                 method=self.intMethod,
                                 elemType="Line2")

        elemdat.outlabel.append(["tn", "ts", "vn", "vs"])
        elemdat.outdata = zeros(shape=(len(elemdat.nodes), 4))

        kin = Kinematics(2, 2)

        for (i, iData) in enumerate(sData):
            B = self.getBmatrix(iData.h, rot)
            kin.strain = dot(B, elemdat.state)

            sigma, tang = self.mat.getStress(kin)

            elemdat.stiff += dot(B.transpose(), dot(tang, B)) * iData.weight
            elemdat.fint += dot(B.transpose(), sigma) * iData.weight

            self.appendNodalOutput(self.mat.outLabels(), self.mat.outData())
Exemple #17
0
    def __init__(self, elnodes, props):
        Element.__init__(self, elnodes, props)

        self.rank = props.rank

        if self.rank == 2:
            self.dofTypes = ['u', 'v']
            self.nstr = 3
            self.outputLabels = ["s11", "s22", "s12"]
        elif self.rank == 3:
            self.dofTypes = ['u', 'v', 'w']
            self.nstr = 6
            self.outputLabels = ["s11", "s22", "s33", "s23", "s13", "s12"]

        self.kin = Kinematics(self.rank, self.nstr)
Exemple #18
0
    def __init__(self, elnodes, props):

        self.method = "TL"

        Element.__init__(self, elnodes, props)

        self.rank = props.rank

        if self.rank == 2:
            self.dofTypes = ['u', 'v']
            self.nstr = 3
        elif self.rank == 3:
            self.dofTypes = ['u', 'v', 'w']
            self.nstr = 6

        self.kin = Kinematics(self.rank, self.nstr)
Exemple #19
0
  def __init__ ( self, elnodes , props ):
    Element.__init__( self, elnodes , props )

    self.rank = props.rank
    self.k    = 1.0e-6

    if self.rank == 2:
      self.dofTypes = [ 'u' , 'v' , 'phase' ]
      self.nstr = 3
    elif self.rank == 3:
      print("Error")

    self.kin = Kinematics(self.rank,self.nstr)
    
    self.hisOld = zeros(4)
    self.hisNew = zeros(4)
    def __init__(self, elnodes, props):

        Element.__init__(self, elnodes, props)

        if props.rank != 2:
            raise RuntimeError(
                "This is an axisymmetric element. Please use an input mesh with rank 2."
            )

        self.dofTypes = ['u', 'v', 'temp']

        self.kin = Kinematics(3, 6)

        self.D = self.material.heatConductivity * eye(2)
        self.capac = self.material.heatCapacity

        self.alpha = self.material.alpha * ones(4)
        self.alpha[3] = 0.

        self.labels = ["qr", "qz"]

        self.transient = True
        self.theta = 1.0
  def getKinematics( self , dphi , elstate ):
  
    kin = Kinematics(2,3)

    kin.F = eye(2)
  
    for i in range(len(dphi)):
      for j in range(2):
        for k in range(2):
          kin.F[j,k] += dphi[i,k]*elstate[2*i+j]

    kin.E = 0.5*(dot(kin.F.transpose(),kin.F)-eye(2))

    kin.strain[0] = kin.E[0,0]
    kin.strain[1] = kin.E[1,1]
    kin.strain[2] = 2.0*kin.E[0,1]
    
    return kin
Exemple #22
0
    def getKinematics(self, dphi, h, elemdat, r):

        kin = Kinematics(3, 6)

        kin.F = eye(3)
        kin.F0 = eye(3)

        elstate = elemdat.state
        elstate0 = elstate - elemdat.Dstate

        invr = 1.0 / r

        for i, (dp, p) in enumerate(zip(dphi, h)):
            kin.F[0, 0] += dp[0] * elstate[2 * i]
            kin.F[0, 1] += dp[1] * elstate[2 * i]
            kin.F[1, 0] += dp[0] * elstate[2 * i + 1]
            kin.F[1, 1] += dp[1] * elstate[2 * i + 1]
            kin.F[2, 2] += p * elstate[2 * i] * invr

            kin.F0[0, 0] += dp[0] * elstate0[2 * i]
            kin.F0[0, 1] += dp[1] * elstate0[2 * i]
            kin.F0[1, 0] += dp[0] * elstate0[2 * i + 1]
            kin.F0[1, 1] += dp[1] * elstate0[2 * i + 1]
            kin.F0[2, 2] += p * elstate0[2 * i] * invr

        kin.E = 0.5 * (dot(kin.F.transpose(), kin.F) - eye(3))
        kin.E0 = 0.5 * (dot(kin.F0.transpose(), kin.F0) - eye(3))

        dE = kin.E - kin.E0

        kin.strain[0] = kin.E[0, 0]
        kin.strain[1] = kin.E[1, 1]
        kin.strain[2] = kin.E[2, 2]
        kin.strain[3] = 2.0 * kin.E[1, 2]
        kin.strain[4] = 2.0 * kin.E[0, 2]
        kin.strain[5] = 2.0 * kin.E[0, 1]

        return kin
Exemple #23
0
  def getKinematics( self , dphi , elstate ):
  
    kin = Kinematics(self.rank,self.nstr)

    kin.F = eye(self.rank)
  
    for i in range(len(dphi)):
      for j in range(self.rank):
        for k in range(self.rank):
          kin.F[j,k] += dphi[i,k]*elstate[self.rank*i+j]

    kin.E = 0.5*(dot(kin.F.transpose(),kin.F)-eye(self.rank))

    kin.strain[0] = kin.E[0,0]
    kin.strain[1] = kin.E[1,1]

    if self.rank == 2:
      kin.strain[2] = 2.0*kin.E[0,1]
    elif self.rank == 3:
      kin.strain[2] =     kin.E[2,2]
      kin.strain[3] = 2.0*kin.E[1,2]
      kin.strain[4] = 2.0*kin.E[0,2]
      kin.strain[5] = 2.0*kin.E[0,1]
    
    return kin