Commit 10a4ee5e authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[stokes] remove stokes2c and stokes2cni

Stokes2c(ni) has been deprecated in 2.5. After some issues according to
FS#235 have been clarified, it can be removed.


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13259 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4a0bcb36
......@@ -38,8 +38,6 @@ AC_CONFIG_FILES([dumux.pc
dumux/decoupled/common/mimetic/Makefile
dumux/freeflow/Makefile
dumux/freeflow/stokes/Makefile
dumux/freeflow/stokes2c/Makefile
dumux/freeflow/stokes2cni/Makefile
dumux/freeflow/stokesnc/Makefile
dumux/freeflow/stokesncni/Makefile
dumux/geomechanics/Makefile
......
SUBDIRS = stokes stokes2c stokes2cni stokesnc stokesncni
SUBDIRS = stokes stokesnc stokesncni
freeflowdir = $(includedir)/dumux/freeflow
......
stokes2cdir = $(includedir)/dumux/freeflow/stokes2c
stokes2c_HEADERS = *.hh
include $(top_srcdir)/am/global-rules
// -*- 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 This file contains the data which is required to calculate the
* component fluxes over a face of a finite volume.
*
* This means concentration gradients, diffusion coefficients, mass fractions, etc.
* at the integration point.
*/
#ifndef DUMUX_STOKES2C_FLUX_VARIABLES_HH
#define DUMUX_STOKES2C_FLUX_VARIABLES_HH
#include <dumux/common/math.hh>
#include <dumux/freeflow/stokes/stokesfluxvariables.hh>
namespace Dumux
{
namespace Properties
{
NEW_PROP_TAG(Stokes2cIndices); //!< Enumerations for the compositional stokes models
}
/*!
* \ingroup BoxStokes2cModel
* \ingroup ImplicitFluxVariables
* \brief This template class contains data which is required to
* calculate the component fluxes over a face of a finite
* volume for the compositional Stokes model.
*
* This means concentration gradients, diffusion coefficient, mass fractions, etc.
* at the integration point of a SCV or boundary face.
*/
template <class TypeTag>
class Stokes2cFluxVariables : public StokesFluxVariables<TypeTag>
{
typedef StokesFluxVariables<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { dim = GridView::dimension };
enum { phaseIdx = Indices::phaseIdx };
enum { transportCompIdx = Indices::transportCompIdx };
typedef typename GridView::template Codim<0>::Entity Element;
typedef Dune::FieldVector<Scalar, dim> DimVector;
public:
/* Use Stokes n-component Model freeflow/stokesnc.The 2c model gets replaced by the more
* general nc model. Adaption to the new model is straight forward. Please not that several
* functions in the fluxvariables now need an input argument compIdx. Associated variables
* are of size number of components. The nc model uses mole fraction formulations of the
* transport equations as default. Mass fractions can be employed via the poperty UseMoles.*/
DUNE_DEPRECATED_MSG("Use stokesnc model")
Stokes2cFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int faceIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: ParentType(problem, element, fvGeometry, faceIdx, elemVolVars, onBoundary)
{
calculateValues_(problem, element, elemVolVars);
}
/*!
* \brief Return the molar density \f$ \mathrm{[mol/m^3]} \f$ at the integration point.
*/
const Scalar molarDensity() const
{ return this->molarDensity_; }
/*!
* \brief Return the mass fraction of the transported component at the integration point.
*/
const Scalar massFraction() const
{ return massFraction_; }
/*!
* \brief Return the molar diffusion coefficient at the integration point.
*/
const Scalar diffusionCoeff() const
{ return diffusionCoeff_; }
/*!
* \brief Return the eddy diffusivity (if implemented).
*/
const Scalar eddyDiffusivity() const
{ return 0; }
/*!
* \brief Return the gradient of the mole fraction at the integration point.
*/
const DimVector &moleFractionGrad() const
{ return moleFractionGrad_; }
protected:
void calculateValues_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
{
molarDensity_ = Scalar(0);
massFraction_ = Scalar(0);
diffusionCoeff_ = Scalar(0);
moleFractionGrad_ = Scalar(0);
// calculate gradients and secondary variables at IPs
for (int idx = 0;
idx < this->fvGeometry_.numScv;
idx++) // loop over vertices of the element
{
molarDensity_ += elemVolVars[idx].molarDensity()*
this->face().shapeValue[idx];
massFraction_ += elemVolVars[idx].massFraction(transportCompIdx) *
this->face().shapeValue[idx];
diffusionCoeff_ += elemVolVars[idx].diffusionCoeff() *
this->face().shapeValue[idx];
// the gradient of the mass fraction at the IP
for (int dimIdx=0; dimIdx<dim; ++dimIdx)
{
moleFractionGrad_ +=
this->face().grad[idx][dimIdx] *
elemVolVars[idx].moleFraction(transportCompIdx);
}
}
Valgrind::CheckDefined(massFraction_);
Valgrind::CheckDefined(diffusionCoeff_);
Valgrind::CheckDefined(moleFractionGrad_);
}
Scalar molarDensity_;
Scalar massFraction_;
Scalar diffusionCoeff_;
DimVector moleFractionGrad_;
};
} // end namespace
#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 Defines the indices required for the compositional Stokes box model.
*/
#ifndef DUMUX_STOKES2C_INDICES_HH
#define DUMUX_STOKES2C_INDICES_HH
#include <dumux/freeflow/stokes/stokesindices.hh>
namespace Dumux
{
// \{
/*!
* \ingroup BoxStokes2cModel
* \ingroup ImplicitIndices
* \brief The common indices for the compositional Stokes box model.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <class TypeTag, int PVOffset = 0>
struct Stokes2cCommonIndices : public StokesCommonIndices<TypeTag>
{
// Phase index
//! Index of the employed phase in case of a two-phase fluidsystem (set by default to nPhase)
static const int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
// Component indices
static const int phaseCompIdx = phaseIdx; //!< The index of the main component of the considered phase
//! The index of the transported (minor) component; ASSUMES phase indices of 0 and 1
static const int transportCompIdx = (unsigned int)(1-phaseIdx);
// equation and primary variable indices
static const int dim = StokesCommonIndices<TypeTag>::dim;
static const int transportEqIdx = PVOffset + dim+1; //!< The index for the transport equation
//! The index of the mass or mole fraction of the transported component in primary variable vectors
static const int massOrMoleFracIdx = transportEqIdx;
};
} // end namespace
#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 compositional Stokes box model.
*
*/
#ifndef DUMUX_STOKES2C_LOCAL_RESIDUAL_HH
#define DUMUX_STOKES2C_LOCAL_RESIDUAL_HH
#include <dumux/freeflow/stokes/stokeslocalresidual.hh>
#include <dumux/freeflow/stokes2c/stokes2cvolumevariables.hh>
#include <dumux/freeflow/stokes2c/stokes2cfluxvariables.hh>
namespace Dumux
{
/*!
* \ingroup BoxStokes2cModel
* \ingroup ImplicitLocalResidual
* \brief Element-wise calculation of the Jacobian matrix for problems
* using the compositional Stokes box model. This is derived
* from the Stokes box model.
*/
template<class TypeTag>
class Stokes2cLocalResidual : public StokesLocalResidual<TypeTag>
{
typedef StokesLocalResidual<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { dim = GridView::dimension };
enum { transportEqIdx = Indices::transportEqIdx }; //!< Index of the transport equation
enum { phaseIdx = Indices::phaseIdx }; //!< Index of the considered phase (only of interest when using two-phase fluidsystems)
// component indices
enum { phaseCompIdx = Indices::phaseCompIdx }; //!< Index of the main component of the fluid phase
enum { transportCompIdx = Indices::transportCompIdx }; //!< Index of the minor component of the fluid phase
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, FluidSystem) FluidSystem;
public:
/* Use Stokes n-component Model freeflow/stokesnc.The 2c model gets replaced by the more
* general nc model. Adaption to the new model is straight forward. Please not that several
* functions in the fluxvariables now need an input argument compIdx. Associated variables
* are of size number of components. The nc model uses mole fraction formulations of the
* transport equations as default. Mass fractions can be employed via the poperty UseMoles.*/
DUNE_DEPRECATED_MSG("Use stokesnc model")
Stokes2cLocalResidual(){}
/*!
* \brief Evaluate the stored amount of quantities additional to the Stokes model
* (transport equation).
*
* The result should be averaged over the volume (e.g. phase mass
* inside a sub control volume divided by the volume)
*
* \param storage The mass of the component 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
{
// compute the storage term for the transport equation
ParentType::computeStorage(storage, scvIdx, usePrevSol);
// 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];
// compute the storage of the component
storage[transportEqIdx] =
volVars.density() *
volVars.massFraction(transportCompIdx);
Valgrind::CheckDefined(volVars.density());
Valgrind::CheckDefined(volVars.massFraction(transportCompIdx));
}
/*!
* \brief Evaluates the advective component (mass) flux
* over a face of a sub-control volume and writes the result in
* the flux vector.
*
* This method is called by compute flux (base class).
*
* \param flux The advective flux over the sub-control-volume face for each component
* \param fluxVars The flux variables at the current SCV/boundary face
*/
void computeAdvectiveFlux(PrimaryVariables &flux,
const FluxVariables &fluxVars) const
{
// call computation of the advective fluxes of the stokes model
// (momentum and mass fluxes)
ParentType::computeAdvectiveFlux(flux, fluxVars);
// vertex data of the upstream and the downstream vertices
const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx());
const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx());
Scalar tmp = fluxVars.normalVelocity();
if (this->massUpwindWeight_ > 0.0)
tmp *= this->massUpwindWeight_ * // upwind data
up.density() * up.massFraction(transportCompIdx);
if (this->massUpwindWeight_ < 1.0)
tmp += (1.0 - this->massUpwindWeight_) * // rest
dn.density() * dn.massFraction(transportCompIdx);
flux[transportEqIdx] += tmp;
Valgrind::CheckDefined(flux[transportEqIdx]);
}
/*!
* \brief Adds the diffusive component flux to the flux vector over
* the face of a sub-control volume.
*
* \param flux The diffusive flux over the SCV face or boundary face
* \param fluxVars The flux variables at the current SCV/boundary face
*/
void computeDiffusiveFlux(PrimaryVariables &flux,
const FluxVariables &fluxVars) const
{
// diffusive mass flux
ParentType::computeDiffusiveFlux(flux, fluxVars);
// diffusive component flux
for (int dimIdx = 0; dimIdx < dim; ++dimIdx)
flux[transportEqIdx] -=
fluxVars.moleFractionGrad()[dimIdx] *
fluxVars.face().normal[dimIdx] *
(fluxVars.diffusionCoeff() + fluxVars.eddyDiffusivity()) *
fluxVars.molarDensity() *
FluidSystem::molarMass(transportCompIdx);
Valgrind::CheckDefined(flux[transportEqIdx]);
}
};
}
#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 Adaptation of the box scheme to the two-component Stokes model.
*/
#ifndef DUMUX_STOKES2C_MODEL_HH
#define DUMUX_STOKES2C_MODEL_HH
#include <dumux/freeflow/stokes/stokesmodel.hh>
#include "stokes2clocalresidual.hh"
#include "stokes2cproperties.hh"
namespace Dumux {
/*!
* \ingroup BoxStokes2cModel
* \brief Adaptation of the BOX scheme to the compositional Stokes model.
*
* This model implements an isothermal two-component Stokes flow of a fluid
* solving a momentum balance, a mass balance and a conservation equation for one component.
*
* Momentum Balance:
* \f[
\frac{\partial \left(\varrho_g {\boldsymbol{v}}_g\right)}{\partial t}
+ \boldsymbol{\nabla} \boldsymbol{\cdot} \left(p_g {\bf {I}}
- \mu_g \left(\boldsymbol{\nabla} \boldsymbol{v}_g
+ \boldsymbol{\nabla} \boldsymbol{v}_g^T\right)\right)
- \varrho_g {\bf g} = 0,
* \f]
*
* Mass balance equation:
* \f[
\frac{\partial \varrho_g}{\partial t} + \boldsymbol{\nabla}\boldsymbol{\cdot}\left(\varrho_g {\boldsymbol{v}}_g\right) - q_g = 0
* \f]
*
* Component mass balance equation:
* \f[
\frac{\partial \left(\varrho_g X_g^\kappa\right)}{\partial t}
+ \boldsymbol{\nabla} \boldsymbol{\cdot} \left( \varrho_g {\boldsymbol{v}}_g X_g^\kappa
- D^\kappa_g \varrho_g \frac{M^\kappa}{M_g} \boldsymbol{\nabla} x_g^\kappa \right)
- q_g^\kappa = 0
* \f]
*
* This is discretized using a fully-coupled vertex
* centered finite volume (box) scheme as spatial and
* the implicit Euler method as temporal discretization.
*/
template<class TypeTag>
class Stokes2cModel : public StokesModel<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { dim = GridView::dimension };
enum { transportCompIdx = Indices::transportCompIdx };
enum { phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx) };
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes) ElementBoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
public:
/* Use Stokes n-component Model freeflow/stokesnc.The 2c model gets replaced by the more
* general nc model. Adaption to the new model is straight forward. Please not that several
* functions in the fluxvariables now need an input argument compIdx. Associated variables
* are of size number of components. The nc model uses mole fraction formulations of the
* transport equations as default. Mass fractions can be employed via the poperty UseMoles.*/
DUNE_DEPRECATED_MSG("Use stokesnc model")
Stokes2cModel(){}
//! \copydoc ImplicitModel::addOutputVtkFields
template <class MultiWriter>
void addOutputVtkFields(const SolutionVector &sol,
MultiWriter &writer)
{
typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > ScalarField;
typedef Dune::BlockVector<Dune::FieldVector<Scalar, dim> > VelocityField;
const Scalar scale_ = GET_PROP_VALUE(TypeTag, Scaling);
// create the required scalar fields
unsigned numVertices = this->gridView_().size(dim);
ScalarField &pn = *writer.allocateManagedBuffer(numVertices);
ScalarField &delP = *writer.allocateManagedBuffer(numVertices);
ScalarField &Xw = *writer.allocateManagedBuffer(numVertices);
ScalarField &rho = *writer.allocateManagedBuffer(numVertices);
ScalarField &mu = *writer.allocateManagedBuffer(numVertices);
VelocityField &velocity = *writer.template allocateManagedBuffer<Scalar, dim> (numVertices);
unsigned numElements = this->gridView_().size(0);
ScalarField &rank = *writer.allocateManagedBuffer(numElements);
FVElementGeometry fvGeometry;
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int eIdx = this->elementMapper().map(*eIt);
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
int numLocalVerts = eIt->template count<dim>();
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*eIt, i, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*eIt,
fvGeometry,
i,
false);
pn[globalIdx] = volVars.pressure()*scale_;
delP[globalIdx] = volVars.pressure()*scale_ - 1e5;
Xw[globalIdx] = volVars.massFraction(phaseIdx, transportCompIdx);
rho[globalIdx] = volVars.density()*scale_*scale_*scale_;
mu[globalIdx] = volVars.dynamicViscosity()*scale_;
velocity[globalIdx] = volVars.velocity();
velocity[globalIdx] *= 1/scale_;
}
}
writer.attachVertexData(pn, "P");
writer.attachVertexData(delP, "delP");
std::ostringstream outputNameX;
outputNameX << "X^" << FluidSystem::componentName(transportCompIdx);
writer.attachVertexData(Xw, outputNameX.str());
writer.attachVertexData(rho, "rho");
writer.attachVertexData(mu, "mu");
writer.attachVertexData(velocity, "v", dim);
}
};
}
#include "stokes2cpropertydefaults.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 *