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; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 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(); } }