コード例 #1
0
ファイル: Hexa8.cs プロジェクト: stjordanis/MSolve
        public virtual IMatrix2D <double> StiffnessMatrix(Element element)
        {
            double[,] coordinates = this.GetCoordinates(element);
            GaussLegendrePoint3D[] integrationPoints = this.CalculateGaussMatrices(coordinates);

            SymmetricMatrix2D <double> stiffnessMatrix = new SymmetricMatrix2D <double>(24);

            int pointId = -1;

            foreach (GaussLegendrePoint3D intPoint in integrationPoints)
            {
                pointId++;
                IMatrix2D <double> constitutiveMatrix = materialsAtGaussPoints[pointId].ConstitutiveMatrix;
                double[,] b = intPoint.DeformationMatrix;
                for (int i = 0; i < 24; i++)
                {
                    double[] eb = new double[24];
                    for (int iE = 0; iE < 6; iE++)
                    {
                        eb[iE] = (constitutiveMatrix[iE, 0] * b[0, i]) + (constitutiveMatrix[iE, 1] * b[1, i]) +
                                 (constitutiveMatrix[iE, 2] * b[2, i]) + (constitutiveMatrix[iE, 3] * b[3, i]) +
                                 (constitutiveMatrix[iE, 4] * b[4, i]) + (constitutiveMatrix[iE, 5] * b[5, i]);
                    }

                    for (int j = i; j < 24; j++)
                    {
                        double stiffness = (b[0, j] * eb[0]) + (b[1, j] * eb[1]) + (b[2, j] * eb[2]) + (b[3, j] * eb[3]) +
                                           (b[4, j] * eb[4]) + (b[5, j] * eb[5]);
                        stiffnessMatrix[i, j] += stiffness * intPoint.WeightFactor;
                    }
                }
            }

            return(stiffnessMatrix);
        }
コード例 #2
0
ファイル: Hexa8.cs プロジェクト: stjordanis/MSolve
        public IMatrix2D <double> CalculateConsistentMass(Element element)
        {
            double[,] coordinates = this.GetCoordinates(element);
            GaussLegendrePoint3D[] integrationPoints = this.CalculateGaussMatrices(coordinates);

            SymmetricMatrix2D <double> consistentMass = new SymmetricMatrix2D <double>(24);

            foreach (GaussLegendrePoint3D intPoint in integrationPoints)
            {
                double[] shapeFunctionValues = this.CalcH8Shape(intPoint.Xi, intPoint.Eta, intPoint.Zeta);
                double   weightDensity       = intPoint.WeightFactor * this.Density;
                for (int shapeFunctionI = 0; shapeFunctionI < shapeFunctionValues.Length; shapeFunctionI++)
                {
                    for (int shapeFunctionJ = shapeFunctionI; shapeFunctionJ < shapeFunctionValues.Length; shapeFunctionJ++)
                    {
                        consistentMass[3 * shapeFunctionI, 3 * shapeFunctionJ] += shapeFunctionValues[shapeFunctionI] *
                                                                                  shapeFunctionValues[shapeFunctionJ] *
                                                                                  weightDensity;
                    }

                    for (int shapeFunctionJ = shapeFunctionI; shapeFunctionJ < shapeFunctionValues.Length; shapeFunctionJ++)
                    {
                        consistentMass[(3 * shapeFunctionI) + 1, (3 * shapeFunctionJ) + 1] =
                            consistentMass[3 * shapeFunctionI, 3 * shapeFunctionJ];

                        consistentMass[(3 * shapeFunctionI) + 2, (3 * shapeFunctionJ) + 2] =
                            consistentMass[3 * shapeFunctionI, 3 * shapeFunctionJ];
                    }
                }
            }

            return(consistentMass);
        }
コード例 #3
0
        public IMatrix2D CalculateConsistentMass(IElement element)
        {
            double[,] coordinates = this.GetCoordinates(element);
            GaussLegendrePoint3D[] integrationPoints = this.CalculateGaussMatrices(coordinates);
            SymmetricMatrix2D      consistentMass    = new SymmetricMatrix2D(8);

            foreach (GaussLegendrePoint3D gaussPoint in integrationPoints)
            {
                double[] shapeFunctionValues = CalculateShapeFunctions(gaussPoint.Xi, gaussPoint.Eta);
                double   weightDensity       = gaussPoint.WeightFactor * Density;
                for (int iShapeFunction = 0; iShapeFunction < shapeFunctionValues.Length; iShapeFunction++)
                {
                    for (int jShapeFunction = iShapeFunction; jShapeFunction < shapeFunctionValues.Length; jShapeFunction++)
                    {
                        consistentMass[2 * iShapeFunction, 2 * jShapeFunction]
                            += shapeFunctionValues[iShapeFunction] *
                               shapeFunctionValues[jShapeFunction] *
                               weightDensity;
                    }
                    for (int jShapeFunction = iShapeFunction; jShapeFunction < shapeFunctionValues.Length; jShapeFunction++)
                    {
                        consistentMass[(2 * iShapeFunction) + 1, (2 * jShapeFunction) + 1] =
                            consistentMass[2 * iShapeFunction, 2 * jShapeFunction];
                    }
                }
            }
            return(consistentMass);
        }
コード例 #4
0
        public virtual IMatrix2D StiffnessMatrix(IElement element)
        {
            double[,] coordinates = this.GetCoordinates(element);
            GaussLegendrePoint3D[] integrationPoints = this.CalculateGaussMatrices(coordinates);
            SymmetricMatrix2D      stiffnessMatrix   = new SymmetricMatrix2D(8);
            int pointId = -1;

            foreach (GaussLegendrePoint3D gaussPoint in integrationPoints)
            {
                pointId++;
                IMatrix2D constitutiveMatrix = materialsAtGaussPoints[pointId].ConstitutiveMatrix;
                double[,] b = gaussPoint.DeformationMatrix;
                for (int i = 0; i < 8; i++)
                {
                    double[] eb = new double[3];
                    for (int iE = 0; iE < 3; iE++)
                    {
                        eb[iE] = (constitutiveMatrix[iE, 0] * b[0, i]) + (constitutiveMatrix[iE, 1] * b[1, i]) +
                                 (constitutiveMatrix[iE, 2] * b[2, i]);
                    }


                    for (int j = i; j < 8; j++)
                    {
                        double stiffness = (b[0, j] * eb[0]) + (b[1, j] * eb[1]) + (b[2, j] * eb[2]);
                        stiffnessMatrix[i, j] += stiffness * gaussPoint.WeightFactor;
                    }
                }
            }

            return(stiffnessMatrix);
        }
コード例 #5
0
        private IMatrix2D <double> PorousMatrix(Element element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <DOFType> dofTypes in elementType.DOFEnumerator.GetDOFTypes(element))
            {
                foreach (DOFType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            SymmetricMatrix2D <double> poreMass = new SymmetricMatrix2D <double>(dofs);

            IMatrix2D <double> mass = solidMassProvider.Matrix(element);

            int matrixRow = 0;
            int solidRow  = 0;

            foreach (IList <DOFType> dofTypesRow in elementType.DOFEnumerator.GetDOFTypes(element))
            {
                foreach (DOFType dofTypeRow in dofTypesRow)
                {
                    int matrixCol = 0;
                    int solidCol  = 0;
                    foreach (IList <DOFType> dofTypesCol in elementType.DOFEnumerator.GetDOFTypes(element))
                    {
                        foreach (DOFType dofTypeCol in dofTypesCol)
                        {
                            if (dofTypeCol == DOFType.Pore)
                            {
                            }
                            else
                            {
                                if (dofTypeRow != DOFType.Pore)
                                {
                                    poreMass[matrixRow, matrixCol] = mass[solidRow, solidCol] * massCoefficient;
                                }
                                solidCol++;
                            }
                            matrixCol++;
                        }
                    }

                    if (dofTypeRow != DOFType.Pore)
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreMass);
        }
コード例 #6
0
 public IMatrix2D <double> Matrix(Element element)
 {
     if (element.ElementType is IPorousFiniteElement)
     {
         return(PorousMatrix(element));
     }
     else
     {
         int dofs = 0;
         foreach (DOFType[] dofTypes in element.ElementType.DOFTypes)
         {
             foreach (DOFType dofType in dofTypes)
             {
                 dofs++;
             }
         }
         SymmetricMatrix2D <double> stiffnessMatrix = new SymmetricMatrix2D <double>(dofs);
         for (int i = 0; i < dofs; i++)
         {
             stiffnessMatrix[i, i] = 1;
         }
         return(stiffnessMatrix);
     }
 }
コード例 #7
0
        private IMatrix2D <double> PorousMatrix(Element element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <DOFType> dofTypes in elementType.DOFTypes)
            {
                foreach (DOFType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            SymmetricMatrix2D <double> poreStiffness = new SymmetricMatrix2D <double>(dofs);

            for (int i = 0; i < dofs; i++)
            {
                poreStiffness[i, i] = 1;
            }

            IMatrix2D <double> permeability = elementType.PermeabilityMatrix(element);
            int matrixRow = 0;
            int solidRow  = 0;
            int fluidRow  = 0;

            foreach (IList <DOFType> dofTypesRow in elementType.DOFTypes)
            {
                foreach (DOFType dofTypeRow in dofTypesRow)
                {
                    int matrixCol = 0;
                    int solidCol  = 0;
                    int fluidCol  = 0;
                    foreach (IList <DOFType> dofTypesCol in elementType.DOFTypes)
                    {
                        foreach (DOFType dofTypeCol in dofTypesCol)
                        {
                            if (dofTypeCol == DOFType.Pore)
                            {
                                if (dofTypeRow == DOFType.Pore)
                                {
                                    poreStiffness[matrixRow, matrixCol] = permeability[fluidRow, fluidCol];
                                }
                                fluidCol++;
                            }
                            else
                            {
                                solidCol++;
                            }
                            matrixCol++;
                        }
                    }

                    if (dofTypeRow == DOFType.Pore)
                    {
                        fluidRow++;
                    }
                    else
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreStiffness);
        }
コード例 #8
0
        public IMatrix2D <double> MassMatrix(Element element)
        {
            double x2 = Math.Pow(element.Nodes[1].X - element.Nodes[0].X, 2);
            double y2 = Math.Pow(element.Nodes[1].Y - element.Nodes[0].Y, 2);
            double z2 = Math.Pow(element.Nodes[1].Z - element.Nodes[0].Z, 2);
            double L  = 1d / Math.Sqrt(x2 + y2 + z2);
            //double halfMass = 0.5 * Density * SectionArea * L;

            //var massMatrix = new SymmetricMatrix2D<double>(new double[] { halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0, 0,
            //    halfMass, 0, 0, 0,
            //    halfMass, 0, 0,
            //    halfMass, 0,
            //    halfMass
            //});
            double halfMass   = Density * SectionArea / L / 6d;
            var    massMatrix = new SymmetricMatrix2D <double>(new double[] { halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                                              halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                                              halfMass, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                                              0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                                              0, 0, 0, 0, 0, 0, 0, 0,
                                                                              0, 0, 0, 0, 0, 0, 0,
                                                                              halfMass, 0, 0, 0, 0, 0,
                                                                              halfMass, 0, 0, 0, 0,
                                                                              halfMass, 0, 0, 0,
                                                                              0, 0, 0,
                                                                              0, 0,
                                                                              0 });

            var refx = new double[] { 1, 1, 1 };
            var beamTransformation = new Matrix2D <double>(12, 12);

            beamTransformation[0, 0] = (element.Nodes[1].X - element.Nodes[0].X) * L;
            beamTransformation[0, 1] = (element.Nodes[1].Y - element.Nodes[0].Y) * L;
            beamTransformation[0, 2] = (element.Nodes[1].Z - element.Nodes[0].Z) * L;

            beamTransformation[1, 0] = refx[1] * beamTransformation[0, 2] - refx[2] * beamTransformation[0, 1];
            beamTransformation[1, 1] = refx[2] * beamTransformation[0, 0] - refx[0] * beamTransformation[0, 2];
            beamTransformation[1, 2] = refx[0] * beamTransformation[0, 1] - refx[1] * beamTransformation[0, 0];
            double dn = 1.0 / Math.Sqrt(beamTransformation[1, 0] * beamTransformation[1, 0] + beamTransformation[1, 1] * beamTransformation[1, 1] + beamTransformation[1, 2] * beamTransformation[1, 2]);

            beamTransformation[1, 0] = beamTransformation[1, 0] * dn;
            beamTransformation[1, 1] = beamTransformation[1, 1] * dn;
            beamTransformation[1, 2] = beamTransformation[1, 2] * dn;
            beamTransformation[2, 0] = beamTransformation[0, 1] * beamTransformation[1, 2] - beamTransformation[0, 2] * beamTransformation[1, 1];
            beamTransformation[2, 1] = beamTransformation[0, 2] * beamTransformation[1, 0] - beamTransformation[0, 0] * beamTransformation[1, 2];
            beamTransformation[2, 2] = beamTransformation[0, 0] * beamTransformation[1, 1] - beamTransformation[0, 1] * beamTransformation[1, 0];

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    beamTransformation[i + 3, j + 3] = beamTransformation[i, j];
                    beamTransformation[i + 6, j + 6] = beamTransformation[i, j];
                    beamTransformation[i + 9, j + 9] = beamTransformation[i, j];
                }
            }
            CalculateRotTranformation(element);

            return(dofEnumerator.GetTransformedMatrix(new SymmetricMatrix2D <double>(rotTransformation.Transpose() * beamTransformation.Transpose() * massMatrix.ToMatrix2D() * beamTransformation * rotTransformation)));
        }
コード例 #9
0
        private IMatrix2D <double> StiffnessMatrixPure(Element element)
        {
            //var m = (material as IFiniteElementMaterial3D);//TODO remove material
            double x2 = Math.Pow(element.Nodes[1].X - element.Nodes[0].X, 2);
            double y2 = Math.Pow(element.Nodes[1].Y - element.Nodes[0].Y, 2);
            double z2 = Math.Pow(element.Nodes[1].Z - element.Nodes[0].Z, 2);
            double L  = 1 / Math.Sqrt(x2 + y2 + z2);
            double L2 = L * L;
            double L3 = L2 * L;
            //double EIx = m.YoungModulus * MomentOfInertiaX;

            /* deprecated calculations after the removal of the material class as input
             * double EIy = m.YoungModulus * MomentOfInertiaY;
             * double EIz = m.YoungModulus * MomentOfInertiaZ;
             * double GJL = m.YoungModulus * L * MomentOfInertiaPolar / (2 * (1 + m.PoissonRatio));
             * double EAL = m.YoungModulus * SectionArea * L;
             */

            double EIy = this.youngModulus * MomentOfInertiaY;
            double EIz = this.youngModulus * MomentOfInertiaZ;
            double GJL = this.youngModulus * L * MomentOfInertiaPolar / (2 * (1 + this.poissonRatio));
            double EAL = this.youngModulus * SectionArea * L;

            var stiffnessMatrix = new SymmetricMatrix2D <double>(new double[] { EAL, 0, 0, 0, 0, 0, -EAL, 0, 0, 0, 0, 0,
                                                                                12 * EIz * L3, 0, 0, 0, 6 * EIz * L2, 0, -12 * EIz * L3, 0, 0, 0, 6 * EIz * L2,
                                                                                12 * EIy * L3, 0, -6 * EIy * L2, 0, 0, 0, -12 * EIy * L3, 0, -6 * EIy * L2, 0,
                                                                                GJL, 0, 0, 0, 0, 0, -GJL, 0, 0,
                                                                                4 * EIy * L, 0, 0, 0, 6 * EIy * L2, 0, 2 * EIy * L, 0,
                                                                                4 * EIz * L, 0, -6 * EIz * L2, 0, 0, 0, 2 * EIz * L,
                                                                                EAL, 0, 0, 0, 0, 0,
                                                                                12 * EIz * L3, 0, 0, 0, -6 * EIz * L2,
                                                                                12 * EIy * L3, 0, 6 * EIy * L2, 0,
                                                                                GJL, 0, 0,
                                                                                4 * EIy * L, 0,
                                                                                4 * EIz * L });

            var refx = new double[] { 1, 1, 1 };
            var beamTransformation = new Matrix2D <double>(12, 12);

            beamTransformation[0, 0] = (element.Nodes[1].X - element.Nodes[0].X) * L;
            beamTransformation[0, 1] = (element.Nodes[1].Y - element.Nodes[0].Y) * L;
            beamTransformation[0, 2] = (element.Nodes[1].Z - element.Nodes[0].Z) * L;

            //beamTransformation[2, 0] = refx[0];
            //beamTransformation[2, 1] = refx[1];
            //beamTransformation[2, 2] = refx[2];

            //beamTransformation[1, 0] = beamTransformation[2, 1] * beamTransformation[0, 2] - beamTransformation[2, 2] * beamTransformation[0, 1];
            //beamTransformation[1, 1] = beamTransformation[2, 2] * beamTransformation[0, 0] - beamTransformation[2, 0] * beamTransformation[0, 2];
            //beamTransformation[1, 2] = beamTransformation[2, 0] * beamTransformation[0, 1] - beamTransformation[2, 1] * beamTransformation[0, 0];
            beamTransformation[1, 0] = refx[1] * beamTransformation[0, 2] - refx[2] * beamTransformation[0, 1];
            beamTransformation[1, 1] = refx[2] * beamTransformation[0, 0] - refx[0] * beamTransformation[0, 2];
            beamTransformation[1, 2] = refx[0] * beamTransformation[0, 1] - refx[1] * beamTransformation[0, 0];
            double dn = 1.0 / Math.Sqrt(beamTransformation[1, 0] * beamTransformation[1, 0] + beamTransformation[1, 1] * beamTransformation[1, 1] + beamTransformation[1, 2] * beamTransformation[1, 2]);

            beamTransformation[1, 0] = beamTransformation[1, 0] * dn;
            beamTransformation[1, 1] = beamTransformation[1, 1] * dn;
            beamTransformation[1, 2] = beamTransformation[1, 2] * dn;
            beamTransformation[2, 0] = beamTransformation[0, 1] * beamTransformation[1, 2] - beamTransformation[0, 2] * beamTransformation[1, 1];
            beamTransformation[2, 1] = beamTransformation[0, 2] * beamTransformation[1, 0] - beamTransformation[0, 0] * beamTransformation[1, 2];
            beamTransformation[2, 2] = beamTransformation[0, 0] * beamTransformation[1, 1] - beamTransformation[0, 1] * beamTransformation[1, 0];

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    beamTransformation[i + 3, j + 3] = beamTransformation[i, j];
                    beamTransformation[i + 6, j + 6] = beamTransformation[i, j];
                    beamTransformation[i + 9, j + 9] = beamTransformation[i, j];
                }
            }

            return(new SymmetricMatrix2D <double>(beamTransformation.Transpose() * stiffnessMatrix.ToMatrix2D() * beamTransformation));

            ////if (element.Nodes.Count(n => n.EmbeddedInElement != null) == 0) return stiffnessMatrix;
            //stiffnessMatrix = new SymmetricMatrix2D<double>(beamTransformation.Transpose() * stiffnessMatrix.ToMatrix2D() * beamTransformation);
            //if (embeddedNodes.Count == 0) return stiffnessMatrix;

            ////var hostElements = element.Nodes.Select(x => x.EmbeddedInElement).Distinct();
            //var size = GetElementDOFTypes(element).SelectMany(x => x).Count();
            //transformation = new Matrix2D<double>(dofs.SelectMany(d => d).Count(), size);
            //isNodeEmbedded = new bool[element.Nodes.Count];

            ////TODO : SEPARATE FROM ELEMENT!!
            ////TODO: Must match DOFs of host with embedded element
            //int row = 0;
            //int col = 0;
            //hostElementList = new List<Element>();
            //for (int i = 0; i < element.Nodes.Count; i++)
            //{
            //    var node = element.Nodes[i];
            //    var embeddedNode = embeddedNodes.Where(x => x.Node == node).FirstOrDefault();
            //    //var hostElement = node.EmbeddedInElement;
            //    Element hostElement = embeddedNode == null ? null : embeddedNode.EmbeddedInElement;
            //    if (hostElement == null)
            //    {
            //        isNodeEmbedded[i] = false;
            //        for (int j = 0; j < dofs[i].Length; j++)
            //        {
            //            transformation[row, col] = 1;
            //            row++;
            //            col++;
            //        }
            //    }
            //    else
            //    {
            //        isNodeEmbedded[i] = true;
            //        //double[] hostShapeFunctions = ((IEmbeddedHostElement)hostElement.ElementType).GetShapeFunctionsForNode(hostElement, node);
            //        double[] hostShapeFunctions = ((IEmbeddedHostElement)hostElement.ElementType).GetShapeFunctionsForNode(hostElement, embeddedNode);

            //        if (hostElementList.IndexOf(hostElement) < 0)
            //            hostElementList.Add(hostElement);
            //        else
            //            col -= hostShapeFunctions.Length * hostDofsPerNode;

            //        for (int j = 0; j < commonDofsPerNode; j++)
            //        {
            //            for (int k = 0; k < hostShapeFunctions.Length; k++)
            //                transformation[row, hostDofsPerNode * k + col + j] = hostShapeFunctions[k];
            //            row++;
            //        }
            //        row += embeddedDofsPerNode - commonDofsPerNode;
            //        col += hostShapeFunctions.Length * hostDofsPerNode;
            //    }
            //}

            //// Add identity matrix
            //int index = 0;
            //if (isNodeEmbedded[0])
            //{
            //    transformation[3, col] = 1;
            //    transformation[4, col + 1] = 1;
            //    transformation[5, col + 2] = 1;
            //    index += 3;
            //}
            //if (isNodeEmbedded[1])
            //{
            //    transformation[9, col + index] = 1;
            //    transformation[10, col + index + 1] = 1;
            //    transformation[11, col + index + 2] = 1;
            //}

            //var transformedMatrix = new SymmetricMatrix2D<double>(transformation.Transpose() * stiffnessMatrix.ToMatrix2D() * transformation);
            ////var sw = File.CreateText(@"d:\BeamTransformed.txt");
            ////for (int i = 0; i < 54; i++)
            ////{
            ////    var s = string.Empty;
            ////    for (int j = 0; j < 54; j++)
            ////        s += transformedMatrix[i, j].ToString() + ";";
            ////    sw.WriteLine(s);
            ////}
            ////sw.Close();
            //return transformedMatrix;
        }
コード例 #10
0
        private IMatrix2D <double> PorousMatrix(Element element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <DOFType> dofTypes in elementType.DOFEnumerator.GetDOFTypes(element))
            {
                foreach (DOFType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            SymmetricMatrix2D <double> poreDamping = new SymmetricMatrix2D <double>(dofs);

            IMatrix2D <double> damping    = solidDampingProvider.Matrix(element);
            IMatrix2D <double> saturation = elementType.SaturationMatrix(element);
            IMatrix2D <double> coupling   = elementType.CouplingMatrix(element);

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

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

                    if (dofTypeRow == DOFType.Pore)
                    {
                        fluidRow++;
                    }
                    else
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreDamping);
        }
コード例 #11
0
        private IMatrix2D <double> PorousMatrix(Element element)
        {
            IPorousFiniteElement elementType = (IPorousFiniteElement)element.ElementType;
            int dofs = 0;

            foreach (IList <DOFType> dofTypes in elementType.DOFEnumerator.GetDOFTypes(element))
            {
                foreach (DOFType dofType in dofTypes)
                {
                    dofs++;
                }
            }
            SymmetricMatrix2D <double> poreStiffness = new SymmetricMatrix2D <double>(dofs);

            IMatrix2D <double> stiffness    = solidStiffnessProvider.Matrix(element);
            IMatrix2D <double> permeability = elementType.PermeabilityMatrix(element);

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

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

                    if (dofTypeRow == DOFType.Pore)
                    {
                        fluidRow++;
                    }
                    else
                    {
                        solidRow++;
                    }
                    matrixRow++;
                }
            }

            return(poreStiffness);
        }