예제 #1
0
        u1_var = []
        u2_var = []
        LM_var = []
        custom_sympy_fe_utilities.CreateVariableMatrixList(u1_var, u1)
        custom_sympy_fe_utilities.CreateVariableMatrixList(u2_var, u2)
        u12_var=u1_var.copy()
        u1_LM_var=u1_var.copy()
        custom_sympy_fe_utilities.CreateVariableMatrixList(u12_var, u2)
        custom_sympy_fe_utilities.CreateVariableMatrixList(LM_var, LM)
        custom_sympy_fe_utilities.CreateVariableMatrixList(u1_LM_var, LM)
        all_var=u12_var.copy()
        custom_sympy_fe_utilities.CreateVariableMatrixList(all_var, LM)

        # Force the variables to be dependendant of the DOF
        if normalvar == 1:
            NormalSlave = custom_sympy_fe_utilities.DefineDofDependencyMatrix(NormalSlave, u1_var)
        DOperator = custom_sympy_fe_utilities.DefineDofDependencyMatrix(DOperator, u12_var) # If you consider Gitterle you need to keep the old operators
        MOperator = custom_sympy_fe_utilities.DefineDofDependencyMatrix(MOperator, u12_var)

        # Definitions of components
        for node in range(nnodes):
            LMNormal[node] = LM.row(node).dot(NormalSlave.row(node))
            wLMNormal[node] = wLM.row(node).dot(NormalSlave.row(node))

            # We calculate the LM tangent resultant
            #aux = LM.row(node).dot(TangentSlave.row(node)) * TangentSlave.row(node)
            #aux_w = wLM.row(node).dot(TangentSlave.row(node)) * TangentSlave.row(node)
            for idim in range(dim):
                #LMTangent[node,idim] = aux[idim]
                #wLMTangent[node,idim] = aux_w[idim]
                LMTangent[node,idim] = LM[node,idim] - LMNormal[node] * NormalSlave[node, idim]
        u1_var = []
        u2_var = []
        lm_var = []
        custom_sympy_fe_utilities.CreateVariableMatrixList(u1_var, u1)
        custom_sympy_fe_utilities.CreateVariableMatrixList(u2_var, u2)
        u12_var = u1_var.copy()
        u1_lm_var = u1_var.copy()
        custom_sympy_fe_utilities.CreateVariableMatrixList(u12_var, u2)
        custom_sympy_fe_utilities.CreateVariableMatrixList(lm_var, LM)
        custom_sympy_fe_utilities.CreateVariableMatrixList(u1_lm_var, LM)
        all_var = u12_var.copy()
        custom_sympy_fe_utilities.CreateVariableMatrixList(all_var, LM)

        # Force the variables to be dependendant of the DOF
        if normalvar == 1:
            NormalSlave = custom_sympy_fe_utilities.DefineDofDependencyMatrix(
                NormalSlave, u1_var)
        DOperator = custom_sympy_fe_utilities.DefineDofDependencyMatrix(
            DOperator, u12_var)
        MOperator = custom_sympy_fe_utilities.DefineDofDependencyMatrix(
            MOperator, u12_var)

        # Defining the normal NormalGap
        Dx1Mx2 = DOperator * x1 - MOperator * x2
        Dw1Mw2 = DOperator * w1 - MOperator * w2

        for node in range(nnodes):
            NormalGap[node] = -Dx1Mx2.row(node).dot(NormalSlave.row(node))

        # Define dofs & test function vector
        dofs = sympy.Matrix(sympy.zeros(number_dof, 1))
        testfunc = sympy.Matrix(sympy.zeros(number_dof, 1))