private Matrix CalculateConstitutiveStiffness()
        {
            var    constitutiveStiffness = SymmetricMatrix.CreateZero(FREEDOM_DEGREE_COUNT);
            double E         = this.material.YoungModulus;
            double G         = E / (2d * (1d + this.material.PoissonRatio));
            double I         = this.beamSection.Inertia;
            double A         = this.beamSection.Area;
            double L         = this.currentLength;
            double LSqruared = L * L;
            double LCubed    = L * L * L;
            double phi       = (12.0 * E * I) / (LSqruared * G * A);
            double psi       = 1.0 / (1.0 + phi);
            double EAOverL   = (E * A) / L;
            double EIOverL   = (E * I) / L;

            constitutiveStiffness[0, 0] = EAOverL;
            constitutiveStiffness[0, 3] = -EAOverL;

            constitutiveStiffness[1, 1] = 12.0 * psi * E * I / LCubed;
            constitutiveStiffness[1, 2] = 6.0 * psi * E * I / LSqruared;
            constitutiveStiffness[1, 4] = -12.0 * psi * E * I / LCubed;
            constitutiveStiffness[1, 5] = 6.0 * psi * E * I / LSqruared;

            constitutiveStiffness[2, 2] = (3.0 * psi + 1.0) * EIOverL;
            constitutiveStiffness[2, 4] = -6.0 * psi * E * I / LSqruared;
            constitutiveStiffness[2, 5] = (3.0 * psi - 1.0) * EIOverL;

            constitutiveStiffness[3, 3] = EAOverL;

            constitutiveStiffness[4, 4] = 12.0 * psi * E * I / LCubed;
            constitutiveStiffness[4, 5] = -6.0 * psi * E * I / LSqruared;

            constitutiveStiffness[5, 5] = (3.0 * psi + 1.0) * EIOverL;

            return(constitutiveStiffness.CopyToFullMatrix());
        }
        private IMatrix PorousMatrix(IElement element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <IDofType> dofTypes in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
            {
                foreach (IDofType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            var poreStiffness = SymmetricMatrix.CreateZero(dofs);

            IMatrix stiffness    = solidStiffnessProvider.Matrix(element);
            IMatrix permeability = elementType.PermeabilityMatrix(element);

            int matrixRow = 0;
            int solidRow  = 0;
            int fluidRow  = 0;

            foreach (IList <IDofType> dofTypesRow in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
            {
                foreach (IDofType dofTypeRow in dofTypesRow)
                {
                    int matrixCol = 0;
                    int solidCol  = 0;
                    int fluidCol  = 0;
                    foreach (IList <IDofType> dofTypesCol in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
                    {
                        foreach (IDofType dofTypeCol in dofTypesCol)
                        {
                            if (dofTypeCol == PorousMediaDof.Pressure)
                            {
                                if (dofTypeRow == PorousMediaDof.Pressure)
                                {
                                    // H correction
                                    poreStiffness[matrixRow, matrixCol] = -permeability[fluidRow, fluidCol];
                                }
                                //poreStiffness[matrixRow, matrixCol] = permeability[fluidRow, fluidCol];
                                fluidCol++;
                            }
                            else
                            {
                                if (dofTypeRow != PorousMediaDof.Pressure)
                                {
                                    poreStiffness[matrixRow, matrixCol] = stiffness[solidRow, solidCol] * stiffnessCoefficient;
                                }
                                solidCol++;
                            }
                            matrixCol++;
                        }
                    }

                    if (dofTypeRow == PorousMediaDof.Pressure)
                    {
                        fluidRow++;
                    }
                    else
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreStiffness);
        }
Example #3
0
        private IMatrix PorousMatrix(IElement element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <IDofType> dofTypes in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
            {
                foreach (IDofType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            var poreDamping = SymmetricMatrix.CreateZero(dofs);

            IMatrix damping    = solidDampingProvider.Matrix(element);
            IMatrix saturation = elementType.SaturationMatrix(element);
            IMatrix coupling   = elementType.CouplingMatrix(element);

            int matrixRow = 0;
            int solidRow  = 0;
            int fluidRow  = 0;

            foreach (IList <IDofType> dofTypesRow in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
            {
                foreach (IDofType dofTypeRow in dofTypesRow)
                {
                    int matrixCol = 0;
                    int solidCol  = 0;
                    int fluidCol  = 0;
                    foreach (IList <IDofType> dofTypesCol in elementType.DofEnumerator.GetDofTypesForMatrixAssembly(element))
                    {
                        foreach (IDofType dofTypeCol in dofTypesCol)
                        {
                            if (dofTypeCol == PorousMediaDof.Pressure)
                            {
                                if (dofTypeRow == PorousMediaDof.Pressure)
                                {
                                    poreDamping[matrixRow, matrixCol] = -saturation[fluidRow, fluidCol];
                                }
                                else
                                {
                                    poreDamping[matrixRow, matrixCol] = coupling[fluidCol, solidRow];
                                }
                                fluidCol++;
                            }
                            else
                            {
                                if (dofTypeRow != PorousMediaDof.Pressure)
                                {
                                    poreDamping[matrixRow, matrixCol] = damping[solidRow, solidCol] * dampingCoefficient;
                                }
                                else
                                {
                                    poreDamping[matrixRow, matrixCol] = coupling[fluidRow, solidCol];
                                }
                                solidCol++;
                            }
                            matrixCol++;
                        }
                    }

                    if (dofTypeRow == PorousMediaDof.Pressure)
                    {
                        fluidRow++;
                    }
                    else
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreDamping);
        }
        /**
         * Calculates the geometric stiffness of the element.
         *
         * @return The geometric stiffness
         */
        private Matrix CalculateGeometricStiffness()
        {
            var    geometricStiffness    = SymmetricMatrix.CreateZero(FREEDOM_DEGREE_COUNT);
            var    forcesInNaturalSystem = this.CalculateForcesInNaturalSystem();
            var    forcesInLocalSystem   = this.CalculateForcesInLocalSystem();
            double torsionalMoment       = forcesInNaturalSystem[NaturalDeformationMode3D.TORSION];
            double axialForce            = forcesInNaturalSystem[NaturalDeformationMode3D.EXTENSION];
            double momentY_A             = forcesInLocalSystem[4];
            double momentZ_A             = forcesInLocalSystem[5];
            double momentY_B             = forcesInLocalSystem[10];
            double momentZ_B             = forcesInLocalSystem[11];
            double length        = this.currentLength;
            double Qy            = -(momentZ_A + momentZ_B) / length;
            double Qz            = (momentY_A + momentY_B) / length;
            double Qy_Over_L     = Qy / length;
            double Qz_Over_L     = Qz / length;
            double Qy_L_Over_6   = (Qy * length) / 6.0;
            double Qz_L_Over_6   = (Qz * length) / 6.0;
            double N_6_Over_5_L  = (6.0 * axialForce) / (5.0 * length);
            double N_Over_10     = axialForce / 10.0;
            double N_L_4_Over_30 = (4.0 * axialForce * length) / 30.0;
            double N_L_Over_30   = (axialForce * length) / 30.0;
            double MyA_Over_L    = momentY_A / length;
            double MyB_Over_L    = momentY_B / length;
            double MzA_Over_L    = momentZ_A / length;
            double MzB_Over_L    = momentZ_B / length;
            double M_Over_L      = torsionalMoment / length;
            double M_3_Over_6    = (3.0 * torsionalMoment) / 6.0;

            geometricStiffness[0, 1] = -Qy_Over_L;
            geometricStiffness[0, 2] = -Qz_Over_L;
            geometricStiffness[0, 7] = Qy_Over_L;
            geometricStiffness[0, 8] = Qz_Over_L;

            geometricStiffness[1, 1]  = N_6_Over_5_L;
            geometricStiffness[1, 3]  = MyA_Over_L;
            geometricStiffness[1, 4]  = M_Over_L;
            geometricStiffness[1, 5]  = N_Over_10;
            geometricStiffness[1, 6]  = Qy_Over_L;
            geometricStiffness[1, 7]  = -N_6_Over_5_L;
            geometricStiffness[1, 9]  = MyB_Over_L;
            geometricStiffness[1, 10] = -M_Over_L;
            geometricStiffness[1, 11] = N_Over_10;

            geometricStiffness[2, 2]  = N_6_Over_5_L;
            geometricStiffness[2, 3]  = MzA_Over_L;
            geometricStiffness[2, 4]  = -N_Over_10;
            geometricStiffness[2, 5]  = M_Over_L;
            geometricStiffness[2, 6]  = Qz_Over_L;
            geometricStiffness[2, 8]  = -N_6_Over_5_L;
            geometricStiffness[2, 9]  = MzB_Over_L;
            geometricStiffness[2, 10] = -N_Over_10;
            geometricStiffness[2, 11] = -M_Over_L;

            geometricStiffness[3, 4]  = ((-2.0 * momentZ_A) + momentZ_B) / 6.0;
            geometricStiffness[3, 5]  = ((2.0 * momentY_A) - momentY_B) / 6.0;
            geometricStiffness[3, 7]  = -MyA_Over_L;
            geometricStiffness[3, 8]  = -MzA_Over_L;
            geometricStiffness[3, 10] = Qy_L_Over_6;
            geometricStiffness[3, 11] = Qz_L_Over_6;

            geometricStiffness[4, 4]  = N_L_4_Over_30;
            geometricStiffness[4, 7]  = -M_Over_L;
            geometricStiffness[4, 8]  = +N_Over_10;
            geometricStiffness[4, 9]  = Qy_L_Over_6;
            geometricStiffness[4, 10] = -N_L_Over_30;
            geometricStiffness[4, 11] = M_3_Over_6;

            geometricStiffness[5, 5]  = N_L_4_Over_30;
            geometricStiffness[5, 7]  = -N_Over_10;
            geometricStiffness[5, 8]  = -M_Over_L;
            geometricStiffness[5, 9]  = Qz_L_Over_6;
            geometricStiffness[5, 10] = -M_3_Over_6;
            geometricStiffness[5, 11] = -N_L_Over_30;

            geometricStiffness[6, 7] = -Qy_Over_L;
            geometricStiffness[6, 8] = -Qz_Over_L;

            geometricStiffness[7, 7]  = N_6_Over_5_L;
            geometricStiffness[7, 9]  = -MyB_Over_L;
            geometricStiffness[7, 10] = M_Over_L;
            geometricStiffness[7, 11] = -N_Over_10;

            geometricStiffness[8, 8]  = N_6_Over_5_L;
            geometricStiffness[8, 9]  = -MzB_Over_L;
            geometricStiffness[8, 10] = N_Over_10;
            geometricStiffness[8, 11] = M_Over_L;

            geometricStiffness[9, 10] = ((-2.0 * momentZ_B) + momentZ_A) / 6.0;
            geometricStiffness[9, 11] = ((+2.0 * momentY_B) - momentY_A) / 6.0;

            geometricStiffness[10, 10] = N_L_4_Over_30;

            geometricStiffness[11, 11] = N_L_4_Over_30;

            return(geometricStiffness.CopyToFullMatrix());
        }
        /**
         * Calculates the constitutive stiffness of the element.
         *
         * @return The constitutive stiffness
         */
        private Matrix CalculateConstitutiveStiffness()
        {
            var    constitutiveStiffness = SymmetricMatrix.CreateZero(FREEDOM_DEGREE_COUNT);
            double E         = this.material.YoungModulus;
            double G         = E / (2d * (1d + this.material.PoissonRatio));
            double Iy        = this.beamSection.InertiaY;
            double Iz        = this.beamSection.InertiaZ;
            double J         = this.beamSection.TorsionalInertia;
            double A         = this.beamSection.Area;
            double Ay        = this.beamSection.EffectiveAreaY;
            double Az        = this.beamSection.EffectiveAreaZ;
            double l         = this.currentLength;
            double lSqruared = l * l;
            double lCubed    = l * l * l;
            double phiY      = (12.0 * E * Iy) / (l * l * G * Az);
            double phiZ      = (12.0 * E * Iz) / (l * l * G * Ay);
            double psiY      = 1.0 / (1.0 + phiY);
            double psiZ      = 1.0 / (1.0 + phiZ);
            double EAOverL   = (E * A) / l;
            double GJOverL   = (G * J) / l;
            double psiZ_E_Iz_12_OverlCubed   = (12.0 * psiZ * E * Iz) / lCubed;
            double psiZ_E_Iz_6_OverlSquared  = (6.0 * psiZ * E * Iz) / lSqruared;
            double psiY_E_12_Iy_OverlCubed   = (12.0 * psiY * E * Iy) / lCubed;
            double psiY_E_6_Iy_OverlSquared  = (6.0 * psiY * E * Iy) / lSqruared;
            double psiZ_3_Plus_1_E_Iz_Overl  = (((3.0 * psiZ) + 1.0) * E * Iz) / l;
            double psiZ_3_Minus_1_E_Iz_Overl = (((3.0 * psiZ) - 1.0) * E * Iz) / l;
            double psiY_3_Plus_1_E_Iy_Overl  = (((3.0 * psiY) + 1.0) * E * Iy) / l;
            double psiY_3_Minus_1_E_Iy_Overl = (((3.0 * psiY) - 1.0) * E * Iy) / l;

            constitutiveStiffness[0, 0] = EAOverL;
            constitutiveStiffness[0, 6] = -EAOverL;

            constitutiveStiffness[1, 1]  = psiZ_E_Iz_12_OverlCubed;
            constitutiveStiffness[1, 5]  = psiZ_E_Iz_6_OverlSquared;
            constitutiveStiffness[1, 7]  = -psiZ_E_Iz_12_OverlCubed;
            constitutiveStiffness[1, 11] = psiZ_E_Iz_6_OverlSquared;

            constitutiveStiffness[2, 2]  = psiY_E_12_Iy_OverlCubed;
            constitutiveStiffness[2, 4]  = -psiY_E_6_Iy_OverlSquared;
            constitutiveStiffness[2, 8]  = -psiY_E_12_Iy_OverlCubed;
            constitutiveStiffness[2, 10] = -psiY_E_6_Iy_OverlSquared;

            constitutiveStiffness[3, 3] = GJOverL;
            constitutiveStiffness[3, 9] = -GJOverL;

            constitutiveStiffness[4, 4]  = psiY_3_Plus_1_E_Iy_Overl;
            constitutiveStiffness[4, 8]  = psiZ_E_Iz_6_OverlSquared;
            constitutiveStiffness[4, 10] = psiY_3_Minus_1_E_Iy_Overl;

            constitutiveStiffness[5, 5]  = psiZ_3_Plus_1_E_Iz_Overl;
            constitutiveStiffness[5, 7]  = -psiY_E_6_Iy_OverlSquared;
            constitutiveStiffness[5, 11] = psiZ_3_Minus_1_E_Iz_Overl;

            constitutiveStiffness[6, 6] = EAOverL;

            constitutiveStiffness[7, 7]  = psiZ_E_Iz_12_OverlCubed;
            constitutiveStiffness[7, 11] = -psiZ_E_Iz_6_OverlSquared;

            constitutiveStiffness[8, 8]  = psiY_E_12_Iy_OverlCubed;
            constitutiveStiffness[8, 10] = psiY_E_6_Iy_OverlSquared;

            constitutiveStiffness[9, 9] = GJOverL;

            constitutiveStiffness[10, 10] = psiY_3_Plus_1_E_Iy_Overl;

            constitutiveStiffness[11, 11] = psiZ_3_Plus_1_E_Iz_Overl;

            return(constitutiveStiffness.CopyToFullMatrix());
        }