From c98d5d4e2aecf7655ae168530c40839dd4f6f7c9 Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Fri, 5 Aug 2011 07:52:43 +0000
Subject: [PATCH] added property tag LSBlockSize to linear solver properties

   - different models may require a block size, which can differ from the
     number of equations of the mathematical model. This has to be
     knwon if the SuperLU solver is used
   - default block size of box models is numEq
   - default block size of decoupled models is 1



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6392 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/common/boxpropertydefaults.hh |  7 +++++++
 dumux/decoupled/common/decoupledproperties.hh |  9 +++++++++
 dumux/linear/linearsolverproperties.hh        | 10 ++++++++++
 dumux/linear/seqsolverbackend.hh              |  4 ++--
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/dumux/boxmodels/common/boxpropertydefaults.hh b/dumux/boxmodels/common/boxpropertydefaults.hh
index 98217a17ae..841b486b6c 100644
--- a/dumux/boxmodels/common/boxpropertydefaults.hh
+++ b/dumux/boxmodels/common/boxpropertydefaults.hh
@@ -218,6 +218,13 @@ SET_PROP(BoxModel, LSMaxIterations)
 {public:
     static constexpr int value = 250;
 };
+
+//! set number of equations of the mathematical model as default
+SET_PROP_DEFAULT(LSBlockSize)
+{public:
+    static constexpr int value = GET_PROP_VALUE(TypeTag, PTAG(NumEq));
+};
+
 } // namespace Properties
 } // namespace Dumux
 
diff --git a/dumux/decoupled/common/decoupledproperties.hh b/dumux/decoupled/common/decoupledproperties.hh
index 6256ab81f2..4931f9c0d2 100644
--- a/dumux/decoupled/common/decoupledproperties.hh
+++ b/dumux/decoupled/common/decoupledproperties.hh
@@ -53,6 +53,7 @@ NEW_TYPE_TAG(DecoupledModel, INHERITS_FROM(ExplicitModel, LinearSolverTypeTag));
 //! grid, and elements, and shape functions.
 NEW_PROP_TAG( SolutionTypes);
 NEW_PROP_TAG( TransportSolutionType);
+NEW_PROP_TAG( PrimaryVariables);
 
 NEW_PROP_TAG( Grid); //!< The type of the DUNE grid
 NEW_PROP_TAG( GridView); //!< The type of the grid view
@@ -163,6 +164,8 @@ public:
     typedef Dune::BlockVector<Dune::FieldVector<Dune::FieldVector<Scalar, dim>, 2*dim > > DimVecElemFace;//!<type for vector of vectors (of size 2 x dimension) of vector (of size dimension) of scalars
 };
 
+SET_TYPE_PROP(DecoupledModel,  PrimaryVariables, typename GET_PROP(TypeTag, PTAG(SolutionTypes))::PrimaryVariables);
+
 /*!
  * \brief Default implementation for the Vector of the transportet quantity
  *
@@ -203,6 +206,12 @@ SET_PROP(DecoupledModel, LSMaxIterations)
 {public:
     static constexpr int value = 500;
 };
+
+//! set the default number of maximum iterations for the linear solver
+SET_PROP(DecoupledModel, LSBlockSize)
+{public:
+    static constexpr int value = 1;
+};
 // \}
 
 }
diff --git a/dumux/linear/linearsolverproperties.hh b/dumux/linear/linearsolverproperties.hh
index 2606805aba..c39becb3b7 100644
--- a/dumux/linear/linearsolverproperties.hh
+++ b/dumux/linear/linearsolverproperties.hh
@@ -65,6 +65,15 @@ NEW_PROP_TAG(PreconditionerIterations);
 //! restart parameter for GMRes
 NEW_PROP_TAG(GMResRestart);
 
+//! Size of the matrix/vector blocks
+/*!
+ * The number of different types of equations which build the system of equations to solve
+ * can differ from the number of equations given by the mathematical/physical model (e.g. IMPES).
+ * Thus, the block size does not have to be equal to NumEq.
+ * (Especially important for the SuperLU solver!)
+ */
+NEW_PROP_TAG(LSBlockSize);
+
 //! do not print anything by default
 SET_PROP_DEFAULT(NewtonLinearSolverVerbosity)
 {public:
@@ -92,6 +101,7 @@ SET_PROP_DEFAULT(GMResRestart)
 {public:
     static constexpr int value = 10;
 };
+
 } // namespace Properties
 } // namespace Dumux
 
diff --git a/dumux/linear/seqsolverbackend.hh b/dumux/linear/seqsolverbackend.hh
index 43e27026b5..40c8641135 100644
--- a/dumux/linear/seqsolverbackend.hh
+++ b/dumux/linear/seqsolverbackend.hh
@@ -471,8 +471,8 @@ public:
     Vector bTmp(b);
 
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
-    enum {numEq = GET_PROP_VALUE(TypeTag, PTAG(NumEq))};
-    typedef typename Dune::FieldMatrix<Scalar, numEq, numEq> MatrixBlock;
+    enum {blockSize = GET_PROP_VALUE(TypeTag, PTAG(LSBlockSize))};
+    typedef typename Dune::FieldMatrix<Scalar, blockSize, blockSize> MatrixBlock;
     typedef typename Dune::BCRSMatrix<MatrixBlock> ISTLMatrix;
 
     Dune::SuperLU<ISTLMatrix> solver(A);
-- 
GitLab