// Return result of matrix and vector multiplying public static CVector fMultiplyMatrVectr(CMatrix fM1, CVector fM2) { // Number of Matrix M1 rows and columns int iM1_iRowsMax = (int)Math.Sqrt(fM1.m_fArrMembers.Length); // square int iM1_jColsMax = (int)Math.Sqrt(fM1.m_fArrMembers.Length); // Number of Matrix M2 rows and columns int iM2_iRowsMax = (int)fM2.FVectorItems.Length; // Number of columns of the first one must be equal to number of rows of the second // Number of rows of the first one must be equal to number of columns of the second if (iM1_jColsMax != iM2_iRowsMax) { throw new ArgumentException(); } // Output Matrix CVector fM = new CVector(iM1_iRowsMax); for (int i = 0; i < iM1_iRowsMax; ++i) { float sum = 0; for (int it = 0; it < iM1_jColsMax; ++it) { sum += fM1.m_fArrMembers[i, it] * fM2.FVectorItems[it]; } fM.FVectorItems[i] = sum; } return fM; }
//----------------------------------------------------------------------------------------------- public CMatrix(CMatrix m11, CMatrix m12, CMatrix m21, CMatrix m22) { m_fArrMembersABxCD = new CMatrix [2,2]; m_fArrMembersABxCD[0, 0] = m11; m_fArrMembersABxCD[0, 1] = m12; m_fArrMembersABxCD[1, 0] = m21; m_fArrMembersABxCD[1, 1] = m22; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Change matrix sign ///// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static CMatrix fChangeSignMatr(CMatrix fM) { for (int i = 0; i < (int)Math.Sqrt(fM.m_fArrMembers.Length); i++) { for (int j = 0; j < (int)Math.Sqrt(fM.m_fArrMembers.Length); j++) fM.m_fArrMembers[i, j] = -fM.m_fArrMembers[i, j]; } return fM; }
// Return transformed matrix - change rows and columns public static CMatrix GetTransMatrix(CMatrix fM) { // Number of Matrix M rows and columns int iM_iRowsMax = (int)Math.Sqrt(fM.m_fArrMembers.Length); // square int iM_jColsMax = (int)Math.Sqrt(fM.m_fArrMembers.Length); // Output Matrix CMatrix fM_T = new CMatrix(iM_jColsMax, iM_iRowsMax); for (int i = 0; i < iM_jColsMax; i++) for (int j = 0; j < iM_iRowsMax; j++) fM_T.m_fArrMembers[i, j] = fM.m_fArrMembers[j, i]; return fM_T; }
public static CVector fGetSum(CMatrix mat1, CVector mat2) { // Skontrolovat !!!!!! if ((int)Math.Sqrt(mat1.m_fArrMembers.Length) == mat2.FVectorItems.Length) { CVector newMatrix = new CVector(mat2.FVectorItems.Length); for (int x = 0; x < (int)Math.Sqrt(mat1.m_fArrMembers.Length); x++) for (int y = 0; y < mat2.FVectorItems.Length; y++) newMatrix.FVectorItems[x] = mat1.m_fArrMembers[x, y] + mat2.FVectorItems[x]; return newMatrix; } else { //Error - exception return null; } }
// Return result of matrix multiplying public static CMatrix fMultiplyMatr(CMatrix fM1, CMatrix fM2) { if (fM1.m_fArrMembers == null || fM2.m_fArrMembers == null) // Empty matrix { throw new ArgumentException(); } // Number of Matrix M1 rows and columns int iM1_iRowsMax = (int)Math.Sqrt(fM1.m_fArrMembers.Length); // square int iM1_jColsMax = (int)Math.Sqrt(fM1.m_fArrMembers.Length); // Number of Matrix M2 rows and columns int iM2_iRowsMax = (int)Math.Sqrt(fM2.m_fArrMembers.Length); int iM2_jColsMax = (int)Math.Sqrt(fM2.m_fArrMembers.Length); // Number of columns of the first one must be equal to number of rows of the second // Number of rows of the first one must be equal to number of columns of the second if (iM1_jColsMax != iM2_iRowsMax) { throw new ArgumentException(); } // Output Matrix CMatrix fM = new CMatrix(iM1_iRowsMax, iM2_jColsMax); for (int i = 0; i < iM1_iRowsMax; ++i) { for (int j = 0; j < iM2_jColsMax; ++j) { float sum = 0; for (int it = 0; it < iM1_jColsMax; ++it) { sum += fM1.m_fArrMembers[i, it] * fM2.m_fArrMembers[it, j]; } fM.m_fArrMembers[i, j] = sum; } } return fM; }
// GENERAL FEM OPERATIONS // Return partial matrix k11 of global matrix of FEM 1D element CMatrix GetPartM_k11(CMatrix fMk_0, CMatrix fMA) { // [fMA]T * [fMk_0] * [fMA] // Output Matrix return MatrixF.fMultiplyMatr(MatrixF.fMultiplyMatr(MatrixF.GetTransMatrix(fMA), fMk_0), fMA); }
CMatrix fGetGlobM(CMatrix fMk11, CMatrix fMk12, CMatrix fMk21, CMatrix fMk22) { // Number of Matrix M rows and columns // Output Matrix return new CMatrix( fMk11, fMk12, fMk21,fMk22); }
public void FillBasic3_StiffMatrices() { // Get Element support type // Depends on nodal support and element releases m_eSuppType = Get_iElemSuppType(); // Get local matrix acc. to end support/restraint of element GetLocMatrix_2D(); // Check of partial matrices members // Partial matrices of global matrix of member 3 x 3 //if(bDebug) //Console.WriteLine(m_fkLocMatr.Print2DMatrix()); // Return partial matrixes and global matrix of FEM element 6 x 6 (2*3x2*3) 2D m_fKGlobM = new CMatrix( GetPartM_k11(m_fkLocMatr, m_fATRMatr2D), GetPartM_k12(m_fkLocMatr, m_fATRMatr2D, m_fBTTMatr2D), GetPartM_k21(m_fkLocMatr, m_fATRMatr2D, m_fBTTMatr2D), GetPartM_k22(m_fkLocMatr, m_fATRMatr2D, m_fBTTMatr2D) ); }
public void Print2DMatrixFormated_ABxCD(CMatrix[,] fM_ABxCD) { Print2DMatrixFormated_ABxCD(fM_ABxCD, 5); }
public void Print2DMatrixFormated_ABxCD(CMatrix[,] fM_ABxCD, int precision) { // Determine the largest entry width in characters // so that we can make all columns an equal width. int largestEntryWidth = 1; for (int l = 0; l < Math.Sqrt(fM_ABxCD.Length); l++) // SubMatrix rows { for (int m = 0; m < Math.Sqrt(fM_ABxCD.Length); m++) // SubMatrix columns { for (int i = 0; i < fM_ABxCD[l, m].m_iRows; i++) { for (int j = 0; j < fM_ABxCD[l, m].m_iColumns; j++) { String text = String.Format(String.Empty + '{' + '0' + ':' + 'g' + precision + '}', fM_ABxCD[l, m].m_fArrMembers[i, j]); if (text.Length > largestEntryWidth) { largestEntryWidth = text.Length; } } } } } // Print each row of the matrix. for (int i = 0; i < 2 * fM_ABxCD[0,0].m_iRows; i++) { System.Console.Write('['); for (int j = 0; j < 2 * fM_ABxCD[0,0].m_iColumns; j++) { System.Console.Write(' '); String text; if (i < fM_ABxCD[0, 0].m_iRows && j < fM_ABxCD[0, 0].IColumns) // k11 text = String.Format(String.Empty + '{' + '0' + ',' + largestEntryWidth + ':' + 'g' + precision + '}', fM_ABxCD[0,0].m_fArrMembers[i, j]); else if(i < fM_ABxCD[0, 0].m_iRows && j >= fM_ABxCD[0, 0].IColumns) // k12 text = String.Format(String.Empty + '{' + '0' + ',' + largestEntryWidth + ':' + 'g' + precision + '}', fM_ABxCD[0,1].m_fArrMembers[i, j-fM_ABxCD[0,1].IColumns]); else if(i >= fM_ABxCD[0, 0].m_iRows && j < fM_ABxCD[0, 0].IColumns) // k21 text = String.Format(String.Empty + '{' + '0' + ',' + largestEntryWidth + ':' + 'g' + precision + '}', fM_ABxCD[1, 0].m_fArrMembers[i- fM_ABxCD[1,0].IRows, j]); else // k22 text = String.Format(String.Empty + '{' + '0' + ',' + largestEntryWidth + ':' + 'g' + precision + '}', fM_ABxCD[1, 1].m_fArrMembers[i - fM_ABxCD[1, 1].IRows, j - fM_ABxCD[1, 1].IColumns]); System.Console.Write(text); // Separator if ((j + 1) < 2 * fM_ABxCD[0,0].m_iColumns) { System.Console.Write(';'); } else { System.Console.Write(' '); } } System.Console.WriteLine(']'); } System.Console.WriteLine(' '); // Empty line }
public void FillBasic3_StiffMatrices() { // Get Element support type // Depends on nodal support and element releases m_eSuppType2D = Get_iElemSuppType2D(); // Return 3 - dimensional array - support types for UXRX, UYRZ, UZRY Get_iElemSuppType3D(m_eSuppType2D); // Set m_eSuppType3D // Get local matrix acc. to end support/restraint of element GetLocMatrix_3D(); // Check of partial matrices members // Partial matrices of global matrix of member 6 x 6 //if(bDebug) //Console.WriteLine(m_fkLocMatr.Print3DMatrix()); // Return partial matrixes and global matrix of FEM element 12 x 12 (2*6x2*6) 3D m_fKGlobM = new CMatrix( GetPartM_k11(m_fkLocMatr, m_fATRMatr3D), GetPartM_k12(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D), GetPartM_k21(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D), GetPartM_k22(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D) ); }
public static CVector fGetSum(CVector mat2, CMatrix mat1) { return fGetSum(mat1, mat2); }
// Transformation Matrix of Element Rotation - 3D // 6x6 private CMatrix Get_AMatr3D1() { /* // Angles SGCSAngles sAngles = Get_Angles(); // Matrix Members float flambda1 = (float)Math.Cos(sAngles.fAngleXx0); float flambda2 = (float)Math.Cos(sAngles.fAngleXy0); float flambda3 = (float)Math.Cos(sAngles.fAngleXz0); float fmu1 = (float)Math.Cos(sAngles.fAngleYx0); float fmu2 = (float)Math.Cos(sAngles.fAngleYy0); float fmu3 = (float)Math.Cos(sAngles.fAngleYz0); float fv1 = (float)Math.Cos(sAngles.fAngleZx0); float fv2 = (float)Math.Cos(sAngles.fAngleZy0); float fv3 = (float)Math.Cos(sAngles.fAngleZz0); */ CMatrix RPart = new CMatrix(3,3); RPart.m_fArrMembers = RPart.fTransMatrix(m_flength_X, m_flength_Y, m_flength_Z, FLength, m_frotation_angle, m_fC_GCS_Coord); float flambda1 = RPart.m_fArrMembers[0, 0]; float flambda2 = RPart.m_fArrMembers[1, 0]; float flambda3 = RPart.m_fArrMembers[2, 0]; float fmu1 = RPart.m_fArrMembers[0, 1]; float fmu2 = RPart.m_fArrMembers[1, 1]; float fmu3 = RPart.m_fArrMembers[2, 1]; float fv1 = RPart.m_fArrMembers[0, 2]; float fv2 = RPart.m_fArrMembers[1, 2]; float fv3 = RPart.m_fArrMembers[2, 2]; /* float[,] RPart = new float[3, 3] { { flambda1, fmu1, fv1 }, { flambda2, fmu2, fv2 }, { flambda3, fmu3, fv3 } }; */ CMatrix fM_output = new CMatrix(6); fM_output.m_fArrMembers = new float[6, 6] { { flambda1, fmu1, fv1, 0f, 0f, 0f }, { flambda2, fmu2, fv2, 0f, 0f, 0f }, { flambda3, fmu3, fv3, 0f, 0f, 0f }, { 0f, 0f, 0f, flambda1, fmu1, fv1 }, { 0f, 0f, 0f, flambda2, fmu2, fv2 }, { 0f, 0f, 0f, flambda3, fmu3, fv3 }, }; return fM_output; }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // posuvne ulozenie - valcovy klb / spojite rovnomerne zatazenie - 3D // najst podklady pre priecne zatazenie !!!! ???????????????????????????????????????????????????????????????? //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- private CMatrix GetLocMatrix_3D_000____00___() { // Local Stiffeness Matrix Members float fEA_len = m_Mat.m_fE * m_CrSc.FA_g / FLength; float f_EIy = m_Mat.m_fE * m_CrSc.FI_y; float f3EIy_len3 = (3f * f_EIy * m_CrSc.FI_y) / (float)Math.Pow(FLength, 3f); float f3EIy_len2 = (3f * f_EIy) / (float)Math.Pow(FLength, 2f); float f3EIy_len1 = (3f * f_EIy) / FLength; float f_EIz = m_Mat.m_fE * m_CrSc.FI_z; float f3EIz_len3 = (3f * f_EIz * m_CrSc.FI_z) / (float)Math.Pow(FLength, 3f); float fGIT_len1 = m_Mat.m_fG * m_CrSc.FI_t / FLength; // Local Stiffeness Matrix CMatrix fM = new CMatrix(6); fM.m_fArrMembers = new float[6, 6] { {fEA_len, 0f, 0f, 0f, 0f, 0f }, { 0f, f3EIz_len3, 0f, 0f, 0f, 0f }, { 0f, 0f, f3EIy_len3, 0f, -f3EIy_len2, 0f }, { 0f, 0f, 0f, fGIT_len1, 0f, 0f }, { 0f, 0f,-f3EIy_len2, 0f, f3EIy_len1, 0f }, { 0f, 0f, 0f, 0f, 0f, 0f } }; return fM; }
private void GetLocMatrix_3D() { switch (m_eSuppType3D) { case EElemSuppType3D.e3DEl_000000_000000: m_fkLocMatr = GetLocMatrix_3D_000000_000000(); break; case EElemSuppType3D.e3DEl_000000_000___: case EElemSuppType3D.e3DEl_000____000000: m_fkLocMatr = GetLocMatrix_3D_000000_000___a(); // !!!! break; case EElemSuppType3D.e3DEl_000000_0_00_0: case EElemSuppType3D.e3DEl_0_00_0_000000: case EElemSuppType3D.e3DEl_0000___0000__: //? Overit - Prut klbovo ulozeny pre RY a RZ, RX je zamedzene na oboch koncoch, priecne zatazenie case EElemSuppType3D.e3DEl_0000____000__: //? Overit - Uvolneny posun UX na konci, uvolnenie RY a RZ na oboch koncoch case EElemSuppType3D.e3DEl__000___0000__: //? Overit - Uvolneny posun UX na zaciatku, uvolnenie RY a RZ na oboch koncoch m_fkLocMatr = GetLocMatrix_3D_000000_0_00_0(); break; case EElemSuppType3D.e3DEl_000000_______: case EElemSuppType3D.e3DEl________000000: m_fkLocMatr = GetLocMatrix_3D_000000_______(); // !!!! break; default: // Error or unsupported element - exception m_fkLocMatr.m_fArrMembers = null; break; } }
// Transformation Matrix of Element Rotation - 3D // 2x2 - 3x3 public float[,][,] Get_AMatr3D0() { /* // Angles SGCSAngles sAngles = Get_Angles(); // Matrix Members float flambda1 = (float)Math.Cos(sAngles.fAngleXx0); float flambda2 = (float)Math.Cos(sAngles.fAngleXy0); float flambda3 = (float)Math.Cos(sAngles.fAngleXz0); float fmu1 = (float)Math.Cos(sAngles.fAngleYx0); float fmu2 = (float)Math.Cos(sAngles.fAngleYy0); float fmu3 = (float)Math.Cos(sAngles.fAngleYz0); float fv1 = (float)Math.Cos(sAngles.fAngleZx0); float fv2 = (float)Math.Cos(sAngles.fAngleZy0); float fv3 = (float)Math.Cos(sAngles.fAngleZz0); */ CMatrix RPart = new CMatrix (3); RPart.m_fArrMembers = RPart.fTransMatrix(m_flength_X, m_flength_Y, m_flength_Z, FLength, m_frotation_angle, m_fC_GCS_Coord); /* float[,] RPart = new float[3, 3] { { flambda1, fmu1, fv1 }, { flambda2, fmu2, fv2 }, { flambda3, fmu3, fv3 } }; */ float[,] MZero = new float[3, 3] { { 0f, 0f, 0f }, { 0f, 0f, 0f }, { 0f, 0f, 0f } }; // Local Stiffeness Matrix return new float[2, 2][,] { { RPart.m_fArrMembers, MZero }, { MZero, RPart.m_fArrMembers } }; }
// Return partial matrix k22 of global matrix of FEM 1D element CMatrix GetPartM_k22(CMatrix fMk_0, CMatrix fMA, CMatrix fMB) { // Output Matrix return MatrixF.fMultiplyMatr(fMB, MatrixF.GetTransMatrix(MatrixF.fMultiplyMatr(MatrixF.fMultiplyMatr(fMB, MatrixF.GetTransMatrix(fMA)), MatrixF.fMultiplyMatr(fMk_0, fMA)))); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TEMPORARY EXAMPLE DATA // Consructor - old public CFEM_CALC() { // Geometry float fGeom_a = 4f, fGeom_b = 5f, fGeom_c = 3.5f; // Unit [m] // Material CMaterial m_Mat = new CMaterial(); // Cross-section CCrSc m_CrSc = new CCrSc_3_00(0, 8, 300, 125, 16.2f, 10.8f, 10.8f, 6.5f, 241.6f); // I 300 section // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! m_CrSc.FI_t = 5.69e-07f; m_CrSc.FI_y = 9.79e-05f; m_CrSc.FI_z = 4.49e-06f; m_CrSc.FA_g = 6.90e-03f; m_CrSc.FA_vy = 4.01e-03f; m_CrSc.FA_vz = 2.89e-03f; // Define Nodes Properties for (int i = 0; i < iNNoTot; i++) { // Create auxiliary Node object CFemNode CNode_i = new CFemNode(iNodeDOFNo); // Fill array object item with auxliary Node m_NodeArray[i] = CNode_i; } // Node 1 m_NodeArray[0].ID = 1; m_NodeArray[0].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUX] = fGeom_a; m_NodeArray[0].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUY] = 0f; m_NodeArray[0].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUZ] = 0f; // Node 2 m_NodeArray[1].ID = 2; m_NodeArray[1].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUX] = 0f; m_NodeArray[1].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUY] = 0f; m_NodeArray[1].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUZ] = 0f; // Node 3 m_NodeArray[2].ID = 5; m_NodeArray[2].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUX] = fGeom_a; m_NodeArray[2].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUY] = 0f; m_NodeArray[2].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUZ] = -fGeom_c; // Node 4 m_NodeArray[3].ID = 3; m_NodeArray[3].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUX] = fGeom_a; m_NodeArray[3].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUY] = -fGeom_b; m_NodeArray[3].m_fVNodeCoordinates.FVectorItems[(int) e3D_DOF.eUZ] = 0f; // Set Nodal Supports (for restraint set 0f) // Node 1 // Node 2 m_NodeArray[1].m_VDisp.FVectorItems[0] = 0f; m_NodeArray[1].m_VDisp.FVectorItems[1] = 0f; m_NodeArray[1].m_VDisp.FVectorItems[2] = 0f; m_NodeArray[1].m_VDisp.FVectorItems[3] = 0f; m_NodeArray[1].m_VDisp.FVectorItems[4] = 0f; m_NodeArray[1].m_VDisp.FVectorItems[5] = 0f; // Node 3 m_NodeArray[2].m_VDisp.FVectorItems[0] = 0f; m_NodeArray[2].m_VDisp.FVectorItems[1] = 0f; m_NodeArray[2].m_VDisp.FVectorItems[2] = 0f; m_NodeArray[2].m_VDisp.FVectorItems[3] = 0f; m_NodeArray[2].m_VDisp.FVectorItems[4] = 0f; m_NodeArray[2].m_VDisp.FVectorItems[5] = 0f; // Node 4 m_NodeArray[3].m_VDisp.FVectorItems[0] = 0f; m_NodeArray[3].m_VDisp.FVectorItems[1] = 0f; m_NodeArray[3].m_VDisp.FVectorItems[2] = 0f; m_NodeArray[3].m_VDisp.FVectorItems[3] = 0f; m_NodeArray[3].m_VDisp.FVectorItems[4] = 0f; m_NodeArray[3].m_VDisp.FVectorItems[5] = 0f; // Set Global Code Numbers int m_iCodeNo = 0; // Number of unrestrained degrees of freedom - finally gives size of structure global matrix foreach (CFemNode i_CNode in m_NodeArray) // Each Node { for (int i = 0; i < iNodeDOFNo; i++) // Each DOF { if (i_CNode.m_VDisp.FVectorItems[i] != 0) // Perform for not restrained DOF { i_CNode.m_ArrNCodeNo[i] = m_iCodeNo; // Set global code number of degree of freedom (DOF) m_iCodeNo++; } } } // Fill members of structure global vector of displacement // Now we know number of not restrained DOF, so we can allocate array size m_fDisp_Vector_CN = new int[m_iCodeNo,3]; // 1st - global DOF code number, 2nd - Node index, 3rd - local code number of DOF in NODE FillGlobalDisplCodeNoOld(); //////////////////////////////////////////////////////////////////////////////////// // Set Nodal Loads (acting directly in nodes) //////////////////////////////////////////////////////////////////////////////////// // !!!!!! No kind of these loads actually /////////////////////////////////////////////////////////////////////////////////////// // Define FEM 1D elements /////////////////////////////////////////////////////////////////////////////////////// for (int i = 0; i < iElemNoTot; i++) { // Create auxiliary Element object CE_1D CElement_i = new CE_1D(); // Fill array object item m_ELemArray[i] = CElement_i; // Create auxiliary Element Load Object CLoad CLoad_i = new CLoad(); // Fill array object item m_ELoadArray[i] = CLoad_i; } // Member 1 [0] Nodes 1 - 2 ([0] [1]) m_ELemArray[0].NodeStart = m_NodeArray[0]; m_ELemArray[0].NodeEnd = m_NodeArray[1]; // Element Type m_ELemArray[0].m_eSuppType3D = EElemSuppType3D.e3DEl_000000_000000; // Element Material m_ELemArray[0].m_Mat = m_Mat; // Element Corss-section m_ELemArray[0].m_CrSc = m_CrSc; // Fill Basic Element Data m_ELemArray[0].FillBasic2(); // Load of Element only due to Element Transversal Forces m_ELoadArray[0].GetEndLoad_g(m_ELemArray[0], m_fq); // Output // kij_0 - local stiffeness matrix 6 x 6 m_ELemArray[0].m_fkLocMatr.Print2DMatrixFormated(); // A Tranformation Rotation Matrixes 6 x 6 m_ELemArray[0].m_fATRMatr3D.Print2DMatrixFormated(); // B Transfer Matrixes 6 x 6 m_ELemArray[0].m_fBTTMatr3D.Print2DMatrixFormated(); // Kij - global matrix of member 12 x 12 m_ELemArray[0].m_fKGlobM.Print2DMatrixFormated(); // Element Load Vector 2 x 6 m_ELemArray[0].m_ArrElemPEF_LCS.Print2DMatrixFormated(); #region MATRIX TEST ///////////////////////////////////////////////////////////////////////////////////////////////////// // TEST /* float[,] farrk11 = new float[6, 6]; float[,] farrk12 = new float[6, 6]; float[,] farrk21 = new float[6, 6]; float[,] farrk22 = new float[6, 6]; // Fill array for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { farrk11[i, j] = ((i+1)*10)+1 + j; } } for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { farrk12[i, j] = ((i + 1) * 10) + 1 + j; } } for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { farrk21[i, j] = ((i + 1) * 10) + 1 + j; } } for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { farrk22[i, j] = ((i + 1) * 10) + 1 + j; } } float[,][,] farrK = new float[2, 2][,] {{farrk11, farrk12}, {farrk21, farrk22}}; Console.WriteLine(m_ELemArray[0].CM.Print2DMatrix(farrK, 2, 6)); */ ////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endregion // Member 2 [1] Nodes 1 - 3 ([0] [2]) m_ELemArray[1].NodeStart = m_NodeArray[0]; m_ELemArray[1].NodeEnd = m_NodeArray[2]; // Element Type m_ELemArray[1].m_eSuppType3D = EElemSuppType3D.e3DEl_000000_000000; // Element Material m_ELemArray[1].m_Mat = m_Mat; // Element Corss-section m_ELemArray[1].m_CrSc = m_CrSc; // Fill Basic Element Data m_ELemArray[1].FillBasic2(); // Load of Element only due to Element Transversal Forces m_ELoadArray[1].GetEndLoad_F(m_ELemArray[1], 0f, 0f, m_fF); // Output // kij_0 - local stiffeness matrix 6 x 6 m_ELemArray[1].m_fkLocMatr.Print2DMatrixFormated(); // A Tranformation Rotation Matrixes 6 x 6 m_ELemArray[1].m_fATRMatr3D.Print2DMatrixFormated(); // B Transfer Matrixes 6 x 6 m_ELemArray[1].m_fBTTMatr3D.Print2DMatrixFormated(); // Kij - global matrix of member 12 x 12 m_ELemArray[1].m_fKGlobM.Print2DMatrixFormated(); // Element Load Vector 2 x 6 m_ELemArray[1].m_ArrElemPEF_LCS.Print2DMatrixFormated(); // Member 3 [2] Nodes 1 - 4 ([0] [3]) m_ELemArray[2].NodeStart = m_NodeArray[0]; m_ELemArray[2].NodeEnd = m_NodeArray[3]; // Element Type m_ELemArray[2].m_eSuppType3D = EElemSuppType3D.e3DEl_000000_000___; // Element Material m_ELemArray[2].m_Mat = m_Mat; // Element Corss-section m_ELemArray[2].m_CrSc = m_CrSc; // Fill Basic Element Data m_ELemArray[2].FillBasic2(); // Load of Element only due to Element Transversal Forces m_ELoadArray[2].GetEndLoad_M(m_ELemArray[2], m_fM, 0f, 0f); // Output // kij_0 - local stiffeness matrix 6 x 6 m_ELemArray[2].m_fkLocMatr.Print2DMatrixFormated(); // A Tranformation Rotation Matrixes 6 x 6 m_ELemArray[2].m_fATRMatr3D.Print2DMatrixFormated(); // B Transfer Matrixes 6 x 6 m_ELemArray[2].m_fBTTMatr3D.Print2DMatrixFormated(); // Kij - global matrix of member 12 x 12 m_ELemArray[2].m_fKGlobM.Print2DMatrixFormated(); // Element Load Vector 2 x 6 m_ELemArray[2].m_ArrElemPEF_LCS.Print2DMatrixFormated(); /* // Nodal loads (sum nodal loads and nodal loads due to element loads) m_NodeArray[2].m_sLoad.s_fFZ += -55000; // Add local nodal load to element ends loads due to intermediate load */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set Global Code Number of Nodes / Nastavit globalne kodove cisla uzlov // Save indexes of nodes and DOF which are free and represent vector of uknown variables in solution // Save it as array of arrays n x 2 (1st value is index - node index (0 - n-1) , 2nd value is DOF index (0-5) // n - total number of nodes in model ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SetNodesGlobCodeNoOld(); // Nastavi DOF v uzlov globalne kodove cisla ??? ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Right side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) m_M_K_Structure = new CMatrix(m_iCodeNo); // Fill Global Stiffeness Matrix FillGlobalMatrixOld(); // Global Stiffeness Matrix m_iCodeNo x m_iCodeNo m_M_K_Structure.Print2DMatrix(); // Auxialiary temporary transformation from 2D to 1D array / from float do double // Pomocne prevody medzi jednorozmernym, dvojroymernym polom a triedom Matrix, // bude nutne zladit a format v akom budeme pracovat s datami a potom zmazat CArray objArray = new CArray(); // Convert Size float[] m_M_K_fTemp1D = objArray.ArrTranf2Dto1D(m_M_K_Structure.m_fArrMembers); // Convert Type double[] m_M_K_dTemp1D = objArray.ArrConverFloatToDouble1D(m_M_K_fTemp1D); MatrixF64 objMatrix = new MatrixF64(6, 6, m_M_K_dTemp1D); // Print Created Matrix of MatrixF64 Class objMatrix.WriteLine(); // Get Inverse Global Stiffeness Matrix MatrixF64 objMatrixInv = objMatrix.Inverse(); // Print Inverse Matrix objMatrixInv.WriteLine(); // Convert Type float[] m_M_K_Inv_fTemp1D = objArray.ArrConverMatrixF64ToFloat1D(objMatrixInv); // Inverse Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) CMatrix m_M_K_Structure_Inv = new CMatrix(m_iCodeNo); m_M_K_Structure_Inv.m_fArrMembers = objArray.ArrTranf1Dto2D(m_M_K_Inv_fTemp1D); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Left side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Load Vector - Allocate Memory (Vector Size) m_V_Load = new CVector(m_iCodeNo); // Fill Global Load Vector FillGlobalLoadVectorOld(); // Display Global Load Vector m_V_Load.Print1DVector(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Solution - calculation of unknown displacement of nodes in GCS - system of linear equations // Start Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Displacement Vector - Allocate Memory (Vector Size) m_V_Displ = new CVector(m_iCodeNo); // Fill Global Displacement Vector m_V_Displ = VectorF.fMultiplyMatrVectr(m_M_K_Structure_Inv, m_V_Load); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // End Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display Global Displacemnt Vector - solution result //Console.ForegroundColor = ConsoleColor.Cyan; m_V_Displ.Print1DVector(); //Console.ForegroundColor = ConsoleColor.Green; //Console.BackgroundColor = ConsoleColor.White; // Set displacements and rotations of DOF in GCS to appropriate node DOF acc. to global code numbers for (int i = 0; i < m_iCodeNo; i++) { // Check if DOF is default (free - ) or has some initial value (settlement; soil consolidation etc.) // See Fill_NDisp_InitStr() for default values - float.PositiveInfinity if (m_NodeArray[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] == float.PositiveInfinity) m_NodeArray[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] = m_V_Displ.FVectorItems[i]; // set calculated else // some real initial value exists m_NodeArray[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] += m_V_Displ.FVectorItems[i]; // add calculated (to sum) } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get final end forces at element in global coordinate system GCS ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for (int i = 0; i < iElemNoTot; i++) { m_ELemArray[i].GetArrElemEF_GCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeStart.ID + "; " + "Start Node End Forces in GCS"); m_ELemArray[i].m_VElemEF_GCS_StNode.Print1DVector(); m_ELemArray[i].GetArrElemEF_GCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeEnd.ID + "; " + "End Node End Forces in GCS"); m_ELemArray[i].m_VElemEF_GCS_EnNode.Print1DVector(); m_ELemArray[i].GetArrElemEF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeStart.ID + "; " + "Start Node End Forces in LCS"); m_ELemArray[i].m_VElemEF_LCS_StNode.Print1DVector(); m_ELemArray[i].GetArrElemEF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeEnd.ID + "; " + "End Node End Forces in LCS"); m_ELemArray[i].m_VElemEF_LCS_EnNode.Print1DVector(); m_ELemArray[i].GetArrElemIF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeStart.ID + "; " + "Start Node Internal Forces in LCS"); m_ELemArray[i].m_VElemIF_LCS_StNode.Print1DVector(); m_ELemArray[i].GetArrElemIF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + m_ELemArray[i].NodeEnd.ID + "; " + "End Node Internal Forces in LCS"); m_ELemArray[i].m_VElemIF_LCS_EnNode.Print1DVector(); } }
// Transformation Transfer Matrix - 3D // 6x6 private CMatrix Get_BMatr3D1() { CMatrix fM = new CMatrix(6); fM.m_fArrMembers = new float[6, 6] { { -1f, 0f, 0f, 0f, 0f, 0f }, { 0f, -1f, 0f, 0f, 0f, 0f }, { 0f, 0f, -1f, 0f, 0f, 0f }, { 0f, -m_flength_Z, m_flength_Y, -1f, 0f, 0f }, { m_flength_Z, 0f, -m_flength_X, 0f, -1f, 0f }, { -m_flength_Y, m_flength_X, 0f, 0f, 0f, -1f } }; return fM; }
// Dokoncit public CMatrix GetInverse(CMatrix fM, double Mout, int actualsize) { CMatrix fInvMatrix = new CMatrix(3, 3); return fInvMatrix; }
public void FillBasic2() { // Displacement // doplnit vektor premiestneni pruta - sklada sa z vektorov pre zac a konc. uzol // SMemberDisp sElemDisp; // Fill Element Nodes Displacement for (int i = 0; i < 12; i++) { if (i < 6) m_ArrDisp.FVectorItems[i] = NodeStart.m_VDisp.FVectorItems[i]; // Fill with Start Node else m_ArrDisp.FVectorItems[i] = NodeEnd.m_VDisp.FVectorItems[i - 6]; // Fill with End Node } // Element / Member load // Lengths in Global Coordinates m_flength_X = GetGCSLengh(0); m_flength_Y = GetGCSLengh(1); m_flength_Z = GetGCSLengh(2); // Lengths of member projection into GCS areas m_flength_XY = GetGCSProjLengh(m_flength_X, m_flength_Y); m_flength_YZ = GetGCSProjLengh(m_flength_Y, m_flength_Z); m_flength_XZ = GetGCSProjLengh(m_flength_X, m_flength_Z); // FEM Element Length FLength = (float)Math.Sqrt((float)Math.Pow(m_flength_X, 2f) + (float)Math.Pow(m_flength_Y, 2f) + (float)Math.Pow(m_flength_Z, 2f)); // Temporary !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Member.FLength = FLength; m_fAlpha = GetGCSAlpha(1); m_fSinAlpha = (float)Math.Sin(m_fAlpha); m_fCosAlpha = (float)Math.Cos(m_fAlpha); // Get auxialiary point relative coordinates Get_C_GCS_coord(); // 3D // Transformation Matrix of Element Rotation (12x12) - 3D m_fATRMatr3D = Get_AMatr3D1(); // Transformation Transfer Matrix - 3D m_fBTTMatr3D = Get_BMatr3D1(); // Get local matrix acc. to end support/restraint of element // 3D switch (m_eSuppType3D) { case EElemSuppType3D.e3DEl_000000_000000: m_fkLocMatr = GetLocMatrix_3D_000000_000000(); break; case EElemSuppType3D.e3DEl_000000_000___: case EElemSuppType3D.e3DEl_000____000000: m_fkLocMatr = GetLocMatrix_3D_000000_000___a(); // !!!! break; case EElemSuppType3D.e3DEl_000000_0_00_0: case EElemSuppType3D.e3DEl_0_00_0_000000: m_fkLocMatr = GetLocMatrix_3D_000000_0_00_0(); break; case EElemSuppType3D.e3DEl_000000_______: case EElemSuppType3D.e3DEl________000000: m_fkLocMatr = GetLocMatrix_3D_000000_______(); // !!!! break; default: // Error break; } // Check of partial matrices members // Partial matrices of global matrix of member 6 x 6 // Console.WriteLine(GetPartM_k11(m_fkLocMatr,m_fAMatr3D).Print2DMatrix()); // Return partial matrixes and global matrix of FEM element // 3D m_fKGlobM = fGetGlobM( GetPartM_k11(m_fkLocMatr, m_fATRMatr3D), GetPartM_k12(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D), GetPartM_k21(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D), GetPartM_k22(m_fkLocMatr, m_fATRMatr3D, m_fBTTMatr3D) ); }
CModel TopoModelFile; // Create topological model file #endregion Fields #region Constructors ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Constructor - new public CFEM_CALC(CModel model, bool bDebugging) { // Load Topological model TopoModelFile = new CModel(); TopoModelFile = model; // Generate FEM model data from Topological model // Prepare solver data // Fill local and global matrices of FEM elements FEMModel = new CGenex(TopoModelFile); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Temp - display matrices if (bDebugging) { for (int i = 0; i < FEMModel.m_arrFemMembers.Length; i++) { // Member ID Console.WriteLine("Member ID: " + FEMModel.m_arrFemMembers[i].ID + "\n"); // kij_0 - local stiffeness matrix 6 x 6 Console.WriteLine("Local stiffeness matrix k" + FEMModel.m_arrFemMembers[i].NodeStart.ID + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "0 - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fkLocMatr.Print2DMatrixFormated(); // A Tranformation Rotation Matrixes 6 x 6 Console.WriteLine("Tranformation rotation matrix A - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fATRMatr3D.Print2DMatrixFormated(); // B Transfer Matrixes 6 x 6 Console.WriteLine("Transfer matrix B - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fBTTMatr3D.Print2DMatrixFormated(); // Kij - global matrix of member 12 x 12 Console.WriteLine("Global stiffeness matrix K" + FEMModel.m_arrFemMembers[i].NodeStart.ID + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "0 - Dimensions: 12 x 12 \n"); FEMModel.m_arrFemMembers[i].m_fKGlobM.Print2DMatrixFormated_ABxCD(FEMModel.m_arrFemMembers[i].m_fKGlobM.m_fArrMembersABxCD); // Element Load Vectors 2 x 6 Console.WriteLine("Member load vector - primary end forces in LCS at start node ID: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_LCS_StNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in LCS at end node ID: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_LCS_EnNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in GCS at start node ID: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_GCS_StNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in GCS at end node ID: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_GCS_EnNode.Print1DVector(); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set Global Code Number of Nodes / Nastavit globalne kodove cisla uzlov // Save indexes of nodes and DOF which are free and represent vector of uknown variables in solution SetNodesGlobCodeNo(); // Nastavi DOF v uzloch a ich globalne kodove cisla, konecne CodeNo urci velkost matice konstrukcie // Fill members of structure global vector of displacement // Now we know number of not restrained DOF, so we can allocate array size m_fDisp_Vector_CN = new int[m_iCodeNo, 3]; // 1st - global DOF code number, 2nd - Node index, 3rd - local code number of DOF in NODE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Save it as array of arrays n x 2 (1st value is index - node index (0 - n-1) , 2nd value is DOF index (0-5) // n - total number of nodes in model ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FillGlobalDisplCodeNo(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Right side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) m_M_K_Structure = new CMatrix(m_iCodeNo); // Fill Global Stiffeness Matrix FillGlobalMatrix(); // Global Stiffeness Matrix m_iCodeNo x m_iCodeNo if (bDebugging) { Console.WriteLine("Global stiffeness matrix - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); m_M_K_Structure.Print2DMatrixFormated(); } // Auxiliary temporary transformation from 2D to 1D array / from float do double // Pomocne prevody medzi jednorozmernym, dvojrozmernym polom a triedou Matrix, // bude nutne zladit a urcit jeden format v akom budeme pracovat s datami a potom zmazat CArray objArray = new CArray(); // Convert Size float[] m_M_K_fTemp1D = objArray.ArrTranf2Dto1D(m_M_K_Structure.m_fArrMembers); // Convert Type double[] m_M_K_dTemp1D = objArray.ArrConverFloatToDouble1D(m_M_K_fTemp1D); MatrixF64 objMatrix = new MatrixF64(m_iCodeNo, m_iCodeNo, m_M_K_dTemp1D); // Print Created Matrix of MatrixF64 Class if (bDebugging) { Console.WriteLine("Global stiffeness matrix in F64 Class - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); objMatrix.WriteLine(); } // Get Inverse Global Stiffeness Matrix MatrixF64 objMatrixInv = objMatrix.Inverse(); // Print Inverse Matrix if (bDebugging) { Console.WriteLine("Inverse global stiffeness matrix - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); objMatrixInv.WriteLine(); } // Convert Type float[] m_M_K_Inv_fTemp1D = objArray.ArrConverMatrixF64ToFloat1D(objMatrixInv); // Inverse Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) CMatrix m_M_K_Structure_Inv = new CMatrix(m_iCodeNo); m_M_K_Structure_Inv.m_fArrMembers = objArray.ArrTranf1Dto2D(m_M_K_Inv_fTemp1D); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Left side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Load Vector - Allocate Memory (Vector Size) m_V_Load = new CVector(m_iCodeNo); // Fill Global Load Vector FillGlobalLoadVector(); // Display Global Load Vector if (bDebugging) { Console.WriteLine("Global load vector - Dimensions: " + m_iCodeNo + " x 1 \n"); m_V_Load.Print1DVector(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Solution - calculation of unknown displacement of nodes in GCS - system of linear equations // Start Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Displacement Vector - Allocate Memory (Vector Size) m_V_Displ = new CVector(m_iCodeNo); // Fill Global Displacement Vector m_V_Displ = VectorF.fMultiplyMatrVectr(m_M_K_Structure_Inv, m_V_Load); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // End Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display Global Displacement Vector - solution result if (bDebugging) { Console.WriteLine("Global displacement vector - Dimensions: " + m_iCodeNo + " x 1 \n"); m_V_Displ.Print1DVector(); } // Set displacements and rotations of DOF in GCS to appropriate node DOF acc. to global code numbers for (int i = 0; i < m_iCodeNo; i++) { // Check if DOF is default (free - ) or has some initial value (settlement; soil consolidation etc.) // See default values - float.PositiveInfinity if (FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] == float.PositiveInfinity) FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] = m_V_Displ.FVectorItems[i]; // set calculated else // some real initial value exists FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] += m_V_Displ.FVectorItems[i]; // add calculated (to sum) } // Set default zero displacements or rotations in GCS to fixed DOF for (int i = 0; i < FEMModel.m_arrFemNodes.Length; i++) { for (int j = 0; j < FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems.Length; j++) // Check each DOF of all nodes { if (FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems[j] == float.PositiveInfinity) // Check that default infinity value wasn't changed FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems[j] = 0; // Set zero } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get final end forces at element in global coordinate system GCS ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (bDebugging) { for (int i = 0; i < FEMModel.m_arrFemMembers.Length; i++) { FEMModel.m_arrFemMembers[i].GetArrElemEF_GCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node End Forces in GCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_GCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_GCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node End Forces in GCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_GCS_EnNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node End Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_LCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node End Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_LCS_EnNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemIF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node Internal Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemIF_LCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemIF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node Internal Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemIF_LCS_EnNode.Print1DVector(); } } // Calculate IF in x-places int inum_cut = 11; int inum_segm = 10; }
// Transformation Transfer Matrix - 3D // 2x2 - 3x3 private CMatrix Get_BMatr3D0() { // SubMatrix // Ksi (Xi) CMatrix RXi = new CMatrix(3, 3); RXi.m_fArrMembers = new float[3,3] { { 0f, -m_flength_Z, -m_flength_Y }, { m_flength_Z, 0f, -m_flength_X }, { -m_flength_Y, m_flength_X, 0f } }; CMatrix MZero = new CMatrix(3, 3); MZero.m_fArrMembers = new float[3, 3] { { 0f, 0f, 0f }, { 0f, 0f, 0f }, { 0f, 0f, 0f } }; CMatrix EPart = new CMatrix(3, 3); EPart.m_fArrMembers = new float[3, 3] { { 1f, 0f, 0f }, { 0f, 1f, 0f }, { 0f, 0f, 1f } }; // Local Stiffeness Matrix // Matrix 2x2 * 3x3 CMatrix fM = new CMatrix(MatrixF.fChangeSignMatr(EPart), MZero, RXi, MatrixF.fChangeSignMatr(EPart)); return fM; }