Commit 51c04f9b authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[folder structure] rename and move files from implicit/1p,2p,3p, adapt includes

parent f2c2cb4c
......@@ -26,7 +26,7 @@
#define DUMUX_ELASTIC2P_INDICES_HH
#include <dumux/geomechanics/elastic/elasticindices.hh>
#include <dumux/implicit/2p/2pindices.hh>
#include <dumux/porousmediumflow/2p/implicit/indices.hh>
namespace Dumux
{
......
......@@ -29,7 +29,7 @@
#define DUMUX_ELASTIC2P_PROPERTIES_HH
#include <dumux/implicit/box/properties.hh>
#include <dumux/implicit/2p/2pproperties.hh>
#include <dumux/porousmediumflow/2p/implicit/properties.hh>
namespace Dumux
{
......
......@@ -56,7 +56,7 @@
#include "el2pnewtoncontroller.hh"
#include "el2pindices.hh"
#include <dumux/implicit/box/propertydefaults.hh>
#include <dumux/implicit/2p/2ppropertydefaults.hh>
#include <dumux/porousmediumflow/2p/implicit/propertydefaults.hh>
#include <dumux/linear/seqsolverbackend.hh>
#include <dumux/linear/amgbackend.hh>
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_ELASTIC2P_VOLUME_VARIABLES_HH
#define DUMUX_ELASTIC2P_VOLUME_VARIABLES_HH
#include <dumux/implicit/2p/2pvolumevariables.hh>
#include <dumux/porousmediumflow/2p/implicit/volumevariables.hh>
#include "el2pproperties.hh"
......
// -*- 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 fully implicit model.
*/
#ifndef DUMUX_1P_INDICES_HH
#define DUMUX_1P_INDICES_HH
#ifndef DUMUX_1P_INDICES_HH_OLD
#define DUMUX_1P_INDICES_HH_OLD
namespace Dumux
{
// \{
#warning this header is deprecated, use dumux/porousmediumflow/1p/implicit/indices.hh instead
/*!
* \ingroup OnePModel
* \ingroup ImplicitIndices
* \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 namespace
#include <dumux/porousmediumflow/1p/implicit/indices.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/>. *
*****************************************************************************/
/*!
* \file
*
* \brief Element-wise calculation of the Jacobian matrix for problems
* using the one-phase fully implicit model.
*/
#ifndef DUMUX_1P_LOCAL_RESIDUAL_HH
#define DUMUX_1P_LOCAL_RESIDUAL_HH
#ifndef DUMUX_1P_LOCAL_RESIDUAL_HH_OLD
#define DUMUX_1P_LOCAL_RESIDUAL_HH_OLD
#include "1pproperties.hh"
#warning this header is deprecated, use dumux/porousmediumflow/1p/implicit/localresidual.hh instead
namespace Dumux
{
/*!
* \ingroup OnePModel
* \ingroup ImplicitLocalResidual
* \brief Element-wise calculation of the Jacobian matrix for problems
* using the one-phase fully implicit model.
*/
template<class TypeTag>
class OnePLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
{
typedef typename GET_PROP_TYPE(TypeTag, LocalResidual) Implementation;
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, Indices) Indices;
//index of the mass balance equation
enum {
conti0EqIdx = Indices::conti0EqIdx //index for the mass balance
};
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 fIdx 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 fIdx, const bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->element_(),
this->fvGeometry_(),
fIdx,
this->curVolVars_(),
onBoundary);
asImp_()->computeAdvectiveFlux(flux, fluxVars);
asImp_()->computeDiffusiveFlux(flux, fluxVars);
}
/*!
* \brief Evaluate the advective mass flux of all components over
* a face of a sub-control volume.
*
* \param flux The advective flux over the sub-control-volume face for each component
* \param fluxVars The flux variables at the current SCV
*/
void computeAdvectiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const
{
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 Adds the diffusive mass flux of all components over
* a face of a sub-control volume.
*
* \param flux The diffusive flux over the sub-control-volume face for each component
* \param fluxVars The flux variables at the current SCV
*/
void computeDiffusiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const
{
// diffusive fluxes
flux += 0.0;
}
/*!
* \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:
Implementation *asImp_()
{ return static_cast<Implementation *> (this); }
const Implementation *asImp_() const
{ return static_cast<const Implementation *> (this); }
Scalar upwindWeight_;
};
}
#include <dumux/porousmediumflow/1p/implicit/localresidual.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/>. *
*****************************************************************************/
/*!
* \file
*
* \brief Base class for all models which use the one-phase,
* fully implicit model.
* Adaption of the fully implicit scheme to the one-phase flow model.
*/
#ifndef DUMUX_1P_MODEL_HH_OLD
#define DUMUX_1P_MODEL_HH_OLD
#ifndef DUMUX_1P_MODEL_HH
#define DUMUX_1P_MODEL_HH
#warning this header is deprecated, use dumux/porousmediumflow/1p/implicit/model.hh instead
#include <dumux/porousmediumflow/implicit/velocityoutput.hh>
#include "1pproperties.hh"
namespace Dumux
{
/*!
* \ingroup OnePModel
* \brief A single-phase, isothermal flow model using the fully implicit scheme.
*
* Single-phase, isothermal flow model, which uses a standard Darcy approach as the
* equation for the conservation of momentum:
* \f[
v = - \frac{\textbf K}{\mu}
\left(\textbf{grad}\, p - \varrho {\textbf g} \right)
* \f]
*
* and solves the mass continuity equation:
* \f[
\phi \frac{\partial \varrho}{\partial t} + \text{div} \left\lbrace
- \varrho \frac{\textbf K}{\mu} \left( \textbf{grad}\, p -\varrho {\textbf g} \right) \right\rbrace = q,
* \f]
* All equations are discretized using a vertex-centered finite volume (box)
* or cell-centered finite volume scheme as spatial
* and the implicit Euler method as time discretization.
* The model supports compressible as well as incompressible fluids.
*/
template<class TypeTag >
class OnePModel : public GET_PROP_TYPE(TypeTag, BaseModel)
{
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum { dim = GridView::dimension };
enum { dimWorld = GridView::dimensionworld };
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
enum { dofCodim = isBox ? dim : 0 };
public:
/*!
* \brief \copybrief Dumux::ImplicitModel::addOutputVtkFields
*
* Specialization for the OnePModel, 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;
typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
// create the required scalar fields
unsigned numDofs = this->numDofs();
ScalarField *p = writer.allocateManagedBuffer(numDofs);
ScalarField *K = writer.allocateManagedBuffer(numDofs);
VectorField *velocity = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
if (velocityOutput.enableOutput())
{
// initialize velocity field
for (unsigned int i = 0; i < numDofs; ++i)
{
(*velocity)[i] = double(0);
}
}
unsigned numElements = this->gridView_().size(0);
ScalarField *rank = writer.allocateManagedBuffer(numElements);
for (const auto& element : Dune::elements(this->gridView_()))
{
if(element.partitionType() == Dune::InteriorEntity)
{
int eIdx = this->problem_().model().elementMapper().index(element);
(*rank)[eIdx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), element);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
element,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim);
const SpatialParams &spatialParams = this->problem_().spatialParams();
(*p)[dofIdxGlobal] = elemVolVars[scvIdx].pressure();
(*K)[dofIdxGlobal] = spatialParams.intrinsicPermeability(element,
fvGeometry,
scvIdx);
}
// velocity output
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, element, /*phaseIdx=*/0);
}
}
writer.attachDofData(*p, "p", isBox);
writer.attachDofData(*K, "K", isBox);
if (velocityOutput.enableOutput())
{
writer.attachDofData(*velocity, "velocity", isBox, dim);
}
writer.attachCellData(*rank, "process rank");
}
};
}
#include "1ppropertydefaults.hh"
#include <dumux/porousmediumflow/1p/implicit/model.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 ImplicitProperties
* \ingroup OnePModel
* \file
*
* \brief Defines the properties required for the one-phase fully implicit model.
*/
#ifndef DUMUX_1P_PROPERTIES_HH
#define DUMUX_1P_PROPERTIES_HH
#ifndef DUMUX_1P_PROPERTIES_HH_OLD
#define DUMUX_1P_PROPERTIES_HH_OLD
#include <dumux/implicit/box/properties.hh>
#include <dumux/implicit/cellcentered/properties.hh>
#include <dumux/porousmediumflow/implicit/nonisothermal/properties.hh>
#warning this header is deprecated, use dumux/porousmediumflow/1p/implicit/properties.hh instead
namespace Dumux
{
// \{
///////////////////////////////////////////////////////////////////////////
// properties for the isothermal single phase model
///////////////////////////////////////////////////////////////////////////
namespace Properties {
//////////////////////////////////////////////////////////////////
// Type tags
//////////////////////////////////////////////////////////////////
//! The type tags for the implicit single-phase problems
NEW_TYPE_TAG(OneP);
NEW_TYPE_TAG(BoxOneP, INHERITS_FROM(BoxModel, OneP));
NEW_TYPE_TAG(CCOneP, INHERITS_FROM(CCModel, OneP));
//! The type tags for the corresponding non-isothermal problems
NEW_TYPE_TAG(OnePNI, INHERITS_FROM(OneP, NonIsothermal));
NEW_TYPE_TAG(BoxOnePNI, INHERITS_FROM(BoxModel, OnePNI));
NEW_TYPE_TAG(CCOnePNI, INHERITS_FROM(CCModel, OnePNI));
//////////////////////////////////////////////////////////////////
// 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(FluidState); //!< The type of the fluid state to use
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
NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
// \}
}
} // end namespace
#include <dumux/porousmediumflow/1p/implicit/properties.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 ImplicitProperties
* \ingroup OnePModel
* \file
*
* \brief Defines the properties required for the one-phase fully implicit model.
*/
#ifndef DUMUX_1P_PROPERTY_DEFAULTS_HH
#define DUMUX_1P_PROPERTY_DEFAULTS_HH
#ifndef DUMUX_1P_PROPERTY_DEFAULTS_HH_OLD
#define DUMUX_1P_PROPERTY_DEFAULTS_HH_OLD
#include "1pproperties.hh"
#warning this header is deprecated, use dumux/porousmediumflow/1p/implicit/propertydefaults.hh instead
#include "1pmodel.hh"
#include "1plocalresidual.hh"
#include "1pvolumevariables.hh"
#include "1pindices.hh"
#include <dumux/porousmediumflow/implicit/nonisothermal/propertydefaults.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/implicitspatialparams1p.hh>
#include <dumux/porousmediumflow/implicit/darcyfluxvariables.hh>
#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh>
namespace Dumux
{
// \{
///////////////////////////////////////////////////////////////////////////
// default property values for the isothermal single phase model
///////////////////////////////////////////////////////////////////////////
namespace Properties {
SET_INT_PROP(OneP, NumEq, 1); //!< set the number of equations to 1
SET_INT_PROP(OneP, NumPhases, 1); //!< The number of phases in the 1p model is 1
//! The local residual function
SET_TYPE_PROP(OneP, LocalResidual, OnePLocalResidual<TypeTag>);
//! the Model property
SET_TYPE_PROP(OneP, Model, OnePModel<TypeTag>);
//! the VolumeVariables property
SET_TYPE_PROP(OneP, VolumeVariables, OnePVolumeVariables<TypeTag>);
//! the FluxVariables property
SET_TYPE_PROP(OneP, FluxVariables, ImplicitDarcyFluxVariables<TypeTag>);
//! The indices required by the isothermal single-phase model
SET_TYPE_PROP(OneP, Indices, OnePIndices);
//! The spatial parameters to be employed.
//! Use ImplicitSpatialParamsOneP by default.
SET_TYPE_PROP(OneP, SpatialParams, ImplicitSpatialParamsOneP<TypeTag>);
//! The weight of the upwind control volume when calculating
//! fluxes. Use central differences by default.
SET_SCALAR_PROP(OneP, ImplicitMassUpwindWeight, 0.5);
//! weight for the upwind mobility in the velocity calculation
//! fluxes. Use central differences by default.
SET_SCALAR_PROP(OneP, ImplicitMobilityUpwindWeight, 0.5);
//! The fluid system to use by default
SET_TYPE_PROP(OneP, FluidSystem, Dumux::FluidSystems::OneP<typename GET_PROP_TYPE(TypeTag, Scalar), typename GET_PROP_TYPE(TypeTag, Fluid)>);
SET_PROP(OneP, Fluid)
{ private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dumux::LiquidPhase<Scalar, Dumux::NullComponent<Scalar> > type;
};
/*!
* \brief The fluid state which is used by the volume variables to
* store the thermodynamic state. This should be chosen
* appropriately for the model ((non-)isothermal, equilibrium, ...).
* This can be done in the problem.
*/
SET_PROP(OneP, FluidState){
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
public:
typedef Dumux::ImmiscibleFluidState<Scalar, FluidSystem> type;
};
// disable velocity output by default
SET_BOOL_PROP(OneP, VtkAddVelocity, false);
// enable gravity by default