Commit 6b292333 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implicit branch: change directory structure. Add dumux/implicit directory....

implicit branch: change directory structure. Add dumux/implicit directory. Copy models from boxmodels/model to implicit/model. Copy boxmodels/common to implicit/box. Copy ccmodels/common (from devel) to implicit/cellcentered. Copy boxmodels/common/box*.hh to implicit/common/implicit*.hh. Move test/boxmodels to test/implicit. Adapt configure.ac and Makefile.ams. Everything still builds.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/branches/implicit@9679 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 0be74f8f
......@@ -56,6 +56,26 @@ AC_CONFIG_FILES([dumux.pc
dumux/freeflow/stokes/Makefile
dumux/freeflow/stokes2c/Makefile
dumux/freeflow/stokes2cni/Makefile
dumux/implicit/Makefile
dumux/implicit/1p/Makefile
dumux/implicit/1p2c/Makefile
dumux/implicit/2p/Makefile
dumux/implicit/2p2c/Makefile
dumux/implicit/2p2cni/Makefile
dumux/implicit/2pni/Makefile
dumux/implicit/2pdfm/Makefile
dumux/implicit/3p3c/Makefile
dumux/implicit/3p3cni/Makefile
dumux/implicit/box/Makefile
dumux/implicit/cellcentered/Makefile
dumux/implicit/common/Makefile
dumux/implicit/co2/Makefile
dumux/implicit/co2ni/Makefile
dumux/implicit/mpnc/Makefile
dumux/implicit/mpnc/diffusion/Makefile
dumux/implicit/mpnc/energy/Makefile
dumux/implicit/mpnc/mass/Makefile
dumux/implicit/richards/Makefile
dumux/io/Makefile
dumux/linear/Makefile
dumux/material/Makefile
......@@ -75,20 +95,20 @@ AC_CONFIG_FILES([dumux.pc
dumux/parallel/Makefile
m4/Makefile
test/Makefile
test/boxmodels/Makefile
test/boxmodels/1p/Makefile
test/boxmodels/2p/Makefile
test/boxmodels/2pni/Makefile
test/boxmodels/1p2c/Makefile
test/boxmodels/2p2c/Makefile
test/boxmodels/2p2cni/Makefile
test/boxmodels/2pdfm/Makefile
test/boxmodels/3p3c/Makefile
test/boxmodels/3p3cni/Makefile
test/boxmodels/co2/Makefile
test/boxmodels/co2ni/Makefile
test/boxmodels/mpnc/Makefile
test/boxmodels/richards/Makefile
test/implicit/Makefile
test/implicit/1p/Makefile
test/implicit/2p/Makefile
test/implicit/2pni/Makefile
test/implicit/1p2c/Makefile
test/implicit/2p2c/Makefile
test/implicit/2p2cni/Makefile
test/implicit/2pdfm/Makefile
test/implicit/3p3c/Makefile
test/implicit/3p3cni/Makefile
test/implicit/co2/Makefile
test/implicit/co2ni/Makefile
test/implicit/mpnc/Makefile
test/implicit/richards/Makefile
test/common/Makefile
test/common/generalproblem/Makefile
test/common/propertysystem/Makefile
......
SUBDIRS = boxmodels common decoupled freeflow io linear material nonlinear parallel
SUBDIRS = boxmodels common decoupled freeflow implicit io linear material nonlinear parallel
dumuxdir = $(includedir)/dumux
......
// -*- 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 Defines the indices for the one-phase box model.
*/
#ifndef DUMUX_1P_INDICES_HH
#define DUMUX_1P_INDICES_HH
namespace Dumux
{
// \{
/*!
* \ingroup OnePBoxModel
* \ingroup BoxIndices
* \brief Indices for the one-phase model.
*/
struct OnePIndices
{
static const int conti0EqIdx = 0; //index for the mass balance
static const int pressureIdx = 0; //index of the primary variable
};
// \}
} // end namepace
#endif
// -*- 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 Element-wise calculation of the Jacobian matrix for problems
* using the one-phase box model.
*/
#ifndef DUMUX_1P_LOCAL_RESIDUAL_HH
#define DUMUX_1P_LOCAL_RESIDUAL_HH
#include <dumux/boxmodels/common/boxlocalresidual.hh>
#include "1pvolumevariables.hh"
#include "1pproperties.hh"
namespace Dumux
{
/*!
* \ingroup OnePBoxModel
* \ingroup BoxLocalResidual
* \brief Element-wise calculation of the Jacobian matrix for problems
* using the one-phase box model.
*/
template<class TypeTag>
class OnePLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
{
typedef OnePLocalResidual<TypeTag> ThisType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, FluxVariables) FluxVariables;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum { dim = GridView::dimension };
typedef Dune::FieldVector<Scalar, dim> DimVector;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
//index of the mass balance equation
enum {
conti0EqIdx = Indices::conti0EqIdx //index for the mass balance
};
//index of the primary variable
enum{
pressureIdx = Indices::pressureIdx //index for the primary variable
};
public:
/*!
* \brief Constructor. Sets the upwind weight.
*/
OnePLocalResidual()
{
// retrieve the upwind weight for the mass conservation equations. Use the value
// specified via the property system as default, and overwrite
// it by the run-time parameter from the Dune::ParameterTree
upwindWeight_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MassUpwindWeight);
};
/*!
* \brief Evaluate the rate of change of all conservation
* quantites (e.g. phase mass) within a sub-control
* volume of a finite volume element for the OneP
* model.
*
* This function should not include the source and sink terms.
* \param storage The phase mass within the sub-control volume
* \param scvIdx The SCV (sub-control-volume) index
* \param usePrevSol Evaluate function with solution of current or previous time step
*/
void computeStorage(PrimaryVariables &storage, const int scvIdx, const bool usePrevSol) const
{
// if flag usePrevSol is set, the solution from the previous
// time step is used, otherwise the current solution is
// used. The secondary variables are used accordingly. This
// is required to compute the derivative of the storage term
// using the implicit euler method.
const ElementVolumeVariables &elemVolVars = usePrevSol ? this->prevVolVars_() : this->curVolVars_();
const VolumeVariables &volVars = elemVolVars[scvIdx];
// partial time derivative of the wetting phase mass
storage[conti0EqIdx] = volVars.density() * volVars.porosity();
}
/*!
* \brief Evaluate the mass flux over a face of a sub-control
* volume.
*
* \param flux The flux over the SCV (sub-control-volume) face
* \param faceIdx The index of the SCV face
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux, const int faceIdx, const bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->element_(),
this->fvGeometry_(),
faceIdx,
this->curVolVars_(),
onBoundary);
const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx(/*phaseIdx=*/0));
const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx(/*phaseIdx=*/0));
flux[conti0EqIdx] =
(( upwindWeight_)*up.density()
+
(1 - upwindWeight_)*dn.density())
*
fluxVars.volumeFlux(/*phaseIdx=*/0);
}
/*!
* \brief Calculate the source term of the equation.
*
* \param source The source/sink in the SCV
* \param scvIdx The index of the SCV
*
*/
void computeSource(PrimaryVariables &source, const int scvIdx)
{
this->problem_().boxSDSource(source,
this->element_(),
this->fvGeometry_(),
scvIdx,
this->curVolVars_());
}
/*!
* \brief Return the temperature given the solution vector of a
* finite volume.
*/
template <class PrimaryVariables>
Scalar temperature(const PrimaryVariables &priVars)
{ return this->problem_.temperature(); /* constant temperature */ }
private:
ThisType &asImp_()
{ return *static_cast<ThisType *>(this); }
const ThisType &asImp_() const
{ return *static_cast<const ThisType *>(this); }
Scalar upwindWeight_;
};
}
#endif
// -*- 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 all models which use the one-phase,
* box model.
* Adaption of the BOX scheme to the one-phase flow model.
*/
#ifndef DUMUX_1P_MODEL_HH
#define DUMUX_1P_MODEL_HH
#include <dumux/boxmodels/common/boxmodel.hh>
#include "1plocalresidual.hh"
namespace Dumux
{
/*!
* \ingroup OnePBoxModel
* \brief A single-phase, isothermal flow model using the box scheme.
*
* Single-phase, isothermal flow model, which solves the mass
* continuity equation
* \f[
\phi \frac{\partial \varrho}{\partial t} + \text{div} (- \varrho \frac{\textbf K}{\mu} ( \textbf{grad}\, p -\varrho {\textbf g})) = q,
* \f]
* discretized using a vertex-centered finite volume (box) scheme as
* spatial and the implicit Euler method as time discretization. The
* model supports compressible as well as incompressible fluids.
*/
template<class TypeTag >
class OnePBoxModel : public GET_PROP_TYPE(TypeTag, BaseModel)
{
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams;
typedef typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes) ElementBoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
enum { dim = GridView::dimension };
public:
/*!
* \brief \copybrief Dumux::BoxModel::addOutputVtkFields
*
* Specialization for the OnePBoxModel, adding the pressure and
* the process rank to the VTK writer.
*/
template<class MultiWriter>
void addOutputVtkFields(const SolutionVector &sol,
MultiWriter &writer)
{
typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
// create the required scalar fields
unsigned numVertices = this->problem_().gridView().size(dim);
ScalarField *p = writer.allocateManagedBuffer(numVertices);
ScalarField *K = writer.allocateManagedBuffer(numVertices);
unsigned numElements = this->gridView_().size(0);
ScalarField *rank = writer.allocateManagedBuffer(numElements);
FVElementGeometry fvGeometry;
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
{
int idx = this->problem_().model().elementMapper().map(*elemIt);
(*rank)[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
int numVerts = elemIt->template count<dim> ();
for (int i = 0; i < numVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*elemIt,
fvGeometry,
i,
false);
const SpatialParams &spatialParams = this->problem_().spatialParams();
(*p)[globalIdx] = volVars.pressure();
(*K)[globalIdx]= spatialParams.intrinsicPermeability(*elemIt,
fvGeometry,
i);
}
}
writer.attachVertexData(*p, "p");
writer.attachVertexData(*K, "K");
writer.attachCellData(*rank, "process rank");
}
};
}
#include "1ppropertydefaults.hh"
#endif
// -*- 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/>. *
*****************************************************************************/
/*!
* \ingroup Properties
* \ingroup BoxProperties
* \ingroup OnePBoxModel
* \file
*
* \brief Defines the properties required for the one-phase BOX model.
*/
#ifndef DUMUX_1P_PROPERTIES_DATA_HH
#define DUMUX_1P_PROPERTIES_DATA_HH
#include <dumux/boxmodels/common/boxproperties.hh>
namespace Dumux
{
// \{
///////////////////////////////////////////////////////////////////////////
// properties for the isothermal single phase model
///////////////////////////////////////////////////////////////////////////
namespace Properties {
//////////////////////////////////////////////////////////////////
// Type tags
//////////////////////////////////////////////////////////////////
//! The type tag for the isothermal single phase problems
NEW_TYPE_TAG(BoxOneP, INHERITS_FROM(BoxModel));
//////////////////////////////////////////////////////////////////
// Property tags
//////////////////////////////////////////////////////////////////
NEW_PROP_TAG(NumPhases); //!< Number of fluid phases in the system
NEW_PROP_TAG(Indices); //!< Enumerations for the model
NEW_PROP_TAG(SpatialParams); //!< The type of the spatial parameters object
NEW_PROP_TAG(FluidSystem); //!< The type of the fluid system to use
NEW_PROP_TAG(Fluid); //!< The fluid used for the default fluid system
NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< Returns weight of the upwind cell when calculating fluxes
NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility in the velocity calculation
NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
// \}
}
} // end namepace
#endif
// -*- 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/>. *
*****************************************************************************/
/*!
* \ingroup Properties
* \ingroup BoxProperties
* \ingroup OnePBoxModel
* \file
*
* \brief Defines the properties required for the one-phase BOX model.
*/
#ifndef DUMUX_1P_PROPERTY_DEFAULTS_HH
#define DUMUX_1P_PROPERTY_DEFAULTS_HH
#include <dumux/boxmodels/common/boxproperties.hh>
#include "1pmodel.hh"
#include "1plocalresidual.hh"
#include "1pvolumevariables.hh"
#include <dumux/boxmodels/common/boxdarcyfluxvariables.hh>
#include "1pindices.hh"
#include <dumux/material/fluidsystems/gasphase.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/nullcomponent.hh>
#include <dumux/material/fluidsystems/1pfluidsystem.hh>
#include <dumux/material/spatialparams/boxspatialparams1p.hh>
namespace Dumux
{
// \{
///////////////////////////////////////////////////////////////////////////
// default property values for the isothermal single phase model
///////////////////////////////////////////////////////////////////////////
namespace Properties {
SET_INT_PROP(BoxOneP, NumEq, 1); //!< set the number of equations to 1
SET_INT_PROP(BoxOneP, NumPhases, 1); //!< The number of phases in the 1p model is 1
//! The local residual function
SET_TYPE_PROP(BoxOneP,
LocalResidual,
OnePLocalResidual<TypeTag>);
//! the Model property
SET_TYPE_PROP(BoxOneP, Model, OnePBoxModel<TypeTag>);
//! the VolumeVariables property
SET_TYPE_PROP(BoxOneP, VolumeVariables, OnePVolumeVariables<TypeTag>);
//! the FluxVariables property
SET_TYPE_PROP(BoxOneP, FluxVariables, BoxDarcyFluxVariables<TypeTag>);
//! The indices required by the isothermal single-phase model
SET_TYPE_PROP(BoxOneP, Indices, OnePIndices);
//! The spatial parameters to be employed.
//! Use BoxSpatialParamsOneP by default.
SET_TYPE_PROP(BoxOneP, SpatialParams, BoxSpatialParamsOneP<TypeTag>);
//! The weight of the upwind control volume when calculating
//! fluxes. Use central differences by default.
SET_SCALAR_PROP(BoxOneP, ImplicitMassUpwindWeight, 0.5);
//! weight for the upwind mobility in the velocity calculation
//! fluxes. Use central differences by default.
SET_SCALAR_PROP(BoxOneP, ImplicitMobilityUpwindWeight, 0.5);
//! The fluid system to use by default
SET_TYPE_PROP(BoxOneP, FluidSystem, Dumux::FluidSystems::OneP<typename GET_PROP_TYPE(TypeTag, Scalar), typename GET_PROP_TYPE(TypeTag, Fluid)>);
SET_PROP(BoxOneP, Fluid)
{ private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dumux::LiquidPhase<Scalar, Dumux::NullComponent<Scalar> > type;
};
// enable gravity by default
SET_BOOL_PROP(BoxOneP, ProblemEnableGravity, true);
//! default value for the forchheimer coefficient
// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
// Actually the Forchheimer coefficient is also a function of the dimensions of the
// porous medium. Taking it as a constant is only a first approximation
// (Nield, Bejan, Convection in porous media, 2006, p. 10)
SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
// \}
} // end namepace Properties
} // end namepace Dumux
#endif
// -*- 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 Quantities required by the one-phase box model defined on a vertex.
*/
#ifndef DUMUX_1P_VOLUME_VARIABLES_HH
#define DUMUX_1P_VOLUME_VARIABLES_HH
#include "1pproperties.hh"
#include <dumux/boxmodels/common/boxvolumevariables.hh>