diff --git a/dumux/boxmodels/2p/2pfluxvariables.hh b/dumux/boxmodels/2p/2pfluxvariables.hh index b304cd2e23c502baa99412fe29d48a5e20ae7453..4ea7096c07d4c285f68fd0dc19ac8e1bcdabc179 100644 --- a/dumux/boxmodels/2p/2pfluxvariables.hh +++ b/dumux/boxmodels/2p/2pfluxvariables.hh @@ -71,8 +71,8 @@ class TwoPFluxVariables typedef typename FVElementGeometry::SubControlVolume SCV; typedef typename FVElementGeometry::SubControlVolumeFace SCVFace; - typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> Tensor; - typedef Dune::FieldVector<CoordScalar, dimWorld> Vector; + typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Tensor; + typedef Dune::FieldVector<Scalar, dimWorld> Vector; public: /* diff --git a/dumux/boxmodels/2p/2plocalresidual.hh b/dumux/boxmodels/2p/2plocalresidual.hh index 3f7541bdfaa3c95149bdd48471daf6035f96f3c0..0b554f26fdb2beb559e25dff62c57e86428bf911 100644 --- a/dumux/boxmodels/2p/2plocalresidual.hh +++ b/dumux/boxmodels/2p/2plocalresidual.hh @@ -171,7 +171,10 @@ public: // (the minus comes from the Darcy law which states that // the flux is from high to low pressure potentials.) fluxVars.intrinsicPermeability().mv(fluxVars.potentialGrad(phaseIdx), tmpVec); - Scalar normalFlux = - (tmpVec*fluxVars.face().normal); + Scalar normalFlux = 0; + for (int i = 0; i < Vector::size; ++i) + normalFlux += tmpVec[i]*fluxVars.face().normal[i]; + normalFlux *= -1; // data attached to upstream and the downstream vertices // of the current phase diff --git a/dumux/boxmodels/2p/2pmodel.hh b/dumux/boxmodels/2p/2pmodel.hh index f06902110e5b4046ba7478ab96d6ba4b3c2f00aa..604d538d0d87294433bc5962c4fa453089356518 100644 --- a/dumux/boxmodels/2p/2pmodel.hh +++ b/dumux/boxmodels/2p/2pmodel.hh @@ -110,6 +110,7 @@ class TwoPModel : public BoxModel<TypeTag> typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef typename GridView::template Codim<0>::Iterator ElementIterator; + typedef typename GridView::ctype CoordScalar; public: /*! @@ -139,8 +140,8 @@ public: MultiWriter &writer) { bool velocityOutput = GET_PROP_VALUE(TypeTag, PTAG(EnableVelocityOutput)); - typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > ScalarField; - typedef Dune::BlockVector<Dune::FieldVector<Scalar, dim> > VectorField; + typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField; + typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField; // create the required scalar fields unsigned numVertices = this->problem_().gridView().size(dim); @@ -156,8 +157,8 @@ public: ScalarField *poro = writer.allocateManagedBuffer(numVertices); ScalarField *Te = writer.allocateManagedBuffer(numVertices); ScalarField *cellNum =writer.allocateManagedBuffer (numVertices); - VectorField *velocityN = writer.template allocateManagedBuffer <Scalar, dim> (numVertices); - VectorField *velocityW = writer.template allocateManagedBuffer <Scalar, dim> (numVertices); + VectorField *velocityN = writer.template allocateManagedBuffer<double, dim>(numVertices); + VectorField *velocityW = writer.template allocateManagedBuffer<double, dim>(numVertices); if(velocityOutput) // check if velocity output is demanded { @@ -271,7 +272,7 @@ public: const Dune::FieldVector<Scalar, dim>& localPosIP = fvElemGeom.subContVolFace[faceIdx].ipLocal; // Transformation of the global normal vector to normal vector in the reference element - const Dune::FieldMatrix<Scalar, dim, dim> jacobianT1 = elemIt->geometry().jacobianTransposed(localPosIP); + const Dune::FieldMatrix<CoordScalar, dim, dim> jacobianT1 = elemIt->geometry().jacobianTransposed(localPosIP); GlobalPosition localNormal(0); jacobianT1.mv(globalNormal, localNormal); @@ -305,18 +306,19 @@ public: } } typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements; - const Dune::FieldVector<Scalar, dim>& localPos = ReferenceElements::general(elemIt->geometry().type()).position(0, - 0); + const Dune::FieldVector<Scalar, dim> &localPos + = ReferenceElements::general(elemIt->geometry().type()).position(0, 0); // get the transposed Jacobian of the element mapping - const Dune::FieldMatrix<Scalar, dim, dim> jacobianT2 = elemIt->geometry().jacobianTransposed(localPos); + const Dune::FieldMatrix<CoordScalar, dim, dim> &jacobianT2 + = elemIt->geometry().jacobianTransposed(localPos); // transform vertex velocities from local to global coordinates for (int i = 0; i < numVerts; ++i) { int globalIdx = this->vertexMapper().map(*elemIt, i, dim); // calculate the subcontrolvolume velocity by the Piola transformation - Dune::FieldVector<Scalar, dim> scvVelocity(0); + Dune::FieldVector<CoordScalar, dim> scvVelocity(0); jacobianT2.mtv(scvVelocityW[i], scvVelocity); scvVelocity /= elemIt->geometry().integrationElement(localPos); diff --git a/dumux/boxmodels/2p/2pproblem.hh b/dumux/boxmodels/2p/2pproblem.hh index b9b4b6e4c162b38d286c275da7ec20f3b98537aa..6981be5acc2f130a392677a9fa65c720929c1003 100644 --- a/dumux/boxmodels/2p/2pproblem.hh +++ b/dumux/boxmodels/2p/2pproblem.hh @@ -53,8 +53,10 @@ class TwoPProblem : public BoxProblem<TypeTag> dimWorld = GridView::dimensionworld }; - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; + typedef typename GridView::ctype CoordScalar; + typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; typedef typename GridView::template Codim<0>::Entity Element; + typedef Dune::FieldVector<Scalar, dim> Vector; public: /*! @@ -152,7 +154,7 @@ public: * This is the box discretization specific interface. By default * it just calls gravityAtPos(). */ - const GlobalPosition &boxGravity(const Element &element, + const Vector &boxGravity(const Element &element, const FVElementGeometry &fvGeom, int scvIdx) const { return asImp_().gravityAtPos(fvGeom.subContVol[scvIdx].global); } @@ -163,7 +165,7 @@ public: * This is discretization independent interface. By default it * just calls gravity(). */ - const GlobalPosition &gravityAtPos(const GlobalPosition &pos) const + const Vector &gravityAtPos(const GlobalPosition &pos) const { return asImp_().gravity(); } /*! @@ -175,7 +177,7 @@ public: * property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds, * else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$. */ - const GlobalPosition &gravity() const + const Vector &gravity() const { return gravity_; } /*! @@ -200,7 +202,7 @@ private: const Implementation &asImp_() const { return *static_cast<const Implementation *>(this); } - GlobalPosition gravity_; + Vector gravity_; // fluids and material properties SpatialParameters* spatialParameters_; diff --git a/test/boxmodels/2p/lensspatialparameters.hh b/test/boxmodels/2p/lensspatialparameters.hh index 3188c22e2057489d60ca769e26d75ccede6cfa76..d0a34f0f153adba60b1a2aa9e2c56d045399e6de 100644 --- a/test/boxmodels/2p/lensspatialparameters.hh +++ b/test/boxmodels/2p/lensspatialparameters.hh @@ -26,8 +26,8 @@ * \brief The spatial parameters for the LensProblem which uses the * twophase box model */ -#ifndef DUMUX_LENSSPATIALPARAMETERS_HH -#define DUMUX_LENSSPATIALPARAMETERS_HH +#ifndef DUMUX_LENS_SPATIAL_PARAMETERS_HH +#define DUMUX_LENS_SPATIAL_PARAMETERS_HH #include <dumux/material/spatialparameters/boxspatialparameters.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh>