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
Commits
1715aa52
Commit
1715aa52
authored
Jul 16, 2018
by
Kilian Weishaupt
Browse files
[io][pmflow] Remove phaseIdxOffset
* use SFINAE and check if fluidSystemPhaseIdx is present
parent
2dae6828
Changes
7
Hide whitespace changes
Inline
Side-by-side
dumux/io/vtkoutputmodule.hh
View file @
1715aa52
...
...
@@ -53,14 +53,13 @@ namespace Dumux {
* \brief A VTK output module to simplify writing dumux simulation data to VTK format
*
* \tparam TypeTag The TypeTag of the problem implementation
* \tparam phaseIdxOffset Used for single-phase problems to retrieve the right phase name
*
* Handles the output of scalar and vector fields to VTK formatted file for multiple
* variables and timesteps. Certain predefined fields can be registered on
* initialization and/or be turned on/off using the designated properties. Additionally
* non-standardized scalar and vector fields can be added to the writer manually.
*/
template
<
typename
TypeTag
,
int
phaseIdxOffset
=
0
>
template
<
typename
TypeTag
>
class
VtkOutputModule
{
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
...
...
@@ -372,7 +371,7 @@ private:
{
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhaseVelocities
;
++
phaseIdx
)
sequenceWriter_
.
addVertexData
(
Field
(
gridGeom_
.
gridView
(),
gridGeom_
.
vertexMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
+
phaseIdxOffset
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
dim
).
get
()
);
}
// cell-centered models
...
...
@@ -380,7 +379,7 @@ private:
{
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhaseVelocities
;
++
phaseIdx
)
sequenceWriter_
.
addCellData
(
Field
(
gridGeom_
.
gridView
(),
gridGeom_
.
elementMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
+
phaseIdxOffset
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
0
).
get
()
);
}
}
...
...
@@ -540,14 +539,14 @@ private:
if
(
dim
>
1
)
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhaseVelocities
;
++
phaseIdx
)
sequenceWriter_
.
addVertexData
(
Field
(
gridGeom_
.
gridView
(),
gridGeom_
.
vertexMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
+
phaseIdxOffset
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
dim
).
get
()
);
// cell-wise velocities
else
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhaseVelocities
;
++
phaseIdx
)
sequenceWriter_
.
addCellData
(
Field
(
gridGeom_
.
gridView
(),
gridGeom_
.
elementMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
+
phaseIdxOffset
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
0
).
get
()
);
}
...
...
dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh
View file @
1715aa52
...
...
@@ -51,10 +51,10 @@ namespace Dumux {
* initialization and/or be turned on/off using the designated properties. Additionally
* non-standardized scalar and vector fields can be added to the writer manually.
*/
template
<
class
TypeTag
,
class
FractureGrid
,
int
phaseIdxOffset
=
0
>
class
BoxDfmVtkOutputModule
:
public
VtkOutputModule
<
TypeTag
,
phaseIdxOffset
>
template
<
class
TypeTag
,
class
FractureGrid
>
class
BoxDfmVtkOutputModule
:
public
VtkOutputModule
<
TypeTag
>
{
using
ParentType
=
VtkOutputModule
<
TypeTag
,
phaseIdxOffset
>
;
using
ParentType
=
VtkOutputModule
<
TypeTag
>
;
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
GridVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridVariables
);
...
...
@@ -270,7 +270,7 @@ private:
{
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhases
;
++
phaseIdx
)
this
->
sequenceWriter
().
addVertexData
(
Field
(
gridView
,
this
->
fvGridGeometry
().
vertexMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
std
::
string
(
FluidSystem
::
phaseName
(
phaseIdx
+
phaseIdxOffset
)
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
dim
).
get
()
);
}
...
...
@@ -455,7 +455,7 @@ private:
{
for
(
int
phaseIdx
=
0
;
phaseIdx
<
numPhases
;
++
phaseIdx
)
this
->
sequenceWriter
().
addVertexData
(
Field
(
gridView
,
this
->
fvGridGeometry
().
vertexMapper
(),
velocity
[
phaseIdx
],
"velocity_"
+
std
::
string
(
FluidSystem
::
phaseName
(
phaseIdx
+
phaseIdxOffset
)
)
+
" (m/s)"
,
"velocity_"
+
velocityOutput
.
phaseName
(
phaseIdx
)
+
" (m/s)"
,
/*numComp*/
dimWorld
,
/*codim*/
dim
).
get
()
);
}
...
...
dumux/porousmediumflow/velocityoutput.hh
View file @
1715aa52
...
...
@@ -30,11 +30,25 @@
#include
<dumux/common/properties.hh>
#include
<dumux/common/parameters.hh>
#include
<dumux/common/typetraits/isvalid.hh>
#include
<dumux/discretization/methods.hh>
#include
<dumux/discretization/elementsolution.hh>
namespace
Dumux
{
namespace
Detail
{
//! helper struct detecting if an Indices class contains a fluidSystemPhaseIdx
struct
hasFluidSystemPhaseIdx
{
template
<
class
Indices
>
auto
operator
()(
Indices
&&
)
->
decltype
(
Indices
::
fluidSystemPhaseIdx
)
{}
};
}
// end namespace Detail
/*!
* \brief Velocity output for implicit (porous media) models
*/
...
...
@@ -52,6 +66,7 @@ class PorousMediumFlowVelocityOutput
using
FluxVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FluxVariables
);
using
BoundaryTypes
=
typename
GET_PROP_TYPE
(
TypeTag
,
BoundaryTypes
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
Indices
=
typename
GET_PROP_TYPE
(
TypeTag
,
ModelTraits
)
::
Indices
;
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
GridVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridVariables
);
...
...
@@ -106,7 +121,12 @@ public:
//! returns whether or not velocity output is enabled
bool
enableOutput
()
{
return
velocityOutput_
;
}
//! returns the name of the phase for a given index for models that use a fluidsystem phase index (e.g. 1pnc)
template
<
bool
hasFluidSystemPhaseIdx
=
decltype
(
isValid
(
Detail
::
hasFluidSystemPhaseIdx
())(
Indices
{}))
::
value
,
std
::
enable_if_t
<
hasFluidSystemPhaseIdx
,
int
>
=
0
>
static
std
::
string
phaseName
(
int
phaseIdx
)
{
return
FluidSystem
::
phaseName
(
Indices
::
fluidSystemPhaseIdx
);
}
//! returns the name of the phase for a given index
template
<
bool
hasFluidSystemPhaseIdx
=
decltype
(
isValid
(
Detail
::
hasFluidSystemPhaseIdx
())(
Indices
{}))
::
value
,
std
::
enable_if_t
<!
hasFluidSystemPhaseIdx
,
int
>
=
0
>
static
std
::
string
phaseName
(
int
phaseIdx
)
{
return
FluidSystem
::
phaseName
(
phaseIdx
);
}
//! returns the number of phase velocities computed by this class
...
...
test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc
View file @
1715aa52
...
...
@@ -110,7 +110,7 @@ int main(int argc, char** argv) try
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
// intialize the vtk output module
VtkOutputModule
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
)
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
VtkOutputModule
<
TypeTag
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
using
VtkOutputFields
=
typename
GET_PROP_TYPE
(
TypeTag
,
VtkOutputFields
);
VtkOutputFields
::
init
(
vtkWriter
);
//!< Add model specific output fields
vtkWriter
.
write
(
0.0
);
...
...
test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc
View file @
1715aa52
...
...
@@ -110,7 +110,7 @@ int main(int argc, char** argv) try
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
// intialize the vtk output module
VtkOutputModule
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
)
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
VtkOutputModule
<
TypeTag
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
using
VtkOutputFields
=
typename
GET_PROP_TYPE
(
TypeTag
,
VtkOutputFields
);
VtkOutputFields
::
init
(
vtkWriter
);
//!< Add model specific output fields
vtkWriter
.
addField
(
problem
->
getExactTemperature
(),
"temperatureExact"
);
...
...
test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc
View file @
1715aa52
...
...
@@ -110,7 +110,7 @@ int main(int argc, char** argv) try
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
// intialize the vtk output module
VtkOutputModule
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
)
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
VtkOutputModule
<
TypeTag
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
using
VtkOutputFields
=
typename
GET_PROP_TYPE
(
TypeTag
,
VtkOutputFields
);
VtkOutputFields
::
init
(
vtkWriter
);
//!< Add model specific output fields
vtkWriter
.
addField
(
problem
->
getExactTemperature
(),
"temperatureExact"
);
...
...
test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc
View file @
1715aa52
...
...
@@ -136,7 +136,7 @@ int main(int argc, char** argv) try
auto
maxDt
=
getParam
<
Scalar
>
(
"TimeLoop.MaxTimeStepSize"
);
// intialize the vtk output module
VtkOutputModule
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
PhaseIdx
)
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
VtkOutputModule
<
TypeTag
>
vtkWriter
(
*
problem
,
*
fvGridGeometry
,
*
gridVariables
,
x
,
problem
->
name
());
using
VtkOutputFields
=
typename
GET_PROP_TYPE
(
TypeTag
,
VtkOutputFields
);
VtkOutputFields
::
init
(
vtkWriter
);
...
...
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