Beispiel #1
0
        private void CalculateInitialConfigurationData(IElement element)
        {
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            Matrix[] BL13_hexa;
            BL13_hexa = GetBL13Hexa(shapeFunctionNaturalDerivatives);

            Matrix[] BNL1_hexa;

            ox_i = new double[8][];
            tu_i = new double[8][];

            (Matrix[] J_0inv_hexa, double[] detJ_0) = JacobianHexa8Reverse.GetJ_0invHexaAndDetJ_0(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);

            integrationCoeffs = new double[nGaussPoints];

            BNL1_hexa = GetBNL1_hexa(J_0inv_hexa);

            for (int j = 0; j < 8; j++)
            {
                ox_i[j] = new double[] { element.Nodes[j].X, element.Nodes[j].Y, element.Nodes[j].Z, };
            }

            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrationCoeffs[gpoint] = detJ_0[gpoint] * QuadratureForStiffness.IntegrationPoints[gpoint].Weight;
            }

            tu_i = new double[8][];
            //GLvec = new double[nGaussPoints][]; //MS
            //GLvec_last_converged = new double[nGaussPoints][];
            DefGradVec = new double[nGaussPoints][];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                //GLvec[gpoint] = new double[6]; //MS
                //GLvec_last_converged[gpoint] = new double[6];
                DefGradVec[gpoint] = new double[9];
            }
            for (int k = 0; k < 8; k++)
            {
                tu_i[k] = new double[3];
            }
            isInitialized = true;
        }
Beispiel #2
0
        private void CalculateInitialConfigurationData(IElement element)
        {
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);

            Matrix[] bl13Matrices;
            bl13Matrices = Getbl13DeformationMatrices(shapeFunctionNaturalDerivatives);

            Matrix[] bnl1Matrices;

            initialCoordinates = new double[8][];
            totalDisplacements = new double[8][];

            (Matrix[] jacobianInverse, double[] jacobianDeterminants) = JacobianHexa8Reverse.GetJ_0invHexaAndjacobianDeterminants(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);

            integrationCoeffs = new double[nGaussPoints];

            bnl1Matrices = GetAuxilliaryDeformationbnl1Matrices(jacobianInverse);

            for (int j = 0; j < 8; j++)
            {
                initialCoordinates[j] = new double[] { element.Nodes[j].X, element.Nodes[j].Y, element.Nodes[j].Z, };
            }

            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrationCoeffs[gpoint] = jacobianDeterminants[gpoint] * QuadratureForStiffness.IntegrationPoints[gpoint].Weight;
            }

            totalDisplacements        = new double[8][];
            strainsVec                = new double[nGaussPoints][];
            strainsVec_last_converged = new double[nGaussPoints][];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                strainsVec[gpoint] = new double[6];
                strainsVec_last_converged[gpoint] = new double[6];
            }
            for (int k = 0; k < 8; k++)
            {
                totalDisplacements[k] = new double[3];
            }
            isInitialized = true;
        }
Beispiel #3
0
        private void CalculateStrains(double[] localdisplacements, IElement element, double[][] tx_i)
        {
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives         = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] J_0inv_hexa, double[] detJ_0) = JacobianHexa8Reverse.GetJ_0invHexaAndDetJ_0(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            //TODO: possibility of caching ll1_hexa or J_0inv

            Matrix[] DGtr = new Matrix[nGaussPoints];
            //Matrix[] GL = new Matrix[nGaussPoints]; //MS
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                DGtr[npoint] = Matrix.CreateZero(3, 3);
                //GL[npoint] = Matrix.CreateZero(3, 3); //MS
            }

            Matrix[] J_1 = JacobianHexa8Reverse.Get_J_1(nGaussPoints, tx_i, shapeFunctionNaturalDerivatives);

            //
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                //
                DGtr[npoint]       = J_0inv_hexa[npoint] * J_1[npoint];
                DefGradVec[npoint] = new double[9] {
                    DGtr[npoint][0, 0], DGtr[npoint][1, 1], DGtr[npoint][2, 2], DGtr[npoint][1, 0], DGtr[npoint][2, 1], DGtr[npoint][0, 2], DGtr[npoint][2, 0], DGtr[npoint][0, 1], DGtr[npoint][1, 2],
                };                                                                                                                                                                                                                         //MS
                ////
                //GL[npoint] = DGtr[npoint] * DGtr[npoint].Transpose();
                //for (int m = 0; m < 3; m++)
                //{
                //    GL[npoint][m, m] += -1;
                //}
                //GL[npoint].ScaleIntoThis(0.5);

                ////
                //for (int m = 0; m < 3; m++)
                //{
                //    GLvec[npoint][m] = GL[npoint][m, m];
                //}
                //GLvec[npoint][3] = 2 * GL[npoint][0, 1];
                //GLvec[npoint][4] = 2 * GL[npoint][1, 2];
                //GLvec[npoint][5] = 2 * GL[npoint][2, 0];
            }
        }
Beispiel #4
0
        private void CalculateStrains(double[] localdisplacements, IElement element, double[][] deformedCoordinates)
        {
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] jacobianInverse, double[] jacobianDeterminants) = JacobianHexa8Reverse.GetJ_0invHexaAndjacobianDeterminants(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            //TODO: possibility of caching shapeFunctionNaturalDerivatives or J_0inv

            Matrix[] deformationGradientsTransposed = new Matrix[nGaussPoints];
            Matrix[] GL = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                deformationGradientsTransposed[npoint] = Matrix.CreateZero(3, 3);
                GL[npoint] = Matrix.CreateZero(3, 3);
            }

            Matrix[] jacobiansDeformedMatrices = JacobianHexa8Reverse.Get_jacobiansDeformedMatrices(nGaussPoints, deformedCoordinates, shapeFunctionNaturalDerivatives);

            //
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                //
                deformationGradientsTransposed[npoint] = jacobianInverse[npoint] * jacobiansDeformedMatrices[npoint];

                //
                GL[npoint] = deformationGradientsTransposed[npoint] * deformationGradientsTransposed[npoint].Transpose();
                for (int m = 0; m < 3; m++)
                {
                    GL[npoint][m, m] += -1;
                }
                GL[npoint].ScaleIntoThis(0.5);

                //
                for (int m = 0; m < 3; m++)
                {
                    strainsVec[npoint][m] = GL[npoint][m, m];
                }
                strainsVec[npoint][3] = 2 * GL[npoint][0, 1];
                strainsVec[npoint][4] = 2 * GL[npoint][1, 2];
                strainsVec[npoint][5] = 2 * GL[npoint][2, 0];
            }
        }
        private Matrix UpdateKmatrices(IElement element)
        {
            Matrix k_element = Matrix.CreateZero(24, 24);


            // initialization of matrices that are not cached currently
            double[][] integrCoeff_Spkvec = new double[nGaussPoints][];
            Matrix[]   BL = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrCoeff_Spkvec[gpoint] = new double[6];
                BL[gpoint] = Matrix.CreateZero(6, 24);
            }
            Matrix ll2 = Matrix.CreateZero(8, 3);

            for (int m = 0; m < 8; m++)
            {
                for (int n = 0; n < 3; n++)
                {
                    ll2[m, n] = tu_i[m][n];
                }
            }
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives         = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] J_0inv_hexa, double[] detJ_0) = JacobianHexa8Reverse.GetJ_0invHexaAndDetJ_0(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            Matrix[] BL13_hexa;
            BL13_hexa = GetBL13Hexa(shapeFunctionNaturalDerivatives);
            Matrix[] BL11a_hexa;             // dimension: gpoints
            Matrix[] BL12_hexa;
            Matrix[] BL01_hexa;
            BL11a_hexa = GetBL11a_hexa(J_0inv_hexa);
            BL12_hexa  = GetBL12_hexa(J_0inv_hexa);
            BL01_hexa  = GetBL01_hexa(J_0inv_hexa);

            Matrix[] BL11             = new Matrix[nGaussPoints];
            Matrix[] BL1112sun01_hexa = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                BL11[npoint]             = Matrix.CreateZero(6, 9);
                BL1112sun01_hexa[npoint] = Matrix.CreateZero(6, 9);                 //TODO this may be unnescessary
            }



            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                //
                integrCoeff_Spkvec[npoint] = materialsAtGaussPoints[npoint].Stresses.Scale(integrationCoeffs[npoint]);

                //
                Matrix l_cyrcumflex = Matrix.CreateZero(3, 3);
                l_cyrcumflex = shapeFunctionNaturalDerivatives[npoint] * ll2;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 3; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            BL11[npoint][m, n]     += BL11a_hexa[npoint][m, p] * l_cyrcumflex[p, n];
                            BL11[npoint][m, 3 + n] += BL11a_hexa[npoint][m, 3 + p] * l_cyrcumflex[p, n];
                            BL11[npoint][m, 6 + n] += BL11a_hexa[npoint][m, 6 + p] * l_cyrcumflex[p, n];
                        }
                    }
                }

                //
                BL1112sun01_hexa[npoint] = BL11[npoint] * BL12_hexa[npoint];
                BL1112sun01_hexa[npoint].AddIntoThis(BL01_hexa[npoint]);

                //
                BL[npoint] = BL1112sun01_hexa[npoint] * BL13_hexa[npoint];
            }
            // TODO: BL and above calculations can cached from calculate forces method

            Matrix[] BNL1_hexa;
            Matrix[] BNL_hexa;
            BNL1_hexa = GetBNL1_hexa(J_0inv_hexa);
            BNL_hexa  = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                BNL_hexa[gpoint] = Matrix.CreateZero(9, 24);                 //todo this may be unnescessary

                BNL_hexa[gpoint] = BNL1_hexa[gpoint] * BL13_hexa[gpoint];
            }


            Matrix[] integrCoeff_Spk = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                integrCoeff_Spk[npoint] = Matrix.CreateZero(3, 3);
            }

            Matrix[] kl_  = new Matrix[nGaussPoints + 1];
            Matrix[] knl_ = new Matrix[nGaussPoints + 1];
            for (int npoint = 0; npoint < nGaussPoints + 1; npoint++)
            {
                kl_[npoint]  = Matrix.CreateZero(24, 24);
                knl_[npoint] = Matrix.CreateZero(24, 24);
            }



            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                Matrix integrCoeff_SPK_epi_BNL_hexa = Matrix.CreateZero(9, 24);         //TODO
                Matrix integrCoeff_cons_disp        = Matrix.CreateZero(6, 6);          //TODO
                Matrix integrCoeff_cons_disp_epi_BL = Matrix.CreateZero(6, 24);         //TODO

                //
                integrCoeff_Spk[npoint][0, 0] = integrCoeff_Spkvec[npoint][0];
                integrCoeff_Spk[npoint][0, 1] = integrCoeff_Spkvec[npoint][3];
                integrCoeff_Spk[npoint][0, 2] = integrCoeff_Spkvec[npoint][5];
                integrCoeff_Spk[npoint][1, 0] = integrCoeff_Spkvec[npoint][3];
                integrCoeff_Spk[npoint][1, 1] = integrCoeff_Spkvec[npoint][1];
                integrCoeff_Spk[npoint][1, 2] = integrCoeff_Spkvec[npoint][4];
                integrCoeff_Spk[npoint][2, 0] = integrCoeff_Spkvec[npoint][5];
                integrCoeff_Spk[npoint][2, 1] = integrCoeff_Spkvec[npoint][4];
                integrCoeff_Spk[npoint][2, 2] = integrCoeff_Spkvec[npoint][2];

                //
                IMatrixView consDisp = materialsAtGaussPoints[npoint].ConstitutiveMatrix;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 6; n++)
                    {
                        integrCoeff_cons_disp[m, n] = integrationCoeffs[npoint] * consDisp[m, n];
                    }
                }

                //
                integrCoeff_cons_disp_epi_BL = integrCoeff_cons_disp * BL[npoint];

                //
                kl_[npoint] = BL[npoint].Transpose() * integrCoeff_cons_disp_epi_BL;

                //
                for (int m = 0; m < 3; m++)                 // 3x24 dimensions
                {
                    for (int n = 0; n < 24; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            integrCoeff_SPK_epi_BNL_hexa[m, n]     += integrCoeff_Spk[npoint][m, p] * BNL_hexa[npoint][p, n];
                            integrCoeff_SPK_epi_BNL_hexa[3 + m, n] += integrCoeff_Spk[npoint][m, p] * BNL_hexa[npoint][3 + p, n];
                            integrCoeff_SPK_epi_BNL_hexa[6 + m, n] += integrCoeff_Spk[npoint][m, p] * BNL_hexa[npoint][6 + p, n];
                        }
                    }
                }

                //
                knl_[npoint] = BNL_hexa[npoint].Transpose() * integrCoeff_SPK_epi_BNL_hexa;
            }

            // Add contributions of each gp on the total element stiffness matrix k_element
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                for (int m = 0; m < 24; m++)
                {
                    for (int n = 0; n < 24; n++)
                    {
                        kl_[nGaussPoints][m, n]  += kl_[npoint][m, n];
                        knl_[nGaussPoints][m, n] += knl_[npoint][m, n];
                    }
                }
            }
            for (int m = 0; m < 24; m++)
            {
                for (int n = 0; n < 24; n++)
                {
                    k_element[m, n] = kl_[nGaussPoints][m, n] + knl_[nGaussPoints][m, n];
                }
            }

            return(k_element);
        }
        private double[] UpdateForces(IElement element)
        {
            //TODO: the gauss point loop should be the outer one

            // Matrices that are not currently cached are calculated here.
            Matrix ll2 = Matrix.CreateZero(8, 3);

            for (int m = 0; m < 8; m++)
            {
                for (int n = 0; n < 3; n++)
                {
                    ll2[m, n] = tu_i[m][n];
                }
            }
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives         = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] J_0inv_hexa, double[] detJ_0) = JacobianHexa8Reverse.GetJ_0invHexaAndDetJ_0(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            Matrix[] BL13_hexa;
            BL13_hexa = GetBL13Hexa(shapeFunctionNaturalDerivatives);
            Matrix[] BL11a_hexa;             // dimension number of gpoints
            Matrix[] BL12_hexa;
            Matrix[] BL01_hexa;
            BL11a_hexa = GetBL11a_hexa(J_0inv_hexa);
            BL12_hexa  = GetBL12_hexa(J_0inv_hexa);
            BL01_hexa  = GetBL01_hexa(J_0inv_hexa);

            //INITIALIZATION of MAtrixes that are currently not cached
            double[][] integrCoeff_Spkvec = new double[nGaussPoints][];
            Matrix[]   BL = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrCoeff_Spkvec[gpoint] = new double[6];
                BL[gpoint] = Matrix.CreateZero(6, 24);
            }

            double[][] fxk1 = new double[nGaussPoints + 1][];
            for (int npoint = 0; npoint < nGaussPoints + 1; npoint++)
            {
                fxk1[npoint] = new double[24];
            }

            Matrix[] BL11             = new Matrix[nGaussPoints];
            Matrix[] BL1112sun01_hexa = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                BL11[npoint]             = Matrix.CreateZero(6, 9);
                BL1112sun01_hexa[npoint] = Matrix.CreateZero(6, 9);
            }

            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                integrCoeff_Spkvec[npoint] = materialsAtGaussPoints[npoint].Stresses.Scale(integrationCoeffs[npoint]);

                //
                Matrix l_cyrcumflex = Matrix.CreateZero(3, 3);
                l_cyrcumflex = shapeFunctionNaturalDerivatives[npoint] * ll2;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 3; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            BL11[npoint][m, n]     += BL11a_hexa[npoint][m, p] * l_cyrcumflex[p, n];
                            BL11[npoint][m, 3 + n] += BL11a_hexa[npoint][m, 3 + p] * l_cyrcumflex[p, n];
                            BL11[npoint][m, 6 + n] += BL11a_hexa[npoint][m, 6 + p] * l_cyrcumflex[p, n];
                        }
                    }
                }

                //
                BL1112sun01_hexa[npoint] = BL11[npoint] * BL12_hexa[npoint];
                BL1112sun01_hexa[npoint].AddIntoThis(BL01_hexa[npoint]);

                //
                BL[npoint] = BL1112sun01_hexa[npoint] * BL13_hexa[npoint];

                //
                fxk1[npoint] = BL[npoint].Multiply(integrCoeff_Spkvec[npoint], true);
            }

            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                fxk1[nGaussPoints].AddIntoThis(fxk1[npoint]);
            }

            return(fxk1[nGaussPoints]);
        }
Beispiel #7
0
        private Matrix UpdateKmatrices(IElement element)
        {
            Matrix elementStiffnessMatrix = Matrix.CreateZero(24, 24);


            // initialization of matrices that are not cached currently
            double[][] integrCoeffsTimesStresses = new double[nGaussPoints][];
            Matrix[]   BL = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrCoeffsTimesStresses[gpoint] = new double[6];
                BL[gpoint] = Matrix.CreateZero(6, 24);
            }
            Matrix ll2 = Matrix.CreateZero(8, 3);

            for (int m = 0; m < 8; m++)
            {
                for (int n = 0; n < 3; n++)
                {
                    ll2[m, n] = totalDisplacements[m][n];
                }
            }
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] jacobianInverse, double[] jacobianDeterminants) = JacobianHexa8Reverse.GetJ_0invHexaAndjacobianDeterminants(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            Matrix[] bl13Matrices;
            bl13Matrices = Getbl13DeformationMatrices(shapeFunctionNaturalDerivatives);
            Matrix[] bl11aMatrices;             // dimension: gpoints
            Matrix[] bl12Marices;
            Matrix[] bl01Matrices;
            bl11aMatrices = Getbl11aDeformationMatrices(jacobianInverse);
            bl12Marices   = GetBL12DeformationMatrices(jacobianInverse);
            bl01Matrices  = Getbl01MDeformationMatrices(jacobianInverse);

            Matrix[] BL11 = new Matrix[nGaussPoints];
            Matrix[] bL1112Plus01Matrices = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                BL11[npoint] = Matrix.CreateZero(6, 9);
                bL1112Plus01Matrices[npoint] = Matrix.CreateZero(6, 9);                 //TODO this may be unnescessary
            }



            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                //
                integrCoeffsTimesStresses[npoint] = materialsAtGaussPoints[npoint].Stresses.Scale(integrationCoeffs[npoint]);

                //
                Matrix lcyrcumflex = Matrix.CreateZero(3, 3);
                lcyrcumflex = shapeFunctionNaturalDerivatives[npoint].Transpose() * ll2;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 3; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            BL11[npoint][m, n]     += bl11aMatrices[npoint][m, p] * lcyrcumflex[p, n];
                            BL11[npoint][m, 3 + n] += bl11aMatrices[npoint][m, 3 + p] * lcyrcumflex[p, n];
                            BL11[npoint][m, 6 + n] += bl11aMatrices[npoint][m, 6 + p] * lcyrcumflex[p, n];
                        }
                    }
                }

                //
                bL1112Plus01Matrices[npoint] = BL11[npoint] * bl12Marices[npoint];
                bL1112Plus01Matrices[npoint].AddIntoThis(bl01Matrices[npoint]);

                //
                BL[npoint] = bL1112Plus01Matrices[npoint] * bl13Matrices[npoint];
            }
            // TODO: BL and above calculations can cached from calculate forces method

            Matrix[] bnl1Matrices;
            Matrix[] bnlMatrices;
            bnl1Matrices = GetAuxilliaryDeformationbnl1Matrices(jacobianInverse);
            bnlMatrices  = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                bnlMatrices[gpoint] = Matrix.CreateZero(9, 24);                 //todo this may be unnescessary

                bnlMatrices[gpoint] = bnl1Matrices[gpoint] * bl13Matrices[gpoint];
            }


            Matrix[] integrCoeff_Spk = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                integrCoeff_Spk[npoint] = Matrix.CreateZero(3, 3);
            }

            Matrix[] kl_  = new Matrix[nGaussPoints + 1];
            Matrix[] knl_ = new Matrix[nGaussPoints + 1];
            for (int npoint = 0; npoint < nGaussPoints + 1; npoint++)
            {
                kl_[npoint]  = Matrix.CreateZero(24, 24);
                knl_[npoint] = Matrix.CreateZero(24, 24);
            }



            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                Matrix integrCoeff_SPK_epi_bnlMatrices = Matrix.CreateZero(9, 24);      //TODO
                Matrix integrCoeff_cons_disp           = Matrix.CreateZero(6, 6);       //TODO
                Matrix integrCoeff_cons_disp_epi_BL    = Matrix.CreateZero(6, 24);      //TODO

                //
                integrCoeff_Spk[npoint][0, 0] = integrCoeffsTimesStresses[npoint][0];
                integrCoeff_Spk[npoint][0, 1] = integrCoeffsTimesStresses[npoint][3];
                integrCoeff_Spk[npoint][0, 2] = integrCoeffsTimesStresses[npoint][5];
                integrCoeff_Spk[npoint][1, 0] = integrCoeffsTimesStresses[npoint][3];
                integrCoeff_Spk[npoint][1, 1] = integrCoeffsTimesStresses[npoint][1];
                integrCoeff_Spk[npoint][1, 2] = integrCoeffsTimesStresses[npoint][4];
                integrCoeff_Spk[npoint][2, 0] = integrCoeffsTimesStresses[npoint][5];
                integrCoeff_Spk[npoint][2, 1] = integrCoeffsTimesStresses[npoint][4];
                integrCoeff_Spk[npoint][2, 2] = integrCoeffsTimesStresses[npoint][2];

                //
                IMatrixView consDisp = materialsAtGaussPoints[npoint].ConstitutiveMatrix;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 6; n++)
                    {
                        integrCoeff_cons_disp[m, n] = integrationCoeffs[npoint] * consDisp[m, n];
                    }
                }

                //
                integrCoeff_cons_disp_epi_BL = integrCoeff_cons_disp * BL[npoint];

                //
                kl_[npoint] = BL[npoint].Transpose() * integrCoeff_cons_disp_epi_BL;

                //
                for (int m = 0; m < 3; m++)                 // 3x24 dimensions
                {
                    for (int n = 0; n < 24; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            integrCoeff_SPK_epi_bnlMatrices[m, n]     += integrCoeff_Spk[npoint][m, p] * bnlMatrices[npoint][p, n];
                            integrCoeff_SPK_epi_bnlMatrices[3 + m, n] += integrCoeff_Spk[npoint][m, p] * bnlMatrices[npoint][3 + p, n];
                            integrCoeff_SPK_epi_bnlMatrices[6 + m, n] += integrCoeff_Spk[npoint][m, p] * bnlMatrices[npoint][6 + p, n];
                        }
                    }
                }

                //
                knl_[npoint] = bnlMatrices[npoint].Transpose() * integrCoeff_SPK_epi_bnlMatrices;
            }

            // Add contributions of each gp on the total element stiffness matrix elementStiffnessMatrix
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                for (int m = 0; m < 24; m++)
                {
                    for (int n = 0; n < 24; n++)
                    {
                        kl_[nGaussPoints][m, n]  += kl_[npoint][m, n];
                        knl_[nGaussPoints][m, n] += knl_[npoint][m, n];
                    }
                }
            }
            for (int m = 0; m < 24; m++)
            {
                for (int n = 0; n < 24; n++)
                {
                    elementStiffnessMatrix[m, n] = kl_[nGaussPoints][m, n] + knl_[nGaussPoints][m, n];
                }
            }

            return(elementStiffnessMatrix);
        }
Beispiel #8
0
        private double[] UpdateForces(IElement element)
        {
            //TODO: the gauss point loop should be the outer one

            // Matrices that are not currently cached are calculated here.
            Matrix ll2 = Matrix.CreateZero(8, 3);

            for (int m = 0; m < 8; m++)
            {
                for (int n = 0; n < 3; n++)
                {
                    ll2[m, n] = totalDisplacements[m][n];
                }
            }
            IReadOnlyList <Matrix> shapeFunctionNaturalDerivatives;

            shapeFunctionNaturalDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness);
            (Matrix[] jacobianInverse, double[] jacobianDeterminants) = JacobianHexa8Reverse.GetJ_0invHexaAndjacobianDeterminants(
                shapeFunctionNaturalDerivatives, element.Nodes, nGaussPoints);
            Matrix[] bl13Matrices;
            bl13Matrices = Getbl13DeformationMatrices(shapeFunctionNaturalDerivatives);
            Matrix[] bl11aMatrices;             // dimension number of gpoints
            Matrix[] bl12Marices;
            Matrix[] bl01Matrices;
            bl11aMatrices = Getbl11aDeformationMatrices(jacobianInverse);
            bl12Marices   = GetBL12DeformationMatrices(jacobianInverse);
            bl01Matrices  = Getbl01MDeformationMatrices(jacobianInverse);

            //INITIALIZATION of MAtrixes that are currently not cached
            double[][] integrCoeffsTimesStresses = new double[nGaussPoints][];
            Matrix[]   BL = new Matrix[nGaussPoints];
            for (int gpoint = 0; gpoint < nGaussPoints; gpoint++)
            {
                integrCoeffsTimesStresses[gpoint] = new double[6];
                BL[gpoint] = Matrix.CreateZero(6, 24);
            }

            double[][] forces = new double[nGaussPoints + 1][];
            for (int npoint = 0; npoint < nGaussPoints + 1; npoint++)
            {
                forces[npoint] = new double[24];
            }

            Matrix[] BL11 = new Matrix[nGaussPoints];
            Matrix[] bL1112Plus01Matrices = new Matrix[nGaussPoints];
            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                BL11[npoint] = Matrix.CreateZero(6, 9);
                bL1112Plus01Matrices[npoint] = Matrix.CreateZero(6, 9);
            }

            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                integrCoeffsTimesStresses[npoint] = materialsAtGaussPoints[npoint].Stresses.Scale(integrationCoeffs[npoint]);

                //
                Matrix lcyrcumflex = Matrix.CreateZero(3, 3);
                lcyrcumflex = shapeFunctionNaturalDerivatives[npoint].Transpose() * ll2;

                for (int m = 0; m < 6; m++)
                {
                    for (int n = 0; n < 3; n++)
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            BL11[npoint][m, n]     += bl11aMatrices[npoint][m, p] * lcyrcumflex[p, n];
                            BL11[npoint][m, 3 + n] += bl11aMatrices[npoint][m, 3 + p] * lcyrcumflex[p, n];
                            BL11[npoint][m, 6 + n] += bl11aMatrices[npoint][m, 6 + p] * lcyrcumflex[p, n];
                        }
                    }
                }

                //
                bL1112Plus01Matrices[npoint] = BL11[npoint] * bl12Marices[npoint];
                bL1112Plus01Matrices[npoint].AddIntoThis(bl01Matrices[npoint]);

                //
                BL[npoint] = bL1112Plus01Matrices[npoint] * bl13Matrices[npoint];

                //
                forces[npoint] = BL[npoint].Multiply(integrCoeffsTimesStresses[npoint], true);
            }

            for (int npoint = 0; npoint < nGaussPoints; npoint++)
            {
                forces[nGaussPoints].AddIntoThis(forces[npoint]);
            }

            return(forces[nGaussPoints]);
        }