3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
sequential/cellcentered/velocity.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
19#ifndef DUMUX_FVVELOCITY_HH
20#define DUMUX_FVVELOCITY_HH
21
22// dumux environment
23#include <dumux/common/math.hh>
25#include "velocitydefault.hh"
26
32namespace Dumux
33{
34
47template<class TypeTag, class Velocity> class FVVelocity
48{
51
53public:
54
57 {
58 velocity_.initialize();
59 }
60
61 //function which iterates through the grid and calculates the global velocity field
63
70 template<class MultiWriter>
71 void addOutputVtkFields(MultiWriter &writer)
72 {
73 velocity_.addOutputVtkFields(writer);
74 }
75
77
80 FVVelocity(Problem& problem) :
81 problem_(problem), velocity_(problem)
82 {}
83
84private:
85 Problem& problem_;
86 Velocity velocity_;
87};
88
89
95template<class TypeTag, class Velocity>
97{
98 for (const auto& element : elements(problem_.gridView()))
99 {
100 // cell information
101 int globalIdxI = problem_.variables().index(element);
102 CellData& cellDataI = problem_.variables().cellData(globalIdxI);
103
104 /***** flux term ***********/
105 // iterate over all faces of the cell
106 for (const auto& intersection : intersections(problem_.gridView(), element))
107 {
108 /************* handle interior face *****************/
109 if (intersection.neighbor())
110 {
111 int isIndex = intersection.indexInInside();
112
113 if (!cellDataI.fluxData().haveVelocity(isIndex))
114 velocity_.calculateVelocity(intersection, cellDataI);
115 } // end neighbor
116
117 /************* boundary face ************************/
118 else
119 {
120 velocity_.calculateVelocityOnBoundary(intersection, cellDataI);
121 }
122 } //end interfaces loop
123 } // end grid traversal
124
125 return;
126}
127
128}//end namespace Dumux
129#endif
Define some often used mathematical functions.
Default implementation of velocity class.
Definition: adapt.hh:29
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:149
Base class for finite volume velocity reconstruction.
Definition: sequential/cellcentered/velocity.hh:48
void addOutputVtkFields(MultiWriter &writer)
Adds velocity output to the output file.
Definition: sequential/cellcentered/velocity.hh:71
void calculateVelocity()
Function which reconstructs a global velocity field.
Definition: sequential/cellcentered/velocity.hh:96
void initialize()
Initialize velocity implementation.
Definition: sequential/cellcentered/velocity.hh:56
FVVelocity(Problem &problem)
Constructs a FVVelocity object.
Definition: sequential/cellcentered/velocity.hh:80
Base file for properties related to sequential IMPET algorithms.