28#ifndef EWOMS_FRACTURE_PROBLEM_HH
29#define EWOMS_FRACTURE_PROBLEM_HH
33#define DISABLE_ALUGRID_SFC_ORDERING 1
34#include <dune/alugrid/grid.hh>
35#include <dune/alugrid/dgf.hh>
37#error "dune-alugrid not found!"
40#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
41#include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
42#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
43#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
44#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
45#include <opm/material/thermal/SomertonThermalConductionLaw.hpp>
46#include <opm/material/thermal/ConstantSolidHeatCapLaw.hpp>
47#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
48#include <opm/material/components/SimpleH2O.hpp>
49#include <opm/material/components/Dnapl.hpp>
57#include <dune/common/version.hh>
58#include <dune/common/fmatrix.hh>
59#include <dune/common/fvector.hh>
66template <
class TypeTag>
82template<
class TypeTag>
84{
using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming>; };
87template<
class TypeTag>
92template<
class TypeTag>
97template<
class TypeTag>
104 using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
108template<
class TypeTag>
115 using type = Opm::LiquidPhase<Scalar, Opm::DNAPL<Scalar> >;
119template<
class TypeTag>
124 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
125 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
128 using Traits = Opm::TwoPhaseMaterialTraits<Scalar,
129 FluidSystem::wettingPhaseIdx,
130 FluidSystem::nonWettingPhaseIdx>;
134 using EffectiveLaw = Opm::RegularizedBrooksCorey<Traits>;
138 using type = Opm::EffToAbsLaw<EffectiveLaw>;
142template<
class TypeTag>
144{
static constexpr bool value =
true; };
147template<
class TypeTag>
156 using type = Opm::SomertonThermalConductionLaw<FluidSystem, Scalar>;
160template<
class TypeTag>
162{
using type = Opm::ConstantSolidHeatCapLaw<GetPropType<TypeTag, Properties::Scalar>>; };
165template<
class TypeTag>
167{
static constexpr bool value =
true; };
170template<
class TypeTag>
175template<
class TypeTag>
180template<
class TypeTag>
199template <
class TypeTag>
222 wettingPhaseIdx = MaterialLaw::wettingPhaseIdx,
223 nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx,
226 numPhases = FluidSystem::numPhases,
229 dim = GridView::dimension,
230 dimWorld = GridView::dimensionworld
233 using FluidState = Opm::ImmiscibleFluidState<Scalar, FluidSystem>;
235 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
236 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
241 bool contains(Dune::GeometryType gt)
242 {
return gt.dim() == dim - 1; }
244 using FaceMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
253 : ParentType(simulator)
261 ParentType::finishInit();
264 temperature_ = 273.15 + 20;
266 matrixMaterialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
267 matrixMaterialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
268 fractureMaterialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
269 fractureMaterialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
272 matrixMaterialParams_.setEntryPC(0.0);
273 matrixMaterialParams_.setMaxPC(2000.0);
274 fractureMaterialParams_.setEntryPC(0.0);
275 fractureMaterialParams_.setMaxPC(1000.0);
279 matrixMaterialParams_.setEntryPressure(2000);
280 matrixMaterialParams_.setLambda(2.0);
281 matrixMaterialParams_.setPcLowSw(1e-1);
282 fractureMaterialParams_.setEntryPressure(1000);
283 fractureMaterialParams_.setLambda(2.0);
284 fractureMaterialParams_.setPcLowSw(5e-2);
288 matrixMaterialParams_.setVgAlpha(0.0037);
289 matrixMaterialParams_.setVgN(4.7);
290 fractureMaterialParams_.setVgAlpha(0.0025);
291 fractureMaterialParams_.setVgN(4.7);
294 matrixMaterialParams_.finalize();
295 fractureMaterialParams_.finalize();
297 matrixK_ = this->toDimMatrix_(1e-15);
298 fractureK_ = this->toDimMatrix_(1e5 * 1e-15);
300 matrixPorosity_ = 0.10;
301 fracturePorosity_ = 0.25;
302 fractureWidth_ = 1e-3;
305 initEnergyParams_(thermalConductionParams_, matrixPorosity_);
313 ParentType::registerParameters();
315 Parameters::SetDefault<Parameters::GridFile>(
"data/fracture.art.dgf");
316 Parameters::SetDefault<Parameters::EndTime<Scalar>>(3e3);
317 Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100);
330 std::ostringstream oss;
331 oss <<
"fracture_" << Model::name();
347 this->model().globalStorage(storage);
350 if (this->gridView().comm().rank() == 0) {
351 std::cout <<
"Storage: " << storage << std::endl << std::flush;
359 template <
class Context>
361 [[maybe_unused]]
unsigned spaceIdx,
362 [[maybe_unused]]
unsigned timeIdx)
const
363 {
return temperature_; }
375 template <
class Context>
377 [[maybe_unused]]
unsigned spaceIdx,
378 [[maybe_unused]]
unsigned timeIdx)
const
386 template <
class Context>
388 [[maybe_unused]]
unsigned spaceIdx,
389 [[maybe_unused]]
unsigned timeIdx)
const
390 {
return fractureK_; }
395 template <
class Context>
396 Scalar
porosity([[maybe_unused]]
const Context& context,
397 [[maybe_unused]]
unsigned spaceIdx,
398 [[maybe_unused]]
unsigned timeIdx)
const
399 {
return matrixPorosity_; }
406 template <
class Context>
408 [[maybe_unused]]
unsigned spaceIdx,
409 [[maybe_unused]]
unsigned timeIdx)
const
410 {
return fracturePorosity_; }
415 template <
class Context>
417 [[maybe_unused]]
unsigned spaceIdx,
418 [[maybe_unused]]
unsigned timeIdx)
const
419 {
return matrixMaterialParams_; }
426 template <
class Context>
428 [[maybe_unused]]
unsigned spaceIdx,
429 [[maybe_unused]]
unsigned timeIdx)
const
430 {
return fractureMaterialParams_; }
436 {
return this->simulator().vanguard().fractureMapper(); }
450 template <
class Context>
452 [[maybe_unused]]
unsigned spaceIdx1,
453 [[maybe_unused]]
unsigned spaceIdx2,
454 [[maybe_unused]]
unsigned timeIdx)
const
455 {
return fractureWidth_; }
460 template <
class Context>
461 const ThermalConductionLawParams&
463 [[maybe_unused]]
unsigned spaceIdx,
464 [[maybe_unused]]
unsigned timeIdx)
const
465 {
return thermalConductionParams_; }
472 template <
class Context>
473 const SolidEnergyLawParams&
475 [[maybe_unused]]
unsigned spaceIdx,
476 [[maybe_unused]]
unsigned timeIdx)
const
477 {
return solidEnergyParams_; }
489 template <
class Context>
490 void boundary(BoundaryRateVector& values,
const Context& context,
491 unsigned spaceIdx,
unsigned timeIdx)
const
493 const GlobalPosition& pos = context.pos(spaceIdx, timeIdx);
495 if (onRightBoundary_(pos)) {
498 FluidState fluidState;
499 fluidState.setTemperature(temperature_);
501 fluidState.setSaturation(wettingPhaseIdx, 0.0);
502 fluidState.setSaturation(nonWettingPhaseIdx,
503 1.0 - fluidState.saturation(wettingPhaseIdx));
505 fluidState.setPressure(wettingPhaseIdx, 1e5);
506 fluidState.setPressure(nonWettingPhaseIdx, fluidState.pressure(wettingPhaseIdx));
508 typename FluidSystem::template ParameterCache<Scalar> paramCache;
509 paramCache.updateAll(fluidState);
510 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
511 fluidState.setDensity(phaseIdx,
512 FluidSystem::density(fluidState, paramCache, phaseIdx));
513 fluidState.setViscosity(phaseIdx,
514 FluidSystem::viscosity(fluidState, paramCache, phaseIdx));
518 values.setFreeFlow(context, spaceIdx, timeIdx, fluidState);
536 template <
class Context>
538 unsigned spaceIdx,
unsigned timeIdx)
const
540 const GlobalPosition& pos = context.pos(spaceIdx, timeIdx);
542 if (!onLeftBoundary_(pos))
546 unsigned globalIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
556 FluidState fractureFluidState;
557 fractureFluidState.setTemperature(temperature_ + 10.0);
559 fractureFluidState.setSaturation(wettingPhaseIdx, 1.0);
560 fractureFluidState.setSaturation(nonWettingPhaseIdx,
561 1.0 - fractureFluidState.saturation(
564 Scalar pCFracture[numPhases];
565 MaterialLaw::capillaryPressures(pCFracture, fractureMaterialParams_,
568 fractureFluidState.setPressure(wettingPhaseIdx, 1.0e5);
569 fractureFluidState.setPressure(nonWettingPhaseIdx,
570 fractureFluidState.pressure(wettingPhaseIdx)
571 + (pCFracture[nonWettingPhaseIdx]
572 - pCFracture[wettingPhaseIdx]));
575 constraints.assignNaiveFromFracture(fractureFluidState,
576 matrixMaterialParams_);
582 template <
class Context>
584 [[maybe_unused]]
const Context& context,
585 [[maybe_unused]]
unsigned spaceIdx,
586 [[maybe_unused]]
unsigned timeIdx)
const
588 FluidState fluidState;
589 fluidState.setTemperature(temperature_);
590 fluidState.setPressure(FluidSystem::wettingPhaseIdx, 1e5);
591 fluidState.setPressure(nonWettingPhaseIdx, fluidState.pressure(wettingPhaseIdx));
593 fluidState.setSaturation(wettingPhaseIdx, 0.0);
594 fluidState.setSaturation(nonWettingPhaseIdx,
595 1.0 - fluidState.saturation(wettingPhaseIdx));
597 values.assignNaive(fluidState);
606 template <
class Context>
608 [[maybe_unused]]
const Context& context,
609 [[maybe_unused]]
unsigned spaceIdx,
610 [[maybe_unused]]
unsigned timeIdx)
const
611 { rate = Scalar(0.0); }
616 bool onLeftBoundary_(
const GlobalPosition& pos)
const
617 {
return pos[0] < this->boundingBoxMin()[0] + eps_; }
619 bool onRightBoundary_(
const GlobalPosition& pos)
const
620 {
return pos[0] > this->boundingBoxMax()[0] - eps_; }
622 bool onLowerBoundary_(
const GlobalPosition& pos)
const
623 {
return pos[1] < this->boundingBoxMin()[1] + eps_; }
625 bool onUpperBoundary_(
const GlobalPosition& pos)
const
626 {
return pos[1] > this->boundingBoxMax()[1] - eps_; }
628 void initEnergyParams_(ThermalConductionLawParams& params, Scalar poro)
631 solidEnergyParams_.setSolidHeatCapacity(790.0
633 solidEnergyParams_.finalize();
635 Scalar lambdaGranite = 2.8;
638 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
639 fs.setTemperature(293.15);
640 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
641 fs.setPressure(phaseIdx, 1.0135e5);
644 typename FluidSystem::template ParameterCache<Scalar> paramCache;
645 paramCache.updateAll(fs);
646 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
647 Scalar rho = FluidSystem::density(fs, paramCache, phaseIdx);
648 fs.setDensity(phaseIdx, rho);
651 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
652 Scalar lambdaSaturated;
653 if (FluidSystem::isLiquid(phaseIdx)) {
654 Scalar lambdaFluid = FluidSystem::thermalConductivity(fs, paramCache, phaseIdx);
656 std::pow(lambdaGranite, (1 - poro))
657 + std::pow(lambdaFluid, poro);
660 lambdaSaturated = std::pow(lambdaGranite, (1 - poro));
662 params.setFullySaturatedLambda(phaseIdx, lambdaSaturated);
665 Scalar lambdaVac = std::pow(lambdaGranite, (1 - poro));
666 params.setVacuumLambda(lambdaVac);
670 DimMatrix fractureK_;
672 Scalar matrixPorosity_;
673 Scalar fracturePorosity_;
675 Scalar fractureWidth_;
677 MaterialLawParams fractureMaterialParams_;
678 MaterialLawParams matrixMaterialParams_;
680 ThermalConductionLawParams thermalConductionParams_;
681 SolidEnergyLawParams solidEnergyParams_;
Provides a simulator vanguard which creates a grid by parsing a Dune Grid Format (DGF) file.
Definition: dgfvanguard.hh:50
Stores the topology of fractures.
Definition: fracturemapper.hh:41
Two-phase problem which involves fractures.
Definition: fractureproblem.hh:201
const SolidEnergyLawParams & solidEnergyLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Return the parameters for the energy storage law of the rock.
Definition: fractureproblem.hh:474
const DimMatrix & intrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: fractureproblem.hh:376
Scalar fractureWidth(const Context &context, unsigned spaceIdx1, unsigned spaceIdx2, unsigned timeIdx) const
Returns the width of the fracture.
Definition: fractureproblem.hh:451
void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the initial value for a control volume.
Definition: fractureproblem.hh:583
static void registerParameters()
Definition: fractureproblem.hh:311
Scalar fracturePorosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
The porosity inside the fractures.
Definition: fractureproblem.hh:407
void finishInit()
Called by the Opm::Simulator in order to initialize the problem.
Definition: fractureproblem.hh:259
std::string name() const
The problem name.
Definition: fractureproblem.hh:328
FractureProblem(Simulator &simulator)
Definition: fractureproblem.hh:252
void constraints(Constraints &constraints, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the constraints for a control volume.
Definition: fractureproblem.hh:537
const DimMatrix & fractureIntrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Intrinsic permeability of fractures.
Definition: fractureproblem.hh:387
const MaterialLawParams & materialLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: fractureproblem.hh:416
void endTimeStep()
Called directly after the time integration.
Definition: fractureproblem.hh:338
const ThermalConductionLawParams & thermalConductionLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: fractureproblem.hh:462
void source(RateVector &rate, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: fractureproblem.hh:607
const MaterialLawParams & fractureMaterialLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
The parameters for the material law inside the fractures.
Definition: fractureproblem.hh:427
Scalar temperature(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: fractureproblem.hh:360
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: fractureproblem.hh:490
const FractureMapper & fractureMapper() const
Returns the object representating the fracture topology.
Definition: fractureproblem.hh:435
Scalar porosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: fractureproblem.hh:396
This file contains the necessary classes to calculate the volumetric fluxes out of a pressure potenti...
Definition: blackoilmodel.hh:74
Definition: blackoilbioeffectsmodules.hh:45
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
Specifies a flux module which uses the Darcy relation.
Definition: darcyfluxmodule.hh:67
Specify whether the some degrees of fredom can be constraint.
Definition: fvbaseproperties.hh:213
Specify whether energy should be considered as a conservation quantity or not.
Definition: multiphasebaseproperties.hh:87
Specifies the relation used for velocity.
Definition: multiphasebaseproperties.hh:83
Dune::ALUGrid< 2, 2, Dune::simplex, Dune::nonconforming > type
Definition: fractureproblem.hh:84
The type of the DUNE grid.
Definition: basicproperties.hh:104
Definition: fvbaseproperties.hh:60
Opm::EffToAbsLaw< EffectiveLaw > type
Definition: fractureproblem.hh:138
The material law which ought to be used (extracted from the spatial parameters)
Definition: multiphasebaseproperties.hh:55
Opm::LiquidPhase< Scalar, Opm::DNAPL< Scalar > > type
Definition: fractureproblem.hh:115
The non-wetting phase for two-phase models.
Definition: immiscibleproperties.hh:44
The type of the problem.
Definition: fvbaseproperties.hh:86
Opm::ConstantSolidHeatCapLaw< GetPropType< TypeTag, Properties::Scalar > > type
Definition: fractureproblem.hh:162
The material law for the energy stored in the solid matrix.
Definition: multiphasebaseproperties.hh:63
The splice to be used for the spatial discretization.
Definition: multiphasebaseproperties.hh:39
Definition: fvbasefdlocallinearizer.hh:65
Definition: fractureproblem.hh:77
std::tuple< DiscreteFractureModel > InheritsFrom
Definition: fractureproblem.hh:77
Definition: vcfvproperties.hh:41
Opm::SomertonThermalConductionLaw< FluidSystem, Scalar > type
Definition: fractureproblem.hh:156
The material law for thermal conduction.
Definition: multiphasebaseproperties.hh:71
Property which provides a Vanguard (manages grids)
Definition: basicproperties.hh:100
Opm::LiquidPhase< Scalar, Opm::SimpleH2O< Scalar > > type
Definition: fractureproblem.hh:104
The wetting phase for two-phase models.
Definition: immiscibleproperties.hh:41