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