Commit 8cd8367c authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implicit branch: unify Box- and CC-Model to ImplicitModel. Delete ccmodel.hh....

implicit branch: unify Box- and CC-Model to ImplicitModel. Delete ccmodel.hh. Deprecate BoxModel in favor of ImplicitModel. Adapt includes and names.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/branches/implicit@9755 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 87bbcce3
#warning This file is deprecated. Include dumux/implicit/box/boxmodel.hh instead.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
*
* \brief Base class for models using box discretization
*/
#ifndef DUMUX_BOX_MODEL_HH
#define DUMUX_BOX_MODEL_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/implicit/common/implicitmodel.hh>
namespace Dumux
{
/*!
* \ingroup BoxModel
*
* \brief The base class for the vertex centered finite volume
* discretization scheme.
*/
template<class TypeTag>
class BoxModel : public ImplicitModel<TypeTag>
{
typedef ImplicitModel<TypeTag> ParentType;
// copying a model is not a good idea
BoxModel(const BoxModel &);
public:
/*!
* \brief The constructor.
*/
DUNE_DEPRECATED_MSG("Use ImplicitModel from dumux/implicit/common/implicitmodel.hh instead.")
BoxModel() : ParentType()
{}
};
}
#endif
......@@ -26,7 +26,7 @@
#ifndef DUMUX_STOKES_LOCAL_RESIDUAL_BASE_HH
#define DUMUX_STOKES_LOCAL_RESIDUAL_BASE_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
//#include <dumux/implicit/box/boxcouplinglocalresidual.hh>
#include "stokesproperties.hh"
......
......@@ -24,7 +24,7 @@
* \brief Base class for all models which use the Stokes box model.
*/
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include "stokeslocalresidual.hh"
#include "stokesnewtoncontroller.hh"
......
......@@ -27,7 +27,7 @@
#ifndef DUMUX_1P_MODEL_HH
#define DUMUX_1P_MODEL_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include "1plocalresidual.hh"
......
......@@ -27,7 +27,7 @@
#define DUMUX_ONEP_TWOC_LOCAL_RESIDUAL_HH
#define VELOCITY_OUTPUT 1 //1 turns velocity output on, 0 turns it off
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include <dumux/implicit/1p2c/1p2cproperties.hh>
#include <dumux/implicit/1p2c/1p2cvolumevariables.hh>
......
......@@ -30,7 +30,7 @@
#include "1p2cproperties.hh"
#include "1p2clocalresidual.hh"
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
namespace Dumux
{
......
......@@ -24,7 +24,7 @@
#ifndef DUMUX_TWOP_LOCAL_RESIDUAL_BASE_HH
#define DUMUX_TWOP_LOCAL_RESIDUAL_BASE_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include "2pproperties.hh"
......
......@@ -26,7 +26,7 @@
#ifndef DUMUX_2P2C_LOCAL_RESIDUAL_BASE_HH
#define DUMUX_2P2C_LOCAL_RESIDUAL_BASE_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include <dumux/common/math.hh>
#include "2p2cproperties.hh"
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_2P2C_VOLUME_VARIABLES_HH
#define DUMUX_2P2C_VOLUME_VARIABLES_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include <dumux/common/math.hh>
#include <dune/common/collectivecommunication.hh>
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_3P3C_LOCAL_RESIDUAL_HH
#define DUMUX_3P3C_LOCAL_RESIDUAL_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include <dumux/common/math.hh>
#include "3p3cproperties.hh"
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_3P3C_VOLUME_VARIABLES_HH
#define DUMUX_3P3C_VOLUME_VARIABLES_HH
#include <dumux/implicit/box/boxmodel.hh>
#include <dumux/boxmodels/common/boxmodel.hh>
#include <dumux/common/math.hh>
#include <dune/common/collectivecommunication.hh>
......
This diff is collapsed.
......@@ -59,4 +59,6 @@ NEW_PROP_TAG(ImplicitUseTwoPointFlux); //! indicates whether two-point flux shou
// \}
#include "boxpropertydefaults.hh"
#endif
......@@ -29,7 +29,6 @@
#include <dumux/implicit/common/implicitpropertydefaults.hh>
#include "boxassembler.hh"
#include "boxmodel.hh"
#include "boxfvelementgeometry.hh"
#include "boxelementboundarytypes.hh"
#include "boxlocalresidual.hh"
......@@ -60,9 +59,6 @@ SET_TYPE_PROP(BoxModel, DofMapper, typename GET_PROP_TYPE(TypeTag, VertexMapper)
//! Set the BaseLocalResidual to BoxLocalResidual
SET_TYPE_PROP(BoxModel, BaseLocalResidual, Dumux::BoxLocalResidual<TypeTag>);
//! Set the BaseModel to BoxModel
SET_TYPE_PROP(BoxModel, BaseModel, Dumux::BoxModel<TypeTag>);
//! An array of secondary variable containers
SET_TYPE_PROP(BoxModel, ElementVolumeVariables, Dumux::BoxElementVolumeVariables<TypeTag>);
......
This diff is collapsed.
......@@ -33,7 +33,6 @@
#include <dumux/implicit/common/implicitpropertydefaults.hh>
#include "ccassembler.hh"
#include "ccmodel.hh"
#include "ccfvelementgeometry.hh"
#include "ccelementboundarytypes.hh"
#include "cclocalresidual.hh"
......@@ -59,9 +58,6 @@ SET_TYPE_PROP(CCModel, DofMapper, typename GET_PROP_TYPE(TypeTag, ElementMapper)
//! Set the BaseLocalResidual to CCLocalResidual
SET_TYPE_PROP(CCModel, BaseLocalResidual, Dumux::CCLocalResidual<TypeTag>);
//! Set the BaseModel to CCModel
SET_TYPE_PROP(CCModel, BaseModel, Dumux::CCModel<TypeTag>);
//! An array of secondary variable containers
SET_TYPE_PROP(CCModel, ElementVolumeVariables, Dumux::CCElementVolumeVariables<TypeTag>);
......
......@@ -290,9 +290,9 @@ public:
// we need to add the distance the solution was moved for
// this vertex
Scalar dist = model_().relativeErrorVertex(i,
currentPriVars,
nextPriVars);
Scalar dist = model_().relativeErrorDof(i,
currentPriVars,
nextPriVars);
delta_[i] += std::abs(dist);
}
......
......@@ -24,17 +24,13 @@
#ifndef DUMUX_IMPLICIT_MODEL_HH
#define DUMUX_IMPLICIT_MODEL_HH
#include "implicitproperties.hh"
#include "implicitpropertydefaults.hh"
#include "implicitelementvolumevariables.hh"
#include "implicitlocaljacobian.hh"
#include "implicitlocalresidual.hh"
#include <dune/grid/common/geometry.hh>
#include <dune/istl/bvector.hh>
#include "implicitproperties.hh"
#include <dumux/common/valgrind.hh>
#include <dumux/parallel/vertexhandles.hh>
#include <dune/grid/common/geometry.hh>
namespace Dumux
{
......@@ -246,7 +242,7 @@ public:
else
{
int globalI = elementMapper().map(*elemIt);
dest[globalI] = localResidual().residual(0);
residual[globalI] = localResidual().residual(0);
}
}
......@@ -311,7 +307,7 @@ public:
}
else
{
DUNE_THROW(Dune::InvalidStateError,
DUNE_THROW(Dune::InvalidStateException,
"requested box volume for cell-centered model");
}
}
......@@ -545,7 +541,7 @@ public:
const Entity &entity)
{
int dofIdx = dofMapper().map(entity);
// write phase state
if (!outstream.good()) {
DUNE_THROW(Dune::IOError,
......@@ -573,6 +569,7 @@ public:
const Entity &entity)
{
int dofIdx = dofMapper().map(entity);
for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
if (!instream.good())
DUNE_THROW(Dune::IOError,
......@@ -590,7 +587,7 @@ public:
if (isBox)
return gridView_().size(dim);
else
return gridView_().size(dim);
return gridView_().size(0);
}
/*!
......@@ -601,12 +598,15 @@ public:
* for vertices, if the cell centered method is used,
* this means a mapper for elements.
*/
const DofMapper &dofMapper() const
template <class T = TypeTag>
const typename std::enable_if<GET_PROP_VALUE(T, ImplicitIsBox), VertexMapper>::type &dofMapper() const
{
if (isBox)
return problem_().vertexMapper();
else
return problem_().elementMapper();
return problem_().vertexMapper();
}
template <class T = TypeTag>
const typename std::enable_if<!GET_PROP_VALUE(T, ImplicitIsBox), ElementMapper>::type &dofMapper() const
{
return problem_().elementMapper();
}
/*!
......@@ -780,7 +780,7 @@ public:
if (isBox)
return onBoundary(vertexMapper().map(element, vIdx, dim));
else
DUNE_THROW(Dune::InvalidStateError,
DUNE_THROW(Dune::InvalidStateException,
"requested for cell-centered model");
}
......@@ -797,7 +797,7 @@ public:
if (!isBox)
return onBoundary(elementMapper().map(elem));
else
DUNE_THROW(Dune::InvalidStateError,
DUNE_THROW(Dune::InvalidStateException,
"requested for box model");
}
......@@ -873,12 +873,20 @@ protected:
fvGeometry.update(gridView_(), *eIt);
// loop over all element vertices, i.e. sub control volumes
for (int scvIdx = 0; scvIdx < fvGeometry.numVertices; scvIdx++)
for (int scvIdx = 0; scvIdx < fvGeometry.numSCV; scvIdx++)
{
// map the local vertex index to the global one
int globalIdx = vertexMapper().map(*eIt,
scvIdx,
dim);
int globalIdx;
if (isBox)
{
// map the local vertex index to the global one
globalIdx = vertexMapper().map(*eIt, scvIdx, dim);
}
else
{
// get the global index of the element
globalIdx = elementMapper().map(*eIt);
}
// let the problem do the dirty work of nailing down
// the initial solution.
......@@ -890,12 +898,16 @@ protected:
scvIdx);
Valgrind::CheckDefined(initPriVars);
// add up the initial values of all sub-control
// volumes. If the initial values disagree for
// different sub control volumes, the initial value
// will be the arithmetic mean.
initPriVars *= fvGeometry.subContVol[scvIdx].volume;
boxVolume_[globalIdx] += fvGeometry.subContVol[scvIdx].volume;
if (isBox)
{
// add up the initial values of all sub-control
// volumes. If the initial values disagree for
// different sub control volumes, the initial value
// will be the arithmetic mean.
initPriVars *= fvGeometry.subContVol[scvIdx].volume;
boxVolume_[globalIdx] += fvGeometry.subContVol[scvIdx].volume;
}
uCur_[globalIdx] += initPriVars;
Valgrind::CheckDefined(uCur_[globalIdx]);
}
......@@ -903,7 +915,7 @@ protected:
// add up the primary variables and the volumes of the boxes
// which cross process borders
if (gridView_().comm().size() > 1) {
if (isBox && gridView_().comm().size() > 1) {
VertexHandleSum<Dune::FieldVector<Scalar, 1>,
Dune::BlockVector<Dune::FieldVector<Scalar, 1> >,
VertexMapper> sumVolumeHandle(boxVolume_, vertexMapper());
......@@ -918,20 +930,17 @@ protected:
Dune::ForwardCommunication);
}
// divide all primary variables by the volume of their boxes
int n = gridView_().size(dim);
for (int i = 0; i < n; ++i) {
uCur_[i] /= boxVolume(i);
if (isBox)
{
// divide all primary variables by the volume of their boxes
for (int i = 0; i < uCur_.size(); ++i) {
uCur_[i] /= boxVolume(i);
}
}
}
/*!
* \brief Find all indices of boundary vertices.
*
* For this we need to loop over all intersections (which is slow
* in general). If the DUNE grid interface would provide a
* onBoundary() method for entities this could be done in a much
* nicer way (actually this would not be necessary)
* \brief Find all indices of boundary vertices (box) / elements (cell centered).
*/
void updateBoundaryIndices_()
{
......@@ -948,20 +957,28 @@ protected:
IntersectionIterator isEndIt = gridView_().iend(*eIt);
for (; isIt != isEndIt; ++isIt) {
if (isIt->boundary()) {
// add all vertices on the intersection to the set of
// boundary vertices
int faceIdx = isIt->indexInInside();
int numFaceVerts = refElement.size(faceIdx, 1, dim);
for (int faceVertIdx = 0;
faceVertIdx < numFaceVerts;
++faceVertIdx)
if (isBox)
{
int elemVertIdx = refElement.subEntity(faceIdx,
1,
faceVertIdx,
dim);
int globalVertIdx = vertexMapper().map(*eIt, elemVertIdx, dim);
boundaryIndices_[globalVertIdx] = true;
// add all vertices on the intersection to the set of
// boundary vertices
int faceIdx = isIt->indexInInside();
int numFaceVerts = refElement.size(faceIdx, 1, dim);
for (int faceVertIdx = 0;
faceVertIdx < numFaceVerts;
++faceVertIdx)
{
int elemVertIdx = refElement.subEntity(faceIdx,
1,
faceVertIdx,
dim);
int globalVertIdx = vertexMapper().map(*eIt, elemVertIdx, dim);
boundaryIndices_[globalVertIdx] = true;
}
}
else
{
int globalIdx = elementMapper().map(*eIt);
boundaryIndices_[globalIdx] = true;
}
}
}
......@@ -1010,4 +1027,6 @@ private:
};
}
#include "implicitpropertydefaults.hh"
#endif
......@@ -24,6 +24,7 @@
#define DUMUX_IMPLICIT_PROBLEM_HH
#include "implicitproperties.hh"
#include "implicitmodel.hh"
#include <dumux/io/vtkmultiwriter.hh>
#include <dumux/io/restart.hh>
......
......@@ -33,6 +33,7 @@
#include <dumux/common/timemanager.hh>
#include "implicitproperties.hh"
#include "implicitmodel.hh"
#include "implicitlocaljacobian.hh"
#include "implicitvolumevariables.hh"
......@@ -73,6 +74,9 @@ SET_TYPE_PROP(ImplicitBase,
Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, GridView),
Dune::MCMGElementLayout>);
//! Set the BaseModel to ImplicitModel
SET_TYPE_PROP(ImplicitBase, BaseModel, Dumux::ImplicitModel<TypeTag>);
//! The volume variable class, to be overloaded by the model
SET_TYPE_PROP(ImplicitBase, VolumeVariables, Dumux::ImplicitVolumeVariables<TypeTag>);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment