mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -21,8 +21,10 @@
|
||||
*
|
||||
* \copydoc Ewoms::TutorialProblemCoupled
|
||||
*/
|
||||
#ifndef EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/
|
||||
#define EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/
|
||||
#ifndef EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro
|
||||
// /*@\label{tutorial-coupled:guardian1}@*/
|
||||
#define EWOMS_TUTORIAL1_PROBLEM_HH // guardian macro
|
||||
// /*@\label{tutorial-coupled:guardian2}@*/
|
||||
|
||||
// The numerical model
|
||||
#include <ewoms/models/immiscible/immisciblemodel.hh>
|
||||
@@ -32,13 +34,16 @@
|
||||
#include <opm/material/components/Lnapl.hpp>
|
||||
|
||||
// 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/MaterialTraits.hpp>
|
||||
|
||||
// For the DUNE grid
|
||||
#include <dune/grid/yaspgrid.hh> /*@\label{tutorial-coupled:include-grid-manager}@*/
|
||||
#include <ewoms/io/cubegridcreator.hh> /*@\label{tutorial-coupled:include-grid-creator}@*/
|
||||
#include \
|
||||
<dune/grid/yaspgrid.hh> /*@\label{tutorial-coupled:include-grid-manager}@*/
|
||||
#include \
|
||||
<ewoms/io/cubegridcreator.hh> /*@\label{tutorial-coupled:include-grid-creator}@*/
|
||||
|
||||
// For Dune::FieldMatrix
|
||||
#include <dune/common/fmatrix.hh>
|
||||
@@ -53,25 +58,37 @@ class TutorialProblemCoupled;
|
||||
namespace Opm {
|
||||
namespace Properties {
|
||||
// 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_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/
|
||||
{ typedef Ewoms::TutorialProblemCoupled<TypeTag> type;};
|
||||
SET_PROP(TutorialProblemCoupled,
|
||||
Problem) /*@\label{tutorial-coupled:set-problem}@*/
|
||||
{
|
||||
typedef Ewoms::TutorialProblemCoupled<TypeTag> type;
|
||||
};
|
||||
|
||||
// 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, GridCreator, Ewoms::CubeGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-gridcreator}@*/
|
||||
SET_TYPE_PROP(TutorialProblemCoupled, Grid,
|
||||
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_TYPE_PROP(TutorialProblemCoupled, WettingPhase, /*@\label{tutorial-coupled:wettingPhase}@*/
|
||||
Opm::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
|
||||
Opm::SimpleH2O<typename GET_PROP_TYPE(TypeTag, Scalar)> >);
|
||||
SET_TYPE_PROP(
|
||||
TutorialProblemCoupled,
|
||||
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_TYPE_PROP(TutorialProblemCoupled, 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_TYPE_PROP(
|
||||
TutorialProblemCoupled,
|
||||
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_PROP(TutorialProblemCoupled, MaterialLaw)
|
||||
@@ -83,11 +100,13 @@ private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
|
||||
typedef Opm::TwoPhaseMaterialTraits<Scalar,
|
||||
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
|
||||
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits;
|
||||
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
|
||||
Traits;
|
||||
|
||||
// define the material law which is parameterized by effective
|
||||
// saturations
|
||||
typedef Opm::RegularizedBrooksCorey<Traits> RawMaterialLaw; /*@\label{tutorial-coupled:rawlaw}@*/
|
||||
typedef Opm::RegularizedBrooksCorey<Traits>
|
||||
RawMaterialLaw; /*@\label{tutorial-coupled:rawlaw}@*/
|
||||
|
||||
public:
|
||||
// Convert absolute saturations into effective ones before passing
|
||||
@@ -96,23 +115,27 @@ public:
|
||||
};
|
||||
|
||||
// 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);
|
||||
|
||||
// define the size of the initial time step [s]
|
||||
SET_SCALAR_PROP(TutorialProblemCoupled, InitialTimeStepSize, 125.0);
|
||||
|
||||
// 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, DomainSizeZ, 0.0);
|
||||
|
||||
// // define the number of cells used for discretizing the physical domain
|
||||
SET_INT_PROP(TutorialProblemCoupled, CellsX, 100);
|
||||
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 Opm
|
||||
|
||||
@@ -120,7 +143,8 @@ namespace Ewoms {
|
||||
//! Tutorial problem using the fully-implicit immiscible model.
|
||||
template <class TypeTag>
|
||||
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, Scalar) Scalar;
|
||||
@@ -136,11 +160,13 @@ class TutorialProblemCoupled
|
||||
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
|
||||
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, Indices) Indices;
|
||||
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
|
||||
enum { numPhases = FluidSystem::numPhases };
|
||||
@@ -154,20 +180,21 @@ class TutorialProblemCoupled
|
||||
public:
|
||||
//! The constructor of the problem
|
||||
TutorialProblemCoupled(TimeManager &timeManager)
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3)
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3)
|
||||
: ParentType(timeManager,
|
||||
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView())
|
||||
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()),
|
||||
#else
|
||||
: ParentType(timeManager,
|
||||
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView())
|
||||
GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()),
|
||||
#endif
|
||||
, eps_(3e-6)
|
||||
eps_(3e-6)
|
||||
{
|
||||
// Use an isotropic and homogeneous intrinsic permeability
|
||||
K_ = this->toDimMatrix_(1e-7);
|
||||
|
||||
// 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
|
||||
|
||||
// Set the residual saturations
|
||||
@@ -178,7 +205,8 @@ public:
|
||||
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
|
||||
{ return "tutorial_coupled"; }
|
||||
|
||||
@@ -189,30 +217,34 @@ public:
|
||||
|
||||
//! Returns the intrinsic permeability tensor [m^2] at a position.
|
||||
template <class Context>
|
||||
const DimMatrix &intrinsicPermeability(const Context &context, /*@\label{tutorial-coupled:permeability}@*/
|
||||
int spaceIdx, int timeIdx) const
|
||||
const DimMatrix &intrinsicPermeability(
|
||||
const Context &context, /*@\label{tutorial-coupled:permeability}@*/
|
||||
int spaceIdx, int timeIdx) const
|
||||
{ return K_; }
|
||||
|
||||
//! Defines the porosity [-] of the medium at a given position
|
||||
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; }
|
||||
|
||||
//! Returns the parameter object for the material law at a given position
|
||||
template <class Context>
|
||||
const MaterialLawParams& materialLawParams(const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/
|
||||
int spaceIdx, int timeIdx) const
|
||||
const MaterialLawParams &materialLawParams(
|
||||
const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/
|
||||
int spaceIdx, int timeIdx) const
|
||||
{ return materialParams_; }
|
||||
|
||||
//! Evaluates the boundary conditions.
|
||||
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);
|
||||
if (pos[0] < eps_) {
|
||||
// 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;
|
||||
Scalar Sw = 1.0;
|
||||
@@ -231,7 +263,7 @@ public:
|
||||
// forced outflow at the right boundary
|
||||
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)]
|
||||
|
||||
values.setMassRate(massRate);
|
||||
@@ -240,10 +272,12 @@ public:
|
||||
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.
|
||||
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[contiNEqIdx] = 0.0;
|
||||
@@ -251,8 +285,8 @@ public:
|
||||
|
||||
//! Evaluates the initial value at a given position in the domain.
|
||||
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::ImmiscibleFluidState<Scalar, FluidSystem> fs;
|
||||
|
||||
@@ -266,7 +300,9 @@ public:
|
||||
|
||||
// set pressure of the wetting phase to 200 kPa = 2 bar
|
||||
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(nPhaseIdx, 200e3 + pC[nPhaseIdx] - pC[nPhaseIdx]);
|
||||
|
||||
@@ -276,7 +312,7 @@ public:
|
||||
private:
|
||||
DimMatrix K_;
|
||||
// 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
|
||||
Scalar eps_;
|
||||
|
||||
Reference in New Issue
Block a user