Skip to content
GitLab
Menu
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
bbb1d333
Commit
bbb1d333
authored
Dec 09, 2017
by
Kilian Weishaupt
Browse files
[navierstokes] Make vtkOutputFields more general
* use tag dispatching for different discretizations
parent
fbaccd6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/freeflow/navierstokes/vtkoutputfields.hh
View file @
bbb1d333
...
...
@@ -18,20 +18,19 @@
*****************************************************************************/
/*!
* \file
* \brief Adds vtk output fields
specific to the twop m
odel
* \brief Adds vtk output fields
for the NavierStokesM
odel
*/
#ifndef DUMUX_NAVIER_STOKES_VTK_OUTPUT_FIELDS_HH
#define DUMUX_NAVIER_STOKES_VTK_OUTPUT_FIELDS_HH
#include
<dumux/common/properties.hh>
#include
<du
ne/common/fvector
.hh>
#include
<du
mux/discretization/methods
.hh>
namespace
Dumux
{
/*!
* \ingroup TwoP, InputOutput
* \brief Adds vtk output fields specific to the twop model
* \brief Adds vtk output fields for the NavierStokesModel
*/
template
<
class
TypeTag
>
class
NavierStokesVtkOutputFields
...
...
@@ -45,14 +44,34 @@ class NavierStokesVtkOutputFields
using
GlobalPosition
=
Dune
::
FieldVector
<
Scalar
,
GridView
::
dimensionworld
>
;
// Helper type used for tag dispatching (to add discretization-specific fields).
template
<
DiscretizationMethods
method
>
using
MethodType
=
std
::
integral_constant
<
DiscretizationMethods
,
method
>
;
public:
template
<
class
VtkOutputModule
>
static
void
init
(
VtkOutputModule
&
vtk
)
{
vtk
.
addVolumeVariable
([](
const
VolumeVariables
&
v
){
return
v
.
pressure
();
},
"p"
);
const
bool
writeFaceVars_
=
getParamFromGroup
<
bool
>
(
GET_PROP_VALUE
(
TypeTag
,
ModelParameterGroup
),
"Vtk.WriteFaceData"
,
false
);
if
(
writeFaceVars_
)
// add discretization-specific fields
const
auto
discType
=
MethodType
<
GET_PROP_VALUE
(
TypeTag
,
DiscretizationMethod
)
>
();
additionalOutput_
(
vtk
,
discType
);
}
private:
//! Adds discretization-specific fields (nothing by default).
template
<
class
VtkOutputModule
,
class
AnyMethod
>
static
void
additionalOutput_
(
VtkOutputModule
&
vtk
,
AnyMethod
)
{
}
//! Adds discretization-specific fields (velocity vectors on the faces for the staggered discretization).
template
<
class
VtkOutputModule
>
static
void
additionalOutput_
(
VtkOutputModule
&
vtk
,
MethodType
<
DiscretizationMethods
::
Staggered
>
)
{
const
bool
writeFaceVars
=
getParamFromGroup
<
bool
>
(
GET_PROP_VALUE
(
TypeTag
,
ModelParameterGroup
),
"Vtk.WriteFaceData"
,
false
);
if
(
writeFaceVars
)
{
auto
faceVelocityVector
=
[](
const
SubControlVolumeFace
&
scvf
,
const
FaceVariables
&
f
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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