mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
FingerProblem: use PersistentContainer to store material laws.
This commit is contained in:
parent
227bfadce9
commit
b8b703cc2d
@ -44,6 +44,7 @@
|
|||||||
#include <dune/common/version.hh>
|
#include <dune/common/version.hh>
|
||||||
#include <dune/common/fvector.hh>
|
#include <dune/common/fvector.hh>
|
||||||
#include <dune/common/fmatrix.hh>
|
#include <dune/common/fmatrix.hh>
|
||||||
|
#include <dune/grid/utility/persistentcontainer.hh>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -173,6 +174,8 @@ class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
||||||
|
typedef typename GET_PROP_TYPE(TypeTag, Stencil) Stencil;
|
||||||
|
enum { codim = Stencil::Entity::codimension };
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
|
typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector;
|
typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector;
|
||||||
@ -184,6 +187,8 @@ class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
|
|||||||
typedef typename GridView::ctype CoordScalar;
|
typedef typename GridView::ctype CoordScalar;
|
||||||
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
|
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
|
||||||
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
|
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
|
||||||
|
|
||||||
|
typedef Dune::PersistentContainer< typename GridView::Grid, MaterialLawParams > MaterialLawParamsContainer;
|
||||||
//!\endcond
|
//!\endcond
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -191,7 +196,8 @@ public:
|
|||||||
* \copydoc Doxygen::defaultProblemConstructor
|
* \copydoc Doxygen::defaultProblemConstructor
|
||||||
*/
|
*/
|
||||||
FingerProblem(Simulator &simulator)
|
FingerProblem(Simulator &simulator)
|
||||||
: ParentType(simulator)
|
: ParentType(simulator),
|
||||||
|
materialParams_( simulator.gridManager().grid(), codim )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -246,16 +252,18 @@ public:
|
|||||||
mdcParams_.finalize();
|
mdcParams_.finalize();
|
||||||
|
|
||||||
// initialize the material parameter objects of the individual
|
// initialize the material parameter objects of the individual
|
||||||
// finite volumes
|
// finite volumes, resize will resize the container to the number of elements
|
||||||
int n = this->model().numGridDof();
|
materialParams_.resize();
|
||||||
materialParams_.resize(n);
|
|
||||||
for (int i = 0; i < n; ++i) {
|
for (auto it = materialParams_.begin(),
|
||||||
materialParams_[i].setMicParams(&micParams_);
|
end = materialParams_.end(); it != end; ++it ) {
|
||||||
materialParams_[i].setMdcParams(&mdcParams_);
|
MaterialLawParams& materialParams = *it ;
|
||||||
materialParams_[i].setSwr(0.0);
|
materialParams.setMicParams(&micParams_);
|
||||||
materialParams_[i].setSnr(0.1);
|
materialParams.setMdcParams(&mdcParams_);
|
||||||
materialParams_[i].finalize();
|
materialParams.setSwr(0.0);
|
||||||
ParkerLenhard::reset(materialParams_[i]);
|
materialParams.setSnr(0.1);
|
||||||
|
materialParams.finalize();
|
||||||
|
ParkerLenhard::reset(materialParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
K_ = this->toDimMatrix_(4.6e-10);
|
K_ = this->toDimMatrix_(4.6e-10);
|
||||||
@ -289,11 +297,13 @@ public:
|
|||||||
auto elemIt = this->gridView().template begin<0>();
|
auto elemIt = this->gridView().template begin<0>();
|
||||||
const auto &elemEndIt = this->gridView().template end<0>();
|
const auto &elemEndIt = this->gridView().template end<0>();
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
for (; elemIt != elemEndIt; ++elemIt) {
|
||||||
elemCtx.updateAll(*elemIt);
|
const auto& elem = *elemIt;
|
||||||
for (int scvIdx = 0; scvIdx < elemCtx.numDof(/*timeIdx=*/0); ++scvIdx) {
|
elemCtx.updateAll( elem );
|
||||||
int globalIdx = elemCtx.globalSpaceIndex(scvIdx, /*timeIdx=*/0);
|
for (int scvIdx = 0; scvIdx < elemCtx.numDof(/*timeIdx=*/0); ++scvIdx)
|
||||||
|
{
|
||||||
|
MaterialLawParams& materialParam = materialLawParams( elemCtx, scvIdx, /*timeIdx=*/0 );
|
||||||
const auto &fs = elemCtx.intensiveQuantities(scvIdx, /*timeIdx=*/0).fluidState();
|
const auto &fs = elemCtx.intensiveQuantities(scvIdx, /*timeIdx=*/0).fluidState();
|
||||||
ParkerLenhard::update(materialParams_[globalIdx], fs);
|
ParkerLenhard::update(materialParam, fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,6 +337,17 @@ public:
|
|||||||
Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const
|
Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const
|
||||||
{ return 0.4; }
|
{ return 0.4; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \copydoc FvBaseMultiPhaseProblem::materialLawParams
|
||||||
|
*/
|
||||||
|
template <class Context>
|
||||||
|
MaterialLawParams &materialLawParams(const Context &context,
|
||||||
|
int spaceIdx, int timeIdx)
|
||||||
|
{
|
||||||
|
const auto& entity = context.stencil(timeIdx).entity( spaceIdx );
|
||||||
|
return materialParams_[ entity ];
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \copydoc FvBaseMultiPhaseProblem::materialLawParams
|
* \copydoc FvBaseMultiPhaseProblem::materialLawParams
|
||||||
*/
|
*/
|
||||||
@ -334,8 +355,8 @@ public:
|
|||||||
const MaterialLawParams &materialLawParams(const Context &context,
|
const MaterialLawParams &materialLawParams(const Context &context,
|
||||||
int spaceIdx, int timeIdx) const
|
int spaceIdx, int timeIdx) const
|
||||||
{
|
{
|
||||||
int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
const auto& entity = context.stencil(timeIdx).entity( spaceIdx );
|
||||||
return materialParams_[globalSpaceIdx];
|
return materialParams_[ entity ];
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
@ -471,7 +492,7 @@ private:
|
|||||||
typename MaterialLawParams::VanGenuchtenParams micParams_;
|
typename MaterialLawParams::VanGenuchtenParams micParams_;
|
||||||
typename MaterialLawParams::VanGenuchtenParams mdcParams_;
|
typename MaterialLawParams::VanGenuchtenParams mdcParams_;
|
||||||
|
|
||||||
std::vector<MaterialLawParams> materialParams_;
|
MaterialLawParamsContainer materialParams_;
|
||||||
|
|
||||||
Opm::ImmiscibleFluidState<Scalar, FluidSystem> initialFluidState_;
|
Opm::ImmiscibleFluidState<Scalar, FluidSystem> initialFluidState_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user