Skip to content
Snippets Groups Projects
Commit 7f6f97ed authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implicit Richards: add velocity calculation and output. Reviewed by Christoph.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10723 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 82ad87f1
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define DUMUX_RICHARDS_MODEL_HH #define DUMUX_RICHARDS_MODEL_HH
#include <dumux/implicit/common/implicitmodel.hh> #include <dumux/implicit/common/implicitmodel.hh>
#include <dumux/implicit/common/implicitvelocityoutput.hh>
#include "richardslocalresidual.hh" #include "richardslocalresidual.hh"
#include "richardsproblem.hh" #include "richardsproblem.hh"
...@@ -108,6 +109,7 @@ class RichardsModel : public GET_PROP_TYPE(TypeTag, BaseModel) ...@@ -108,6 +109,7 @@ class RichardsModel : public GET_PROP_TYPE(TypeTag, BaseModel)
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables; typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector; typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
...@@ -135,6 +137,7 @@ public: ...@@ -135,6 +137,7 @@ public:
void addOutputVtkFields(const SolutionVector &sol, MultiWriter &writer) void addOutputVtkFields(const SolutionVector &sol, MultiWriter &writer)
{ {
typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField; typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
// get the number of degrees of freedom // get the number of degrees of freedom
unsigned numDofs = this->numDofs(); unsigned numDofs = this->numDofs();
...@@ -151,13 +154,20 @@ public: ...@@ -151,13 +154,20 @@ public:
ScalarField *mobN = writer.allocateManagedBuffer(numDofs); ScalarField *mobN = writer.allocateManagedBuffer(numDofs);
ScalarField *poro = writer.allocateManagedBuffer(numDofs); ScalarField *poro = writer.allocateManagedBuffer(numDofs);
ScalarField *Te = writer.allocateManagedBuffer(numDofs); ScalarField *Te = writer.allocateManagedBuffer(numDofs);
VectorField *velocity = writer.template allocateManagedBuffer<double, dim>(numDofs);
ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
unsigned numElements = this->gridView_().size(0); if (velocityOutput.enableOutput())
ScalarField *rank = {
writer.allocateManagedBuffer (numElements); // initialize velocity field
for (unsigned int i = 0; i < numDofs; ++i)
{
(*velocity)[i] = Scalar(0);
}
}
FVElementGeometry fvGeometry; unsigned numElements = this->gridView_().size(0);
VolumeVariables volVars; ScalarField *rank = writer.allocateManagedBuffer (numElements);
ElementIterator elemIt = this->gridView_().template begin<0>(); ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>(); ElementIterator elemEndIt = this->gridView_().template end<0>();
...@@ -166,33 +176,38 @@ public: ...@@ -166,33 +176,38 @@ public:
int idx = this->problem_().model().elementMapper().map(*elemIt); int idx = this->problem_().model().elementMapper().map(*elemIt);
(*rank)[idx] = this->gridView_().comm().rank(); (*rank)[idx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), *elemIt); fvGeometry.update(this->gridView_(), *elemIt);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*elemIt,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx) for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{ {
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim); int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
volVars.update(sol[globalIdx], (*pW)[globalIdx] = elemVolVars[scvIdx].pressure(wPhaseIdx);
this->problem_(), (*pN)[globalIdx] = elemVolVars[scvIdx].pressure(nPhaseIdx);
*elemIt, (*pC)[globalIdx] = elemVolVars[scvIdx].capillaryPressure();
fvGeometry, (*Sw)[globalIdx] = elemVolVars[scvIdx].saturation(wPhaseIdx);
scvIdx, (*Sn)[globalIdx] = elemVolVars[scvIdx].saturation(nPhaseIdx);
false); (*rhoW)[globalIdx] = elemVolVars[scvIdx].density(wPhaseIdx);
(*rhoN)[globalIdx] = elemVolVars[scvIdx].density(nPhaseIdx);
(*pW)[globalIdx] = volVars.pressure(wPhaseIdx); (*mobW)[globalIdx] = elemVolVars[scvIdx].mobility(wPhaseIdx);
(*pN)[globalIdx] = volVars.pressure(nPhaseIdx); (*mobN)[globalIdx] = elemVolVars[scvIdx].mobility(nPhaseIdx);
(*pC)[globalIdx] = volVars.capillaryPressure(); (*poro)[globalIdx] = elemVolVars[scvIdx].porosity();
(*Sw)[globalIdx] = volVars.saturation(wPhaseIdx); (*Te)[globalIdx] = elemVolVars[scvIdx].temperature();
(*Sn)[globalIdx] = volVars.saturation(nPhaseIdx);
(*rhoW)[globalIdx] = volVars.density(wPhaseIdx);
(*rhoN)[globalIdx] = volVars.density(nPhaseIdx);
(*mobW)[globalIdx] = volVars.mobility(wPhaseIdx);
(*mobN)[globalIdx] = volVars.mobility(nPhaseIdx);
(*poro)[globalIdx] = volVars.porosity();
(*Te)[globalIdx] = volVars.temperature();
} }
// velocity output
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, *elemIt, /*phaseIdx=*/0);
} }
velocityOutput.completeVelocityCalculation(*velocity);
writer.attachDofData(*Sn, "Sn", isBox); writer.attachDofData(*Sn, "Sn", isBox);
writer.attachDofData(*Sw, "Sw", isBox); writer.attachDofData(*Sw, "Sw", isBox);
writer.attachDofData(*pN, "pn", isBox); writer.attachDofData(*pN, "pn", isBox);
...@@ -204,6 +219,10 @@ public: ...@@ -204,6 +219,10 @@ public:
writer.attachDofData(*mobN, "mobN", isBox); writer.attachDofData(*mobN, "mobN", isBox);
writer.attachDofData(*poro, "porosity", isBox); writer.attachDofData(*poro, "porosity", isBox);
writer.attachDofData(*Te, "temperature", isBox); writer.attachDofData(*Te, "temperature", isBox);
if (velocityOutput.enableOutput())
{
writer.attachDofData(*velocity, "velocity", isBox, dim);
}
writer.attachCellData(*rank, "process rank"); writer.attachCellData(*rank, "process rank");
} }
}; };
......
...@@ -64,6 +64,7 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i ...@@ -64,6 +64,7 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i
NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the weight of the upwind direction in the mass conservation equations NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the weight of the upwind direction in the mass conservation equations
NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< The value of the weight for the upwind mobility in the velocity calculation NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< The value of the weight for the upwind mobility in the velocity calculation
NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
// \} // \}
} }
......
...@@ -151,6 +151,9 @@ public: ...@@ -151,6 +151,9 @@ public:
NonwettingPhase> type; NonwettingPhase> type;
}; };
// disable velocity output by default
SET_BOOL_PROP(Richards, VtkAddVelocity, false);
// enable gravity by default // enable gravity by default
SET_BOOL_PROP(Richards, ProblemEnableGravity, true); SET_BOOL_PROP(Richards, ProblemEnableGravity, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment