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);
        }
Beispiel #2
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);
        }
        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);
        }