Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux-course
Commits
0f6f03c0
Commit
0f6f03c0
authored
Jul 18, 2018
by
Timo Koch
Committed by
Kilian Weishaupt
Jul 19, 2018
Browse files
[pm-ff] Use 1padapter instead of phase index
parent
6695f293
Changes
6
Hide whitespace changes
Inline
Side-by-side
exercises/exercise-coupling-ff-pm/models/ex_models_ffproblem.hh
View file @
0f6f03c0
...
...
@@ -26,6 +26,7 @@
#include
<dune/grid/yaspgrid.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
#include
<dumux/freeflow/navierstokes/problem.hh>
...
...
@@ -44,11 +45,12 @@ NEW_TYPE_TAG(StokesTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC
// Set the grid type
SET_TYPE_PROP
(
StokesTypeTag
,
Grid
,
Dune
::
YaspGrid
<
2
,
Dune
::
EquidistantOffsetCoordinates
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
),
2
>
>
);
// Set the fluid system
SET_TYPE_PROP
(
StokesTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// Set phase index (gas)
SET_INT_PROP
(
StokesTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
// The fluid system
SET_PROP
(
StokesTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
H2OAir
::
gasPhaseIdx
>
;
};
// Do not replace one equation with a total mass balance
SET_INT_PROP
(
StokesTypeTag
,
ReplaceCompEqIdx
,
3
);
...
...
@@ -101,10 +103,6 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
static
constexpr
bool
useMoles
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
useMoles
();
static
constexpr
auto
dim
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
dim
();
static
constexpr
auto
phaseIdx
=
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
);
static
constexpr
auto
transportCompIdx
=
1
-
phaseIdx
;
public:
StokesSubProblem
(
std
::
shared_ptr
<
const
FVGridGeometry
>
fvGridGeometry
,
std
::
shared_ptr
<
CouplingManager
>
couplingManager
)
:
ParentType
(
fvGridGeometry
,
"Stokes"
),
eps_
(
1e-6
),
couplingManager_
(
couplingManager
)
...
...
@@ -159,27 +157,27 @@ public:
if
(
onLeftBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
transportComp
Idx
+
dim
);
values
.
setDirichlet
(
Indices
::
conti0Eq
Idx
+
1
);
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
}
else
if
(
onRightBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
Indices
::
pressureIdx
);
values
.
setOutflow
(
transportComp
Idx
+
dim
);
values
.
setOutflow
(
Indices
::
conti0Eq
Idx
+
1
);
}
else
{
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
values
.
setNeumann
(
phaseIdx
+
dim
);
values
.
setNeumann
(
transportComp
Idx
+
dim
);
values
.
setNeumann
(
Indices
::
conti0EqIdx
);
values
.
setNeumann
(
Indices
::
conti0Eq
Idx
+
1
);
}
if
(
couplingManager
().
isCoupledEntity
(
CouplingManager
::
stokesIdx
,
scvf
))
{
values
.
setCouplingNeumann
(
phaseIdx
+
dim
);
values
.
setCouplingNeumann
(
transportComp
Idx
+
dim
);
values
.
setCouplingNeumann
(
Indices
::
conti0EqIdx
);
values
.
setCouplingNeumann
(
Indices
::
conti0Eq
Idx
+
1
);
values
.
setCouplingNeumann
(
Indices
::
momentumYBalanceIdx
);
values
.
setBJS
(
Indices
::
momentumXBalanceIdx
);
}
...
...
@@ -257,11 +255,11 @@ public:
{
FluidState
fluidState
;
updateFluidStateForBC_
(
fluidState
,
pressure_
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
phaseIdx
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
0
);
PrimaryVariables
values
(
0.0
);
values
[
Indices
::
pressureIdx
]
=
pressure_
+
density
*
this
->
gravity
()[
1
]
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
]);
values
[
transportComp
Idx
+
dim
]
=
moleFraction_
;
values
[
Indices
::
conti0Eq
Idx
+
1
]
=
moleFraction_
;
values
[
Indices
::
velocityXIdx
]
=
4.0
*
velocity_
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
])
*
(
this
->
fvGridGeometry
().
bBoxMax
()[
1
]
-
globalPos
[
1
])
/
(
height_
()
*
height_
());
...
...
@@ -307,22 +305,22 @@ private:
void
updateFluidStateForBC_
(
FluidState
&
fluidState
,
const
Scalar
pressure
)
const
{
fluidState
.
setTemperature
(
temperature
());
fluidState
.
setPressure
(
phaseIdx
,
pressure
);
fluidState
.
setSaturation
(
phaseIdx
,
1.0
);
fluidState
.
setMoleFraction
(
phaseIdx
,
transportCompIdx
,
moleFraction_
);
fluidState
.
setMoleFraction
(
phaseIdx
,
phaseIdx
,
1.0
-
moleFraction_
);
fluidState
.
setPressure
(
0
,
pressure
);
fluidState
.
setSaturation
(
0
,
1.0
);
fluidState
.
setMoleFraction
(
0
,
1
,
moleFraction_
);
fluidState
.
setMoleFraction
(
0
,
0
,
1.0
-
moleFraction_
);
typename
FluidSystem
::
ParameterCache
paramCache
;
paramCache
.
updatePhase
(
fluidState
,
phaseIdx
);
paramCache
.
updatePhase
(
fluidState
,
0
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setDensity
(
phaseIdx
,
density
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
0
);
fluidState
.
setDensity
(
0
,
density
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setMolarDensity
(
phaseIdx
,
molarDensity
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
0
);
fluidState
.
setMolarDensity
(
0
,
molarDensity
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setEnthalpy
(
phaseIdx
,
enthalpy
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
0
);
fluidState
.
setEnthalpy
(
0
,
enthalpy
);
}
// the height of the free-flow domain
const
Scalar
height_
()
const
...
...
exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh
View file @
0f6f03c0
...
...
@@ -28,6 +28,7 @@
#include
<dumux/discretization/cellcentered/tpfa/properties.hh>
#include
<dumux/io/gnuplotinterface.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
#include
<dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh>
...
...
@@ -49,10 +50,11 @@ NEW_TYPE_TAG(DarcyTypeTag, INHERITS_FROM(CCTpfaModel, OnePNC));
SET_TYPE_PROP
(
DarcyTypeTag
,
Problem
,
Dumux
::
DarcySubProblem
<
TypeTag
>
);
// The fluid system
SET_TYPE_PROP
(
DarcyTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// Use gas as phase
SET_INT_PROP
(
DarcyTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
SET_PROP
(
DarcyTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
H2OAir
::
gasPhaseIdx
>
;
};
// Use moles
SET_BOOL_PROP
(
DarcyTypeTag
,
UseMoles
,
true
);
...
...
@@ -96,8 +98,8 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
// primary variable indices
conti0EqIdx
=
Indices
::
conti0EqIdx
,
pressureIdx
=
Indices
::
pressureIdx
,
phaseIdx
=
Indices
::
fluidSystemPhaseIdx
,
transportCompIdx
=
1
-
phaseIdx
phaseIdx
=
0
,
transportCompIdx
=
1
};
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
...
...
@@ -181,11 +183,8 @@ public:
for
(
auto
&&
scv
:
scvs
(
fvGeometry
))
{
const
auto
&
volVars
=
elemVolVars
[
scv
];
for
(
int
phaseIdx
=
0
;
phaseIdx
<
FluidSystem
::
numPhases
;
++
phaseIdx
)
{
// insert calculation of the water mass here
waterMass
+=
0.0
;
}
// insert calculation of the water mass here
waterMass
+=
0.0
;
}
}
...
...
exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh
View file @
0f6f03c0
...
...
@@ -25,6 +25,7 @@
#include
<dune/grid/yaspgrid.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
#include
<dumux/discretization/staggered/freeflow/properties.hh>
...
...
@@ -43,11 +44,13 @@ NEW_TYPE_TAG(ZeroEqTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC
// Set the grid type
SET_TYPE_PROP
(
ZeroEqTypeTag
,
Grid
,
Dune
::
YaspGrid
<
2
,
Dune
::
TensorProductCoordinates
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
),
2
>
>
);
// set the fluid system
SET_TYPE_PROP
(
ZeroEqTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// set phase index (air)
SET_INT_PROP
(
ZeroEqTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
// The fluid system
SET_PROP
(
ZeroEqTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
static
constexpr
auto
phaseIdx
=
H2OAir
::
gasPhaseIdx
;
// simulate the air phase
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
phaseIdx
>
;
};
SET_INT_PROP
(
ZeroEqTypeTag
,
ReplaceCompEqIdx
,
3
);
...
...
@@ -98,9 +101,6 @@ class FreeFlowSubProblem : public NavierStokesProblem<TypeTag>
static
constexpr
bool
useMoles
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
useMoles
();
static
constexpr
auto
phaseIdx
=
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
);
static
constexpr
auto
transportCompIdx
=
1
-
phaseIdx
;
public:
FreeFlowSubProblem
(
std
::
shared_ptr
<
const
FVGridGeometry
>
fvGridGeometry
,
std
::
shared_ptr
<
CouplingManager
>
couplingManager
)
:
ParentType
(
fvGridGeometry
,
"Stokes"
),
eps_
(
1e-6
),
couplingManager_
(
couplingManager
)
...
...
@@ -157,7 +157,7 @@ public:
{
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
values
.
setDirichlet
(
Indices
::
conti0EqIdx
);
values
.
setDirichlet
(
Indices
::
conti0EqIdx
+
1
);
values
.
setDirichlet
(
Indices
::
energyBalanceIdx
);
}
...
...
@@ -182,7 +182,7 @@ public:
if
(
onRightBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
Indices
::
pressureIdx
);
values
.
setOutflow
(
Indices
::
conti0EqIdx
);
values
.
setOutflow
(
Indices
::
conti0EqIdx
+
1
);
values
.
setOutflow
(
Indices
::
energyBalanceIdx
);
}
...
...
@@ -268,11 +268,11 @@ public:
FluidState
fluidState
;
updateFluidStateForBC_
(
fluidState
,
refTemperature
(),
refPressure
(),
refMoleFrac
());
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
phaseIdx
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
0
);
PrimaryVariables
values
(
0.0
);
values
[
Indices
::
pressureIdx
]
=
refPressure
()
+
density
*
this
->
gravity
()[
1
]
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
]);
values
[
Indices
::
conti0EqIdx
]
=
refMoleFrac
();
values
[
Indices
::
conti0EqIdx
+
1
]
=
refMoleFrac
();
values
[
Indices
::
velocityXIdx
]
=
refVelocity
();
values
[
Indices
::
temperatureIdx
]
=
refTemperature
();
...
...
@@ -338,22 +338,22 @@ private:
const
Scalar
pressure
,
const
Scalar
moleFraction
)
const
{
fluidState
.
setTemperature
(
temperature
);
fluidState
.
setPressure
(
phaseIdx
,
pressure
);
fluidState
.
setSaturation
(
phaseIdx
,
1.0
);
fluidState
.
setMoleFraction
(
phaseIdx
,
transportCompIdx
,
moleFraction
);
fluidState
.
setMoleFraction
(
phaseIdx
,
phaseIdx
,
1.0
-
moleFraction
);
fluidState
.
setPressure
(
0
,
pressure
);
fluidState
.
setSaturation
(
0
,
1.0
);
fluidState
.
setMoleFraction
(
0
,
1
,
moleFraction
);
fluidState
.
setMoleFraction
(
0
,
0
,
1.0
-
moleFraction
);
typename
FluidSystem
::
ParameterCache
paramCache
;
paramCache
.
updatePhase
(
fluidState
,
phaseIdx
);
paramCache
.
updatePhase
(
fluidState
,
0
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setDensity
(
phaseIdx
,
density
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
0
);
fluidState
.
setDensity
(
0
,
density
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setMolarDensity
(
phaseIdx
,
molarDensity
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
0
);
fluidState
.
setMolarDensity
(
0
,
molarDensity
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setEnthalpy
(
phaseIdx
,
enthalpy
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
0
);
fluidState
.
setEnthalpy
(
0
,
enthalpy
);
}
// the height of the free-flow domain
...
...
exercises/solution/exercise-coupling-ff-pm/models/ex_models_ffproblem.hh
View file @
0f6f03c0
...
...
@@ -26,6 +26,7 @@
#include
<dune/grid/yaspgrid.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
#include
<dumux/freeflow/navierstokes/problem.hh>
...
...
@@ -44,11 +45,12 @@ NEW_TYPE_TAG(StokesTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC
// Set the grid type
SET_TYPE_PROP
(
StokesTypeTag
,
Grid
,
Dune
::
YaspGrid
<
2
,
Dune
::
EquidistantOffsetCoordinates
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
),
2
>
>
);
// Set the fluid system
SET_TYPE_PROP
(
StokesTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// Set phase index (gas)
SET_INT_PROP
(
StokesTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
// The fluid system
SET_PROP
(
StokesTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
H2OAir
::
gasPhaseIdx
>
;
};
// Do not replace one equation with a total mass balance
SET_INT_PROP
(
StokesTypeTag
,
ReplaceCompEqIdx
,
3
);
...
...
@@ -102,8 +104,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
static
constexpr
bool
useMoles
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
useMoles
();
static
constexpr
auto
dim
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
dim
();
static
constexpr
auto
phaseIdx
=
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
);
static
constexpr
auto
transportCompIdx
=
1
-
phaseIdx
;
static
constexpr
auto
transportCompIdx
=
1
;
public:
StokesSubProblem
(
std
::
shared_ptr
<
const
FVGridGeometry
>
fvGridGeometry
,
std
::
shared_ptr
<
CouplingManager
>
couplingManager
)
...
...
@@ -159,27 +160,27 @@ public:
if
(
onLeftBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
transportComp
Idx
+
dim
);
values
.
setDirichlet
(
Indices
::
conti0Eq
Idx
+
1
);
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
}
else
if
(
onRightBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
Indices
::
pressureIdx
);
values
.
setOutflow
(
transportComp
Idx
+
dim
);
values
.
setOutflow
(
Indices
::
conti0Eq
Idx
+
1
);
}
else
{
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
values
.
setNeumann
(
phaseIdx
+
dim
);
values
.
setNeumann
(
transportComp
Idx
+
dim
);
values
.
setNeumann
(
Indices
::
conti0EqIdx
);
values
.
setNeumann
(
Indices
::
conti0Eq
Idx
+
1
);
}
if
(
couplingManager
().
isCoupledEntity
(
CouplingManager
::
stokesIdx
,
scvf
))
{
values
.
setCouplingNeumann
(
phaseIdx
+
dim
);
values
.
setCouplingNeumann
(
transportComp
Idx
+
dim
);
values
.
setCouplingNeumann
(
Indices
::
conti0EqIdx
);
values
.
setCouplingNeumann
(
Indices
::
conti0Eq
Idx
+
1
);
values
.
setCouplingNeumann
(
Indices
::
momentumYBalanceIdx
);
values
.
setBJS
(
Indices
::
momentumXBalanceIdx
);
}
...
...
@@ -257,11 +258,11 @@ public:
{
FluidState
fluidState
;
updateFluidStateForBC_
(
fluidState
,
pressure_
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
phaseIdx
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
0
);
PrimaryVariables
values
(
0.0
);
values
[
Indices
::
pressureIdx
]
=
pressure_
+
density
*
this
->
gravity
()[
1
]
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
]);
values
[
transportComp
Idx
+
dim
]
=
moleFraction_
;
values
[
Indices
::
conti0Eq
Idx
+
1
]
=
moleFraction_
;
values
[
Indices
::
velocityXIdx
]
=
4.0
*
velocity_
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
])
*
(
this
->
fvGridGeometry
().
bBoxMax
()[
1
]
-
globalPos
[
1
])
/
(
height_
()
*
height_
());
...
...
@@ -307,22 +308,22 @@ private:
void
updateFluidStateForBC_
(
FluidState
&
fluidState
,
const
Scalar
pressure
)
const
{
fluidState
.
setTemperature
(
temperature
());
fluidState
.
setPressure
(
phaseIdx
,
pressure
);
fluidState
.
setSaturation
(
phaseIdx
,
1.0
);
fluidState
.
setMoleFraction
(
phaseIdx
,
transportCompIdx
,
moleFraction_
);
fluidState
.
setMoleFraction
(
phaseIdx
,
phaseIdx
,
1.0
-
moleFraction_
);
fluidState
.
setPressure
(
0
,
pressure
);
fluidState
.
setSaturation
(
0
,
1.0
);
fluidState
.
setMoleFraction
(
0
,
1
,
moleFraction_
);
fluidState
.
setMoleFraction
(
0
,
0
,
1.0
-
moleFraction_
);
typename
FluidSystem
::
ParameterCache
paramCache
;
paramCache
.
updatePhase
(
fluidState
,
phaseIdx
);
paramCache
.
updatePhase
(
fluidState
,
0
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setDensity
(
phaseIdx
,
density
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
0
);
fluidState
.
setDensity
(
0
,
density
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setMolarDensity
(
phaseIdx
,
molarDensity
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
0
);
fluidState
.
setMolarDensity
(
0
,
molarDensity
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setEnthalpy
(
phaseIdx
,
enthalpy
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
0
);
fluidState
.
setEnthalpy
(
0
,
enthalpy
);
}
// the height of the free-flow domain
const
Scalar
height_
()
const
...
...
exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh
View file @
0f6f03c0
...
...
@@ -26,6 +26,7 @@
#include
<dune/grid/yaspgrid.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/discretization/cellcentered/tpfa/properties.hh>
#include
<dumux/io/gnuplotinterface.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
...
...
@@ -58,12 +59,15 @@ NEW_TYPE_TAG(DarcyTypeTag, INHERITS_FROM(CCTpfaModel, OnePNC));
SET_TYPE_PROP
(
DarcyTypeTag
,
Problem
,
Dumux
::
DarcySubProblem
<
TypeTag
>
);
// The fluid system
SET_
TYPE_
PROP
(
DarcyTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// Use gas as phase
SET_PROP
(
DarcyTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
#if EXNUMBER == 0
SET_INT_PROP
(
DarcyTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
H2OAir
::
gasPhaseIdx
>
;
#else
using
type
=
H2OAir
;
#endif
};
// Use moles
SET_BOOL_PROP
(
DarcyTypeTag
,
UseMoles
,
true
);
...
...
@@ -123,8 +127,8 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
#elif EXNUMBER >= 1
transportCompIdx
=
Indices
::
switchIdx
#else
phaseIdx
=
Indices
::
fluidSystemPhaseIdx
,
transportCompIdx
=
1
-
phaseIdx
phaseIdx
=
0
,
transportCompIdx
=
1
#endif
};
...
...
exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh
View file @
0f6f03c0
...
...
@@ -25,6 +25,7 @@
#include
<dune/grid/yaspgrid.hh>
#include
<dumux/material/fluidsystems/1padapter.hh>
#include
<dumux/material/fluidsystems/h2oair.hh>
#include
<dumux/discretization/staggered/freeflow/properties.hh>
...
...
@@ -52,11 +53,13 @@ NEW_TYPE_TAG(ZeroEqTypeTag, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC
// Set the grid type
SET_TYPE_PROP
(
ZeroEqTypeTag
,
Grid
,
Dune
::
YaspGrid
<
2
,
Dune
::
TensorProductCoordinates
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
),
2
>
>
);
// set the fluid system
SET_TYPE_PROP
(
ZeroEqTypeTag
,
FluidSystem
,
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
);
// set phase index (air)
SET_INT_PROP
(
ZeroEqTypeTag
,
PhaseIdx
,
GET_PROP_TYPE
(
TypeTag
,
FluidSystem
)
::
gasPhaseIdx
);
// The fluid system
SET_PROP
(
ZeroEqTypeTag
,
FluidSystem
)
{
using
H2OAir
=
FluidSystems
::
H2OAir
<
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
)
>
;
static
constexpr
auto
phaseIdx
=
H2OAir
::
gasPhaseIdx
;
// simulate the air phase
using
type
=
FluidSystems
::
OnePAdapter
<
H2OAir
,
phaseIdx
>
;
};
SET_INT_PROP
(
ZeroEqTypeTag
,
ReplaceCompEqIdx
,
3
);
...
...
@@ -113,9 +116,6 @@ class FreeFlowSubProblem : public NavierStokesProblem<TypeTag>
static
constexpr
bool
useMoles
=
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
useMoles
();
static
constexpr
auto
phaseIdx
=
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
);
static
constexpr
auto
transportCompIdx
=
1
-
phaseIdx
;
public:
FreeFlowSubProblem
(
std
::
shared_ptr
<
const
FVGridGeometry
>
fvGridGeometry
,
std
::
shared_ptr
<
CouplingManager
>
couplingManager
)
:
ParentType
(
fvGridGeometry
,
"Stokes"
),
eps_
(
1e-6
),
couplingManager_
(
couplingManager
)
...
...
@@ -172,7 +172,7 @@ public:
{
values
.
setDirichlet
(
Indices
::
velocityXIdx
);
values
.
setDirichlet
(
Indices
::
velocityYIdx
);
values
.
setDirichlet
(
Indices
::
conti0EqIdx
);
values
.
setDirichlet
(
Indices
::
conti0EqIdx
+
1
);
values
.
setDirichlet
(
Indices
::
energyBalanceIdx
);
}
...
...
@@ -201,7 +201,7 @@ public:
if
(
onRightBoundary_
(
globalPos
))
{
values
.
setDirichlet
(
Indices
::
pressureIdx
);
values
.
setOutflow
(
Indices
::
conti0EqIdx
);
values
.
setOutflow
(
Indices
::
conti0EqIdx
+
1
);
values
.
setOutflow
(
Indices
::
energyBalanceIdx
);
}
...
...
@@ -299,11 +299,11 @@ public:
FluidState
fluidState
;
updateFluidStateForBC_
(
fluidState
,
refTemperature
(),
refPressure
(),
refMoleFrac
());
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
phaseIdx
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
0
);
PrimaryVariables
values
(
0.0
);
values
[
Indices
::
pressureIdx
]
=
refPressure
()
+
density
*
this
->
gravity
()[
1
]
*
(
globalPos
[
1
]
-
this
->
fvGridGeometry
().
bBoxMin
()[
1
]);
values
[
Indices
::
conti0EqIdx
]
=
refMoleFrac
();
values
[
Indices
::
conti0EqIdx
+
1
]
=
refMoleFrac
();
values
[
Indices
::
velocityXIdx
]
=
refVelocity
();
values
[
Indices
::
temperatureIdx
]
=
refTemperature
();
...
...
@@ -369,22 +369,22 @@ private:
const
Scalar
pressure
,
const
Scalar
moleFraction
)
const
{
fluidState
.
setTemperature
(
temperature
);
fluidState
.
setPressure
(
phaseIdx
,
pressure
);
fluidState
.
setSaturation
(
phaseIdx
,
1.0
);
fluidState
.
setMoleFraction
(
phaseIdx
,
transportCompIdx
,
moleFraction
);
fluidState
.
setMoleFraction
(
phaseIdx
,
phaseIdx
,
1.0
-
moleFraction
);
fluidState
.
setPressure
(
0
,
pressure
);
fluidState
.
setSaturation
(
0
,
1.0
);
fluidState
.
setMoleFraction
(
0
,
1
,
moleFraction
);
fluidState
.
setMoleFraction
(
0
,
0
,
1.0
-
moleFraction
);
typename
FluidSystem
::
ParameterCache
paramCache
;
paramCache
.
updatePhase
(
fluidState
,
phaseIdx
);
paramCache
.
updatePhase
(
fluidState
,
0
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setDensity
(
phaseIdx
,
density
);
const
Scalar
density
=
FluidSystem
::
density
(
fluidState
,
paramCache
,
0
);
fluidState
.
setDensity
(
0
,
density
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setMolarDensity
(
phaseIdx
,
molarDensity
);
const
Scalar
molarDensity
=
FluidSystem
::
molarDensity
(
fluidState
,
paramCache
,
0
);
fluidState
.
setMolarDensity
(
0
,
molarDensity
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
phaseIdx
);
fluidState
.
setEnthalpy
(
phaseIdx
,
enthalpy
);
const
Scalar
enthalpy
=
FluidSystem
::
enthalpy
(
fluidState
,
paramCache
,
0
);
fluidState
.
setEnthalpy
(
0
,
enthalpy
);
}
// the height of the free-flow domain
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment