version 3.10-dev
porousmediumflow/2p1c/darcyslaw.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_2P1C_SPURIOUS_FLUX_BLOCKING_DARCYS_LAW_HH
14#define DUMUX_2P1C_SPURIOUS_FLUX_BLOCKING_DARCYS_LAW_HH
15
16#include <dumux/common/math.hh>
21
22namespace Dumux {
23
24namespace Properties {
25 template<class TypeTag, class MyTypeTag>
27}
28
35template <class TypeTag>
36class TwoPOneCDarcysLaw : public DarcysLaw<TypeTag>
37{
40 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
41 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
42 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
44 using ElemFluxVarCache = typename GridFluxVariablesCache::LocalView;
45 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
51 using Element = typename GridView::template Codim<0>::Entity;
52 using CoordScalar = typename GridView::ctype;
53
54 enum { dim = GridView::dimension};
55 enum { dimWorld = GridView::dimensionworld};
56
57 // copy some indices for convenience
58 enum {
59 // phase indices
60 liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
61 gasPhaseIdx = FluidSystem::gasPhaseIdx,
62 };
63
64 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
65 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
66
67public:
68
70 static Scalar flux(const Problem& problem,
71 const Element& element,
72 const FVElementGeometry& fvGeometry,
73 const ElementVolumeVariables& elemVolVars,
74 const SubControlVolumeFace& scvf,
75 const int phaseIdx,
76 const ElemFluxVarCache& elemFluxVarCache)
77 {
78 const Scalar flux = ParentType::flux(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx, elemFluxVarCache);
79
80 // only block wetting-phase (i.e. liquid water) fluxes
81 if((!getPropValue<TypeTag, Properties::UseBlockingOfSpuriousFlow>()) || phaseIdx != liquidPhaseIdx)
82 return flux;
83
84 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
85 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
86
87 const Scalar factor = std::signbit(flux) ? factor_(outsideVolVars, insideVolVars, phaseIdx) :
88 factor_(insideVolVars, outsideVolVars, phaseIdx);
89
90 return flux * factor;
91 }
92
93private:
101 static Scalar factor_(const VolumeVariables &up, const VolumeVariables &dn,const int phaseIdx)
102 {
103 Scalar factor = 1.0;
104
105 const Scalar tDn = dn.temperature(); //temperature of the downstream SCV (where the cold water is potentially intruding into a steam zone)
106 const Scalar tUp = up.temperature(); //temperature of the upstream SCV
107
108 const Scalar sgDn = dn.saturation(gasPhaseIdx); //gas phase saturation of the downstream SCV
109 const Scalar sgUp = up.saturation(gasPhaseIdx); //gas phase saturation of the upstream SCV
110
111 bool upIsNotSteam = false;
112 bool downIsSteam = false;
113 bool spuriousFlow = false;
114
115 if(sgUp <= 1e-5)
116 upIsNotSteam = true;
117
118 if(sgDn > 1e-5)
119 downIsSteam = true;
120
121 if(upIsNotSteam && downIsSteam && tDn > tUp && phaseIdx == liquidPhaseIdx)
122 spuriousFlow = true;
123
124 if(spuriousFlow)
125 {
126 Scalar deltaT = tDn - tUp;
127
128 if((deltaT) > 15 )
129 factor = 0.0 ;
130
131 else
132 factor = 1-(deltaT/15);
133 }
134 return factor;
135 }
136};
137
138} // end namespace Dumux
139
140#endif
forward declaration of the method-specific implementation
Definition: flux/ccmpfa/darcyslaw.hh:27
Specialization of Darcy's Law for the two-phase one-component model, including a the possibility to...
Definition: porousmediumflow/2p1c/darcyslaw.hh:37
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElemFluxVarCache &elemFluxVarCache)
Compute the Darcy flux and use a blocking factor, if specified.
Definition: porousmediumflow/2p1c/darcyslaw.hh:70
Defines all properties used in Dumux.
Advective fluxes according to Darcy's law.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Define some often used mathematical functions.
The available discretization methods in Dumux.
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
a tag to mark properties as undefined
Definition: propertysystem.hh:27
Determines whether blocking of spurious flow is used or not.
Definition: porousmediumflow/2p1c/darcyslaw.hh:26