reformat the source code

this was done semi-automatically. The line length has been set to 80
characters, but with a quite low penalty for crossing this limit.
This commit is contained in:
Andreas Lauser 2013-11-29 16:33:46 +01:00
parent d47687be5d
commit 98c5b8fba7
54 changed files with 1363 additions and 1148 deletions

View File

@ -19,14 +19,17 @@
/*! /*!
* \file * \file
* *
* \brief Main file of the tutorial for a fully coupled twophase VCVF discretization. * \brief Main file of the tutorial for a fully coupled twophase VCVF
*discretization.
*/ */
#include "config.h" /*@\label{tutorial-coupled:include-begin}@*/ #include "config.h" /*@\label{tutorial-coupled:include-begin}@*/
#include <ewoms/common/start.hh> /*@\label{tutorial-coupled:include-end}@*/ #include <ewoms/common/start.hh> /*@\label{tutorial-coupled:include-end}@*/
#include "tutorial1problem.hh" /*@\label{tutorial-coupled:include-problem-header}@*/ #include "tutorial1problem.hh" /*@\label{tutorial-coupled:include-problem-header}@*/
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(TutorialProblemCoupled) TypeTag; /*@\label{tutorial-coupled:set-type-tag}@*/ typedef TTAG(
return Ewoms::start<TypeTag>(argc, argv); /*@\label{tutorial-coupled:call-start}@*/ TutorialProblemCoupled) TypeTag; /*@\label{tutorial-coupled:set-type-tag}@*/
return Ewoms::start<TypeTag>(argc,
argv); /*@\label{tutorial-coupled:call-start}@*/
} }

View File

@ -21,8 +21,10 @@
* *
* \copydoc Ewoms::TutorialProblemCoupled * \copydoc Ewoms::TutorialProblemCoupled
*/ */
#ifndef EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/ #ifndef EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro
#define EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/ // /*@\label{tutorial-coupled:guardian1}@*/
#define EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro
// /*@\label{tutorial-coupled:guardian2}@*/
// The numerical model // The numerical model
#include <ewoms/models/immiscible/immisciblemodel.hh> #include <ewoms/models/immiscible/immisciblemodel.hh>
@ -32,13 +34,16 @@
#include <opm/material/components/Lnapl.hpp> #include <opm/material/components/Lnapl.hpp>
// Headers required for the capillary pressure law // Headers required for the capillary pressure law
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp> /*@\label{tutorial-coupled:rawLawInclude}@*/ #include \
<opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp> /*@\label{tutorial-coupled:rawLawInclude}@*/
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp> #include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp> #include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
// For the DUNE grid // For the DUNE grid
#include <dune/grid/yaspgrid.hh> /*@\label{tutorial-coupled:include-grid-manager}@*/ #include \
#include <ewoms/io/cubegridcreator.hh> /*@\label{tutorial-coupled:include-grid-creator}@*/ <dune/grid/yaspgrid.hh> /*@\label{tutorial-coupled:include-grid-manager}@*/
#include \
<ewoms/io/cubegridcreator.hh> /*@\label{tutorial-coupled:include-grid-creator}@*/
// For Dune::FieldMatrix // For Dune::FieldMatrix
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
@ -53,25 +58,37 @@ class TutorialProblemCoupled;
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
// Create a new type tag for the problem // Create a new type tag for the problem
NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(VcfvImmiscibleTwoPhase)); /*@\label{tutorial-coupled:create-type-tag}@*/ NEW_TYPE_TAG(TutorialProblemCoupled,
INHERITS_FROM(VcfvImmiscibleTwoPhase)); /*@\label
{tutorial-coupled:create-type-tag}@*/
// Set the "Problem" property // Set the "Problem" property
SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/ SET_PROP(TutorialProblemCoupled,
{ typedef Ewoms::TutorialProblemCoupled<TypeTag> type;}; Problem) /*@\label{tutorial-coupled:set-problem}@*/
{
typedef Ewoms::TutorialProblemCoupled<TypeTag> type;
};
// Set grid and the grid creator to be used // Set grid and the grid creator to be used
SET_TYPE_PROP(TutorialProblemCoupled, Grid, Dune::YaspGrid</*dim=*/2>); /*@\label{tutorial-coupled:set-grid}@*/ SET_TYPE_PROP(TutorialProblemCoupled, Grid,
SET_TYPE_PROP(TutorialProblemCoupled, GridCreator, Ewoms::CubeGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-gridcreator}@*/ Dune::YaspGrid</*dim=*/2>); /*@\label{tutorial-coupled:set-grid}@*/
SET_TYPE_PROP(TutorialProblemCoupled, GridCreator,
Ewoms::CubeGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-gridcreator}@*/
// Set the wetting phase /*@\label{tutorial-coupled:2p-system-start}@*/ // Set the wetting phase /*@\label{tutorial-coupled:2p-system-start}@*/
SET_TYPE_PROP(TutorialProblemCoupled, WettingPhase, /*@\label{tutorial-coupled:wettingPhase}@*/ SET_TYPE_PROP(
Opm::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar), TutorialProblemCoupled,
Opm::SimpleH2O<typename GET_PROP_TYPE(TypeTag, Scalar)> >); WettingPhase, /*@\label{tutorial-coupled:wettingPhase}@*/
Opm::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
Opm::SimpleH2O<typename GET_PROP_TYPE(TypeTag, Scalar)> >);
// Set the non-wetting phase // Set the non-wetting phase
SET_TYPE_PROP(TutorialProblemCoupled, NonwettingPhase, /*@\label{tutorial-coupled:nonwettingPhase}@*/ SET_TYPE_PROP(
Opm::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar), TutorialProblemCoupled,
Opm::LNAPL<typename GET_PROP_TYPE(TypeTag, Scalar)> >); /*@\label{tutorial-coupled:2p-system-end}@*/ NonwettingPhase, /*@\label{tutorial-coupled:nonwettingPhase}@*/
Opm::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
Opm::LNAPL<typename GET_PROP_TYPE(TypeTag, Scalar)> >); /*@\label
{tutorial-coupled:2p-system-end}@*/
// Set the material law // Set the material law
SET_PROP(TutorialProblemCoupled, MaterialLaw) SET_PROP(TutorialProblemCoupled, MaterialLaw)
@ -83,11 +100,13 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
typedef Opm::RegularizedBrooksCorey<Traits> RawMaterialLaw; /*@\label{tutorial-coupled:rawlaw}@*/ typedef Opm::RegularizedBrooksCorey<Traits>
RawMaterialLaw; /*@\label{tutorial-coupled:rawlaw}@*/
public: public:
// Convert absolute saturations into effective ones before passing // Convert absolute saturations into effective ones before passing
@ -96,23 +115,27 @@ public:
}; };
// Disable gravity // Disable gravity
SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-coupled:gravity}@*/ SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity,
false); /*@\label{tutorial-coupled:gravity}@*/
// define how long the simulation should run [s] /*@\label{tutorial-coupled:default-params-begin}@*/ // define how long the simulation should run [s]
// /*@\label{tutorial-coupled:default-params-begin}@*/
SET_SCALAR_PROP(TutorialProblemCoupled, EndTime, 100e3); SET_SCALAR_PROP(TutorialProblemCoupled, EndTime, 100e3);
// define the size of the initial time step [s] // define the size of the initial time step [s]
SET_SCALAR_PROP(TutorialProblemCoupled, InitialTimeStepSize, 125.0); SET_SCALAR_PROP(TutorialProblemCoupled, InitialTimeStepSize, 125.0);
// define the physical size of the problem's domain [m] // define the physical size of the problem's domain [m]
SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeX, 300.0); /*@\label{tutorial-coupled:grid-default-params-begin}@*/ SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeX,
300.0); /*@\label{tutorial-coupled:grid-default-params-begin}@*/
SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeY, 60.0); SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeY, 60.0);
SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeZ, 0.0); SET_SCALAR_PROP(TutorialProblemCoupled, DomainSizeZ, 0.0);
// // define the number of cells used for discretizing the physical domain // // define the number of cells used for discretizing the physical domain
SET_INT_PROP(TutorialProblemCoupled, CellsX, 100); SET_INT_PROP(TutorialProblemCoupled, CellsX, 100);
SET_INT_PROP(TutorialProblemCoupled, CellsY, 1); SET_INT_PROP(TutorialProblemCoupled, CellsY, 1);
SET_INT_PROP(TutorialProblemCoupled, CellsZ, 1); /*@\label{tutorial-coupled:default-params-end}@*/ SET_INT_PROP(TutorialProblemCoupled, CellsZ,
1); /*@\label{tutorial-coupled:default-params-end}@*/
} // namespace Properties } // namespace Properties
} // namespace Opm } // namespace Opm
@ -120,7 +143,8 @@ namespace Ewoms {
//! Tutorial problem using the fully-implicit immiscible model. //! Tutorial problem using the fully-implicit immiscible model.
template <class TypeTag> template <class TypeTag>
class TutorialProblemCoupled class TutorialProblemCoupled
: public GET_PROP_TYPE(TypeTag, BaseProblem) /*@\label{tutorial-coupled:def-problem}@*/ : public GET_PROP_TYPE(TypeTag,
BaseProblem) /*@\label{tutorial-coupled:def-problem}@*/
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
@ -136,11 +160,13 @@ class TutorialProblemCoupled
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; /*@\label{tutorial-coupled:matLawObjectType}@*/ typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams)
MaterialLawParams; /*@\label{tutorial-coupled:matLawObjectType}@*/
// phase indices // phase indices
enum { numPhases = FluidSystem::numPhases }; enum { numPhases = FluidSystem::numPhases };
@ -154,20 +180,21 @@ class TutorialProblemCoupled
public: public:
//! The constructor of the problem //! The constructor of the problem
TutorialProblemCoupled(TimeManager &timeManager) TutorialProblemCoupled(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
#else #else
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
#endif #endif
, eps_(3e-6) eps_(3e-6)
{ {
// Use an isotropic and homogeneous intrinsic permeability // Use an isotropic and homogeneous intrinsic permeability
K_ = this->toDimMatrix_(1e-7); K_ = this->toDimMatrix_(1e-7);
// Parameters of the Brooks-Corey law // Parameters of the Brooks-Corey law
materialParams_.setEntryPressure(500.0); // entry pressure [Pa] /*@\label{tutorial-coupled:setLawParams}@*/ materialParams_.setEntryPressure(500.0); // entry pressure [Pa]
// /*@\label{tutorial-coupled:setLawParams}@*/
materialParams_.setLambda(2); // shape parameter materialParams_.setLambda(2); // shape parameter
// Set the residual saturations // Set the residual saturations
@ -178,7 +205,8 @@ public:
materialParams_.finalize(); materialParams_.finalize();
} }
//! Specifies the problem name. This is used for files generated by the simulation. //! Specifies the problem name. This is used for files generated by the
// simulation.
const char *name() const const char *name() const
{ return "tutorial_coupled"; } { return "tutorial_coupled"; }
@ -189,30 +217,34 @@ public:
//! Returns the intrinsic permeability tensor [m^2] at a position. //! Returns the intrinsic permeability tensor [m^2] at a position.
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, /*@\label{tutorial-coupled:permeability}@*/ const DimMatrix &intrinsicPermeability(
int spaceIdx, int timeIdx) const const Context &context, /*@\label{tutorial-coupled:permeability}@*/
int spaceIdx, int timeIdx) const
{ return K_; } { return K_; }
//! Defines the porosity [-] of the medium at a given position //! Defines the porosity [-] of the medium at a given position
template <class Context> template <class Context>
Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const /*@\label{tutorial-coupled:porosity}@*/ Scalar porosity(const Context &context, int spaceIdx,
int timeIdx) const /*@\label{tutorial-coupled:porosity}@*/
{ return 0.2; } { return 0.2; }
//! Returns the parameter object for the material law at a given position //! Returns the parameter object for the material law at a given position
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/ const MaterialLawParams &materialLawParams(
int spaceIdx, int timeIdx) const const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/
int spaceIdx, int timeIdx) const
{ return materialParams_; } { return materialParams_; }
//! Evaluates the boundary conditions. //! Evaluates the boundary conditions.
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context, int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (pos[0] < eps_) { if (pos[0] < eps_) {
// Free-flow conditions on left boundary // Free-flow conditions on left boundary
const auto &materialParams = this->materialLawParams(context, spaceIdx, timeIdx); const auto &materialParams
= this->materialLawParams(context, spaceIdx, timeIdx);
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
Scalar Sw = 1.0; Scalar Sw = 1.0;
@ -231,7 +263,7 @@ public:
// forced outflow at the right boundary // forced outflow at the right boundary
RateVector massRate(0.0); RateVector massRate(0.0);
massRate[contiWEqIdx] = 0.0; // [kg / (s m^2)] massRate[contiWEqIdx] = 0.0; // [kg / (s m^2)]
massRate[contiNEqIdx] = 3e-2; // [kg / (s m^2)] massRate[contiNEqIdx] = 3e-2; // [kg / (s m^2)]
values.setMassRate(massRate); values.setMassRate(massRate);
@ -240,10 +272,12 @@ public:
values.setNoFlow(); values.setNoFlow();
} }
//! Evaluates the source term for all conserved quantities at a given position //! Evaluates the source term for all conserved quantities at a given
// position
//! of the domain [kg/(m^3 * s)]. Positive values mean that mass is created. //! of the domain [kg/(m^3 * s)]. Positive values mean that mass is created.
template <class Context> template <class Context>
void source(RateVector &source, const Context &context, int spaceIdx, int timeIdx) const void source(RateVector &source, const Context &context, int spaceIdx,
int timeIdx) const
{ {
source[contiWEqIdx] = 0.0; source[contiWEqIdx] = 0.0;
source[contiNEqIdx] = 0.0; source[contiNEqIdx] = 0.0;
@ -251,8 +285,8 @@ public:
//! Evaluates the initial value at a given position in the domain. //! Evaluates the initial value at a given position in the domain.
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int spaceIdx, int timeIdx) const int timeIdx) const
{ {
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
@ -266,7 +300,9 @@ public:
// set pressure of the wetting phase to 200 kPa = 2 bar // set pressure of the wetting phase to 200 kPa = 2 bar
Scalar pC[numPhases]; Scalar pC[numPhases];
MaterialLaw::capillaryPressures(pC, materialLawParams(context, spaceIdx, timeIdx), fs); MaterialLaw::capillaryPressures(pC, materialLawParams(context, spaceIdx,
timeIdx),
fs);
fs.setPressure(wPhaseIdx, 200e3); fs.setPressure(wPhaseIdx, 200e3);
fs.setPressure(nPhaseIdx, 200e3 + pC[nPhaseIdx] - pC[nPhaseIdx]); fs.setPressure(nPhaseIdx, 200e3 + pC[nPhaseIdx] - pC[nPhaseIdx]);
@ -276,7 +312,7 @@ public:
private: private:
DimMatrix K_; DimMatrix K_;
// Object that holds the values/parameters of the selected material law. // Object that holds the values/parameters of the selected material law.
MaterialLawParams materialParams_; /*@\label{tutorial-coupled:matParamsObject}@*/ MaterialLawParams materialParams_; /*@\label{tutorial-coupled:matParamsObject}@*/
// small epsilon value // small epsilon value
Scalar eps_; Scalar eps_;

View File

@ -35,17 +35,18 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionFlashProblem, INHERITS_FROM(VcfvFlash, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionFlashProblem,
INHERITS_FROM(VcfvFlash, Co2InjectionBaseProblem));
// for the flash model we want to use thermodynamic hints or it will // for the flash model we want to use thermodynamic hints or it will
// get _very_ slow. // get _very_ slow.
SET_BOOL_PROP(Co2InjectionFlashProblem, EnableHints, true); SET_BOOL_PROP(Co2InjectionFlashProblem, EnableHints, true);
// use the flash solver adapted to the CO2 injection problem // use the flash solver adapted to the CO2 injection problem
SET_TYPE_PROP(Co2InjectionFlashProblem, SET_TYPE_PROP(
FlashSolver, Co2InjectionFlashProblem, FlashSolver,
Ewoms::Co2InjectionFlash<typename GET_PROP_TYPE(TypeTag, Scalar), Ewoms::Co2InjectionFlash<typename GET_PROP_TYPE(TypeTag, Scalar),
typename GET_PROP_TYPE(TypeTag, FluidSystem)> ); typename GET_PROP_TYPE(TypeTag, FluidSystem)>);
// the flash model has serious problems with the numerical // the flash model has serious problems with the numerical
// precision. if quadruple precision math is available, we use it, // precision. if quadruple precision math is available, we use it,
@ -58,7 +59,7 @@ SET_SCALAR_PROP(Co2InjectionFlashProblem, NewtonRelativeTolerance, 1e-5);
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionFlashProblem) ProblemTypeTag; typedef TTAG(Co2InjectionFlashProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -32,7 +32,8 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionFlashNIProblem, INHERITS_FROM(VcfvFlash, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionFlashNIProblem,
INHERITS_FROM(VcfvFlash, Co2InjectionBaseProblem));
SET_BOOL_PROP(Co2InjectionFlashNIProblem, EnableEnergy, true); SET_BOOL_PROP(Co2InjectionFlashNIProblem, EnableEnergy, true);
@ -41,10 +42,10 @@ SET_BOOL_PROP(Co2InjectionFlashNIProblem, EnableEnergy, true);
SET_BOOL_PROP(Co2InjectionFlashNIProblem, EnableHints, true); SET_BOOL_PROP(Co2InjectionFlashNIProblem, EnableHints, true);
// use the CO2 injection problem adapted flash solver // use the CO2 injection problem adapted flash solver
SET_TYPE_PROP(Co2InjectionFlashNIProblem, SET_TYPE_PROP(
FlashSolver, Co2InjectionFlashNIProblem, FlashSolver,
Ewoms::Co2InjectionFlash<typename GET_PROP_TYPE(TypeTag, Scalar), Ewoms::Co2InjectionFlash<typename GET_PROP_TYPE(TypeTag, Scalar),
typename GET_PROP_TYPE(TypeTag, FluidSystem)> ); typename GET_PROP_TYPE(TypeTag, FluidSystem)>);
// the flash model has serious problems with the numerical // the flash model has serious problems with the numerical
// precision. if quadruple precision math is available, we use it, // precision. if quadruple precision math is available, we use it,
@ -54,10 +55,10 @@ SET_TYPE_PROP(Co2InjectionFlashNIProblem, Scalar, quad);
#else #else
SET_SCALAR_PROP(Co2InjectionFlashNIProblem, NewtonRelativeTolerance, 1e-5); SET_SCALAR_PROP(Co2InjectionFlashNIProblem, NewtonRelativeTolerance, 1e-5);
#endif #endif
}
}
} } int main(int argc, char **argv)
int main(int argc, char** argv)
{ {
typedef TTAG(Co2InjectionFlashNIProblem) ProblemTypeTag; typedef TTAG(Co2InjectionFlashNIProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,13 +29,15 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionImmiscibleProblem, INHERITS_FROM(VcfvImmiscible, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionImmiscibleProblem,
} } INHERITS_FROM(VcfvImmiscible, Co2InjectionBaseProblem));
}
}
//////////////////////// ////////////////////////
// the main function // the main function
//////////////////////// ////////////////////////
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionImmiscibleProblem) ProblemTypeTag; typedef TTAG(Co2InjectionImmiscibleProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -30,7 +30,8 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionImmiscibleNIProblem, INHERITS_FROM(VcfvImmiscible, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionImmiscibleNIProblem,
INHERITS_FROM(VcfvImmiscible, Co2InjectionBaseProblem));
SET_BOOL_PROP(Co2InjectionImmiscibleNIProblem, EnableEnergy, true); SET_BOOL_PROP(Co2InjectionImmiscibleNIProblem, EnableEnergy, true);
} }
@ -39,7 +40,7 @@ SET_BOOL_PROP(Co2InjectionImmiscibleNIProblem, EnableEnergy, true);
//////////////////////// ////////////////////////
// the main function // the main function
//////////////////////// ////////////////////////
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionImmiscibleNIProblem) ProblemTypeTag; typedef TTAG(Co2InjectionImmiscibleNIProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -30,11 +30,12 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionNcpProblem, INHERITS_FROM(VcfvNcp, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionNcpProblem,
INHERITS_FROM(VcfvNcp, Co2InjectionBaseProblem));
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionNcpProblem) ProblemTypeTag; typedef TTAG(Co2InjectionNcpProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -30,12 +30,13 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionNcpNIProblem, INHERITS_FROM(VcfvNcp, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionNcpNIProblem,
INHERITS_FROM(VcfvNcp, Co2InjectionBaseProblem));
SET_BOOL_PROP(Co2InjectionNcpNIProblem, EnableEnergy, true); SET_BOOL_PROP(Co2InjectionNcpNIProblem, EnableEnergy, true);
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionNcpNIProblem) ProblemTypeTag; typedef TTAG(Co2InjectionNcpNIProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -19,7 +19,8 @@
/*! /*!
* \file * \file
* *
* \brief Test for the isothermal primary variable switching VCVF discretization. * \brief Test for the isothermal primary variable switching VCVF
*discretization.
*/ */
#include "config.h" #include "config.h"
@ -29,10 +30,12 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionPvsProblem, INHERITS_FROM(VcfvPvs, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionPvsProblem,
} } INHERITS_FROM(VcfvPvs, Co2InjectionBaseProblem));
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionPvsProblem) ProblemTypeTag; typedef TTAG(Co2InjectionPvsProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -19,7 +19,8 @@
/*! /*!
* \file * \file
* *
* \brief Test for the non-isothermal primary variable switching VCVF discretization. * \brief Test for the non-isothermal primary variable switching VCVF
*discretization.
*/ */
#include "config.h" #include "config.h"
@ -29,12 +30,14 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(Co2InjectionPvsNIProblem, INHERITS_FROM(VcfvPvs, Co2InjectionBaseProblem)); NEW_TYPE_TAG(Co2InjectionPvsNIProblem,
INHERITS_FROM(VcfvPvs, Co2InjectionBaseProblem));
SET_BOOL_PROP(Co2InjectionPvsNIProblem, EnableEnergy, true); SET_BOOL_PROP(Co2InjectionPvsNIProblem, EnableEnergy, true);
} } }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Co2InjectionPvsNIProblem) ProblemTypeTag; typedef TTAG(Co2InjectionPvsNIProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -33,7 +33,7 @@ NEW_TYPE_TAG(CuvetteProblem, INHERITS_FROM(VcfvPvs, CuvetteBaseProblem));
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(CuvetteProblem) ProblemTypeTag; typedef TTAG(CuvetteProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -33,7 +33,7 @@ NEW_TYPE_TAG(DiffusionProblem, INHERITS_FROM(VcfvFlash, DiffusionBaseProblem));
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(DiffusionProblem) ProblemTypeTag; typedef TTAG(DiffusionProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -33,7 +33,7 @@ NEW_TYPE_TAG(DiffusionProblem, INHERITS_FROM(VcfvNcp, DiffusionBaseProblem));
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(DiffusionProblem) ProblemTypeTag; typedef TTAG(DiffusionProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -33,7 +33,7 @@ NEW_TYPE_TAG(DiffusionProblem, INHERITS_FROM(VcfvPvs, DiffusionBaseProblem));
} }
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(DiffusionProblem) ProblemTypeTag; typedef TTAG(DiffusionProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,10 +29,12 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(FingerProblem, INHERITS_FROM(VcfvImmiscibleTwoPhase, FingerBaseProblem)); NEW_TYPE_TAG(FingerProblem,
}} INHERITS_FROM(VcfvImmiscibleTwoPhase, FingerBaseProblem));
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(FingerProblem) ProblemTypeTag; typedef TTAG(FingerProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -25,13 +25,13 @@
#if !HAVE_ALUGRID #if !HAVE_ALUGRID
#warning "The ALUGrid Dune grid manager is required for this test." #warning "The ALUGrid Dune grid manager is required for this test."
int main(int argc, char** argv) int main(int argc, char **argv)
{} {}
#else #else
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/fractureproblem.hh" #include "problems/fractureproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(FractureProblem) ProblemTypeTag; typedef TTAG(FractureProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,10 +29,12 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(GroundWaterProblem, INHERITS_FROM(VcfvImmiscibleOnePhase, GroundWaterBaseProblem)); NEW_TYPE_TAG(GroundWaterProblem,
}} INHERITS_FROM(VcfvImmiscibleOnePhase, GroundWaterBaseProblem));
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(GroundWaterProblem) ProblemTypeTag; typedef TTAG(GroundWaterProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,12 +29,13 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(InfiltrationProblem, INHERITS_FROM(VcfvPvs, InfiltrationBaseProblem)); NEW_TYPE_TAG(InfiltrationProblem,
}} INHERITS_FROM(VcfvPvs, InfiltrationBaseProblem));
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(InfiltrationProblem) ProblemTypeTag; typedef TTAG(InfiltrationProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);
} }

View File

@ -31,9 +31,10 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(LensProblem, INHERITS_FROM(VcfvImmiscibleTwoPhase, LensBaseProblem)); NEW_TYPE_TAG(LensProblem, INHERITS_FROM(VcfvImmiscibleTwoPhase, LensBaseProblem));
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(LensProblem) ProblemTypeTag; typedef TTAG(LensProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -26,7 +26,7 @@
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/richardslensproblem.hh" #include "problems/richardslensproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(RichardsLensProblem) ProblemTypeTag; typedef TTAG(RichardsLensProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -31,9 +31,10 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(ObstacleProblem, INHERITS_FROM(VcfvImmiscible, ObstacleBaseProblem)); NEW_TYPE_TAG(ObstacleProblem, INHERITS_FROM(VcfvImmiscible, ObstacleBaseProblem));
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(ObstacleProblem) ProblemTypeTag; typedef TTAG(ObstacleProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -31,9 +31,10 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(ObstacleProblem, INHERITS_FROM(VcfvNcp, ObstacleBaseProblem)); NEW_TYPE_TAG(ObstacleProblem, INHERITS_FROM(VcfvNcp, ObstacleBaseProblem));
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(ObstacleProblem) ProblemTypeTag; typedef TTAG(ObstacleProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -20,7 +20,8 @@
/** /**
* \file * \file
* *
* \brief Test for the isothermal primary variable switching VCVF discretization. * \brief Test for the isothermal primary variable switching VCVF
*discretization.
*/ */
#include "config.h" #include "config.h"
@ -34,9 +35,10 @@ NEW_TYPE_TAG(ObstacleProblem, INHERITS_FROM(VcfvPvs, ObstacleBaseProblem));
// Verbosity of the PVS model (0=silent, 1=medium, 2=chatty) // Verbosity of the PVS model (0=silent, 1=medium, 2=chatty)
SET_INT_PROP(ObstacleProblem, PvsVerbosity, 1); SET_INT_PROP(ObstacleProblem, PvsVerbosity, 1);
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(ObstacleProblem) ProblemTypeTag; typedef TTAG(ObstacleProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -33,9 +33,10 @@ NEW_TYPE_TAG(OutflowProblem, INHERITS_FROM(VcfvPvs, OutflowBaseProblem));
// Verbosity of the PVS model (0=silent, 1=medium, 2=chatty) // Verbosity of the PVS model (0=silent, 1=medium, 2=chatty)
SET_INT_PROP(OutflowProblem, PvsVerbosity, 1); SET_INT_PROP(OutflowProblem, PvsVerbosity, 1);
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(OutflowProblem) ProblemTypeTag; typedef TTAG(OutflowProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,12 +29,15 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(PowerInjectionProblem, INHERITS_FROM(VcfvImmiscibleTwoPhase, PowerInjectionBaseProblem)); NEW_TYPE_TAG(PowerInjectionProblem,
INHERITS_FROM(VcfvImmiscibleTwoPhase, PowerInjectionBaseProblem));
SET_TYPE_PROP(PowerInjectionProblem, VelocityModule, Ewoms::VcfvDarcyVelocityModule<TypeTag>); SET_TYPE_PROP(PowerInjectionProblem, VelocityModule,
} } Ewoms::VcfvDarcyVelocityModule<TypeTag>);
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(PowerInjectionProblem) ProblemTypeTag; typedef TTAG(PowerInjectionProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -29,12 +29,15 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(PowerInjectionProblem, INHERITS_FROM(VcfvImmiscibleTwoPhase, PowerInjectionBaseProblem)); NEW_TYPE_TAG(PowerInjectionProblem,
INHERITS_FROM(VcfvImmiscibleTwoPhase, PowerInjectionBaseProblem));
SET_TYPE_PROP(PowerInjectionProblem, VelocityModule, Ewoms::VcfvForchheimerVelocityModule<TypeTag>); SET_TYPE_PROP(PowerInjectionProblem, VelocityModule,
} } Ewoms::VcfvForchheimerVelocityModule<TypeTag>);
}
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(PowerInjectionProblem) ProblemTypeTag; typedef TTAG(PowerInjectionProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -43,25 +43,25 @@ class Co2InjectionFlash : public Opm::NcpFlash<Scalar, FluidSystem>
typedef typename ParentType::ComponentVector ComponentVector; typedef typename ParentType::ComponentVector ComponentVector;
enum { numPhases = FluidSystem::numPhases }; enum { numPhases = FluidSystem::numPhases };
public: public:
/*! /*!
* \brief Guess initial values for all quantities. * \brief Guess initial values for all quantities.
*/ */
template <class FluidState> template <class FluidState>
static void guessInitial(FluidState &fluidState, static void guessInitial(FluidState &fluidState, ParameterCache &paramCache,
ParameterCache &paramCache,
const ComponentVector &globalMolarities) const ComponentVector &globalMolarities)
{ {
ParentType::guessInitial(fluidState, paramCache, globalMolarities); ParentType::guessInitial(fluidState, paramCache, globalMolarities);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
// pressure. something close to the reservoid pressure as initial guess // pressure. something close to the reservoid pressure as initial
// guess
fluidState.setPressure(phaseIdx, 1.0135e6); fluidState.setPressure(phaseIdx, 1.0135e6);
} }
paramCache.updateAllPressures(fluidState); paramCache.updateAllPressures(fluidState);
} }
}; };
} // namespace Ewoms } // namespace Ewoms

View File

@ -55,7 +55,8 @@ class Co2InjectionProblem;
namespace Co2Injection { namespace Co2Injection {
#include <opm/material/components/co2tables.inc> #include <opm/material/components/co2tables.inc>
}} // namespace Ewoms }
} // namespace Ewoms
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
@ -77,18 +78,21 @@ NEW_PROP_TAG(SimulationName);
SET_TYPE_PROP(Co2InjectionBaseProblem, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(Co2InjectionBaseProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property // Set the problem property
SET_TYPE_PROP(Co2InjectionBaseProblem, Problem, Ewoms::Co2InjectionProblem<TypeTag>); SET_TYPE_PROP(Co2InjectionBaseProblem, Problem,
Ewoms::Co2InjectionProblem<TypeTag>);
// Set fluid configuration // Set fluid configuration
SET_PROP(Co2InjectionBaseProblem, FluidSystem) SET_PROP(Co2InjectionBaseProblem, FluidSystem)
{ private: {
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Ewoms::Co2Injection::CO2Tables CO2Tables; typedef Ewoms::Co2Injection::CO2Tables CO2Tables;
static const bool useComplexRelations = false; static const bool useComplexRelations = false;
public: public:
typedef Opm::FluidSystems::BrineCO2<Scalar, CO2Tables> type; typedef Opm::FluidSystems::BrineCO2<Scalar, CO2Tables> type;
//typedef Opm::FluidSystems::H2ON2<Scalar, useComplexRelations> type; // typedef Opm::FluidSystems::H2ON2<Scalar, useComplexRelations> type;
}; };
// Set the material Law // Set the material Law
@ -99,7 +103,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
@ -181,8 +186,7 @@ namespace Ewoms {
* hydrostatic pressure is assumed. * hydrostatic pressure is assumed.
*/ */
template <class TypeTag> template <class TypeTag>
class Co2InjectionProblem class Co2InjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -190,30 +194,23 @@ class Co2InjectionProblem
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { enum { dim = GridView::dimension };
// Grid and world dimension enum { dimWorld = GridView::dimensionworld };
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
// copy some indices for convenience // copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enum { numPhases = FluidSystem::numPhases };
numPhases = FluidSystem::numPhases, enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { lPhaseIdx = FluidSystem::lPhaseIdx };
gPhaseIdx = FluidSystem::gPhaseIdx, enum { CO2Idx = FluidSystem::CO2Idx };
lPhaseIdx = FluidSystem::lPhaseIdx, enum { BrineIdx = FluidSystem::BrineIdx };
enum { conti0EqIdx = Indices::conti0EqIdx };
CO2Idx = FluidSystem::CO2Idx, enum { contiCO2EqIdx = conti0EqIdx + CO2Idx };
BrineIdx = FluidSystem::BrineIdx,
conti0EqIdx = Indices::conti0EqIdx,
contiCO2EqIdx = conti0EqIdx + CO2Idx
};
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -229,7 +226,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
Co2InjectionProblem(TimeManager &timeManager) Co2InjectionProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -239,20 +236,23 @@ public:
{ {
eps_ = 1e-6; eps_ = 1e-6;
temperatureLow_ = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemTemperatureLow); temperatureLow_
temperatureHigh_ = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemTemperatureHigh); = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemTemperatureLow);
temperatureHigh_
= EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemTemperatureHigh);
nTemperature_ = EWOMS_GET_PARAM(TypeTag, int, FluidSystemNumTemperature); nTemperature_ = EWOMS_GET_PARAM(TypeTag, int, FluidSystemNumTemperature);
nPressure_ = EWOMS_GET_PARAM(TypeTag, int, FluidSystemNumPressure); nPressure_ = EWOMS_GET_PARAM(TypeTag, int, FluidSystemNumPressure);
pressureLow_ = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemPressureLow); pressureLow_ = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemPressureLow);
pressureHigh_ = EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemPressureHigh); pressureHigh_
= EWOMS_GET_PARAM(TypeTag, Scalar, FluidSystemPressureHigh);
maxDepth_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxDepth); maxDepth_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxDepth);
temperature_ = EWOMS_GET_PARAM(TypeTag, Scalar, Temperature); temperature_ = EWOMS_GET_PARAM(TypeTag, Scalar, Temperature);
name_ = EWOMS_GET_PARAM(TypeTag, std::string, SimulationName); name_ = EWOMS_GET_PARAM(TypeTag, std::string, SimulationName);
// initialize the tables of the fluid system // initialize the tables of the fluid system
//FluidSystem::init(); // FluidSystem::init();
FluidSystem::init(/*Tmin=*/temperatureLow_, FluidSystem::init(/*Tmin=*/temperatureLow_,
/*Tmax=*/temperatureHigh_, /*Tmax=*/temperatureHigh_,
/*nT=*/nTemperature_, /*nT=*/nTemperature_,
@ -297,17 +297,33 @@ public:
{ {
ParentType::registerParameters(); ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemTemperatureLow, "The lower temperature [K] for tabulation of the fluid system"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemTemperatureLow,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemTemperatureHigh, "The upper temperature [K] for tabulation of the fluid system"); "The lower temperature [K] for tabulation of the "
EWOMS_REGISTER_PARAM(TypeTag, int, FluidSystemNumTemperature, "The number of intervals between the lower and upper temperature"); "fluid system");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemTemperatureHigh,
"The upper temperature [K] for tabulation of the "
"fluid system");
EWOMS_REGISTER_PARAM(TypeTag, int, FluidSystemNumTemperature,
"The number of intervals between the lower and "
"upper temperature");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemPressureLow, "The lower pressure [Pa] for tabulation of the fluid system"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemPressureLow,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemPressureHigh, "The upper pressure [Pa] for tabulation of the fluid system"); "The lower pressure [Pa] for tabulation of the "
EWOMS_REGISTER_PARAM(TypeTag, int, FluidSystemNumPressure, "The number of intervals between the lower and upper pressure"); "fluid system");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, FluidSystemPressureHigh,
"The upper pressure [Pa] for tabulation of the "
"fluid system");
EWOMS_REGISTER_PARAM(TypeTag, int, FluidSystemNumPressure,
"The number of intervals between the lower and "
"upper pressure");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, Temperature, "The temperature [K] in the reservoir"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, Temperature,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxDepth, "The maximum depth [m] of the reservoir"); "The temperature [K] in the reservoir");
EWOMS_REGISTER_PARAM(TypeTag, std::string, SimulationName, "The name of the simulation used for the output files"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxDepth,
"The maximum depth [m] of the reservoir");
EWOMS_REGISTER_PARAM(TypeTag, std::string, SimulationName,
"The name of the simulation used for the output "
"files");
} }
/*! /*!
@ -339,8 +355,8 @@ public:
// Write mass balance information for rank 0 // Write mass balance information for rank 0
if (this->gridView().comm().rank() == 0) { if (this->gridView().comm().rank() == 0) {
std::cout<<"Storage: liquid=[" << storageL << "]" std::cout << "Storage: liquid=[" << storageL << "]"
<< " gas=[" << storageG << "]\n"; << " gas=[" << storageG << "]\n";
} }
} }
@ -360,7 +376,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -384,7 +401,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -398,18 +416,18 @@ public:
* In this case, we assume the rock-matrix to be granite. * In this case, we assume the rock-matrix to be granite.
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 790 // specific heat capacity of granite [J / (kg K)]
790 // specific heat capacity of granite [J / (kg K)] * 2700; // density of granite [kg/m^3]
* 2700; // density of granite [kg/m^3]
} }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::heatConductionParams * \copydoc VcfvMultiPhaseProblem::heatConductionParams
*/ */
template <class Context> template <class Context>
const HeatConductionLawParams& const HeatConductionLawParams &
heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -429,8 +447,7 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -449,7 +466,9 @@ public:
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
fs.setSaturation(gPhaseIdx, 1.0); fs.setSaturation(gPhaseIdx, 1.0);
fs.setPressure(gPhaseIdx,context. volVars(spaceIdx, timeIdx).fluidState().pressure(gPhaseIdx)); fs.setPressure(gPhaseIdx,
context.volVars(spaceIdx, timeIdx).fluidState().pressure(
gPhaseIdx));
fs.setTemperature(temperature(context, spaceIdx, timeIdx)); fs.setTemperature(temperature(context, spaceIdx, timeIdx));
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(fs, gPhaseIdx); paramCache.updatePhase(fs, gPhaseIdx);
@ -475,13 +494,15 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
Opm::CompositionalFluidState<Scalar, FluidSystem> fs; Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
//const auto &matParams = this->materialLawParams(context, spaceIdx, timeIdx); // const auto &matParams = this->materialLawParams(context, spaceIdx,
//values.assignMassConservative(fs, matParams, /*inEquilibrium=*/true); // timeIdx);
// values.assignMassConservative(fs, matParams, /*inEquilibrium=*/true);
values.assignNaive(fs); values.assignNaive(fs);
} }
@ -492,16 +513,16 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
private: private:
template <class Context, class FluidState> template <class Context, class FluidState>
void initialFluidState_(FluidState &fs, const Context &context, int spaceIdx, int timeIdx) const void initialFluidState_(FluidState &fs, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -520,11 +541,12 @@ private:
// set pressures // set pressures
////// //////
Scalar densityL = FluidSystem::Brine::liquidDensity(temperature_, 1e5); Scalar densityL = FluidSystem::Brine::liquidDensity(temperature_, 1e5);
Scalar depth = maxDepth_ - pos[dim -1]; Scalar depth = maxDepth_ - pos[dim - 1];
Scalar pl = 1e5 - densityL*this->gravity()[dim - 1]*depth; Scalar pl = 1e5 - densityL * this->gravity()[dim - 1] * depth;
Scalar pC[numPhases]; Scalar pC[numPhases];
const auto &matParams = this->materialLawParams(context, spaceIdx, timeIdx); const auto &matParams
= this->materialLawParams(context, spaceIdx, timeIdx);
MaterialLaw::capillaryPressures(pC, matParams, fs); MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(lPhaseIdx, pl + (pC[lPhaseIdx] - pC[lPhaseIdx])); fs.setPressure(lPhaseIdx, pl + (pC[lPhaseIdx] - pC[lPhaseIdx]));
@ -539,8 +561,7 @@ private:
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP; typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
CFRP::solve(fs, CFRP::solve(fs, paramCache,
paramCache,
/*refPhaseIdx=*/lPhaseIdx, /*refPhaseIdx=*/lPhaseIdx,
/*setViscosity=*/true, /*setViscosity=*/true,
/*setEnthalpy=*/true); /*setEnthalpy=*/true);
@ -563,8 +584,9 @@ private:
Scalar lambdaWater = 0.6; Scalar lambdaWater = 0.6;
Scalar lambdaGranite = 2.8; Scalar lambdaGranite = 2.8;
Scalar lambdaWet = std::pow(lambdaGranite, (1-poro)) * std::pow(lambdaWater, poro); Scalar lambdaWet = std::pow(lambdaGranite, (1 - poro))
Scalar lambdaDry = std::pow(lambdaGranite, (1-poro)); * std::pow(lambdaWater, poro);
Scalar lambdaDry = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(gPhaseIdx, lambdaDry); params.setFullySaturatedLambda(gPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(lPhaseIdx, lambdaWet); params.setFullySaturatedLambda(lPhaseIdx, lambdaWet);
@ -572,7 +594,7 @@ private:
} }
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
{ return pos[dim-1] > fineLayerBottom_; } { return pos[dim - 1] > fineLayerBottom_; }
DimMatrix fineK_; DimMatrix fineK_;
DimMatrix coarseK_; DimMatrix coarseK_;
@ -594,7 +616,7 @@ private:
int nTemperature_; int nTemperature_;
int nPressure_; int nPressure_;
std::string name_ ; std::string name_;
Scalar pressureLow_, pressureHigh_; Scalar pressureLow_, pressureHigh_;
Scalar temperatureLow_, temperatureHigh_; Scalar temperatureLow_, temperatureHigh_;

View File

@ -65,9 +65,9 @@ SET_TYPE_PROP(CuvetteBaseProblem, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(CuvetteBaseProblem, Problem, Ewoms::CuvetteProblem<TypeTag>); SET_TYPE_PROP(CuvetteBaseProblem, Problem, Ewoms::CuvetteProblem<TypeTag>);
// Set the fluid system // Set the fluid system
SET_TYPE_PROP(CuvetteBaseProblem, SET_TYPE_PROP(
FluidSystem, CuvetteBaseProblem, FluidSystem,
Opm::FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>); Opm::FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>);
// Enable gravity // Enable gravity
SET_BOOL_PROP(CuvetteBaseProblem, EnableGravity, true); SET_BOOL_PROP(CuvetteBaseProblem, EnableGravity, true);
@ -94,7 +94,7 @@ public:
// material law API // material law API
typedef Opm::ThreePAdapter<wPhaseIdx, nPhaseIdx, gPhaseIdx, ThreePLaw> type; typedef Opm::ThreePAdapter<wPhaseIdx, nPhaseIdx, gPhaseIdx, ThreePLaw> type;
//typedef Opm::MpLinearMaterial<FluidSystem::numPhases, Scalar> type; // typedef Opm::MpLinearMaterial<FluidSystem::numPhases, Scalar> type;
}; };
// Set the heat conduction law // Set the heat conduction law
@ -148,7 +148,7 @@ namespace Ewoms {
* problem to about 2-3 hours simulation time. Complete remediation * problem to about 2-3 hours simulation time. Complete remediation
* of the domain requires much longer (about 10 days simulated time). * of the domain requires much longer (about 10 days simulated time).
*/ */
template <class TypeTag > template <class TypeTag>
class CuvetteProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) class CuvetteProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -158,33 +158,30 @@ class CuvetteProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw;
typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) HeatConductionLawParams; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams)
HeatConductionLawParams;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
// copy some indices for convenience // copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enum { numPhases = FluidSystem::numPhases };
numPhases = FluidSystem::numPhases, enum { numComponents = FluidSystem::numComponents };
numComponents = FluidSystem::numComponents, enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { H2OIdx = FluidSystem::H2OIdx };
enum { airIdx = FluidSystem::airIdx };
enum { NAPLIdx = FluidSystem::NAPLIdx };
enum { conti0EqIdx = Indices::conti0EqIdx };
wPhaseIdx = FluidSystem::wPhaseIdx, // Grid and world dimension
nPhaseIdx = FluidSystem::nPhaseIdx, enum { dim = GridView::dimension };
gPhaseIdx = FluidSystem::gPhaseIdx, enum { dimWorld = GridView::dimensionworld };
H2OIdx = FluidSystem::H2OIdx,
airIdx = FluidSystem::airIdx,
NAPLIdx = FluidSystem::NAPLIdx,
conti0EqIdx = Indices::conti0EqIdx,
// Grid and world dimension
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
typedef typename GridView::ctype CoordScalar; typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
@ -195,14 +192,14 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
CuvetteProblem(TimeManager &timeManager) CuvetteProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
#else #else
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
#endif #endif
, eps_(1e-6) eps_(1e-6)
{ {
if (Valgrind::IsRunning()) if (Valgrind::IsRunning())
FluidSystem::init(/*minT=*/283.15, /*maxT=*/500.0, /*nT=*/20, FluidSystem::init(/*minT=*/283.15, /*maxT=*/500.0, /*nT=*/20,
@ -219,7 +216,7 @@ public:
finePorosity_ = 0.42; finePorosity_ = 0.42;
coarsePorosity_ = 0.42; coarsePorosity_ = 0.42;
// parameters for the capillary pressure law // parameters for the capillary pressure law
#if 1 #if 1
// three-phase van Genuchten law // three-phase van Genuchten law
fineMaterialParams_.setVgAlpha(0.0005); fineMaterialParams_.setVgAlpha(0.0005);
@ -294,7 +291,7 @@ public:
*/ */
const char *name() const const char *name() const
{ {
static std::string tmp = std::string("cuvette_")+this->model().name(); static std::string tmp = std::string("cuvette_") + this->model().name();
return tmp.c_str(); return tmp.c_str();
} }
@ -316,7 +313,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -341,7 +339,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -354,7 +353,7 @@ public:
* \copydoc VcfvMultiPhaseProblem::heatConductionParams * \copydoc VcfvMultiPhaseProblem::heatConductionParams
*/ */
template <class Context> template <class Context>
const HeatConductionLawParams& const HeatConductionLawParams &
heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
{ return heatCondParams_; } { return heatCondParams_; }
@ -362,11 +361,11 @@ public:
* \copydoc VcfvMultiPhaseProblem::heatCapacitySolid * \copydoc VcfvMultiPhaseProblem::heatCapacitySolid
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 850 // specific heat capacity [J / (kg K)]
850 // specific heat capacity [J / (kg K)] * 2650; // density of sand [kg/m^3]
* 2650; // density of sand [kg/m^3]
} }
//! \} //! \}
@ -380,7 +379,8 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -392,27 +392,26 @@ public:
values.setFreeFlow(context, spaceIdx, timeIdx, fs); values.setFreeFlow(context, spaceIdx, timeIdx, fs);
values.setNoFlow(); values.setNoFlow();
} }
else if (onLeftBoundary_(pos)) else if (onLeftBoundary_(pos)) {
{
// injection // injection
RateVector molarRate; RateVector molarRate;
// inject with the same composition as the gas phase of // inject with the same composition as the gas phase of
// the injection fluid state // the injection fluid state
Scalar molarInjectionRate = 0.3435; // [mol/(m^2 s)] Scalar molarInjectionRate = 0.3435; // [mol/(m^2 s)]
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx)
molarRate[conti0EqIdx + compIdx] = molarRate[conti0EqIdx + compIdx]
- molarInjectionRate = -molarInjectionRate
* injectFluidState_.moleFraction(gPhaseIdx, compIdx); * injectFluidState_.moleFraction(gPhaseIdx, compIdx);
// calculate the total mass injection rate [kg / (m^2 s) // calculate the total mass injection rate [kg / (m^2 s)
Scalar massInjectionRate = Scalar massInjectionRate
molarInjectionRate = molarInjectionRate
* injectFluidState_.averageMolarMass(gPhaseIdx); * injectFluidState_.averageMolarMass(gPhaseIdx);
// set the boundary rate vector // set the boundary rate vector
values.setMolarRate(molarRate); values.setMolarRate(molarRate);
values.setEnthalpyRate(- injectFluidState_.enthalpy(gPhaseIdx) values.setEnthalpyRate(-injectFluidState_.enthalpy(gPhaseIdx)
* massInjectionRate); // [J / (m^2 s)] * massInjectionRate); // [J / (m^2 s)]
} }
else else
@ -430,7 +429,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
Opm::CompositionalFluidState<Scalar, FluidSystem> fs; Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
@ -447,7 +447,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, const Context &context, int spaceIdx, int timeIdx) const void source(RateVector &rate, const Context &context, int spaceIdx,
int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -467,9 +468,8 @@ private:
bool isContaminated_(const GlobalPosition &pos) const bool isContaminated_(const GlobalPosition &pos) const
{ {
return return (0.20 <= pos[0]) && (pos[0] <= 0.80) && (0.4 <= pos[1])
(0.20 <= pos[0]) && (pos[0] <= 0.80) && (pos[1] <= 0.65);
&& (0.4 <= pos[1]) && (pos[1] <= 0.65);
} }
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
@ -478,14 +478,13 @@ private:
return true; return true;
else if (pos[1] <= 0.15 && 1.20 <= pos[0]) else if (pos[1] <= 0.15 && 1.20 <= pos[0])
return true; return true;
else return false; else
return false;
} }
template <class FluidState, class Context> template <class FluidState, class Context>
void initialFluidState_(FluidState &fs, void initialFluidState_(FluidState &fs, const Context &context,
const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -493,23 +492,24 @@ private:
Scalar pw = 1e5; Scalar pw = 1e5;
if(isContaminated_(pos)) { if (isContaminated_(pos)) {
fs.setSaturation(wPhaseIdx, 0.12); fs.setSaturation(wPhaseIdx, 0.12);
fs.setSaturation(nPhaseIdx, 0.07); fs.setSaturation(nPhaseIdx, 0.07);
fs.setSaturation(gPhaseIdx, 1 - 0.12 - 0.07); fs.setSaturation(gPhaseIdx, 1 - 0.12 - 0.07);
// set the capillary pressures // set the capillary pressures
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx); const auto &matParams
= materialLawParams(context, spaceIdx, timeIdx);
Scalar pc[numPhases]; Scalar pc[numPhases];
MaterialLaw::capillaryPressures(pc, matParams, fs); MaterialLaw::capillaryPressures(pc, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[wPhaseIdx]));
pw + (pc[phaseIdx] - pc[wPhaseIdx]));
// compute the phase compositions // compute the phase compositions
typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC; typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC;
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
MMPC::solve(fs, paramCache, /*setViscosity=*/true, /*setEnthalpy=*/true); MMPC::solve(fs, paramCache, /*setViscosity=*/true,
/*setEnthalpy=*/true);
} }
else { else {
fs.setSaturation(wPhaseIdx, 0.12); fs.setSaturation(wPhaseIdx, 0.12);
@ -517,33 +517,33 @@ private:
fs.setSaturation(nPhaseIdx, 0); fs.setSaturation(nPhaseIdx, 0);
// set the capillary pressures // set the capillary pressures
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx); const auto &matParams
= materialLawParams(context, spaceIdx, timeIdx);
Scalar pc[numPhases]; Scalar pc[numPhases];
MaterialLaw::capillaryPressures(pc, matParams, fs); MaterialLaw::capillaryPressures(pc, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[wPhaseIdx]));
pw + (pc[phaseIdx] - pc[wPhaseIdx]));
// compute the phase compositions // compute the phase compositions
typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC; typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC;
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
MMPC::solve(fs, paramCache, /*setViscosity=*/true, /*setEnthalpy=*/true); MMPC::solve(fs, paramCache, /*setViscosity=*/true,
/*setEnthalpy=*/true);
// set the contaminant mole fractions to zero. this is a // set the contaminant mole fractions to zero. this is a
// little bit hacky... // little bit hacky...
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
fs.setMoleFraction(phaseIdx, NAPLIdx, 0.0); fs.setMoleFraction(phaseIdx, NAPLIdx, 0.0);
if (phaseIdx == nPhaseIdx) if (phaseIdx == nPhaseIdx)
continue; continue;
Scalar sumx = 0; Scalar sumx = 0;
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx)
sumx += fs.moleFraction(phaseIdx, compIdx); sumx += fs.moleFraction(phaseIdx, compIdx);
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx)
fs.setMoleFraction(phaseIdx, fs.setMoleFraction(phaseIdx, compIdx,
compIdx,
fs.moleFraction(phaseIdx, compIdx) / sumx); fs.moleFraction(phaseIdx, compIdx) / sumx);
} }
} }
@ -570,12 +570,13 @@ private:
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
Scalar lambdaSaturated; Scalar lambdaSaturated;
if (FluidSystem::isLiquid(phaseIdx)) { if (FluidSystem::isLiquid(phaseIdx)) {
Scalar lambdaFluid = Scalar lambdaFluid
FluidSystem::thermalConductivity(fs, paramCache, phaseIdx); = FluidSystem::thermalConductivity(fs, paramCache, phaseIdx);
lambdaSaturated = std::pow(lambdaGranite, (1-poro)) + std::pow(lambdaFluid, poro); lambdaSaturated = std::pow(lambdaGranite, (1 - poro))
+ std::pow(lambdaFluid, poro);
} }
else else
lambdaSaturated = std::pow(lambdaGranite, (1-poro)); lambdaSaturated = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(phaseIdx, lambdaSaturated); params.setFullySaturatedLambda(phaseIdx, lambdaSaturated);
if (!FluidSystem::isLiquid(phaseIdx)) if (!FluidSystem::isLiquid(phaseIdx))
@ -585,26 +586,21 @@ private:
void initInjectFluidState_() void initInjectFluidState_()
{ {
injectFluidState_.setTemperature(383.0); // [K] injectFluidState_.setTemperature(383.0); // [K]
injectFluidState_.setPressure(gPhaseIdx, 1e5); // [Pa] injectFluidState_.setPressure(gPhaseIdx, 1e5); // [Pa]
injectFluidState_.setSaturation(gPhaseIdx, 1.0); // [-] injectFluidState_.setSaturation(gPhaseIdx, 1.0); // [-]
Scalar xgH2O = 0.417; Scalar xgH2O = 0.417;
injectFluidState_.setMoleFraction(gPhaseIdx, injectFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xgH2O); // [-]
H2OIdx, injectFluidState_.setMoleFraction(gPhaseIdx, airIdx, 1 - xgH2O); // [-]
xgH2O); // [-] injectFluidState_.setMoleFraction(gPhaseIdx, NAPLIdx, 0.0); // [-]
injectFluidState_.setMoleFraction(gPhaseIdx,
airIdx,
1 - xgH2O); // [-]
injectFluidState_.setMoleFraction(gPhaseIdx,
NAPLIdx,
0.0); // [-]
// set the specific enthalpy of the gas phase // set the specific enthalpy of the gas phase
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(injectFluidState_, gPhaseIdx); paramCache.updatePhase(injectFluidState_, gPhaseIdx);
Scalar h = FluidSystem::enthalpy(injectFluidState_, paramCache, gPhaseIdx); Scalar h
= FluidSystem::enthalpy(injectFluidState_, paramCache, gPhaseIdx);
injectFluidState_.setEnthalpy(gPhaseIdx, h); injectFluidState_.setEnthalpy(gPhaseIdx, h);
} }

View File

@ -82,7 +82,8 @@ private:
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
Traits;
public: public:
typedef Opm::LinearMaterial<Traits> type; typedef Opm::LinearMaterial<Traits> type;
@ -108,8 +109,8 @@ SET_SCALAR_PROP(DiffusionBaseProblem, EndTime, 1e6);
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
SET_SCALAR_PROP(DiffusionBaseProblem, InitialTimeStepSize, 1000); SET_SCALAR_PROP(DiffusionBaseProblem, InitialTimeStepSize, 1000);
}} // namespace Opm, Properties }
} // namespace Opm, Properties
namespace Ewoms { namespace Ewoms {
/*! /*!
@ -123,8 +124,7 @@ namespace Ewoms {
* diffusion. * diffusion.
*/ */
template <class TypeTag> template <class TypeTag>
class DiffusionProblem class DiffusionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -152,7 +152,8 @@ class DiffusionProblem
}; };
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;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -167,7 +168,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
DiffusionProblem(TimeManager &timeManager) DiffusionProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -212,7 +213,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ return K_; } { return K_; }
/*! /*!
@ -226,15 +228,15 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ return materialParams_; } { return materialParams_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::temperature * \copydoc VcfvMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return temperature_; } { return temperature_; }
//! \} //! \}
@ -250,8 +252,7 @@ public:
* This problem sets no-flow boundaries everywhere. * This problem sets no-flow boundaries everywhere.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ values.setNoFlow(); } { values.setNoFlow(); }
@ -266,9 +267,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (onLeftSide_(pos)) if (onLeftSide_(pos))
@ -284,16 +284,15 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
private: private:
bool onLeftSide_(const GlobalPosition &pos) const bool onLeftSide_(const GlobalPosition &pos) const
{ return pos[0] < (this->bboxMin()[0] + this->bboxMax()[0])/2; } { return pos[0] < (this->bboxMin()[0] + this->bboxMax()[0]) / 2; }
void setupInitialFluidStates_() void setupInitialFluidStates_()
{ {
@ -314,15 +313,16 @@ private:
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP; typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
CFRP::solve(leftInitialFluidState_, paramCache, gPhaseIdx, /*setViscosity=*/false, /*setEnthalpy=*/false); CFRP::solve(leftInitialFluidState_, paramCache, gPhaseIdx,
/*setViscosity=*/false, /*setEnthalpy=*/false);
// create the initial fluid state for the right half of the domain // create the initial fluid state for the right half of the domain
rightInitialFluidState_.assign(leftInitialFluidState_); rightInitialFluidState_.assign(leftInitialFluidState_);
xH2O = 0.0; xH2O = 0.0;
rightInitialFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xH2O); rightInitialFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xH2O);
rightInitialFluidState_.setMoleFraction(gPhaseIdx, N2Idx, 1 - xH2O); rightInitialFluidState_.setMoleFraction(gPhaseIdx, N2Idx, 1 - xH2O);
CFRP::solve(rightInitialFluidState_, paramCache, gPhaseIdx, /*setViscosity=*/false, /*setEnthalpy=*/false); CFRP::solve(rightInitialFluidState_, paramCache, gPhaseIdx,
/*setViscosity=*/false, /*setEnthalpy=*/false);
} }
DimMatrix K_; DimMatrix K_;

View File

@ -50,8 +50,7 @@ namespace Opm {
////////// //////////
// Specify the properties for the finger problem // Specify the properties for the finger problem
////////// //////////
namespace Properties namespace Properties {
{
// declare the properties required by the for the finger grid creator // declare the properties required by the for the finger grid creator
NEW_PROP_TAG(Grid); NEW_PROP_TAG(Grid);
NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Scalar);
@ -88,16 +87,24 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid executed after it was loaded"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX, "The size of the domain in x direction"); "The number of global refinements of the grid "
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX, "The number of intervalls in x direction"); "executed after it was loaded");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX,
"The size of the domain in x direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX,
"The number of intervalls in x direction");
if (dim > 1) { if (dim > 1) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY, "The size of the domain in y direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY, "The number of intervalls in y direction"); "The size of the domain in y direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY,
"The number of intervalls in y direction");
} }
if (dim > 2) { if (dim > 2) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ, "The size of the domain in z direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ, "The number of intervalls in z direction"); "The size of the domain in z direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ,
"The number of intervalls in z direction");
} }
} }
@ -123,20 +130,21 @@ public:
cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ); cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ);
} }
unsigned numRefinments = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); unsigned numRefinments
= EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements);
Dune::GridFactory<Grid> factory(grid_); Dune::GridFactory<Grid> factory(grid_);
if (dim == 3) { if (dim == 3) {
Dune::FieldVector<double,dim> pos; Dune::FieldVector<double, dim> pos;
for (int k = 0; k <= cellRes[0]; k++) { for (int k = 0; k <= cellRes[0]; k++) {
pos[2] = upperRight[2]*double(k)/cellRes[2]; pos[2] = upperRight[2] * double(k) / cellRes[2];
for (int j = 0; j <= cellRes[1]; j++) { for (int j = 0; j <= cellRes[1]; j++) {
pos[1] = upperRight[1]*double(j)/cellRes[1]; pos[1] = upperRight[1] * double(j) / cellRes[1];
for (int i = 0; i <= cellRes[0]; i++) { for (int i = 0; i <= cellRes[0]; i++) {
pos[0] = upperRight[0]*double(i)/cellRes[0]; pos[0] = upperRight[0] * double(i) / cellRes[0];
factory.insertVertex(pos); factory.insertVertex(pos);
} }
} }
@ -144,12 +152,12 @@ public:
} }
else { else {
assert(dim == 2); assert(dim == 2);
Dune::FieldVector<double,dim> pos; Dune::FieldVector<double, dim> pos;
for (int j = 0; j <= cellRes[1]; j++) { for (int j = 0; j <= cellRes[1]; j++) {
pos[1] = upperRight[1]*double(j)/cellRes[1]; pos[1] = upperRight[1] * double(j) / cellRes[1];
for (int i = 0; i <= cellRes[0]; i++) { for (int i = 0; i <= cellRes[0]; i++) {
pos[0] = upperRight[0]*double(i)/cellRes[0]; pos[0] = upperRight[0] * double(i) / cellRes[0];
factory.insertVertex(pos); factory.insertVertex(pos);
} }
} }
@ -166,14 +174,14 @@ public:
int m = cellRes[0] + 1; int m = cellRes[0] + 1;
int n = cellRes[1] + 1; int n = cellRes[1] + 1;
for (int k = 0; k < cellRes[2]; ++k) { for (int k = 0; k < cellRes[2]; ++k) {
int i0 = k*m*n + j*m + i; int i0 = k * m * n + j * m + i;
int i1 = k*m*n + j*m + (i+1); int i1 = k * m * n + j * m + (i + 1);
int i2 = k*m*n + (j+1)*m + i; int i2 = k * m * n + (j + 1) * m + i;
int i3 = k*m*n + (j+1)*m + (i+1); int i3 = k * m * n + (j + 1) * m + (i + 1);
int i4 = (k+1)*m*n + j*m + i; int i4 = (k + 1) * m * n + j * m + i;
int i5 = (k+1)*m*n + j*m + (i+1); int i5 = (k + 1) * m * n + j * m + (i + 1);
int i6 = (k+1)*m*n + (j+1)*m + i; int i6 = (k + 1) * m * n + (j + 1) * m + i;
int i7 = (k+1)*m*n + (j+1)*m + (i+1); int i7 = (k + 1) * m * n + (j + 1) * m + (i + 1);
#if FINGER_CUBES #if FINGER_CUBES
v[0] = i0; v[0] = i0;
@ -184,44 +192,57 @@ public:
v[5] = i5; v[5] = i5;
v[6] = i6; v[6] = i6;
v[7] = i7; v[7] = i7;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::cube, 3), v);
#else #else
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
v[3] = i4; v[3] = i4;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i4; v[0] = i4;
v[1] = i5; v[1] = i5;
v[2] = i6; v[2] = i6;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i2; v[0] = i2;
v[1] = i5; v[1] = i5;
v[2] = i4; v[2] = i4;
v[3] = i1; v[3] = i1;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i2; v[0] = i2;
v[1] = i3; v[1] = i3;
v[2] = i7; v[2] = i7;
v[3] = i5; v[3] = i5;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i5; v[0] = i5;
v[1] = i7; v[1] = i7;
v[2] = i6; v[2] = i6;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i1; v[0] = i1;
v[1] = i3; v[1] = i3;
v[2] = i5; v[2] = i5;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
#endif #endif
} }
} }
@ -229,26 +250,29 @@ public:
assert(dim == 2); assert(dim == 2);
int m = cellRes[0] + 1; int m = cellRes[0] + 1;
int i0 = j*m + i; int i0 = j * m + i;
int i1 = j*m + (i+1); int i1 = j * m + (i + 1);
int i2 = (j+1)*m + i; int i2 = (j + 1) * m + i;
int i3 = (j+1)*m + (i+1); int i3 = (j + 1) * m + (i + 1);
#if FINGER_CUBES #if FINGER_CUBES
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
v[3] = i3; v[3] = i3;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::cube, 2), v);
#else #else
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 2), v);
v[0] = i1; v[0] = i1;
v[1] = i3; v[1] = i3;
v[2] = i2; v[2] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 2), v);
#endif #endif
} }
} }
@ -304,16 +328,24 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid executed after it was loaded"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX, "The size of the domain in x direction"); "The number of global refinements of the grid "
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX, "The number of intervalls in x direction"); "executed after it was loaded");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX,
"The size of the domain in x direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX,
"The number of intervalls in x direction");
if (dim > 1) { if (dim > 1) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY, "The size of the domain in y direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY, "The number of intervalls in y direction"); "The size of the domain in y direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY,
"The number of intervalls in y direction");
} }
if (dim > 2) { if (dim > 2) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ, "The size of the domain in z direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ, "The number of intervalls in z direction"); "The size of the domain in z direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ,
"The number of intervalls in z direction");
} }
} }
@ -322,7 +354,7 @@ public:
*/ */
static void makeGrid() static void makeGrid()
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
std::bitset<FINGER_DIM> isPeriodic(false); std::bitset<FINGER_DIM> isPeriodic(false);
std::array<int, FINGER_DIM> cellRes; std::array<int, FINGER_DIM> cellRes;
#else #else
@ -346,16 +378,16 @@ public:
cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ); cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ);
} }
unsigned numRefinments = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); unsigned numRefinments
= EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements);
grid_ = new Dune::YaspGrid<FINGER_DIM>( grid_ = new Dune::YaspGrid<FINGER_DIM>(
#ifdef HAVE_MPI #ifdef HAVE_MPI
Dune::MPIHelper::getCommunicator(), Dune::MPIHelper::getCommunicator(),
#endif #endif
upperRight, // upper right upperRight, // upper right
cellRes, // number of cells cellRes, // number of cells
isPeriodic, isPeriodic, 0); // overlap size
0); // overlap size
grid_->globalRefine(numRefinments); grid_->globalRefine(numRefinments);
} }

View File

@ -59,7 +59,8 @@ NEW_TYPE_TAG(FingerBaseProblem);
SET_TYPE_PROP(FingerBaseProblem, GridCreator, Ewoms::FingerGridCreator<TypeTag>); SET_TYPE_PROP(FingerBaseProblem, GridCreator, Ewoms::FingerGridCreator<TypeTag>);
// Retrieve the grid type from the grid creator // Retrieve the grid type from the grid creator
SET_TYPE_PROP(FingerBaseProblem, Grid, typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid); SET_TYPE_PROP(FingerBaseProblem, Grid,
typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid);
// declare the properties specific for the finger problem // declare the properties specific for the finger problem
NEW_PROP_TAG(InitialWaterSaturation); NEW_PROP_TAG(InitialWaterSaturation);
@ -72,6 +73,7 @@ SET_PROP(FingerBaseProblem, WettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
}; };
@ -81,6 +83,7 @@ SET_PROP(FingerBaseProblem, NonwettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::GasPhase<Scalar, Opm::Air<Scalar> > type; typedef Opm::GasPhase<Scalar, Opm::Air<Scalar> > type;
}; };
@ -92,7 +95,8 @@ SET_PROP(FingerBaseProblem, MaterialLaw)
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// use the parker-lenhard hysteresis law // use the parker-lenhard hysteresis law
typedef Opm::ParkerLenhard<Traits> ParkerLenhard; typedef Opm::ParkerLenhard<Traits> ParkerLenhard;
@ -100,10 +104,10 @@ SET_PROP(FingerBaseProblem, MaterialLaw)
}; };
// Enable partial reassembly of the jacobian matrix? // Enable partial reassembly of the jacobian matrix?
//SET_BOOL_PROP(FingerBaseProblem, EnablePartialReassemble, true); // SET_BOOL_PROP(FingerBaseProblem, EnablePartialReassemble, true);
// Enable reuse of jacobian matrices? // Enable reuse of jacobian matrices?
//SET_BOOL_PROP(FingerBaseProblem, EnableJacobianRecycling, true); // SET_BOOL_PROP(FingerBaseProblem, EnableJacobianRecycling, true);
// Write the solutions of individual newton iterations? // Write the solutions of individual newton iterations?
SET_BOOL_PROP(FingerBaseProblem, NewtonWriteConvergence, false); SET_BOOL_PROP(FingerBaseProblem, NewtonWriteConvergence, false);
@ -156,10 +160,9 @@ namespace Ewoms {
* discretization is fine enough. * discretization is fine enough.
*/ */
template <class TypeTag> template <class TypeTag>
class FingerProblem class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
//!\cond SKIP_THIS //!\cond SKIP_THIS
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
@ -189,7 +192,8 @@ class FingerProblem
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext; typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
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;
typedef typename GET_PROP(TypeTag, MaterialLaw)::ParkerLenhard ParkerLenhard; typedef typename GET_PROP(TypeTag, MaterialLaw)::ParkerLenhard ParkerLenhard;
@ -200,14 +204,14 @@ class FingerProblem
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;
//!\endcond //!\endcond
public: public:
/*! /*!
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
FingerProblem(TimeManager &timeManager) FingerProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -230,7 +234,7 @@ public:
* \copydoc VcfvProblem::name * \copydoc VcfvProblem::name
*/ */
std::string name() const std::string name() const
{ return std::string("finger_")+this->model().name(); } { return std::string("finger_") + this->model().name(); }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::registerParameters * \copydoc VcfvMultiPhaseProblem::registerParameters
@ -239,7 +243,9 @@ public:
{ {
ParentType::registerParameters(); ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, InitialWaterSaturation, "The initial saturation in the domain [] of the wetting phase"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, InitialWaterSaturation,
"The initial saturation in the domain [] of the "
"wetting phase");
} }
/*! /*!
@ -260,11 +266,7 @@ public:
// initialize the material parameter objects of the individual // initialize the material parameter objects of the individual
// finite volumes // finite volumes
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) int n = this->model().numDofs();
int n = GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView().size(dimWorld);
#else
int n = GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView().size(dimWorld);
#endif
materialParams_.resize(n); materialParams_.resize(n);
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
materialParams_[i].setMicParams(&micParams_); materialParams_[i].setMicParams(&micParams_);
@ -292,12 +294,12 @@ 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); elemCtx.updateAll(*elemIt);
for (int scvIdx = 0; scvIdx < elemCtx.numScv(); ++scvIdx) { for (int scvIdx = 0; scvIdx < elemCtx.numScv(); ++scvIdx) {
int globalIdx = elemCtx.globalSpaceIndex(scvIdx, /*timeIdx=*/0); int globalIdx = elemCtx.globalSpaceIndex(scvIdx, /*timeIdx=*/0);
const auto &fs = elemCtx.volVars(scvIdx, /*timeIdx=*/0).fluidState(); const auto &fs
= elemCtx.volVars(scvIdx, /*timeIdx=*/0).fluidState();
ParkerLenhard::update(materialParams_[globalIdx], fs); ParkerLenhard::update(materialParams_[globalIdx], fs);
} }
} }
@ -314,29 +316,30 @@ public:
* \copydoc VcfvMultiPhaseProblem::temperature * \copydoc VcfvMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return temperature_; } { return temperature_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ return K_; } { return K_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::porosity * \copydoc VcfvMultiPhaseProblem::porosity
*/ */
template <class Context> template <class Context>
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 VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return materialParams_[globalSpaceIdx]; return materialParams_[globalSpaceIdx];
@ -353,13 +356,13 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.cvCenter(spaceIdx, timeIdx); const GlobalPosition &pos = context.cvCenter(spaceIdx, timeIdx);
if (onLeftBoundary_(pos) || onRightBoundary_(pos) || onLowerBoundary_(pos)) { if (onLeftBoundary_(pos) || onRightBoundary_(pos)
|| onLowerBoundary_(pos)) {
values.setNoFlow(); values.setNoFlow();
} }
else { else {
@ -371,7 +374,7 @@ public:
// override the value for the liquid phase by forced // override the value for the liquid phase by forced
// imbibition of water on inlet boundary segments // imbibition of water on inlet boundary segments
if (onInlet_(pos)) { if (onInlet_(pos)) {
values[contiWEqIdx] = - 0.001; // [kg/(m^2 s)] values[contiWEqIdx] = -0.001; // [kg/(m^2 s)]
} }
} }
@ -386,9 +389,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
// assign the primary variables // assign the primary variables
values.assignNaive(initialFluidState_); values.assignNaive(initialFluidState_);
@ -398,8 +400,7 @@ public:
* \copydoc VcfvProblem::constraints * \copydoc VcfvProblem::constraints
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -421,9 +422,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -443,15 +443,16 @@ private:
bool onInlet_(const GlobalPosition &pos) const bool onInlet_(const GlobalPosition &pos) const
{ {
Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; Scalar width = this->bboxMax()[0] - this->bboxMin()[0];
Scalar lambda = (this->bboxMax()[0] - pos[0])/width; Scalar lambda = (this->bboxMax()[0] - pos[0]) / width;
if (!onUpperBoundary_(pos)) if (!onUpperBoundary_(pos))
return false; return false;
Scalar xInject[] = { 0.25, 0.75 }; Scalar xInject[] = { 0.25, 0.75 };
Scalar injectLen[] = { 0.1, 0.1 }; Scalar injectLen[] = { 0.1, 0.1 };
for (unsigned i = 0; i < sizeof(xInject)/sizeof(Scalar); ++ i) { for (unsigned i = 0; i < sizeof(xInject) / sizeof(Scalar); ++i) {
if (xInject[i] - injectLen[i]/2 < lambda && lambda < xInject[i] + injectLen[i]/2) if (xInject[i] - injectLen[i] / 2 < lambda
&& lambda < xInject[i] + injectLen[i] / 2)
return true; return true;
} }
return false; return false;

View File

@ -63,9 +63,9 @@ NEW_TYPE_TAG(FractureProblem, INHERITS_FROM(VcfvDiscreteFracture));
SET_TYPE_PROP(FractureProblem, GridCreator, Ewoms::ArtGridCreator<TypeTag>); SET_TYPE_PROP(FractureProblem, GridCreator, Ewoms::ArtGridCreator<TypeTag>);
// Set the grid type // Set the grid type
SET_TYPE_PROP(FractureProblem, SET_TYPE_PROP(
Grid, FractureProblem, Grid,
Dune::ALUGrid</*dim=*/2, /*dimWorld=*/2, Dune::simplex, Dune::nonconforming>); Dune::ALUGrid</*dim=*/2, /*dimWorld=*/2, Dune::simplex, Dune::nonconforming>);
// Set the problem property // Set the problem property
SET_TYPE_PROP(FractureProblem, Problem, Ewoms::FractureProblem<TypeTag>); SET_TYPE_PROP(FractureProblem, Problem, Ewoms::FractureProblem<TypeTag>);
@ -98,13 +98,14 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
typedef Opm::RegularizedBrooksCorey<Traits> EffectiveLaw; typedef Opm::RegularizedBrooksCorey<Traits> EffectiveLaw;
//typedef RegularizedVanGenuchten<Traits> EffectiveLaw; // typedef RegularizedVanGenuchten<Traits> EffectiveLaw;
//typedef LinearMaterial<Traits> EffectiveLaw; // typedef LinearMaterial<Traits> EffectiveLaw;
public: public:
typedef Opm::EffToAbsLaw<EffectiveLaw> type; typedef Opm::EffToAbsLaw<EffectiveLaw> type;
@ -155,9 +156,8 @@ namespace Ewoms {
* the fractures and gradually pushes the oil out on the right side, * the fractures and gradually pushes the oil out on the right side,
* where the pressure is kept constant. * where the pressure is kept constant.
*/ */
template <class TypeTag > template <class TypeTag>
class FractureProblem class FractureProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
@ -167,13 +167,15 @@ class FractureProblem
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector; typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag,
BoundaryRateVector) BoundaryRateVector;
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) HeatConductionLawParams; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams)
HeatConductionLawParams;
enum { enum {
// phase indices // phase indices
@ -193,10 +195,10 @@ class FractureProblem
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix; typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
template<int dim> template <int dim>
struct FaceLayout struct FaceLayout
{ {
bool contains (Dune::GeometryType gt) bool contains(Dune::GeometryType gt)
{ return gt.dim() == dim - 1; } { return gt.dim() == dim - 1; }
}; };
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, FaceLayout> FaceMapper; typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, FaceLayout> FaceMapper;
@ -208,7 +210,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
FractureProblem(TimeManager &timeManager) FractureProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -250,8 +252,8 @@ public:
matrixMaterialParams_.finalize(); matrixMaterialParams_.finalize();
fractureMaterialParams_.finalize(); fractureMaterialParams_.finalize();
matrixK_ = this->toDimMatrix_(1e-15); //m^2 matrixK_ = this->toDimMatrix_(1e-15); // m^2
fractureK_ = this->toDimMatrix_(1e5*1e-15); //m^2 fractureK_ = this->toDimMatrix_(1e5 * 1e-15); // m^2
matrixPorosity_ = 0.10; matrixPorosity_ = 0.10;
fracturePorosity_ = 0.25; fracturePorosity_ = 0.25;
@ -296,8 +298,7 @@ public:
* \copydoc VcfvMultiPhaseProblem::temperature * \copydoc VcfvMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return temperature_; } { return temperature_; }
// \} // \}
@ -311,7 +312,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ return matrixK_; } { return matrixK_; }
/*! /*!
@ -320,7 +322,9 @@ public:
* \copydoc Doxygen::contextParams * \copydoc Doxygen::contextParams
*/ */
template <class Context> template <class Context>
const DimMatrix &fractureIntrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &fractureIntrinsicPermeability(const Context &context,
int spaceIdx,
int timeIdx) const
{ return fractureK_; } { return fractureK_; }
/*! /*!
@ -336,14 +340,16 @@ public:
* \copydoc Doxygen::contextParams * \copydoc Doxygen::contextParams
*/ */
template <class Context> template <class Context>
Scalar fracturePorosity(const Context &context, int spaceIdx, int timeIdx) const Scalar fracturePorosity(const Context &context, int spaceIdx,
int timeIdx) const
{ return fracturePorosity_; } { return fracturePorosity_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ return matrixMaterialParams_; } { return matrixMaterialParams_; }
/*! /*!
@ -352,7 +358,9 @@ public:
* \copydoc Doxygen::contextParams * \copydoc Doxygen::contextParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& fractureMaterialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &fractureMaterialLawParams(const Context &context,
int spaceIdx,
int timeIdx) const
{ return fractureMaterialParams_; } { return fractureMaterialParams_; }
/*! /*!
@ -374,14 +382,15 @@ public:
* \param timeIdx The index used by the time discretization. * \param timeIdx The index used by the time discretization.
*/ */
template <class Context> template <class Context>
Scalar fractureWidth(const Context &context, int spaceIdx1, int spaceIdx2, int timeIdx) const Scalar fractureWidth(const Context &context, int spaceIdx1, int spaceIdx2,
int timeIdx) const
{ return fractureWidth_; } { return fractureWidth_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::heatConductionParams * \copydoc VcfvMultiPhaseProblem::heatConductionParams
*/ */
template <class Context> template <class Context>
const HeatConductionLawParams& const HeatConductionLawParams &
heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
{ return heatCondParams_; } { return heatCondParams_; }
@ -391,11 +400,11 @@ public:
* In this case, we assume the rock-matrix to be granite. * In this case, we assume the rock-matrix to be granite.
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 790 // specific heat capacity of granite [J / (kg K)]
790 // specific heat capacity of granite [J / (kg K)] * 2700; // density of granite [kg/m^3]
* 2700; // density of granite [kg/m^3]
} }
// \} // \}
@ -409,21 +418,20 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (onRightBoundary_(pos)) if (onRightBoundary_(pos)) {
{
// on the right boundary, we impose a free-flow // on the right boundary, we impose a free-flow
// (i.e. Dirichlet) condition // (i.e. Dirichlet) condition
FluidState fluidState; FluidState fluidState;
fluidState.setTemperature(temperature_); fluidState.setTemperature(temperature_);
fluidState.setSaturation(wPhaseIdx, 0.0); fluidState.setSaturation(wPhaseIdx, 0.0);
fluidState.setSaturation(nPhaseIdx, 1.0 - fluidState.saturation(wPhaseIdx)); fluidState.setSaturation(nPhaseIdx,
1.0 - fluidState.saturation(wPhaseIdx));
fluidState.setPressure(wPhaseIdx, 1e5); fluidState.setPressure(wPhaseIdx, 1e5);
fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx)); fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx));
@ -448,8 +456,7 @@ public:
* \copydoc VcfvProblem::constraints * \copydoc VcfvProblem::constraints
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -472,25 +479,31 @@ public:
fractureFluidState.setTemperature(temperature_ + 10); fractureFluidState.setTemperature(temperature_ + 10);
fractureFluidState.setSaturation(wPhaseIdx, 1.0); fractureFluidState.setSaturation(wPhaseIdx, 1.0);
fractureFluidState.setSaturation(nPhaseIdx, 1.0 - fractureFluidState.saturation(wPhaseIdx)); fractureFluidState.setSaturation(nPhaseIdx,
1.0 - fractureFluidState.saturation(
wPhaseIdx));
Scalar pCFracture[numPhases]; Scalar pCFracture[numPhases];
MaterialLaw::capillaryPressures(pCFracture, fractureMaterialParams_, fractureFluidState); MaterialLaw::capillaryPressures(pCFracture, fractureMaterialParams_,
fractureFluidState);
fractureFluidState.setPressure(wPhaseIdx, /*pressure=*/1e5); fractureFluidState.setPressure(wPhaseIdx, /*pressure=*/1e5);
fractureFluidState.setPressure(nPhaseIdx, fractureFluidState.pressure(wPhaseIdx) + (pCFracture[nPhaseIdx] - pCFracture[wPhaseIdx])); fractureFluidState.setPressure(nPhaseIdx,
fractureFluidState.pressure(wPhaseIdx)
+ (pCFracture[nPhaseIdx]
- pCFracture[wPhaseIdx]));
constraints.setAllConstraint(); constraints.setAllConstraint();
constraints.assignNaiveFromFracture(fractureFluidState, matrixMaterialParams_); constraints.assignNaiveFromFracture(fractureFluidState,
matrixMaterialParams_);
} }
/*! /*!
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
FluidState fluidState; FluidState fluidState;
fluidState.setTemperature(temperature_); fluidState.setTemperature(temperature_);
@ -498,7 +511,8 @@ public:
fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx)); fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx));
fluidState.setSaturation(wPhaseIdx, 0.0); fluidState.setSaturation(wPhaseIdx, 0.0);
fluidState.setSaturation(nPhaseIdx, 1.0 - fluidState.saturation(wPhaseIdx)); fluidState.setSaturation(nPhaseIdx,
1.0 - fluidState.saturation(wPhaseIdx));
values.assignNaive(fluidState); values.assignNaive(fluidState);
} }
@ -510,9 +524,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
// \} // \}
@ -551,17 +564,18 @@ private:
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
Scalar lambdaSaturated; Scalar lambdaSaturated;
if (FluidSystem::isLiquid(phaseIdx)) { if (FluidSystem::isLiquid(phaseIdx)) {
Scalar lambdaFluid = Scalar lambdaFluid
FluidSystem::thermalConductivity(fs, paramCache, phaseIdx); = FluidSystem::thermalConductivity(fs, paramCache, phaseIdx);
lambdaSaturated = std::pow(lambdaGranite, (1-poro)) + std::pow(lambdaFluid, poro); lambdaSaturated = std::pow(lambdaGranite, (1 - poro))
+ std::pow(lambdaFluid, poro);
} }
else else
lambdaSaturated = std::pow(lambdaGranite, (1-poro)); lambdaSaturated = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(phaseIdx, lambdaSaturated); params.setFullySaturatedLambda(phaseIdx, lambdaSaturated);
} }
Scalar lambdaVac = std::pow(lambdaGranite, (1-poro)); Scalar lambdaVac = std::pow(lambdaGranite, (1 - poro));
params.setVacuumLambda(lambdaVac); params.setVacuumLambda(lambdaVac);
} }

View File

@ -62,15 +62,17 @@ SET_PROP(GroundWaterBaseProblem, Fluid)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
}; };
// Set the grid type // Set the grid type
SET_TYPE_PROP(GroundWaterBaseProblem, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(GroundWaterBaseProblem, Grid, Dune::YaspGrid<2>);
//SET_TYPE_PROP(GroundWaterBaseProblem, Grid, Dune::SGrid<2, 2>); // SET_TYPE_PROP(GroundWaterBaseProblem, Grid, Dune::SGrid<2, 2>);
SET_TYPE_PROP(GroundWaterBaseProblem, Problem, Ewoms::GroundWaterProblem<TypeTag>); SET_TYPE_PROP(GroundWaterBaseProblem, Problem,
Ewoms::GroundWaterProblem<TypeTag>);
SET_SCALAR_PROP(GroundWaterBaseProblem, LensLowerLeftX, 0.25); SET_SCALAR_PROP(GroundWaterBaseProblem, LensLowerLeftX, 0.25);
SET_SCALAR_PROP(GroundWaterBaseProblem, LensLowerLeftY, 0.25); SET_SCALAR_PROP(GroundWaterBaseProblem, LensLowerLeftY, 0.25);
@ -81,8 +83,10 @@ SET_SCALAR_PROP(GroundWaterBaseProblem, LensUpperRightZ, 0.75);
SET_SCALAR_PROP(GroundWaterBaseProblem, Permeability, 1e-10); SET_SCALAR_PROP(GroundWaterBaseProblem, Permeability, 1e-10);
SET_SCALAR_PROP(GroundWaterBaseProblem, PermeabilityLens, 1e-12); SET_SCALAR_PROP(GroundWaterBaseProblem, PermeabilityLens, 1e-12);
// Linear solver settings // Linear solver settings
SET_TYPE_PROP(GroundWaterBaseProblem, LinearSolverWrapper, Ewoms::Linear::SolverWrapperConjugatedGradients<TypeTag> ); SET_TYPE_PROP(GroundWaterBaseProblem, LinearSolverWrapper,
SET_TYPE_PROP(GroundWaterBaseProblem, PreconditionerWrapper, Ewoms::Linear::PreconditionerWrapperILU<TypeTag> ); Ewoms::Linear::SolverWrapperConjugatedGradients<TypeTag>);
SET_TYPE_PROP(GroundWaterBaseProblem, PreconditionerWrapper,
Ewoms::Linear::PreconditionerWrapperILU<TypeTag>);
SET_INT_PROP(GroundWaterBaseProblem, LinearSolverVerbosity, 0); SET_INT_PROP(GroundWaterBaseProblem, LinearSolverVerbosity, 0);
// Enable gravity // Enable gravity
@ -113,8 +117,7 @@ namespace Ewoms {
* occupied by a rectangular lens of lower permeability. * occupied by a rectangular lens of lower permeability.
*/ */
template <class TypeTag> template <class TypeTag>
class GroundWaterProblem class GroundWaterProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -135,7 +138,8 @@ class GroundWaterProblem
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
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;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GridView::ctype CoordScalar; typedef typename GridView::ctype CoordScalar;
@ -148,7 +152,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
GroundWaterProblem(TimeManager &timeManager) GroundWaterProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -166,12 +170,16 @@ public:
lensUpperRight_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightX); lensUpperRight_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightX);
if (dim > 1) if (dim > 1)
lensUpperRight_[1] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY); lensUpperRight_[1]
= EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
if (dim > 2) if (dim > 2)
lensUpperRight_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY); lensUpperRight_[2]
= EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
intrinsicPerm_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, Permeability)); intrinsicPerm_
intrinsicPermLens_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, PermeabilityLens)); = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, Permeability));
intrinsicPermLens_ = this->toDimMatrix_(
EWOMS_GET_PARAM(TypeTag, Scalar, PermeabilityLens));
} }
/*! /*!
@ -181,21 +189,36 @@ public:
{ {
ParentType::registerParameters(); ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX, "The x-coordinate of the lens' lower-left corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX, "The x-coordinate of the lens' upper-right corner [m]."); "The x-coordinate of the lens' lower-left corner "
"[m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX,
"The x-coordinate of the lens' upper-right corner "
"[m].");
if (dimWorld > 1) { if (dimWorld > 1) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY, "The y-coordinate of the lens' lower-left corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY, "The y-coordinate of the lens' upper-right corner [m]."); "The y-coordinate of the lens' lower-left "
"corner [m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY,
"The y-coordinate of the lens' upper-right "
"corner [m].");
} }
if (dimWorld > 2) { if (dimWorld > 2) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ, "The z-coordinate of the lens' lower-left corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ, "The z-coordinate of the lens' upper-right corner [m]."); "The z-coordinate of the lens' lower-left "
"corner [m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ,
"The z-coordinate of the lens' upper-right "
"corner [m].");
} }
EWOMS_REGISTER_PARAM(TypeTag, Scalar, Permeability, "The intrinsic permeability [m^2] of the ambient material."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, Permeability,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, PermeabilityLens, "The intrinsic permeability [m^2] of the lens."); "The intrinsic permeability [m^2] of the ambient "
"material.");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, PermeabilityLens,
"The intrinsic permeability [m^2] of the lens.");
} }
/*! /*!
@ -231,8 +254,12 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
{ return isInLens_(context.pos(spaceIdx, timeIdx))?intrinsicPermLens_:intrinsicPerm_; } int timeIdx) const
{
return isInLens_(context.pos(spaceIdx, timeIdx)) ? intrinsicPermLens_
: intrinsicPerm_;
}
//! \} //! \}
/*! /*!
@ -244,8 +271,7 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
@ -258,7 +284,8 @@ public:
else // on upper boundary else // on upper boundary
pressure = 1e5; pressure = 1e5;
Opm::ImmiscibleFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem,
/*storeEnthalpy=*/false> fs;
fs.setSaturation(/*phaseIdx=*/0, 1.0); fs.setSaturation(/*phaseIdx=*/0, 1.0);
fs.setPressure(/*phaseIdx=*/0, pressure); fs.setPressure(/*phaseIdx=*/0, pressure);
fs.setTemperature(T); fs.setTemperature(T);
@ -270,7 +297,6 @@ public:
// no flow boundary // no flow boundary
values.setNoFlow(); values.setNoFlow();
} }
} }
//! \} //! \}
@ -284,35 +310,34 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
//const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); // const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
values[pressure0Idx] = 1.0e+5;// + 9.81*1.23*(20-globalPos[dim-1]); values[pressure0Idx] = 1.0e+5; // + 9.81*1.23*(20-globalPos[dim-1]);
} }
/*! /*!
* \copydoc VcfvProblem::source * \copydoc VcfvProblem::source
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
private: private:
bool onLowerBoundary_(const GlobalPosition &pos) const bool onLowerBoundary_(const GlobalPosition &pos) const
{ return pos[dim-1] < eps_; } { return pos[dim - 1] < eps_; }
bool onUpperBoundary_(const GlobalPosition &pos) const bool onUpperBoundary_(const GlobalPosition &pos) const
{ return pos[dim-1] > this->bboxMax()[dim-1] - eps_; } { return pos[dim - 1] > this->bboxMax()[dim - 1] - eps_; }
bool isInLens_(const GlobalPosition &pos) const bool isInLens_(const GlobalPosition &pos) const
{ {
return return lensLowerLeft_[0] <= pos[0] && pos[0] <= lensUpperRight_[0]
lensLowerLeft_[0] <= pos[0] && pos[0] <= lensUpperRight_[0] && && lensLowerLeft_[1] <= pos[1] && pos[1] <= lensUpperRight_[1];
lensLowerLeft_[1] <= pos[1] && pos[1] <= lensUpperRight_[1];
} }
GlobalPosition lensLowerLeft_; GlobalPosition lensLowerLeft_;

View File

@ -55,12 +55,13 @@ NEW_TYPE_TAG(InfiltrationBaseProblem);
SET_TYPE_PROP(InfiltrationBaseProblem, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(InfiltrationBaseProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property // Set the problem property
SET_TYPE_PROP(InfiltrationBaseProblem, Problem, Ewoms::InfiltrationProblem<TypeTag>); SET_TYPE_PROP(InfiltrationBaseProblem, Problem,
Ewoms::InfiltrationProblem<TypeTag>);
// Set the fluid system // Set the fluid system
SET_TYPE_PROP(InfiltrationBaseProblem, SET_TYPE_PROP(
FluidSystem, InfiltrationBaseProblem, FluidSystem,
Opm::FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>); Opm::FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>);
// Enable gravity? // Enable gravity?
SET_BOOL_PROP(InfiltrationBaseProblem, EnableGravity, true); SET_BOOL_PROP(InfiltrationBaseProblem, EnableGravity, true);
@ -113,7 +114,8 @@ SET_SCALAR_PROP(InfiltrationBaseProblem, EndTime, 6e3);
SET_SCALAR_PROP(InfiltrationBaseProblem, InitialTimeStepSize, 60); SET_SCALAR_PROP(InfiltrationBaseProblem, InitialTimeStepSize, 60);
// The default DGF file to load // The default DGF file to load
SET_STRING_PROP(InfiltrationBaseProblem, GridFile, "./grids/infiltration_50x3.dgf"); SET_STRING_PROP(InfiltrationBaseProblem, GridFile,
"./grids/infiltration_50x3.dgf");
} // namespace Properties } // namespace Properties
} // namespace Opm } // namespace Opm
@ -140,7 +142,7 @@ namespace Ewoms {
* (Dirichlet), Top and bottom are Neumann boundaries, all no-flow * (Dirichlet), Top and bottom are Neumann boundaries, all no-flow
* except for the small infiltration zone in the upper left part. * except for the small infiltration zone in the upper left part.
*/ */
template <class TypeTag > template <class TypeTag>
class InfiltrationProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) class InfiltrationProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -151,7 +153,8 @@ class InfiltrationProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
@ -188,21 +191,21 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
InfiltrationProblem(TimeManager &timeManager) InfiltrationProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
#else #else
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
#endif #endif
, eps_(1e-6) eps_(1e-6)
{ {
temperature_ = 273.15 + 10.0; // -> 10 degrees Celsius temperature_ = 273.15 + 10.0; // -> 10 degrees Celsius
FluidSystem::init(/*tempMin=*/temperature_ - 1, FluidSystem::init(/*tempMin=*/temperature_ - 1,
/*tempMax=*/temperature_ + 1, /*tempMax=*/temperature_ + 1,
/*nTemp=*/3, /*nTemp=*/3,
/*pressMin=*/0.8*1e5, /*pressMin=*/0.8 * 1e5,
/*pressMax=*/3*1e5, /*pressMax=*/3 * 1e5,
/*nPress=*/200); /*nPress=*/200);
// intrinsic permeabilities // intrinsic permeabilities
@ -264,7 +267,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -278,7 +282,7 @@ public:
template <class Context> template <class Context>
Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const
{ {
//const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); // const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
// if (isFineMaterial_(pos)) // if (isFineMaterial_(pos))
// return finePorosity_; // return finePorosity_;
// else // else
@ -290,7 +294,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ return materialParams_; } { return materialParams_; }
/*! /*!
@ -299,11 +304,11 @@ public:
* In this case, we assume the rock-matrix to be quartz. * In this case, we assume the rock-matrix to be quartz.
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 850. // specific heat capacity [J / (kg K)]
850. // specific heat capacity [J / (kg K)] * 2650.; // density of sand [kg/m^3]
* 2650.; // density of sand [kg/m^3]
} }
//! \} //! \}
@ -317,7 +322,8 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -350,7 +356,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
Opm::CompositionalFluidState<Scalar, FluidSystem> fs; Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
@ -368,7 +375,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, const Context &context, int spaceIdx, int timeIdx) const void source(RateVector &rate, const Context &context, int spaceIdx,
int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -390,15 +398,17 @@ private:
{ return onUpperBoundary_(pos) && 50 < pos[0] && pos[0] < 75; } { return onUpperBoundary_(pos) && 50 < pos[0] && pos[0] < 75; }
template <class FluidState, class Context> template <class FluidState, class Context>
void initialFluidState_(FluidState &fs, const Context &context, int spaceIdx, int timeIdx) const void initialFluidState_(FluidState &fs, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition pos = context.pos(spaceIdx, timeIdx); const GlobalPosition pos = context.pos(spaceIdx, timeIdx);
Scalar y = pos[1]; Scalar y = pos[1];
Scalar x = pos[0]; Scalar x = pos[0];
Scalar densityW = 1000.0; Scalar densityW = 1000.0;
Scalar pc = 9.81 * densityW * (y - (5 - 5e-4*x)); Scalar pc = 9.81 * densityW * (y - (5 - 5e-4 * x));
if (pc < 0.0) pc = 0.0; if (pc < 0.0)
pc = 0.0;
// set pressures // set pressures
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx); const auto &matParams = materialLawParams(context, spaceIdx, timeIdx);
@ -427,57 +437,57 @@ private:
if (onLeftBoundary_(pos)) if (onLeftBoundary_(pos))
pg += 10e3; pg += 10e3;
MaterialLaw::capillaryPressures(pcAll, matParams, fs); MaterialLaw::capillaryPressures(pcAll, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, pg + (pcAll[phaseIdx] - pcAll[gPhaseIdx])); fs.setPressure(phaseIdx, pg + (pcAll[phaseIdx] - pcAll[gPhaseIdx]));
// set composition of gas phase // set composition of gas phase
fs.setMoleFraction(gPhaseIdx, H2OIdx, 1e-6); fs.setMoleFraction(gPhaseIdx, H2OIdx, 1e-6);
fs.setMoleFraction(gPhaseIdx, airIdx, 1 - fs.moleFraction(gPhaseIdx, H2OIdx)); fs.setMoleFraction(gPhaseIdx, airIdx,
1 - fs.moleFraction(gPhaseIdx, H2OIdx));
fs.setMoleFraction(gPhaseIdx, NAPLIdx, 0); fs.setMoleFraction(gPhaseIdx, NAPLIdx, 0);
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP; typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
CFRP::solve(fs, CFRP::solve(fs, paramCache, gPhaseIdx,
paramCache,
gPhaseIdx,
/*setViscosity=*/false, /*setViscosity=*/false,
/*setEnthalpy=*/false); /*setEnthalpy=*/false);
fs.setMoleFraction(wPhaseIdx, H2OIdx, 1 - fs.moleFraction(wPhaseIdx, H2OIdx)); fs.setMoleFraction(wPhaseIdx, H2OIdx,
1 - fs.moleFraction(wPhaseIdx, H2OIdx));
} }
static Scalar invertPCGW_(Scalar pcIn, const MaterialLawParams &pcParams) static Scalar invertPCGW_(Scalar pcIn, const MaterialLawParams &pcParams)
{ {
Scalar lower,upper; Scalar lower, upper;
int k; int k;
int maxIt = 50; int maxIt = 50;
Scalar bisLimit = 1.; Scalar bisLimit = 1.;
Scalar Sw, pcGW; Scalar Sw, pcGW;
lower=0.0; upper=1.0; lower = 0.0;
for (k=1; k<=25; k++) upper = 1.0;
{ for (k = 1; k <= 25; k++) {
Sw = 0.5*(upper+lower); Sw = 0.5 * (upper + lower);
pcGW = MaterialLaw::pCGW(pcParams, Sw); pcGW = MaterialLaw::pCGW(pcParams, Sw);
Scalar delta = pcGW-pcIn; Scalar delta = pcGW - pcIn;
if (delta<0.) delta*=-1.; if (delta < 0.)
if (delta<bisLimit) delta *= -1.;
{ if (delta < bisLimit) {
return(Sw); return (Sw);
} }
if (k==maxIt) { if (k == maxIt) {
return(Sw); return (Sw);
} }
if (pcGW>pcIn) lower=Sw; if (pcGW > pcIn)
else upper=Sw; lower = Sw;
else
upper = Sw;
} }
return 0; return 0;
} }
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
{ {
return return 70. <= pos[0] && pos[0] <= 85. && 7.0 <= pos[1] && pos[1] <= 7.50;
70. <= pos[0] && pos[0] <= 85. &&
7.0 <= pos[1] && pos[1] <= 7.50;
} }
DimMatrix fineK_; DimMatrix fineK_;

View File

@ -84,10 +84,12 @@ class LensGridCreator
public: public:
#if LENS_CUBES #if LENS_CUBES
typedef Dune::UGGrid<LENS_DIM> Grid; typedef Dune::UGGrid<LENS_DIM> Grid;
//typedef Dune::ALUGrid<LENS_DIM, LENS_DIM, Dune::cube, Dune::nonconforming> Grid; // typedef Dune::ALUGrid<LENS_DIM, LENS_DIM, Dune::cube, Dune::nonconforming>
// Grid;
#else #else
typedef Dune::UGGrid<LENS_DIM> Grid; typedef Dune::UGGrid<LENS_DIM> Grid;
//typedef Dune::ALUGrid<LENS_DIM, LENS_DIM, Dune::simplex, Dune::nonconforming> Grid; // typedef Dune::ALUGrid<LENS_DIM, LENS_DIM, Dune::simplex, Dune::nonconforming>
// Grid;
#endif #endif
/*! /*!
@ -95,16 +97,24 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid executed after it was loaded"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX, "The size of the domain in x direction"); "The number of global refinements of the grid "
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX, "The number of intervalls in x direction"); "executed after it was loaded");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX,
"The size of the domain in x direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX,
"The number of intervalls in x direction");
if (dim > 1) { if (dim > 1) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY, "The size of the domain in y direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY, "The number of intervalls in y direction"); "The size of the domain in y direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY,
"The number of intervalls in y direction");
} }
if (dim > 2) { if (dim > 2) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ, "The size of the domain in z direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ, "The number of intervalls in z direction"); "The size of the domain in z direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ,
"The number of intervalls in z direction");
} }
} }
@ -131,15 +141,15 @@ public:
Dune::GridFactory<Grid> factory; Dune::GridFactory<Grid> factory;
if (dim == 3) { if (dim == 3) {
Dune::FieldVector<double,dim> pos; Dune::FieldVector<double, dim> pos;
for (int k = 0; k <= cellRes[0]; k++) { for (int k = 0; k <= cellRes[0]; k++) {
pos[2] = upperRight[2]*double(k)/cellRes[2]; pos[2] = upperRight[2] * double(k) / cellRes[2];
for (int j = 0; j <= cellRes[1]; j++) { for (int j = 0; j <= cellRes[1]; j++) {
pos[1] = upperRight[1]*double(j)/cellRes[1]; pos[1] = upperRight[1] * double(j) / cellRes[1];
for (int i = 0; i <= cellRes[0]; i++) { for (int i = 0; i <= cellRes[0]; i++) {
pos[0] = upperRight[0]*double(i)/cellRes[0]; pos[0] = upperRight[0] * double(i) / cellRes[0];
factory.insertVertex(pos); factory.insertVertex(pos);
} }
} }
@ -147,12 +157,12 @@ public:
} }
else { else {
assert(dim == 2); assert(dim == 2);
Dune::FieldVector<double,dim> pos; Dune::FieldVector<double, dim> pos;
for (int j = 0; j <= cellRes[1]; j++) { for (int j = 0; j <= cellRes[1]; j++) {
pos[1] = upperRight[1]*double(j)/cellRes[1]; pos[1] = upperRight[1] * double(j) / cellRes[1];
for (int i = 0; i <= cellRes[0]; i++) { for (int i = 0; i <= cellRes[0]; i++) {
pos[0] = upperRight[0]*double(i)/cellRes[0]; pos[0] = upperRight[0] * double(i) / cellRes[0];
factory.insertVertex(pos); factory.insertVertex(pos);
} }
} }
@ -169,14 +179,14 @@ public:
int m = cellRes[0] + 1; int m = cellRes[0] + 1;
int n = cellRes[1] + 1; int n = cellRes[1] + 1;
for (int k = 0; k < cellRes[2]; ++k) { for (int k = 0; k < cellRes[2]; ++k) {
int i0 = k*m*n + j*m + i; int i0 = k * m * n + j * m + i;
int i1 = k*m*n + j*m + (i+1); int i1 = k * m * n + j * m + (i + 1);
int i2 = k*m*n + (j+1)*m + i; int i2 = k * m * n + (j + 1) * m + i;
int i3 = k*m*n + (j+1)*m + (i+1); int i3 = k * m * n + (j + 1) * m + (i + 1);
int i4 = (k+1)*m*n + j*m + i; int i4 = (k + 1) * m * n + j * m + i;
int i5 = (k+1)*m*n + j*m + (i+1); int i5 = (k + 1) * m * n + j * m + (i + 1);
int i6 = (k+1)*m*n + (j+1)*m + i; int i6 = (k + 1) * m * n + (j + 1) * m + i;
int i7 = (k+1)*m*n + (j+1)*m + (i+1); int i7 = (k + 1) * m * n + (j + 1) * m + (i + 1);
#if LENS_CUBES #if LENS_CUBES
v[0] = i0; v[0] = i0;
@ -187,44 +197,57 @@ public:
v[5] = i5; v[5] = i5;
v[6] = i6; v[6] = i6;
v[7] = i7; v[7] = i7;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::cube, 3), v);
#else #else
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
v[3] = i4; v[3] = i4;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i4; v[0] = i4;
v[1] = i5; v[1] = i5;
v[2] = i6; v[2] = i6;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i2; v[0] = i2;
v[1] = i5; v[1] = i5;
v[2] = i4; v[2] = i4;
v[3] = i1; v[3] = i1;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i2; v[0] = i2;
v[1] = i3; v[1] = i3;
v[2] = i7; v[2] = i7;
v[3] = i5; v[3] = i5;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i5; v[0] = i5;
v[1] = i7; v[1] = i7;
v[2] = i6; v[2] = i6;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
v[0] = i1; v[0] = i1;
v[1] = i3; v[1] = i3;
v[2] = i5; v[2] = i5;
v[3] = i2; v[3] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,3), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 3),
v);
#endif #endif
} }
} }
@ -232,26 +255,29 @@ public:
assert(dim == 2); assert(dim == 2);
int m = cellRes[0] + 1; int m = cellRes[0] + 1;
int i0 = j*m + i; int i0 = j * m + i;
int i1 = j*m + (i+1); int i1 = j * m + (i + 1);
int i2 = (j+1)*m + i; int i2 = (j + 1) * m + i;
int i3 = (j+1)*m + (i+1); int i3 = (j + 1) * m + (i + 1);
#if LENS_CUBES #if LENS_CUBES
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
v[3] = i3; v[3] = i3;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::cube, 2), v);
#else #else
v[0] = i0; v[0] = i0;
v[1] = i1; v[1] = i1;
v[2] = i2; v[2] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 2), v);
v[0] = i1; v[0] = i1;
v[1] = i3; v[1] = i3;
v[2] = i2; v[2] = i2;
factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,2), v); factory.insertElement(
Dune::GeometryType(Dune::GeometryType::simplex, 2), v);
#endif #endif
} }
} }
@ -259,7 +285,8 @@ public:
grid_ = factory.createGrid(); grid_ = factory.createGrid();
unsigned numRefinements = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); unsigned numRefinements
= EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements);
grid_->globalRefine(numRefinements); grid_->globalRefine(numRefinements);
} }
@ -309,16 +336,24 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid executed after it was loaded"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX, "The size of the domain in x direction"); "The number of global refinements of the grid "
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX, "The number of intervalls in x direction"); "executed after it was loaded");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX,
"The size of the domain in x direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsX,
"The number of intervalls in x direction");
if (dim > 1) { if (dim > 1) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY, "The size of the domain in y direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY, "The number of intervalls in y direction"); "The size of the domain in y direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsY,
"The number of intervalls in y direction");
} }
if (dim > 2) { if (dim > 2) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ, "The size of the domain in z direction"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ,
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ, "The number of intervalls in z direction"); "The size of the domain in z direction");
EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ,
"The number of intervalls in z direction");
} }
} }
@ -327,7 +362,7 @@ public:
*/ */
static void makeGrid() static void makeGrid()
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
std::bitset<LENS_DIM> isPeriodic(false); std::bitset<LENS_DIM> isPeriodic(false);
std::array<int, LENS_DIM> cellRes; std::array<int, LENS_DIM> cellRes;
#else #else
@ -351,15 +386,15 @@ public:
cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ); cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ);
} }
unsigned numRefinements = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); unsigned numRefinements
= EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements);
grid_ = new Dune::YaspGrid<LENS_DIM>( grid_ = new Dune::YaspGrid<LENS_DIM>(
#ifdef HAVE_MPI #ifdef HAVE_MPI
/*mpiCommunicator=*/Dune::MPIHelper::getCommunicator(), /*mpiCommunicator=*/Dune::MPIHelper::getCommunicator(),
#endif #endif
/*upperRightCorner=*/upperRight, /*upperRightCorner=*/upperRight,
/*numCells=*/cellRes, /*numCells=*/cellRes, isPeriodic,
isPeriodic,
/*overlap=*/1); /*overlap=*/1);
grid_->globalRefine(numRefinements); grid_->globalRefine(numRefinements);
} }

View File

@ -68,7 +68,8 @@ NEW_PROP_TAG(LensUpperRightZ);
SET_TYPE_PROP(LensBaseProblem, GridCreator, Ewoms::LensGridCreator<TypeTag>); SET_TYPE_PROP(LensBaseProblem, GridCreator, Ewoms::LensGridCreator<TypeTag>);
// Retrieve the grid type from the grid creator // Retrieve the grid type from the grid creator
SET_TYPE_PROP(LensBaseProblem, Grid, typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid); SET_TYPE_PROP(LensBaseProblem, Grid,
typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid);
// Set the problem property // Set the problem property
SET_TYPE_PROP(LensBaseProblem, Problem, Ewoms::LensProblem<TypeTag>); SET_TYPE_PROP(LensBaseProblem, Problem, Ewoms::LensProblem<TypeTag>);
@ -78,6 +79,7 @@ SET_PROP(LensBaseProblem, WettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
}; };
@ -87,6 +89,7 @@ SET_PROP(LensBaseProblem, NonwettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::DNAPL<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::DNAPL<Scalar> > type;
}; };
@ -99,7 +102,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
@ -114,10 +118,10 @@ public:
SET_TAG_PROP(LensBaseProblem, LinearSolver, ParallelAmgBackend); SET_TAG_PROP(LensBaseProblem, LinearSolver, ParallelAmgBackend);
// Enable partial reassembly of the jacobian matrix? // Enable partial reassembly of the jacobian matrix?
//SET_BOOL_PROP(LensBaseProblem, EnablePartialReassemble, true); // SET_BOOL_PROP(LensBaseProblem, EnablePartialReassemble, true);
// Enable reuse of jacobian matrices? // Enable reuse of jacobian matrices?
//SET_BOOL_PROP(LensBaseProblem, EnableJacobianRecycling, true); // SET_BOOL_PROP(LensBaseProblem, EnableJacobianRecycling, true);
// Write the solutions of individual newton iterations? // Write the solutions of individual newton iterations?
SET_BOOL_PROP(LensBaseProblem, NewtonWriteConvergence, false); SET_BOOL_PROP(LensBaseProblem, NewtonWriteConvergence, false);
@ -177,8 +181,7 @@ namespace Ewoms {
* saturation on both sides is zero. * saturation on both sides is zero.
*/ */
template <class TypeTag> template <class TypeTag>
class LensProblem class LensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -208,7 +211,8 @@ class LensProblem
}; };
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;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -223,7 +227,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
LensProblem(TimeManager &timeManager) LensProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -242,7 +246,8 @@ public:
if (dimWorld == 3) { if (dimWorld == 3) {
lensLowerLeft_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftZ); lensLowerLeft_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftZ);
lensUpperRight_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightZ); lensUpperRight_[2]
= EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightZ);
} }
// parameters for the Van Genuchten law // parameters for the Van Genuchten law
@ -271,14 +276,26 @@ public:
{ {
ParentType::registerParameters(); ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX, "The x-coordinate of the lens' lower-left corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY, "The y-coordinate of the lens' lower-left corner [m]."); "The x-coordinate of the lens' lower-left corner "
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX, "The x-coordinate of the lens' upper-right corner [m]."); "[m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY, "The y-coordinate of the lens' upper-right corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY,
"The y-coordinate of the lens' lower-left corner "
"[m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX,
"The x-coordinate of the lens' upper-right corner "
"[m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY,
"The y-coordinate of the lens' upper-right corner "
"[m].");
if (dimWorld == 3) { if (dimWorld == 3) {
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ, "The z-coordinate of the lens' lower-left corner [m]."); EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ, "The z-coordinate of the lens' upper-right corner [m]."); "The z-coordinate of the lens' lower-left "
"corner [m].");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ,
"The z-coordinate of the lens' upper-right "
"corner [m].");
} }
}; };
@ -291,7 +308,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
@ -311,7 +329,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
@ -324,8 +343,7 @@ public:
* \copydoc VcfvMultiPhaseProblem::temperature * \copydoc VcfvMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return temperature_; } { return temperature_; }
//! \} //! \}
@ -356,7 +374,7 @@ public:
// Write mass balance information for rank 0 // Write mass balance information for rank 0
if (this->gridView().comm().rank() == 0) { if (this->gridView().comm().rank() == 0) {
std::cout<<"Storage: " << storage << std::endl; std::cout << "Storage: " << storage << std::endl;
} }
} }
@ -371,43 +389,43 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (onLeftBoundary_(pos) || onRightBoundary_(pos)) { if (onLeftBoundary_(pos) || onRightBoundary_(pos)) {
// free flow boundary // free flow boundary
Scalar densityW = WettingPhase::density(temperature_, /*pressure=*/1e5); Scalar densityW
= WettingPhase::density(temperature_, /*pressure=*/1e5);
Scalar T = temperature(context, spaceIdx, timeIdx); Scalar T = temperature(context, spaceIdx, timeIdx);
Scalar pw, Sw; Scalar pw, Sw;
// set wetting phase pressure and saturation // set wetting phase pressure and saturation
if (onLeftBoundary_(pos)) if (onLeftBoundary_(pos)) {
{
Scalar height = this->bboxMax()[1] - this->bboxMin()[1]; Scalar height = this->bboxMax()[1] - this->bboxMin()[1];
Scalar depth = this->bboxMax()[1] - pos[1]; Scalar depth = this->bboxMax()[1] - pos[1];
Scalar alpha = (1 + 1.5/height); Scalar alpha = (1 + 1.5 / height);
// hydrostatic pressure scaled by alpha // hydrostatic pressure scaled by alpha
pw = 1e5 - alpha*densityW*this->gravity()[1]*depth; pw = 1e5 - alpha * densityW * this->gravity()[1] * depth;
Sw = 1.0; Sw = 1.0;
} }
else { else {
Scalar depth = this->bboxMax()[1] - pos[1]; Scalar depth = this->bboxMax()[1] - pos[1];
// hydrostatic pressure // hydrostatic pressure
pw = 1e5 - densityW*this->gravity()[1]*depth; pw = 1e5 - densityW * this->gravity()[1] * depth;
Sw = 1.0; Sw = 1.0;
} }
// specify a full fluid state using pw and Sw // specify a full fluid state using pw and Sw
const MaterialLawParams &matParams = const MaterialLawParams &matParams
this->materialLawParams(context, spaceIdx, timeIdx); = this->materialLawParams(context, spaceIdx, timeIdx);
Opm::ImmiscibleFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem,
/*storeEnthalpy=*/false> fs;
fs.setSaturation(wPhaseIdx, Sw); fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1 - Sw); fs.setSaturation(nPhaseIdx, 1 - Sw);
fs.setTemperature(T); fs.setTemperature(T);
@ -415,7 +433,7 @@ public:
Scalar pC[numPhases]; Scalar pC[numPhases];
MaterialLaw::capillaryPressures(pC, matParams, fs); MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(wPhaseIdx, pw); fs.setPressure(wPhaseIdx, pw);
fs.setPressure(nPhaseIdx, pw + pC[nPhaseIdx] - pC[wPhaseIdx]); fs.setPressure(nPhaseIdx, pw + pC[nPhaseIdx] - pC[wPhaseIdx]);
// impose an freeflow boundary condition // impose an freeflow boundary condition
values.setFreeFlow(context, spaceIdx, timeIdx, fs); values.setFreeFlow(context, spaceIdx, timeIdx, fs);
@ -432,7 +450,6 @@ public:
// no flow boundary // no flow boundary
values.setNoFlow(); values.setNoFlow();
} }
} }
//! \} //! \}
@ -446,9 +463,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
Scalar depth = this->bboxMax()[1] - pos[1]; Scalar depth = this->bboxMax()[1] - pos[1];
@ -467,11 +483,11 @@ public:
Scalar densityW = FluidSystem::density(fs, paramCache, wPhaseIdx); Scalar densityW = FluidSystem::density(fs, paramCache, wPhaseIdx);
// hydrostatic pressure (assuming incompressibility) // hydrostatic pressure (assuming incompressibility)
Scalar pw = 1e5 - densityW*this->gravity()[1]*depth; Scalar pw = 1e5 - densityW * this->gravity()[1] * depth;
// calculate the capillary pressure // calculate the capillary pressure
const MaterialLawParams &matParams = const MaterialLawParams &matParams
this->materialLawParams(context, spaceIdx, timeIdx); = this->materialLawParams(context, spaceIdx, timeIdx);
Scalar pC[numPhases]; Scalar pC[numPhases];
MaterialLaw::capillaryPressures(pC, matParams, fs); MaterialLaw::capillaryPressures(pC, matParams, fs);
@ -490,9 +506,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -501,7 +516,8 @@ private:
bool isInLens_(const GlobalPosition &pos) const bool isInLens_(const GlobalPosition &pos) const
{ {
for (int i = 0; i < dim; ++i) { for (int i = 0; i < dim; ++i) {
if (pos[i] < lensLowerLeft_[i] - eps_ || pos[i] > lensUpperRight_[i] + eps_) if (pos[i] < lensLowerLeft_[i] - eps_ || pos[i] > lensUpperRight_[i]
+ eps_)
return false; return false;
} }
return true; return true;
@ -522,8 +538,8 @@ private:
bool onInlet_(const GlobalPosition &pos) const bool onInlet_(const GlobalPosition &pos) const
{ {
Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; Scalar width = this->bboxMax()[0] - this->bboxMin()[0];
Scalar lambda = (this->bboxMax()[0] - pos[0])/width; Scalar lambda = (this->bboxMax()[0] - pos[0]) / width;
return onUpperBoundary_(pos) && 0.5 < lambda && lambda < 2.0/3.0; return onUpperBoundary_(pos) && 0.5 < lambda && lambda < 2.0 / 3.0;
} }
GlobalPosition lensLowerLeft_; GlobalPosition lensLowerLeft_;

View File

@ -45,15 +45,18 @@ namespace Properties {
NEW_TYPE_TAG(NavierStokesTestProblem, INHERITS_FROM(VcfvNavierStokes)); NEW_TYPE_TAG(NavierStokesTestProblem, INHERITS_FROM(VcfvNavierStokes));
// Set the grid type // Set the grid type
SET_TYPE_PROP(NavierStokesTestProblem, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); SET_TYPE_PROP(NavierStokesTestProblem, Grid,
Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
// Set the property which defines the type of the physical problem // Set the property which defines the type of the physical problem
SET_TYPE_PROP(NavierStokesTestProblem, Problem, Ewoms::NavierStokesTestProblem<TypeTag>); SET_TYPE_PROP(NavierStokesTestProblem, Problem,
Ewoms::NavierStokesTestProblem<TypeTag>);
SET_PROP(NavierStokesTestProblem, Fluid) SET_PROP(NavierStokesTestProblem, Fluid)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::GasPhase<Scalar, Opm::N2<Scalar> > type; typedef Opm::GasPhase<Scalar, Opm::N2<Scalar> > type;
}; };
@ -71,8 +74,10 @@ SET_SCALAR_PROP(NavierStokesTestProblem, EndTime, 1e-3);
SET_SCALAR_PROP(NavierStokesTestProblem, InitialTimeStepSize, 1e-3); SET_SCALAR_PROP(NavierStokesTestProblem, InitialTimeStepSize, 1e-3);
// Default grid file to load // Default grid file to load
SET_STRING_PROP(NavierStokesTestProblem, GridFile, "grids/test_navierstokes.dgf"); SET_STRING_PROP(NavierStokesTestProblem, GridFile,
}} "grids/test_navierstokes.dgf");
}
}
namespace Ewoms { namespace Ewoms {
/*! /*!
@ -102,7 +107,8 @@ class NavierStokesTestProblem : public StokesProblem<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
@ -125,7 +131,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
NavierStokesTestProblem(TimeManager &timeManager) NavierStokesTestProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -151,8 +157,7 @@ public:
* This problem assumes a constant temperature of 10 degrees Celsius. * This problem assumes a constant temperature of 10 degrees Celsius.
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return 273.15 + 10; } { return 273.15 + 10; }
//! \} //! \}
@ -166,18 +171,19 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
/* const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); /* const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
values.setOutflow(massBalanceIdx); values.setOutflow(massBalanceIdx);
values.setDirichlet(momentumXIdx); values.setDirichlet(momentumXIdx);
values.setDirichlet(momentumYIdx); values.setDirichlet(momentumYIdx);
// set pressure for all vertices at the bottom // set pressure for all vertices at the bottom
if (onLowerBoundary_(pos)) { if (onLowerBoundary_(pos)) {
values.setDirichlet(massBalanceIdx); values.setDirichlet(massBalanceIdx);
} }
*/ */
values.setNoFlow(context, spaceIdx, timeIdx); values.setNoFlow(context, spaceIdx, timeIdx);
} }
@ -192,9 +198,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ initial_(values); } { initial_(values); }
/*! /*!
@ -203,14 +208,16 @@ public:
* For this problem, we fix the velocity of upper boundary. * For this problem, we fix the velocity of upper boundary.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, const Context &context, int spaceIdx, int timeIdx) const void constraints(Constraints &constraints, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (onUpperBoundary_(pos)) { if (onUpperBoundary_(pos)) {
// lid moves from left to right // lid moves from left to right
const Scalar lidVelocity = 1.0; const Scalar lidVelocity = 1.0;
constraints.setConstraint(momentum0EqIdx, velocity0Idx + 0, lidVelocity); constraints.setConstraint(momentum0EqIdx, velocity0Idx + 0,
lidVelocity);
constraints.setConstraint(momentum0EqIdx + 1, velocity0Idx + 1, 0); constraints.setConstraint(momentum0EqIdx + 1, velocity0Idx + 1, 0);
constraints.setConstraint(conti0EqIdx, pressureIdx, 1e5); constraints.setConstraint(conti0EqIdx, pressureIdx, 1e5);
} }
@ -220,9 +227,8 @@ public:
* \copydoc VcfvProblem::source * \copydoc VcfvProblem::source
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -246,7 +252,7 @@ private:
{ return globalPos[1] < this->bboxMin()[1] + eps_; } { return globalPos[1] < this->bboxMin()[1] + eps_; }
bool onUpperBoundary_(const GlobalPosition &globalPos) const bool onUpperBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[1] > this->bboxMax()[1] - eps_; } { return globalPos[1] > this->bboxMax()[1] - eps_; }
Scalar eps_; Scalar eps_;
}; };

View File

@ -58,13 +58,10 @@ NEW_TYPE_TAG(ObstacleBaseProblem);
SET_TYPE_PROP(ObstacleBaseProblem, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(ObstacleBaseProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property // Set the problem property
SET_TYPE_PROP(ObstacleBaseProblem, SET_TYPE_PROP(ObstacleBaseProblem, Problem, Ewoms::ObstacleProblem<TypeTag>);
Problem,
Ewoms::ObstacleProblem<TypeTag>);
// Set fluid configuration // Set fluid configuration
SET_TYPE_PROP(ObstacleBaseProblem, SET_TYPE_PROP(ObstacleBaseProblem, FluidSystem,
FluidSystem,
Opm::FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar)>); Opm::FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar)>);
// Set the material Law // Set the material Law
@ -77,7 +74,7 @@ private:
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx> /*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
MaterialTraits; MaterialTraits;
typedef Opm::LinearMaterial<MaterialTraits> EffMaterialLaw; typedef Opm::LinearMaterial<MaterialTraits> EffMaterialLaw;
@ -139,8 +136,7 @@ namespace Ewoms {
* and the right boundary where a free flow condition is assumed. * and the right boundary where a free flow condition is assumed.
*/ */
template <class TypeTag> template <class TypeTag>
class ObstacleProblem class ObstacleProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -149,7 +145,8 @@ class ObstacleProblem
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag,
BoundaryRateVector) BoundaryRateVector;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -160,12 +157,9 @@ class ObstacleProblem
// Grid and world dimension // Grid and world dimension
dim = GridView::dimension, dim = GridView::dimension,
dimWorld = GridView::dimensionworld, dimWorld = GridView::dimensionworld,
numPhases = GET_PROP_VALUE(TypeTag, NumPhases), numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
gPhaseIdx = FluidSystem::gPhaseIdx, gPhaseIdx = FluidSystem::gPhaseIdx,
lPhaseIdx = FluidSystem::lPhaseIdx, lPhaseIdx = FluidSystem::lPhaseIdx,
H2OIdx = FluidSystem::H2OIdx, H2OIdx = FluidSystem::H2OIdx,
N2Idx = FluidSystem::N2Idx N2Idx = FluidSystem::N2Idx
}; };
@ -180,7 +174,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
ObstacleProblem(TimeManager &timeManager) ObstacleProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -218,10 +212,10 @@ public:
// parameters for the linear law, i.e. minimum and maximum // parameters for the linear law, i.e. minimum and maximum
// pressures // pressures
fineMaterialParams_.setPcMinSat(lPhaseIdx,0.0); fineMaterialParams_.setPcMinSat(lPhaseIdx, 0.0);
fineMaterialParams_.setPcMaxSat(lPhaseIdx,0.0); fineMaterialParams_.setPcMaxSat(lPhaseIdx, 0.0);
coarseMaterialParams_.setPcMinSat(lPhaseIdx,0.0); coarseMaterialParams_.setPcMinSat(lPhaseIdx, 0.0);
coarseMaterialParams_.setPcMaxSat(lPhaseIdx,0.0); coarseMaterialParams_.setPcMaxSat(lPhaseIdx, 0.0);
/* /*
// entry pressures for Brooks-Corey // entry pressures for Brooks-Corey
@ -254,13 +248,9 @@ public:
this->model().globalPhaseStorage(phaseStorage, phaseIdx); this->model().globalPhaseStorage(phaseStorage, phaseIdx);
if (this->gridView().comm().rank() == 0) { if (this->gridView().comm().rank() == 0) {
std::cout std::cout << "Storage in " << FluidSystem::phaseName(phaseIdx)
<<"Storage in " << "Phase: [" << phaseStorage << "]"
<< FluidSystem::phaseName(phaseIdx) << "\n";
<< "Phase: ["
<< phaseStorage
<< "]"
<< "\n";
} }
} }
@ -270,9 +260,8 @@ public:
// Write mass balance information for rank 0 // Write mass balance information for rank 0
if (this->gridView().comm().rank() == 0) { if (this->gridView().comm().rank() == 0) {
std::cout std::cout << "Storage total: [" << storage << "]"
<<"Storage total: [" << storage << "]" << "\n";
<< "\n";
} }
} }
@ -287,7 +276,8 @@ public:
const std::string name() const const std::string name() const
{ {
std::ostringstream oss; std::ostringstream oss;
oss << "obstacle" << "_" << this->model().name(); oss << "obstacle"
<< "_" << this->model().name();
return oss.str(); return oss.str();
} }
@ -304,7 +294,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
if (isFineMaterial_(context.pos(spaceIdx, timeIdx))) if (isFineMaterial_(context.pos(spaceIdx, timeIdx)))
return fineK_; return fineK_;
@ -328,7 +319,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams &materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -344,18 +336,18 @@ public:
* medium is granite. * medium is granite.
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 790 // specific heat capacity of granite [J / (kg K)]
790 // specific heat capacity of granite [J / (kg K)] * 2700; // density of granite [kg/m^3]
* 2700; // density of granite [kg/m^3]
} }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::heatConductionParams * \copydoc VcfvMultiPhaseProblem::heatConductionParams
*/ */
template <class Context> template <class Context>
const HeatConductionLawParams& const HeatConductionLawParams &
heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -375,7 +367,8 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -398,7 +391,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx); const auto &matParams = materialLawParams(context, spaceIdx, timeIdx);
values.assignMassConservative(outletFluidState_, matParams); values.assignMassConservative(outletFluidState_, matParams);
@ -411,9 +405,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = 0.0; } { rate = 0.0; }
//! \} //! \}
@ -424,11 +417,7 @@ private:
* fine-permeability region or not. * fine-permeability region or not.
*/ */
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
{ { return 10 <= pos[0] && pos[0] <= 20 && 0 <= pos[1] && pos[1] <= 35; }
return
10 <= pos[0] && pos[0] <= 20 &&
0 <= pos[1] && pos[1] <= 35;
}
bool onInlet_(const GlobalPosition &globalPos) const bool onInlet_(const GlobalPosition &globalPos) const
{ {
@ -446,12 +435,15 @@ private:
void initFluidStates_() void initFluidStates_()
{ {
initFluidState_(inletFluidState_, coarseMaterialParams_, /*isInlet=*/true); initFluidState_(inletFluidState_, coarseMaterialParams_,
initFluidState_(outletFluidState_, coarseMaterialParams_, /*isInlet=*/false); /*isInlet=*/true);
initFluidState_(outletFluidState_, coarseMaterialParams_,
/*isInlet=*/false);
} }
template <class FluidState> template <class FluidState>
void initFluidState_(FluidState &fs, const MaterialLawParams &matParams, bool isInlet) void initFluidState_(FluidState &fs, const MaterialLawParams &matParams,
bool isInlet)
{ {
int refPhaseIdx; int refPhaseIdx;
int otherPhaseIdx; int otherPhaseIdx;
@ -496,18 +488,16 @@ private:
// calulate the capillary pressure // calulate the capillary pressure
PhaseVector pC; PhaseVector pC;
MaterialLaw::capillaryPressures(pC, matParams, fs); MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(otherPhaseIdx, fs.setPressure(otherPhaseIdx, fs.pressure(refPhaseIdx)
fs.pressure(refPhaseIdx) + (pC[otherPhaseIdx] - pC[refPhaseIdx]));
+ (pC[otherPhaseIdx] - pC[refPhaseIdx]));
// make the fluid state consistent with local thermodynamic // make the fluid state consistent with local thermodynamic
// equilibrium // equilibrium
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> ComputeFromReferencePhase; typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem>
ComputeFromReferencePhase;
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
ComputeFromReferencePhase::solve(fs, ComputeFromReferencePhase::solve(fs, paramCache, refPhaseIdx,
paramCache,
refPhaseIdx,
/*setViscosity=*/false, /*setViscosity=*/false,
/*setEnthalpy=*/false); /*setEnthalpy=*/false);
} }
@ -517,8 +507,9 @@ private:
Scalar lambdaWater = 0.6; Scalar lambdaWater = 0.6;
Scalar lambdaGranite = 2.8; Scalar lambdaGranite = 2.8;
Scalar lambdaWet = std::pow(lambdaGranite, (1-poro)) * std::pow(lambdaWater, poro); Scalar lambdaWet = std::pow(lambdaGranite, (1 - poro))
Scalar lambdaDry = std::pow(lambdaGranite, (1-poro)); * std::pow(lambdaWater, poro);
Scalar lambdaDry = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(gPhaseIdx, lambdaDry); params.setFullySaturatedLambda(gPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(lPhaseIdx, lambdaWet); params.setFullySaturatedLambda(lPhaseIdx, lambdaWet);

View File

@ -51,8 +51,10 @@ SET_TYPE_PROP(OutflowBaseProblem, Problem, Ewoms::OutflowProblem<TypeTag>);
// Set fluid system // Set fluid system
SET_PROP(OutflowBaseProblem, FluidSystem) SET_PROP(OutflowBaseProblem, FluidSystem)
{ private: {
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
// Two-component single phase fluid system // Two-component single phase fluid system
typedef Opm::FluidSystems::H2ON2LiquidPhase<Scalar> type; typedef Opm::FluidSystems::H2ON2LiquidPhase<Scalar> type;
@ -94,8 +96,7 @@ namespace Ewoms {
* used. * used.
*/ */
template <class TypeTag> template <class TypeTag>
class OutflowProblem class OutflowProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -103,7 +104,8 @@ class OutflowProblem
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -129,17 +131,18 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
OutflowProblem(TimeManager &timeManager) OutflowProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
#else #else
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
#endif #endif
, eps_(1e-6) eps_(1e-6)
{ {
temperature_ = 273.15 + 20; temperature_ = 273.15 + 20;
FluidSystem::init(/*minT=*/temperature_ - 1, /*maxT=*/temperature_ + 2, /*numT=*/3, FluidSystem::init(/*minT=*/temperature_ - 1, /*maxT=*/temperature_ + 2,
/*numT=*/3,
/*minp=*/0.8e5, /*maxp=*/2.5e5, /*nump=*/500); /*minp=*/0.8e5, /*maxp=*/2.5e5, /*nump=*/500);
// set parameters of porous medium // set parameters of porous medium
@ -174,7 +177,8 @@ public:
* This problem uses a constant intrinsic permeability. * This problem uses a constant intrinsic permeability.
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ return perm_; } { return perm_; }
/*! /*!
@ -216,14 +220,14 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
if (onLeftBoundary_(globalPos)) { if (onLeftBoundary_(globalPos)) {
Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs; Opm::CompositionalFluidState<Scalar, FluidSystem,
/*storeEnthalpy=*/false> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
fs.setPressure(/*phaseIdx=*/0, fs.pressure(/*phaseIdx=*/0) + 1e5); fs.setPressure(/*phaseIdx=*/0, fs.pressure(/*phaseIdx=*/0) + 1e5);
@ -235,7 +239,8 @@ public:
values.setFreeFlow(context, spaceIdx, timeIdx, fs); values.setFreeFlow(context, spaceIdx, timeIdx, fs);
} }
else if (onRightBoundary_(globalPos)) { else if (onRightBoundary_(globalPos)) {
Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs; Opm::CompositionalFluidState<Scalar, FluidSystem,
/*storeEnthalpy=*/false> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
// impose an outflow boundary condition // impose an outflow boundary condition
@ -257,7 +262,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs; Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
@ -272,9 +278,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -287,14 +292,15 @@ private:
{ return pos[0] > this->bboxMax()[0] - eps_; } { return pos[0] > this->bboxMax()[0] - eps_; }
template <class FluidState, class Context> template <class FluidState, class Context>
void initialFluidState_(FluidState &fs, void initialFluidState_(FluidState &fs, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
Scalar T = temperature(context, spaceIdx, timeIdx); Scalar T = temperature(context, spaceIdx, timeIdx);
//Scalar rho = FluidSystem::H2O::liquidDensity(T, /*pressure=*/1.5e5); // Scalar rho = FluidSystem::H2O::liquidDensity(T, /*pressure=*/1.5e5);
//Scalar z = context.pos(spaceIdx, timeIdx)[dim - 1] - this->bboxMax()[dim - 1]; // Scalar z = context.pos(spaceIdx, timeIdx)[dim - 1] -
//Scalar z = context.pos(spaceIdx, timeIdx)[dim - 1] - this->bboxMax()[dim - 1]; // this->bboxMax()[dim - 1];
// Scalar z = context.pos(spaceIdx, timeIdx)[dim - 1] -
// this->bboxMax()[dim - 1];
fs.setSaturation(/*phaseIdx=*/0, 1.0); fs.setSaturation(/*phaseIdx=*/0, 1.0);
fs.setPressure(/*phaseIdx=*/0, 1e5 /* + rho*z */); fs.setPressure(/*phaseIdx=*/0, 1e5 /* + rho*z */);

View File

@ -57,16 +57,19 @@ NEW_TYPE_TAG(PowerInjectionBaseProblem);
SET_TYPE_PROP(PowerInjectionBaseProblem, Grid, Dune::YaspGrid</*dim=*/1>); SET_TYPE_PROP(PowerInjectionBaseProblem, Grid, Dune::YaspGrid</*dim=*/1>);
// set the GridCreator property // set the GridCreator property
SET_TYPE_PROP(PowerInjectionBaseProblem, GridCreator, Ewoms::CubeGridCreator<TypeTag>); SET_TYPE_PROP(PowerInjectionBaseProblem, GridCreator,
Ewoms::CubeGridCreator<TypeTag>);
// Set the problem property // Set the problem property
SET_TYPE_PROP(PowerInjectionBaseProblem, Problem, Ewoms::PowerInjectionProblem<TypeTag>); SET_TYPE_PROP(PowerInjectionBaseProblem, Problem,
Ewoms::PowerInjectionProblem<TypeTag>);
// Set the wetting phase // Set the wetting phase
SET_PROP(PowerInjectionBaseProblem, WettingPhase) SET_PROP(PowerInjectionBaseProblem, WettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
}; };
@ -76,6 +79,7 @@ SET_PROP(PowerInjectionBaseProblem, NonwettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::GasPhase<Scalar, Opm::Air<Scalar> > type; typedef Opm::GasPhase<Scalar, Opm::Air<Scalar> > type;
}; };
@ -88,7 +92,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
@ -136,8 +141,7 @@ namespace Ewoms {
* Systems, University of Stuttgart, 2011 * Systems, University of Stuttgart, 2011
*/ */
template <class TypeTag> template <class TypeTag>
class PowerInjectionProblem class PowerInjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -166,7 +170,8 @@ class PowerInjectionProblem
}; };
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;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -181,7 +186,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
PowerInjectionProblem(TimeManager &timeManager) PowerInjectionProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -236,7 +241,7 @@ public:
// Write mass balance information for rank 0 // Write mass balance information for rank 0
if (this->gridView().comm().rank() == 0) { if (this->gridView().comm().rank() == 0) {
std::cout<<"Storage: " << storage << std::endl; std::cout << "Storage: " << storage << std::endl;
} }
} }
//! \} //! \}
@ -250,14 +255,16 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ return K_; } { return K_; }
/*! /*!
* \copydoc VcfvForchheimerBaseProblem::ergunCoefficient * \copydoc VcfvForchheimerBaseProblem::ergunCoefficient
*/ */
template <class Context> template <class Context>
Scalar ergunCoefficient(const Context &context, int spaceIdx, int timeIdx) const Scalar ergunCoefficient(const Context &context, int spaceIdx,
int timeIdx) const
{ return 0.3866; } { return 0.3866; }
/*! /*!
@ -271,15 +278,15 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ return materialParams_; } { return materialParams_; }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::temperature * \copydoc VcfvMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return temperature_; } { return temperature_; }
//! \} //! \}
@ -296,8 +303,7 @@ public:
* left and a free-flow boundary on the right. * left and a free-flow boundary on the right.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -310,11 +316,10 @@ public:
// impose a forced flow boundary // impose a forced flow boundary
values.setMassRate(massRate); values.setMassRate(massRate);
} }
else { else {
// free flow boundary with initial condition on the right // free flow boundary with initial condition on the right
values.setFreeFlow(context, spaceIdx, timeIdx, initialFluidState_); values.setFreeFlow(context, spaceIdx, timeIdx, initialFluidState_);
} }
} }
//! \} //! \}
@ -328,9 +333,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
// assign the primary variables // assign the primary variables
values.assignNaive(initialFluidState_); values.assignNaive(initialFluidState_);
@ -343,9 +347,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}

View File

@ -71,10 +71,11 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::ThreePhaseMaterialTraits<Scalar, typedef Opm::
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, ThreePhaseMaterialTraits<Scalar,
/*nonWettingPhaseIdx=*/FluidSystem::oPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::oPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gPhaseIdx> Traits;
public: public:
typedef Opm::LinearMaterial<Traits> type; typedef Opm::LinearMaterial<Traits> type;
@ -132,8 +133,7 @@ namespace Ewoms {
* which is 50% above the reservoir pressure. * which is 50% above the reservoir pressure.
*/ */
template <class TypeTag> template <class TypeTag>
class ReservoirProblem class ReservoirProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -141,32 +141,28 @@ class ReservoirProblem
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { // Grid and world dimension
// Grid and world dimension enum { dim = GridView::dimension };
dim = GridView::dimension, enum { dimWorld = GridView::dimensionworld };
dimWorld = GridView::dimensionworld
};
// copy some indices for convenience // copy some indices for convenience
enum { enum { numPhases = FluidSystem::numPhases };
numPhases = FluidSystem::numPhases, enum { numComponents = FluidSystem::numComponents };
numComponents = FluidSystem::numComponents, enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { oPhaseIdx = FluidSystem::oPhaseIdx };
gPhaseIdx = FluidSystem::gPhaseIdx, enum { wPhaseIdx = FluidSystem::wPhaseIdx };
oPhaseIdx = FluidSystem::oPhaseIdx, enum { gCompIdx = FluidSystem::gCompIdx };
wPhaseIdx = FluidSystem::wPhaseIdx, enum { oCompIdx = FluidSystem::oCompIdx };
enum { wCompIdx = FluidSystem::wCompIdx };
gCompIdx = FluidSystem::gCompIdx,
oCompIdx = FluidSystem::oCompIdx,
wCompIdx = FluidSystem::wCompIdx
};
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
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;
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, BlackOilFluidState) BlackOilFluidState; typedef typename GET_PROP_TYPE(TypeTag,
BlackOilFluidState) BlackOilFluidState;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
@ -180,7 +176,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
ReservoirProblem(TimeManager &timeManager) ReservoirProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -195,71 +191,66 @@ public:
name_ = EWOMS_GET_PARAM(TypeTag, std::string, SimulationName); name_ = EWOMS_GET_PARAM(TypeTag, std::string, SimulationName);
FluidSystem::initBegin(); FluidSystem::initBegin();
std::vector<std::pair<Scalar, Scalar> > Bg = { std::vector<std::pair<Scalar, Scalar> > Bg
{ 1.013529e+05, 9.998450e-01 }, = { { 1.013529e+05, 9.998450e-01 },
{ 2.757903e+06, 3.075500e-02 }, { 2.757903e+06, 3.075500e-02 },
{ 5.515806e+06, 1.537947e-02 }, { 5.515806e+06, 1.537947e-02 },
{ 8.273709e+06, 1.021742e-02 }, { 8.273709e+06, 1.021742e-02 },
{ 1.103161e+07, 7.662783e-03 }, { 1.103161e+07, 7.662783e-03 },
{ 1.378951e+07, 6.151899e-03 }, { 1.378951e+07, 6.151899e-03 },
{ 1.654742e+07, 5.108709e-03 }, { 1.654742e+07, 5.108709e-03 },
{ 1.930532e+07, 4.378814e-03 }, { 1.930532e+07, 4.378814e-03 },
{ 2.206322e+07, 3.857780e-03 }, { 2.206322e+07, 3.857780e-03 },
{ 2.482113e+07, 3.388401e-03 }, { 2.482113e+07, 3.388401e-03 },
{ 2.757903e+07, 3.049842e-03 } { 2.757903e+07, 3.049842e-03 } };
}; std::vector<std::pair<Scalar, Scalar> > Bo
std::vector<std::pair<Scalar, Scalar> > Bo = { = { { 1.013529e+05, 1.000000e+00 },
{ 1.013529e+05, 1.000000e+00 }, { 2.757903e+06, 1.012000e+00 },
{ 2.757903e+06, 1.012000e+00 }, { 5.515806e+06, 1.025500e+00 },
{ 5.515806e+06, 1.025500e+00 }, { 8.273709e+06, 1.038000e+00 },
{ 8.273709e+06, 1.038000e+00 }, { 1.103161e+07, 1.051000e+00 },
{ 1.103161e+07, 1.051000e+00 }, { 1.378951e+07, 1.063000e+00 },
{ 1.378951e+07, 1.063000e+00 }, { 1.654742e+07, 1.075000e+00 },
{ 1.654742e+07, 1.075000e+00 }, { 1.930532e+07, 1.087000e+00 },
{ 1.930532e+07, 1.087000e+00 }, { 2.206322e+07, 1.098500e+00 },
{ 2.206322e+07, 1.098500e+00 }, { 2.482113e+07, 1.110000e+00 },
{ 2.482113e+07, 1.110000e+00 }, { 2.757903e+07, 1.120000e+00 } };
{ 2.757903e+07, 1.120000e+00 } std::vector<std::pair<Scalar, Scalar> > Rs
}; = { { 1.013529e+05, 0.000000e+00 },
std::vector<std::pair<Scalar, Scalar> > Rs = { { 2.757903e+06, 2.938776e+01 },
{ 1.013529e+05, 0.000000e+00 }, { 5.515806e+06, 5.966605e+01 },
{ 2.757903e+06, 2.938776e+01 }, { 8.273709e+06, 8.905380e+01 },
{ 5.515806e+06, 5.966605e+01 }, { 1.103161e+07, 1.184416e+02 },
{ 8.273709e+06, 8.905380e+01 }, { 1.378951e+07, 1.474731e+02 },
{ 1.103161e+07, 1.184416e+02 }, { 1.654742e+07, 1.754360e+02 },
{ 1.378951e+07, 1.474731e+02 }, { 1.930532e+07, 2.012616e+02 },
{ 1.654742e+07, 1.754360e+02 }, { 2.206322e+07, 2.261967e+02 },
{ 1.930532e+07, 2.012616e+02 }, { 2.482113e+07, 2.475696e+02 },
{ 2.206322e+07, 2.261967e+02 }, { 2.757903e+07, 2.671614e+02 } };
{ 2.482113e+07, 2.475696e+02 }, std::vector<std::pair<Scalar, Scalar> > muo
{ 2.757903e+07, 2.671614e+02 } = { { 1.013529e+05, 1.200000e-03 },
}; { 2.757903e+06, 1.170000e-03 },
std::vector<std::pair<Scalar, Scalar> > muo = { { 5.515806e+06, 1.140000e-03 },
{ 1.013529e+05, 1.200000e-03 }, { 8.273709e+06, 1.110000e-03 },
{ 2.757903e+06, 1.170000e-03 }, { 1.103161e+07, 1.080000e-03 },
{ 5.515806e+06, 1.140000e-03 }, { 1.378951e+07, 1.060000e-03 },
{ 8.273709e+06, 1.110000e-03 }, { 1.654742e+07, 1.030000e-03 },
{ 1.103161e+07, 1.080000e-03 }, { 1.930532e+07, 1.000000e-03 },
{ 1.378951e+07, 1.060000e-03 }, { 2.206322e+07, 9.800000e-04 },
{ 1.654742e+07, 1.030000e-03 }, { 2.482113e+07, 9.500000e-04 },
{ 1.930532e+07, 1.000000e-03 }, { 2.757903e+07, 9.400000e-04 } };
{ 2.206322e+07, 9.800000e-04 }, std::vector<std::pair<Scalar, Scalar> > mug
{ 2.482113e+07, 9.500000e-04 }, = { { 1.013529e+05, 1.250000e-05 },
{ 2.757903e+07, 9.400000e-04 } { 2.757903e+06, 1.300000e-05 },
}; { 5.515806e+06, 1.350000e-05 },
std::vector<std::pair<Scalar, Scalar> > mug = { { 8.273709e+06, 1.400000e-05 },
{ 1.013529e+05, 1.250000e-05 }, { 1.103161e+07, 1.450000e-05 },
{ 2.757903e+06, 1.300000e-05 }, { 1.378951e+07, 1.500000e-05 },
{ 5.515806e+06, 1.350000e-05 }, { 1.654742e+07, 1.550000e-05 },
{ 8.273709e+06, 1.400000e-05 }, { 1.930532e+07, 1.600000e-05 },
{ 1.103161e+07, 1.450000e-05 }, { 2.206322e+07, 1.650000e-05 },
{ 1.378951e+07, 1.500000e-05 }, { 2.482113e+07, 1.700000e-05 },
{ 1.654742e+07, 1.550000e-05 }, { 2.757903e+07, 1.750000e-05 }, };
{ 1.930532e+07, 1.600000e-05 },
{ 2.206322e+07, 1.650000e-05 },
{ 2.482113e+07, 1.700000e-05 },
{ 2.757903e+07, 1.750000e-05 },
};
FluidSystem::setGasFormationVolumeFactor(Bg); FluidSystem::setGasFormationVolumeFactor(Bg);
FluidSystem::setOilFormationVolumeFactor(Bo); FluidSystem::setOilFormationVolumeFactor(Bo);
FluidSystem::setGasDissolutionFactor(Rs); FluidSystem::setGasDissolutionFactor(Rs);
@ -270,7 +261,7 @@ public:
FluidSystem::setSurfaceDensities(/*oil=*/720.51, FluidSystem::setSurfaceDensities(/*oil=*/720.51,
/*water=*/1009.32, /*water=*/1009.32,
/*gas=*/1.1245); /*gas=*/1.1245);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
FluidSystem::setReferenceVolumeFactor(phaseIdx, 1.0); FluidSystem::setReferenceVolumeFactor(phaseIdx, 1.0);
FluidSystem::initEnd(); FluidSystem::initEnd();
@ -285,7 +276,7 @@ public:
finePorosity_ = 0.2; finePorosity_ = 0.2;
coarsePorosity_ = 0.3; coarsePorosity_ = 0.3;
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
fineMaterialParams_.setPcMinSat(phaseIdx, 0.0); fineMaterialParams_.setPcMinSat(phaseIdx, 0.0);
fineMaterialParams_.setPcMaxSat(phaseIdx, 0.0); fineMaterialParams_.setPcMaxSat(phaseIdx, 0.0);
@ -307,9 +298,13 @@ public:
{ {
ParentType::registerParameters(); ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, Temperature, "The temperature [K] in the reservoir"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, Temperature,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxDepth, "The maximum depth [m] of the reservoir"); "The temperature [K] in the reservoir");
EWOMS_REGISTER_PARAM(TypeTag, std::string, SimulationName, "The name of the simulation used for the output files"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxDepth,
"The maximum depth [m] of the reservoir");
EWOMS_REGISTER_PARAM(TypeTag, std::string, SimulationName,
"The name of the simulation used for the output "
"files");
} }
/*! /*!
@ -319,7 +314,8 @@ public:
* above one with low permeability. * above one with low permeability.
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -343,7 +339,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -388,8 +385,7 @@ public:
* extraction and production wells, so all boundaries are no-flow. * extraction and production wells, so all boundaries are no-flow.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
// no flow on top and bottom // no flow on top and bottom
@ -410,7 +406,8 @@ public:
* the whole domain. * the whole domain.
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
////// //////
// set the primary variables // set the primary variables
@ -429,23 +426,19 @@ public:
* reservoir. * reservoir.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
Scalar x = pos[0] - this->bboxMin()[0]; Scalar x = pos[0] - this->bboxMin()[0];
Scalar y = pos[dim-1] - this->bboxMin()[dim-1]; Scalar y = pos[dim - 1] - this->bboxMin()[dim - 1];
Scalar height = this->bboxMax()[dim-1] - this->bboxMin()[dim-1]; Scalar height = this->bboxMax()[dim - 1] - this->bboxMin()[dim - 1];
Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; Scalar width = this->bboxMax()[0] - this->bboxMin()[0];
if ((onLeftBoundary_(pos) if ((onLeftBoundary_(pos) || onRightBoundary_(pos)) && y < height / 2) {
|| onRightBoundary_(pos))
&& y < height/2)
{
// injectors // injectors
auto fs = initialFluidState_; auto fs = initialFluidState_;
Scalar pInj = pReservoir_*1.5; Scalar pInj = pReservoir_ * 1.5;
fs.setPressure(wPhaseIdx, pInj); fs.setPressure(wPhaseIdx, pInj);
fs.setPressure(oPhaseIdx, pInj); fs.setPressure(oPhaseIdx, pInj);
fs.setPressure(gPhaseIdx, pInj); fs.setPressure(gPhaseIdx, pInj);
@ -461,21 +454,20 @@ public:
// set the composition of the oil phase to the initial // set the composition of the oil phase to the initial
// composition // composition
for (int compIdx = 0; compIdx < numComponents; ++compIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx)
fs.setMoleFraction(oPhaseIdx, fs.setMoleFraction(oPhaseIdx, compIdx,
compIdx, initialFluidState_.moleFraction(oPhaseIdx,
initialFluidState_.moleFraction(oPhaseIdx, compIdx)); compIdx));
fs.setMoleFraction(wPhaseIdx, wCompIdx, 1.0); fs.setMoleFraction(wPhaseIdx, wCompIdx, 1.0);
constraints.setAllConstraint(); constraints.setAllConstraint();
constraints.assignNaive(fs); constraints.assignNaive(fs);
} }
else if (width/2 - 1 < x && x < width/2 + 1 && y > height/2) else if (width / 2 - 1 < x && x < width / 2 + 1 && y > height / 2) {
{
// producer // producer
auto fs = initialFluidState_; auto fs = initialFluidState_;
Scalar pProd = pReservoir_/1.5; Scalar pProd = pReservoir_ / 1.5;
fs.setPressure(wPhaseIdx, pProd); fs.setPressure(wPhaseIdx, pProd);
fs.setPressure(oPhaseIdx, pProd); fs.setPressure(oPhaseIdx, pProd);
fs.setPressure(gPhaseIdx, pProd); fs.setPressure(gPhaseIdx, pProd);
@ -486,9 +478,9 @@ public:
// set the compositions to the initial composition // set the compositions to the initial composition
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
for (int compIdx = 0; compIdx < numComponents; ++compIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx)
fs.setMoleFraction(phaseIdx, fs.setMoleFraction(phaseIdx, compIdx,
compIdx, initialFluidState_.moleFraction(phaseIdx,
initialFluidState_.moleFraction(phaseIdx, compIdx)); compIdx));
constraints.setAllConstraint(); constraints.setAllConstraint();
constraints.assignNaive(fs); constraints.assignNaive(fs);
@ -501,9 +493,8 @@ public:
* For this problem, the source term of all components is 0 everywhere. * For this problem, the source term of all components is 0 everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -558,18 +549,18 @@ private:
Scalar pSat = pReservoir_; // the saturation pressure of the oil Scalar pSat = pReservoir_; // the saturation pressure of the oil
Scalar Bo = FluidSystem::oilFormationVolumeFactor(pSat); Scalar Bo = FluidSystem::oilFormationVolumeFactor(pSat);
Scalar Rs = FluidSystem::gasDissolutionFactor(pSat); Scalar Rs = FluidSystem::gasDissolutionFactor(pSat);
Scalar rhoo = FluidSystem::surfaceDensity(oPhaseIdx)/Bo; Scalar rhoo = FluidSystem::surfaceDensity(oPhaseIdx) / Bo;
Scalar rhogref = FluidSystem::surfaceDensity(gPhaseIdx); Scalar rhogref = FluidSystem::surfaceDensity(gPhaseIdx);
// calculate composition of oil phase in terms of mass // calculate composition of oil phase in terms of mass
// fractions. // fractions.
Scalar XoG = Rs*rhogref / rhoo; Scalar XoG = Rs * rhogref / rhoo;
// convert mass to mole fractions // convert mass to mole fractions
Scalar MG = FluidSystem::molarMass(gCompIdx); Scalar MG = FluidSystem::molarMass(gCompIdx);
Scalar MO = FluidSystem::molarMass(oCompIdx); Scalar MO = FluidSystem::molarMass(oCompIdx);
Scalar xoG = XoG*MO/((MO - MG)*XoG + MG); Scalar xoG = XoG * MO / ((MO - MG) * XoG + MG);
Scalar xoO = 1 - xoG; Scalar xoO = 1 - xoG;
// finally set the oil-phase composition // finally set the oil-phase composition
@ -587,7 +578,7 @@ private:
{ return onRightBoundary_(pos) && (5 < pos[1]) && (pos[1] < 15); } { return onRightBoundary_(pos) && (5 < pos[1]) && (pos[1] < 15); }
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
{ return pos[dim-1] > layerBottom_; } { return pos[dim - 1] > layerBottom_; }
DimMatrix fineK_; DimMatrix fineK_;
DimMatrix coarseK_; DimMatrix coarseK_;
@ -606,7 +597,7 @@ private:
Scalar maxDepth_; Scalar maxDepth_;
Scalar eps_; Scalar eps_;
std::string name_ ; std::string name_;
}; };
} // namespace Ewoms } // namespace Ewoms

View File

@ -53,13 +53,16 @@ SET_TYPE_PROP(RichardsLensProblem, Grid, Dune::YaspGrid<2>);
// Set the physical problem to be solved // Set the physical problem to be solved
SET_PROP(RichardsLensProblem, Problem) SET_PROP(RichardsLensProblem, Problem)
{ typedef Ewoms::RichardsLensProblem<TypeTag> type; }; {
typedef Ewoms::RichardsLensProblem<TypeTag> type;
};
// Set the wetting phase // Set the wetting phase
SET_PROP(RichardsLensProblem, WettingPhase) SET_PROP(RichardsLensProblem, WettingPhase)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type; typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
}; };
@ -72,7 +75,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
@ -112,7 +116,8 @@ SET_SCALAR_PROP(RichardsLensProblem, EndTime, 3000);
SET_SCALAR_PROP(RichardsLensProblem, InitialTimeStepSize, 100); SET_SCALAR_PROP(RichardsLensProblem, InitialTimeStepSize, 100);
// The default DGF file to load // The default DGF file to load
SET_STRING_PROP(RichardsLensProblem, GridFile, "./grids/richardslens_24x16.dgf"); SET_STRING_PROP(RichardsLensProblem, GridFile,
"./grids/richardslens_24x16.dgf");
} // namespace Properties } // namespace Properties
} // namespace Opm } // namespace Opm
@ -134,14 +139,14 @@ namespace Ewoms {
* instead of a \c DNAPL infiltrates from the top. * instead of a \c DNAPL infiltrates from the top.
*/ */
template <class TypeTag> template <class TypeTag>
class RichardsLensProblem class RichardsLensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
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;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
@ -152,17 +157,15 @@ class RichardsLensProblem
// copy some indices for convenience // copy some indices for convenience
pressureWIdx = Indices::pressureWIdx, pressureWIdx = Indices::pressureWIdx,
contiWEqIdx = Indices::contiWEqIdx, contiWEqIdx = Indices::contiWEqIdx,
wPhaseIdx = GET_PROP_VALUE(TypeTag, LiquidPhaseIndex), wPhaseIdx = GET_PROP_VALUE(TypeTag, LiquidPhaseIndex),
nPhaseIdx = 1 - wPhaseIdx, nPhaseIdx = 1 - wPhaseIdx,
numPhases = FluidSystem::numPhases, numPhases = FluidSystem::numPhases,
// Grid and world dimension // Grid and world dimension
dimWorld = GridView::dimensionworld dimWorld = GridView::dimensionworld
}; };
//get the material law from the property system // get the material law from the property system
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
//! The parameters of the material law to be used //! The parameters of the material law to be used
typedef typename MaterialLaw::Params MaterialLawParams; typedef typename MaterialLaw::Params MaterialLawParams;
@ -177,13 +180,14 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
RichardsLensProblem(TimeManager &timeManager) RichardsLensProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
#endif #endif
, pnRef_(1e5) pnRef_(1e5)
{ {
eps_ = 3e-6; eps_ = 3e-6;
pnRef_ = 1e5; pnRef_ = 1e5;
@ -206,10 +210,10 @@ public:
// parameters for the linear law // parameters for the linear law
// minimum and maximum pressures // minimum and maximum pressures
// lensMaterialParams_.setEntryPC(0); // lensMaterialParams_.setEntryPC(0);
// outerMaterialParams_.setEntryPC(0); // outerMaterialParams_.setEntryPC(0);
// lensMaterialParams_.setMaxPC(0); // lensMaterialParams_.setMaxPC(0);
// outerMaterialParams_.setMaxPC(0); // outerMaterialParams_.setMaxPC(0);
lensK_ = this->toDimMatrix_(1e-12); lensK_ = this->toDimMatrix_(1e-12);
outerK_ = this->toDimMatrix_(5e-12); outerK_ = this->toDimMatrix_(5e-12);
@ -237,7 +241,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::intrinsicPermeability * \copydoc VcfvMultiPhaseProblem::intrinsicPermeability
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isInLens_(pos)) if (isInLens_(pos))
@ -256,7 +261,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (isInLens_(pos)) if (isInLens_(pos))
@ -270,7 +276,8 @@ public:
* \copydetails Doxygen::contextParams * \copydetails Doxygen::contextParams
*/ */
template <class Context> template <class Context>
Scalar referencePressure(const Context &context, int spaceIdx, int timeIdx) const Scalar referencePressure(const Context &context, int spaceIdx,
int timeIdx) const
{ return pnRef_; } { return pnRef_; }
//! \} //! \}
@ -284,14 +291,14 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (onLeftBoundary_(pos) || if (onLeftBoundary_(pos) || onRightBoundary_(pos)) {
onRightBoundary_(pos)) const auto &materialParams
{ = this->materialLawParams(context, spaceIdx, timeIdx);
const auto &materialParams = this->materialLawParams(context, spaceIdx, timeIdx);
Scalar Sw = 0.0; Scalar Sw = 0.0;
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
@ -328,11 +335,11 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const auto &materialParams = this->materialLawParams(context, spaceIdx, timeIdx); const auto &materialParams
= this->materialLawParams(context, spaceIdx, timeIdx);
Scalar Sw = 0.0; Scalar Sw = 0.0;
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs; Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
@ -351,7 +358,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, const Context &context, int spaceIdx, int timeIdx) const void source(RateVector &rate, const Context &context, int spaceIdx,
int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
//! \} //! \}
@ -372,8 +380,8 @@ private:
bool onInlet_(const GlobalPosition &pos) const bool onInlet_(const GlobalPosition &pos) const
{ {
Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; Scalar width = this->bboxMax()[0] - this->bboxMin()[0];
Scalar lambda = (this->bboxMax()[0] - pos[0])/width; Scalar lambda = (this->bboxMax()[0] - pos[0]) / width;
return onUpperBoundary_(pos) && 0.5 < lambda && lambda < 2.0/3.0; return onUpperBoundary_(pos) && 0.5 < lambda && lambda < 2.0 / 3.0;
} }
bool isInLens_(const GlobalPosition &pos) const bool isInLens_(const GlobalPosition &pos) const

View File

@ -51,13 +51,11 @@ SET_TYPE_PROP(Stokes2cTestProblem, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(Stokes2cTestProblem, Problem, Ewoms::Stokes2cTestProblem<TypeTag>); SET_TYPE_PROP(Stokes2cTestProblem, Problem, Ewoms::Stokes2cTestProblem<TypeTag>);
//! Select the fluid system //! Select the fluid system
SET_TYPE_PROP(Stokes2cTestProblem, SET_TYPE_PROP(Stokes2cTestProblem, FluidSystem,
FluidSystem,
Opm::FluidSystems::H2OAir<typename GET_PROP_TYPE(TypeTag, Scalar)>); Opm::FluidSystems::H2OAir<typename GET_PROP_TYPE(TypeTag, Scalar)>);
//! Select the phase to be considered //! Select the phase to be considered
SET_INT_PROP(Stokes2cTestProblem, SET_INT_PROP(Stokes2cTestProblem, StokesPhaseIndex,
StokesPhaseIndex,
GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx); GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx);
// Disable gravity // Disable gravity
@ -90,15 +88,15 @@ namespace Ewoms {
* exhibiting slightly higher humitiy than the ones on the right. * exhibiting slightly higher humitiy than the ones on the right.
*/ */
template <class TypeTag> template <class TypeTag>
class Stokes2cTestProblem class Stokes2cTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag,
BoundaryRateVector) BoundaryRateVector;
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
@ -110,11 +108,9 @@ class Stokes2cTestProblem
// copy some indices for convenience // copy some indices for convenience
conti0EqIdx = Indices::conti0EqIdx, conti0EqIdx = Indices::conti0EqIdx,
momentum0EqIdx = Indices::momentum0EqIdx, momentum0EqIdx = Indices::momentum0EqIdx,
velocity0Idx = Indices::velocity0Idx, velocity0Idx = Indices::velocity0Idx,
moleFrac1Idx = Indices::moleFrac1Idx, moleFrac1Idx = Indices::moleFrac1Idx,
pressureIdx = Indices::pressureIdx, pressureIdx = Indices::pressureIdx,
H2OIdx = FluidSystem::H2OIdx, H2OIdx = FluidSystem::H2OIdx,
AirIdx = FluidSystem::AirIdx AirIdx = FluidSystem::AirIdx
}; };
@ -127,7 +123,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
Stokes2cTestProblem(TimeManager &timeManager) Stokes2cTestProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -158,8 +154,7 @@ public:
* This problem assumes a temperature of 10 degrees Celsius. * This problem assumes a temperature of 10 degrees Celsius.
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return 273.15 + 10; /* -> 10 deg C */ } { return 273.15 + 10; /* -> 10 deg C */ }
// \} // \}
@ -177,13 +172,14 @@ public:
* upper edge. * upper edge.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (onLowerBoundary_(pos)) if (onLowerBoundary_(pos))
values.setOutFlow(context, spaceIdx, timeIdx); values.setOutFlow(context, spaceIdx, timeIdx);
else if(onUpperBoundary_(pos)) { else if (onUpperBoundary_(pos)) {
// upper boundary is constraint! // upper boundary is constraint!
values = 0.0; values = 0.0;
} }
@ -208,18 +204,19 @@ public:
* 0.5% is set. * 0.5% is set.
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx); const GlobalPosition &globalPos = context.pos(spaceIdx, timeIdx);
values = 0.0; values = 0.0;
//parabolic profile // parabolic profile
const Scalar v1 = 1.0; const Scalar v1 = 1.0;
values[velocity0Idx + 1] = values[velocity0Idx + 1]
- v1*(globalPos[0] - this->bboxMin()[0])*(this->bboxMax()[0] - globalPos[0]) = -v1 * (globalPos[0] - this->bboxMin()[0])
/ (0.25*(this->bboxMax()[0] - this->bboxMin()[0])*(this->bboxMax()[0] - this->bboxMin()[0])); * (this->bboxMax()[0] - globalPos[0])
/ (0.25 * (this->bboxMax()[0] - this->bboxMin()[0])
* (this->bboxMax()[0] - this->bboxMin()[0]));
Scalar moleFrac[numComponents]; Scalar moleFrac[numComponents];
if (onUpperBoundary_(globalPos)) if (onUpperBoundary_(globalPos))
@ -240,9 +237,8 @@ public:
* is 0 everywhere. * is 0 everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
/*! /*!
@ -252,8 +248,7 @@ public:
* initial conditions. * initial conditions.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -262,8 +257,11 @@ public:
PrimaryVariables initCond; PrimaryVariables initCond;
initial(initCond, context, spaceIdx, timeIdx); initial(initCond, context, spaceIdx, timeIdx);
constraints.setConstraint(pressureIdx, conti0EqIdx, initCond[pressureIdx]);; constraints.setConstraint(pressureIdx, conti0EqIdx,
constraints.setConstraint(moleFrac1Idx, conti0EqIdx + 1, initCond[moleFrac1Idx]); initCond[pressureIdx]);
;
constraints.setConstraint(moleFrac1Idx, conti0EqIdx + 1,
initCond[moleFrac1Idx]);
for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx) for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx)
constraints.setConstraint(velocity0Idx + axisIdx, constraints.setConstraint(velocity0Idx + axisIdx,
momentum0EqIdx + axisIdx, momentum0EqIdx + axisIdx,

View File

@ -48,13 +48,11 @@ SET_TYPE_PROP(StokesNITestProblem, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(StokesNITestProblem, Problem, Ewoms::StokesNITestProblem<TypeTag>); SET_TYPE_PROP(StokesNITestProblem, Problem, Ewoms::StokesNITestProblem<TypeTag>);
//! Select the fluid system //! Select the fluid system
SET_TYPE_PROP(StokesNITestProblem, SET_TYPE_PROP(StokesNITestProblem, FluidSystem,
FluidSystem,
Opm::FluidSystems::H2OAir<typename GET_PROP_TYPE(TypeTag, Scalar)>); Opm::FluidSystems::H2OAir<typename GET_PROP_TYPE(TypeTag, Scalar)>);
//! Select the phase to be considered //! Select the phase to be considered
SET_INT_PROP(StokesNITestProblem, SET_INT_PROP(StokesNITestProblem, StokesPhaseIndex,
StokesPhaseIndex,
GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx); GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx);
// Enable gravity // Enable gravity
@ -90,8 +88,7 @@ namespace Ewoms {
* conditions. * conditions.
*/ */
template <class TypeTag> template <class TypeTag>
class StokesNITestProblem class StokesNITestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
@ -100,14 +97,14 @@ class StokesNITestProblem
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
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;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
enum { // Number of equations and grid dimension enum { // Number of equations and grid dimension
numEq = GET_PROP_VALUE(TypeTag, NumEq), numEq = GET_PROP_VALUE(TypeTag, NumEq),
dimWorld = GridView::dimensionworld dimWorld = GridView::dimensionworld };
};
enum { enum {
// primary variable indices // primary variable indices
pressureIdx = Indices::pressureIdx, pressureIdx = Indices::pressureIdx,
@ -133,7 +130,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
StokesNITestProblem(TimeManager &timeManager) StokesNITestProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -170,16 +167,14 @@ public:
* \copydoc VcfvProblem::boundary * \copydoc VcfvProblem::boundary
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (onUpperBoundary_(pos)) if (onUpperBoundary_(pos))
values.setOutFlow(context, spaceIdx, timeIdx); values.setOutFlow(context, spaceIdx, timeIdx);
else if(onLowerBoundary_(pos)) { else if (onLowerBoundary_(pos)) {
// lower boundary is constraint! // lower boundary is constraint!
values = 0.0; values = 0.0;
} }
@ -200,9 +195,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -224,18 +218,18 @@ public:
// parabolic velocity profile // parabolic velocity profile
const Scalar maxVelocity = 1.0; const Scalar maxVelocity = 1.0;
Scalar a = - 4*maxVelocity/(width*width); Scalar a = -4 * maxVelocity / (width * width);
Scalar b = - a*width; Scalar b = -a * width;
Scalar c = 0; Scalar c = 0;
DimVector velocity(0.0); DimVector velocity(0.0);
velocity[1] = a * x*x + b * x + c; velocity[1] = a * x * x + b * x + c;
// hydrostatic pressure // hydrostatic pressure
Scalar rho = 1.189; Scalar rho = 1.189;
Scalar pressure = 1e5 - rho*this->gravity()[1]*y; Scalar pressure = 1e5 - rho * this->gravity()[1] * y;
for (int axisIdx = 0; axisIdx < dimWorld; ++ axisIdx) for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx)
values[velocity0Idx + axisIdx] = velocity[axisIdx]; values[velocity0Idx + axisIdx] = velocity[axisIdx];
values[pressureIdx] = pressure; values[pressureIdx] = pressure;
@ -250,9 +244,8 @@ public:
* is 0 everywhere. * is 0 everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
/*! /*!
@ -262,20 +255,23 @@ public:
* adjacent to the inlet. * adjacent to the inlet.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (onLowerBoundary_(pos) || onUpperBoundary_(pos)) if (onLowerBoundary_(pos) || onUpperBoundary_(pos)) {
{
PrimaryVariables initCond; PrimaryVariables initCond;
initial(initCond, context, spaceIdx, timeIdx); initial(initCond, context, spaceIdx, timeIdx);
constraints.setConstraint(temperatureIdx, energyEqIdx, initCond[temperatureIdx]);; constraints.setConstraint(temperatureIdx, energyEqIdx,
constraints.setConstraint(pressureIdx, conti0EqIdx, initCond[pressureIdx]); initCond[temperatureIdx]);
constraints.setConstraint(moleFrac1Idx, conti0EqIdx+1, initCond[moleFrac1Idx]);; ;
constraints.setConstraint(pressureIdx, conti0EqIdx,
initCond[pressureIdx]);
constraints.setConstraint(moleFrac1Idx, conti0EqIdx + 1,
initCond[moleFrac1Idx]);
;
for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx) for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx)
constraints.setConstraint(velocity0Idx + axisIdx, constraints.setConstraint(velocity0Idx + axisIdx,
momentum0EqIdx + axisIdx, momentum0EqIdx + axisIdx,
@ -300,18 +296,12 @@ private:
bool onBoundary_(const GlobalPosition &pos) const bool onBoundary_(const GlobalPosition &pos) const
{ {
return onLeftBoundary_(pos) return onLeftBoundary_(pos) || onRightBoundary_(pos)
|| onRightBoundary_(pos) || onLowerBoundary_(pos) || onUpperBoundary_(pos);
|| onLowerBoundary_(pos)
|| onUpperBoundary_(pos);
} }
bool inLens_(const GlobalPosition &pos) const bool inLens_(const GlobalPosition &pos) const
{ { return pos[0] < 0.75 && pos[0] > 0.25 && pos[1] < 0.75 && pos[1] > 0.25; }
return
pos[0]<0.75 && pos[0]>0.25 &&
pos[1]<0.75 && pos[1]>0.25;
}
Scalar eps_; Scalar eps_;
}; };

View File

@ -56,6 +56,7 @@ SET_PROP(StokesTestProblem, Fluid)
{ {
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef Opm::GasPhase<Scalar, Opm::N2<Scalar> > type; typedef Opm::GasPhase<Scalar, Opm::N2<Scalar> > type;
}; };
@ -92,15 +93,15 @@ namespace Ewoms {
* free-flow on the left and no-flow at the top and bottom boundaries. * free-flow on the left and no-flow at the top and bottom boundaries.
*/ */
template <class TypeTag> template <class TypeTag>
class StokesTestProblem class StokesTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
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;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, Fluid) Fluid; typedef typename GET_PROP_TYPE(TypeTag, Fluid) Fluid;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
@ -128,7 +129,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
StokesTestProblem(TimeManager &timeManager) StokesTestProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -154,8 +155,7 @@ public:
* This problem assumes a constant temperature of 10 degrees Celsius. * This problem assumes a constant temperature of 10 degrees Celsius.
*/ */
template <class Context> template <class Context>
Scalar temperature(const Context &context, Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
int spaceIdx, int timeIdx) const
{ return 273.15 + 10; } // -> 10 deg C { return 273.15 + 10; } // -> 10 deg C
//! \} //! \}
@ -173,7 +173,8 @@ public:
* a parabolic velocity profile via constraints. * a parabolic velocity profile via constraints.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, const Context &context, int spaceIdx, int timeIdx) const void boundary(BoundaryRateVector &values, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -183,16 +184,16 @@ public:
// parabolic velocity profile // parabolic velocity profile
const Scalar maxVelocity = 1.0; const Scalar maxVelocity = 1.0;
Scalar a = - 4*maxVelocity/(height*height); Scalar a = -4 * maxVelocity / (height * height);
Scalar b = - a*height; Scalar b = -a * height;
Scalar c = 0; Scalar c = 0;
DimVector velocity(0.0); DimVector velocity(0.0);
velocity[0] = a * y*y + b * y + c; velocity[0] = a * y * y + b * y + c;
if (onRightBoundary_(pos)) if (onRightBoundary_(pos))
values.setOutFlow(context, spaceIdx, timeIdx); values.setOutFlow(context, spaceIdx, timeIdx);
else if(onLeftBoundary_(pos)) { else if (onLeftBoundary_(pos)) {
// left boundary is constraint! // left boundary is constraint!
values = 0.0; values = 0.0;
} }
@ -213,9 +214,8 @@ public:
* \copydoc VcfvProblem::initial * \copydoc VcfvProblem::initial
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -225,12 +225,12 @@ public:
// parabolic velocity profile on boundaries // parabolic velocity profile on boundaries
const Scalar maxVelocity = 1.0; const Scalar maxVelocity = 1.0;
Scalar a = - 4*maxVelocity/(height*height); Scalar a = -4 * maxVelocity / (height * height);
Scalar b = - a*height; Scalar b = -a * height;
Scalar c = 0; Scalar c = 0;
DimVector velocity(0.0); DimVector velocity(0.0);
velocity[0] = a * y*y + b * y + c; velocity[0] = a * y * y + b * y + c;
for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx) for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx)
values[velocity0Idx + axisIdx] = velocity[axisIdx]; values[velocity0Idx + axisIdx] = velocity[axisIdx];
@ -244,9 +244,8 @@ public:
* is 0 everywhere. * is 0 everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int timeIdx) const
int spaceIdx, int timeIdx) const
{ rate = Scalar(0.0); } { rate = Scalar(0.0); }
/*! /*!
@ -256,8 +255,7 @@ public:
* velocity profile using constraints. * velocity profile using constraints.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
@ -266,7 +264,9 @@ public:
PrimaryVariables initCond; PrimaryVariables initCond;
initial(initCond, context, spaceIdx, timeIdx); initial(initCond, context, spaceIdx, timeIdx);
constraints.setConstraint(pressureIdx, conti0EqIdx, initCond[pressureIdx]);; constraints.setConstraint(pressureIdx, conti0EqIdx,
initCond[pressureIdx]);
;
for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx) for (int axisIdx = 0; axisIdx < dimWorld; ++axisIdx)
constraints.setConstraint(velocity0Idx + axisIdx, constraints.setConstraint(velocity0Idx + axisIdx,
momentum0EqIdx + axisIdx, momentum0EqIdx + axisIdx,
@ -291,9 +291,8 @@ private:
bool onBoundary_(const GlobalPosition &pos) const bool onBoundary_(const GlobalPosition &pos) const
{ {
return return onLeftBoundary_(pos) || onRightBoundary_(pos)
onLeftBoundary_(pos) || onRightBoundary_(pos) || || onLowerBoundary_(pos) || onUpperBoundary_(pos);
onLowerBoundary_(pos) || onUpperBoundary_(pos);
} }
Scalar eps_; Scalar eps_;

View File

@ -68,7 +68,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar, typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx, /*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx> Traits; /*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
Traits;
// define the material law which is parameterized by effective // define the material law which is parameterized by effective
// saturations // saturations
@ -149,9 +150,8 @@ namespace Ewoms {
* saturation of zero and a geothermal temperature gradient of 0.03 * saturation of zero and a geothermal temperature gradient of 0.03
* K/m. * K/m.
*/ */
template <class TypeTag > template <class TypeTag>
class WaterAirProblem class WaterAirProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
: public GET_PROP_TYPE(TypeTag, BaseProblem)
{ {
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
@ -162,31 +162,30 @@ class WaterAirProblem
// copy some indices for convenience // copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enum { numPhases = FluidSystem::numPhases };
numPhases = FluidSystem::numPhases,
// energy related indices // energy related indices
temperatureIdx = Indices::temperatureIdx, enum { temperatureIdx = Indices::temperatureIdx };
energyEqIdx = Indices::energyEqIdx, enum { energyEqIdx = Indices::energyEqIdx };
// component indices // component indices
H2OIdx = FluidSystem::H2OIdx, enum { H2OIdx = FluidSystem::H2OIdx };
AirIdx = FluidSystem::AirIdx, enum { AirIdx = FluidSystem::AirIdx };
// phase indices // phase indices
lPhaseIdx = FluidSystem::lPhaseIdx, enum { lPhaseIdx = FluidSystem::lPhaseIdx };
gPhaseIdx = FluidSystem::gPhaseIdx, enum { gPhaseIdx = FluidSystem::gPhaseIdx };
// equation indices // equation indices
conti0EqIdx = Indices::conti0EqIdx, enum { conti0EqIdx = Indices::conti0EqIdx };
// Grid and world dimension // Grid and world dimension
dim = GridView::dimension, enum { dim = GridView::dimension };
dimWorld = GridView::dimensionworld enum { dimWorld = GridView::dimensionworld };
};
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;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
@ -195,7 +194,8 @@ class WaterAirProblem
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw;
typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) HeatConductionLawParams; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams)
HeatConductionLawParams;
typedef typename GridView::ctype CoordScalar; typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
@ -207,7 +207,7 @@ public:
* \copydoc Doxygen::defaultProblemConstructor * \copydoc Doxygen::defaultProblemConstructor
*/ */
WaterAirProblem(TimeManager &timeManager) WaterAirProblem(TimeManager &timeManager)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
: ParentType(timeManager, : ParentType(timeManager,
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
#else #else
@ -276,7 +276,8 @@ public:
* permeable than the lower one. * permeable than the lower one.
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const const DimMatrix &intrinsicPermeability(const Context &context, int spaceIdx,
int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -301,7 +302,8 @@ public:
* \copydoc VcfvMultiPhaseProblem::materialLawParams * \copydoc VcfvMultiPhaseProblem::materialLawParams
*/ */
template <class Context> template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, int spaceIdx, int timeIdx) const const MaterialLawParams &materialLawParams(const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
if (isFineMaterial_(pos)) if (isFineMaterial_(pos))
@ -316,18 +318,18 @@ public:
* In this case, we assume the rock-matrix to be granite. * In this case, we assume the rock-matrix to be granite.
*/ */
template <class Context> template <class Context>
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const Scalar heatCapacitySolid(const Context &context, int spaceIdx,
int timeIdx) const
{ {
return return 790 // specific heat capacity of granite [J / (kg K)]
790 // specific heat capacity of granite [J / (kg K)] * 2700; // density of granite [kg/m^3]
* 2700; // density of granite [kg/m^3]
} }
/*! /*!
* \copydoc VcfvMultiPhaseProblem::heatConductionParams * \copydoc VcfvMultiPhaseProblem::heatConductionParams
*/ */
template <class Context> template <class Context>
const HeatConductionLawParams& const HeatConductionLawParams &
heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
@ -352,15 +354,12 @@ public:
* right boundaries of the domain. * right boundaries of the domain.
*/ */
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.cvCenter(spaceIdx, timeIdx); const auto &pos = context.cvCenter(spaceIdx, timeIdx);
assert(onLeftBoundary_(pos) || assert(onLeftBoundary_(pos) || onLowerBoundary_(pos)
onLowerBoundary_(pos) || || onRightBoundary_(pos) || onUpperBoundary_(pos));
onRightBoundary_(pos) ||
onUpperBoundary_(pos));
if (onInlet_(pos)) { if (onInlet_(pos)) {
RateVector massRate(0.0); RateVector massRate(0.0);
@ -370,8 +369,6 @@ public:
values.setMassRate(massRate); values.setMassRate(massRate);
} }
else if (onLeftBoundary_(pos) || onRightBoundary_(pos)) { else if (onLeftBoundary_(pos) || onRightBoundary_(pos)) {
//int globalIdx = context.elemContext().globalSpaceIndex(context.insideScvIndex(spaceIdx,timeIdx), timeIdx);
Opm::CompositionalFluidState<Scalar, FluidSystem> fs; Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
@ -397,9 +394,10 @@ public:
* liquid water and assume hydrostatic pressure. * liquid water and assume hydrostatic pressure.
*/ */
template <class Context> template <class Context>
void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const void initial(PrimaryVariables &values, const Context &context, int spaceIdx,
int timeIdx) const
{ {
//int globalIdx = context.globalSpaceIndex(spaceIdx, timeIdx); // int globalIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
Opm::CompositionalFluidState<Scalar, FluidSystem> fs; Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx); initialFluidState_(fs, context, spaceIdx, timeIdx);
@ -415,14 +413,14 @@ public:
* of the finite-volumes which are closest to the inlet constant. * of the finite-volumes which are closest to the inlet constant.
*/ */
template <class Context> template <class Context>
void constraints(Constraints &constraints, void constraints(Constraints &constraints, const Context &context,
const Context &context,
int spaceIdx, int timeIdx) const int spaceIdx, int timeIdx) const
{ {
const auto &pos = context.pos(spaceIdx, timeIdx); const auto &pos = context.pos(spaceIdx, timeIdx);
if (onInlet_(pos)) { if (onInlet_(pos)) {
constraints.setConstraint(temperatureIdx, energyEqIdx, 380);; constraints.setConstraint(temperatureIdx, energyEqIdx, 380);
;
} }
} }
@ -433,8 +431,8 @@ public:
* everywhere. * everywhere.
*/ */
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate, const Context &context, int spaceIdx,
const Context &context, int spaceIdx, int timeIdx) const int timeIdx) const
{ rate = 0; } { rate = 0; }
//! \} //! \}
@ -459,12 +457,13 @@ private:
{ return (20 < pos[0]) && (pos[0] < 30) && (pos[1] < 30); } { return (20 < pos[0]) && (pos[0] < 30) && (pos[1] < 30); }
template <class Context, class FluidState> template <class Context, class FluidState>
void initialFluidState_(FluidState &fs, const Context &context, int spaceIdx, int timeIdx) const void initialFluidState_(FluidState &fs, const Context &context,
int spaceIdx, int timeIdx) const
{ {
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx); const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
Scalar densityW = 1000.0; Scalar densityW = 1000.0;
fs.setPressure(lPhaseIdx, 1e5 + (maxDepth_ - pos[1])*densityW*9.81); fs.setPressure(lPhaseIdx, 1e5 + (maxDepth_ - pos[1]) * densityW * 9.81);
fs.setSaturation(lPhaseIdx, 1.0); fs.setSaturation(lPhaseIdx, 1.0);
fs.setMoleFraction(lPhaseIdx, H2OIdx, 1.0); fs.setMoleFraction(lPhaseIdx, H2OIdx, 1.0);
fs.setMoleFraction(lPhaseIdx, AirIdx, 0.0); fs.setMoleFraction(lPhaseIdx, AirIdx, 0.0);
@ -472,18 +471,20 @@ private:
if (inHighTemperatureRegion_(pos)) if (inHighTemperatureRegion_(pos))
fs.setTemperature(380); fs.setTemperature(380);
else else
fs.setTemperature(283.0 + (maxDepth_ - pos[1])*0.03); fs.setTemperature(283.0 + (maxDepth_ - pos[1]) * 0.03);
// set the gas saturation and pressure // set the gas saturation and pressure
fs.setSaturation(gPhaseIdx, 0); fs.setSaturation(gPhaseIdx, 0);
Scalar pc[numPhases]; Scalar pc[numPhases];
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx); const auto &matParams = materialLawParams(context, spaceIdx, timeIdx);
MaterialLaw::capillaryPressures(pc, matParams, fs); MaterialLaw::capillaryPressures(pc, matParams, fs);
fs.setPressure(gPhaseIdx, fs.pressure(lPhaseIdx) + (pc[gPhaseIdx] - pc[lPhaseIdx])); fs.setPressure(gPhaseIdx, fs.pressure(lPhaseIdx)
+ (pc[gPhaseIdx] - pc[lPhaseIdx]));
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP; typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
CFRP::solve(fs, paramCache, lPhaseIdx, /*setViscosity=*/false, /*setEnthalpy=*/true); CFRP::solve(fs, paramCache, lPhaseIdx, /*setViscosity=*/false,
/*setEnthalpy=*/true);
} }
void computeHeatCondParams_(HeatConductionLawParams &params, Scalar poro) void computeHeatCondParams_(HeatConductionLawParams &params, Scalar poro)
@ -507,12 +508,13 @@ private:
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
Scalar lambdaSaturated; Scalar lambdaSaturated;
if (FluidSystem::isLiquid(phaseIdx)) { if (FluidSystem::isLiquid(phaseIdx)) {
Scalar lambdaFluid = Scalar lambdaFluid
FluidSystem::thermalConductivity(fs, paramCache, phaseIdx); = FluidSystem::thermalConductivity(fs, paramCache, phaseIdx);
lambdaSaturated = std::pow(lambdaGranite, (1-poro)) + std::pow(lambdaFluid, poro); lambdaSaturated = std::pow(lambdaGranite, (1 - poro))
+ std::pow(lambdaFluid, poro);
} }
else else
lambdaSaturated = std::pow(lambdaGranite, (1-poro)); lambdaSaturated = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(phaseIdx, lambdaSaturated); params.setFullySaturatedLambda(phaseIdx, lambdaSaturated);
if (!FluidSystem::isLiquid(phaseIdx)) if (!FluidSystem::isLiquid(phaseIdx))
@ -521,7 +523,7 @@ private:
} }
bool isFineMaterial_(const GlobalPosition &pos) const bool isFineMaterial_(const GlobalPosition &pos) const
{ return pos[dim-1] > layerBottom_; } { return pos[dim - 1] > layerBottom_; }
DimMatrix fineK_; DimMatrix fineK_;
DimMatrix coarseK_; DimMatrix coarseK_;

View File

@ -30,9 +30,10 @@
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
NEW_TYPE_TAG(ReservoirProblem, INHERITS_FROM(VcfvBlackOil, ReservoirBaseProblem)); NEW_TYPE_TAG(ReservoirProblem, INHERITS_FROM(VcfvBlackOil, ReservoirBaseProblem));
}} }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(ReservoirProblem) ProblemTypeTag; typedef TTAG(ReservoirProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -18,7 +18,8 @@
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \file * \file
* \brief Test for the isothermal Navier-Stokes VCVF discretization; this test case is * \brief Test for the isothermal Navier-Stokes VCVF discretization; this test
* case is
* known as lid-driven cavity-flow in literature. * known as lid-driven cavity-flow in literature.
*/ */
#include "config.h" #include "config.h"
@ -26,7 +27,7 @@
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/navierstokestestproblem.hh" #include "problems/navierstokestestproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(NavierStokesTestProblem) ProblemTypeTag; typedef TTAG(NavierStokesTestProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -18,7 +18,8 @@
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \file * \file
* \brief A test for numerical integration using the vertex-centered finite volume geometries. * \brief A test for numerical integration using the vertex-centered finite
* volume geometries.
*/ */
#include "config.h" #include "config.h"
@ -53,16 +54,14 @@ void testIdenityMapping()
{ {
QuadratureGeom foo; QuadratureGeom foo;
Scalar corners[][3] = { Scalar corners[][3] = { { 0, 0, 0 },
{ 0, 0, 0 }, { 1, 0, 0 },
{ 1, 0, 0 }, { 0, 1, 0 },
{ 0, 1, 0 }, { 1, 1, 0 },
{ 1, 1, 0 }, { 0, 0, 1 },
{ 0, 0, 1 }, { 1, 0, 1 },
{ 1, 0, 1 }, { 0, 1, 1 },
{ 0, 1, 1 }, { 1, 1, 1 } };
{ 1, 1, 1 }
};
foo.setCorners(corners, 8); foo.setCorners(corners, 8);
std::cout << "testing identity mapping...\n"; std::cout << "testing identity mapping...\n";
@ -72,9 +71,9 @@ void testIdenityMapping()
for (int k = 0; k < n; ++k) { for (int k = 0; k < n; ++k) {
LocalPosition localPos; LocalPosition localPos;
localPos[0] = Scalar(i)/(n - 1); localPos[0] = Scalar(i) / (n - 1);
localPos[1] = Scalar(j)/(n - 1); localPos[1] = Scalar(j) / (n - 1);
localPos[2] = Scalar(k)/(n - 1); localPos[2] = Scalar(k) / (n - 1);
GlobalPosition globalPos = foo.global(localPos); GlobalPosition globalPos = foo.global(localPos);
@ -107,10 +106,12 @@ void writeTetrahedronSubControlVolumes(const Grid &grid)
for (; eIt != eEndIt; ++eIt) { for (; eIt != eEndIt; ++eIt) {
fvElemGeom.update(gridView, *eIt); fvElemGeom.update(gridView, *eIt);
for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) { for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) {
const auto &scvLocalGeom = *(fvElemGeom.subContVol[scvIdx].localGeometry); const auto &scvLocalGeom
= *(fvElemGeom.subContVol[scvIdx].localGeometry);
for (int i = 0; i < scvLocalGeom.numCorners; ++ i) { for (int i = 0; i < scvLocalGeom.numCorners; ++i) {
GlobalPosition pos(eIt->geometry().global(scvLocalGeom.corner(i))); GlobalPosition pos(
eIt->geometry().global(scvLocalGeom.corner(i)));
gf2.insertVertex(pos); gf2.insertVertex(pos);
} }
} }
@ -121,15 +122,16 @@ void writeTetrahedronSubControlVolumes(const Grid &grid)
for (; eIt != eEndIt; ++eIt) { for (; eIt != eEndIt; ++eIt) {
fvElemGeom.update(gridView, *eIt); fvElemGeom.update(gridView, *eIt);
for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) { for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) {
const auto &scvLocalGeom = *fvElemGeom.subContVol[scvIdx].localGeometry; const auto &scvLocalGeom
= *fvElemGeom.subContVol[scvIdx].localGeometry;
std::vector<unsigned int> vertexIndices; std::vector<unsigned int> vertexIndices;
for (int i = 0; i < scvLocalGeom.numCorners; ++ i) { for (int i = 0; i < scvLocalGeom.numCorners; ++i) {
vertexIndices.push_back(cornerOffset); vertexIndices.push_back(cornerOffset);
++ cornerOffset; ++cornerOffset;
} }
gf2.insertElement(Dune::GeometryType(Dune::GeometryType::cube,dim), gf2.insertElement(Dune::GeometryType(Dune::GeometryType::cube, dim),
vertexIndices); vertexIndices);
} }
} }
@ -147,22 +149,16 @@ void testTetrahedron()
typedef Dune::ALUGrid<dim, dim, Dune::simplex, Dune::nonconforming> Grid; typedef Dune::ALUGrid<dim, dim, Dune::simplex, Dune::nonconforming> Grid;
typedef Dune::GridFactory<Grid> GridFactory; typedef Dune::GridFactory<Grid> GridFactory;
GridFactory gf; GridFactory gf;
Scalar corners[][3] = { Scalar corners[][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
{ 0, 0, 0 },
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
for (unsigned i = 0; i < sizeof(corners)/sizeof(corners[0]); ++i) { for (unsigned i = 0; i < sizeof(corners) / sizeof(corners[0]); ++i) {
GlobalPosition pos; GlobalPosition pos;
for (unsigned j = 0; j < dim; ++j) for (unsigned j = 0; j < dim; ++j)
pos[j] = corners[i][j]; pos[j] = corners[i][j];
gf.insertVertex(pos); gf.insertVertex(pos);
} }
std::vector<unsigned int> v = { 0, 1, 2, 3 }; std::vector<unsigned int> v = { 0, 1, 2, 3 };
gf.insertElement(Dune::GeometryType(Dune::GeometryType::simplex,dim), gf.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, dim), v);
v);
auto *grid = gf.createGrid(); auto *grid = gf.createGrid();
// write the sub-control volumes to a VTK file. // write the sub-control volumes to a VTK file.
@ -193,10 +189,12 @@ void writeCubeSubControlVolumes(const Grid &grid)
for (; eIt != eEndIt; ++eIt) { for (; eIt != eEndIt; ++eIt) {
fvElemGeom.update(gridView, *eIt); fvElemGeom.update(gridView, *eIt);
for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) { for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) {
const auto &scvLocalGeom = *(fvElemGeom.subContVol[scvIdx].localGeometry); const auto &scvLocalGeom
= *(fvElemGeom.subContVol[scvIdx].localGeometry);
for (int i = 0; i < scvLocalGeom.numCorners; ++ i) { for (int i = 0; i < scvLocalGeom.numCorners; ++i) {
GlobalPosition pos(eIt->geometry().global(scvLocalGeom.corner(i))); GlobalPosition pos(
eIt->geometry().global(scvLocalGeom.corner(i)));
gf2.insertVertex(pos); gf2.insertVertex(pos);
} }
} }
@ -207,15 +205,16 @@ void writeCubeSubControlVolumes(const Grid &grid)
for (; eIt != eEndIt; ++eIt) { for (; eIt != eEndIt; ++eIt) {
fvElemGeom.update(gridView, *eIt); fvElemGeom.update(gridView, *eIt);
for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) { for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) {
const auto &scvLocalGeom = *fvElemGeom.subContVol[scvIdx].localGeometry; const auto &scvLocalGeom
= *fvElemGeom.subContVol[scvIdx].localGeometry;
std::vector<unsigned int> vertexIndices; std::vector<unsigned int> vertexIndices;
for (int i = 0; i < scvLocalGeom.numCorners; ++ i) { for (int i = 0; i < scvLocalGeom.numCorners; ++i) {
vertexIndices.push_back(cornerOffset); vertexIndices.push_back(cornerOffset);
++ cornerOffset; ++cornerOffset;
} }
gf2.insertElement(Dune::GeometryType(Dune::GeometryType::cube,dim), gf2.insertElement(Dune::GeometryType(Dune::GeometryType::cube, dim),
vertexIndices); vertexIndices);
} }
} }
@ -233,26 +232,23 @@ void testCube()
typedef Dune::ALUGrid<dim, dim, Dune::cube, Dune::nonconforming> Grid; typedef Dune::ALUGrid<dim, dim, Dune::cube, Dune::nonconforming> Grid;
typedef Dune::GridFactory<Grid> GridFactory; typedef Dune::GridFactory<Grid> GridFactory;
GridFactory gf; GridFactory gf;
Scalar corners[][3] = { Scalar corners[][3] = { { 0, 0, 0 },
{ 0, 0, 0 }, { 1, 0, 0 },
{ 1, 0, 0 }, { 0, 2, 0 },
{ 0, 2, 0 }, { 3, 3, 0 },
{ 3, 3, 0 }, { 0, 0, 4 },
{ 0, 0, 4 }, { 5, 0, 5 },
{ 5, 0, 5 }, { 0, 6, 6 },
{ 0, 6, 6 }, { 7, 7, 7 }, };
{ 7, 7, 7 },
};
for (unsigned i = 0; i < sizeof(corners)/sizeof(corners[0]); ++i) { for (unsigned i = 0; i < sizeof(corners) / sizeof(corners[0]); ++i) {
GlobalPosition pos; GlobalPosition pos;
for (unsigned j = 0; j < dim; ++j) for (unsigned j = 0; j < dim; ++j)
pos[j] = corners[i][j]; pos[j] = corners[i][j];
gf.insertVertex(pos); gf.insertVertex(pos);
} }
std::vector<unsigned int> v = { 0, 1, 2, 3, 4, 5, 6, 7 }; std::vector<unsigned int> v = { 0, 1, 2, 3, 4, 5, 6, 7 };
gf.insertElement(Dune::GeometryType(Dune::GeometryType::cube,dim), gf.insertElement(Dune::GeometryType(Dune::GeometryType::cube, dim), v);
v);
auto *grid = gf.createGrid(); auto *grid = gf.createGrid();
// write the sub-control volumes to a VTK file. // write the sub-control volumes to a VTK file.
@ -266,7 +262,7 @@ void testQuadrature()
{ {
std::cout << "testing SCV quadrature...\n"; std::cout << "testing SCV quadrature...\n";
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
std::bitset<dim> isPeriodic(false); std::bitset<dim> isPeriodic(false);
std::array<int, dim> cellRes; std::array<int, dim> cellRes;
#else #else
@ -283,16 +279,15 @@ void testQuadrature()
#ifdef HAVE_MPI #ifdef HAVE_MPI
Dune::MPIHelper::getCommunicator(), Dune::MPIHelper::getCommunicator(),
#endif #endif
upperRight, // upper right upperRight, // upper right
cellRes, // number of cells cellRes, // number of cells
isPeriodic, isPeriodic, 0); // overlap
0); // overlap
// compute approximate integral // compute approximate integral
auto gridView = grid.leafView(); auto gridView = grid.leafView();
auto eIt = gridView.begin<0>(); auto eIt = gridView.begin<0>();
const auto eEndIt = gridView.end<0>(); const auto eEndIt = gridView.end<0>();
Scalar result=0; Scalar result = 0;
// instanciate a FvElementGeometry // instanciate a FvElementGeometry
typedef Ewoms::VcfvElementGeometry<Scalar, GridView> FvElementGeometry; typedef Ewoms::VcfvElementGeometry<Scalar, GridView> FvElementGeometry;
FvElementGeometry fvElemGeom; FvElementGeometry fvElemGeom;
@ -303,43 +298,46 @@ void testQuadrature()
// loop over all sub-control volumes // loop over all sub-control volumes
for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) { for (int scvIdx = 0; scvIdx < fvElemGeom.numVertices; ++scvIdx) {
const auto &scvLocalGeom = *fvElemGeom.subContVol[scvIdx].localGeometry; const auto &scvLocalGeom
= *fvElemGeom.subContVol[scvIdx].localGeometry;
Dune::GeometryType geomType = scvLocalGeom.type(); Dune::GeometryType geomType = scvLocalGeom.type();
static const int quadratureOrder = 2; static const int quadratureOrder = 2;
const auto &rule = Dune::QuadratureRules<Scalar,dim>::rule(geomType, quadratureOrder); const auto &rule
= Dune::QuadratureRules<Scalar, dim>::rule(geomType,
quadratureOrder);
// integrate f over the sub-control volume // integrate f over the sub-control volume
for (auto it = rule.begin(); it != rule.end(); ++ it) for (auto it = rule.begin(); it != rule.end(); ++it) {
{
auto posScvLocal = it->position(); auto posScvLocal = it->position();
auto posElemLocal = scvLocalGeom.global(posScvLocal); auto posElemLocal = scvLocalGeom.global(posScvLocal);
auto posGlobal = elemGeom.global(posScvLocal); auto posGlobal = elemGeom.global(posScvLocal);
Scalar fval = f(posGlobal); Scalar fval = f(posGlobal);
Scalar weight = it->weight(); Scalar weight = it->weight();
Scalar detjac = Scalar detjac = scvLocalGeom.integrationElement(posScvLocal)
scvLocalGeom.integrationElement(posScvLocal) * * elemGeom.integrationElement(posElemLocal);
elemGeom.integrationElement(posElemLocal);
result += fval * weight * detjac; result += fval * weight * detjac;
} }
} }
} }
std::cout << "result: " << result << " (expected value: " << 1.0/(1 << dim) << ")\n"; std::cout << "result: " << result
<< " (expected value: " << 1.0 / (1 << dim) << ")\n";
} }
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
// initialize MPI, finalize is done automatically on exit // initialize MPI, finalize is done automatically on exit
Dune::MPIHelper::instance(argc, argv); Dune::MPIHelper::instance(argc, argv);
testIdenityMapping(); testIdenityMapping();
// test the quadrature in a tetrahedron. since the CLang compiler // test the quadrature in a tetrahedron. since the CLang compiler
// prior to version 3.2 generates incorrect code here, we do not // prior to version 3.2 generates incorrect code here, we do not
// do it if the compiler is clang 3.1 or older. // do it if the compiler is clang 3.1 or older.
#if !__clang__ || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3) #if !__clang__ || __clang_major__ > 3 \
|| (__clang_major__ == 3 && __clang_minor__ >= 3)
testTetrahedron(); testTetrahedron();
testCube(); testCube();
#endif #endif

View File

@ -24,7 +24,7 @@
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/stokestestproblem.hh" #include "problems/stokestestproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(StokesTestProblem) ProblemTypeTag; typedef TTAG(StokesTestProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -25,7 +25,7 @@
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/stokes2ctestproblem.hh" #include "problems/stokes2ctestproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(Stokes2cTestProblem) ProblemTypeTag; typedef TTAG(Stokes2cTestProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -25,7 +25,7 @@
#include <ewoms/common/start.hh> #include <ewoms/common/start.hh>
#include "problems/stokesnitestproblem.hh" #include "problems/stokesnitestproblem.hh"
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(StokesNITestProblem) ProblemTypeTag; typedef TTAG(StokesNITestProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);

View File

@ -32,9 +32,10 @@ namespace Properties {
NEW_TYPE_TAG(WaterAirProblem, INHERITS_FROM(VcfvPvs, WaterAirBaseProblem)); NEW_TYPE_TAG(WaterAirProblem, INHERITS_FROM(VcfvPvs, WaterAirBaseProblem));
SET_BOOL_PROP(WaterAirProblem, EnableEnergy, true); SET_BOOL_PROP(WaterAirProblem, EnableEnergy, true);
} } }
}
int main(int argc, char** argv) int main(int argc, char **argv)
{ {
typedef TTAG(WaterAirProblem) ProblemTypeTag; typedef TTAG(WaterAirProblem) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv); return Ewoms::start<ProblemTypeTag>(argc, argv);