version 3.8
velocityreconstruction.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//
12#ifndef DUMUX_NAVIERSTOKES_STAGGERED_VELOCITYRECONSTRUCTION_HH
13#define DUMUX_NAVIERSTOKES_STAGGERED_VELOCITYRECONSTRUCTION_HH
14#include <algorithm>
16
17namespace Dumux {
18
24{
26 template<class VelocityHelper, class FVElementGeometry>
27 static auto cellCenterVelocity(const VelocityHelper& getFaceVelocity,
28 const FVElementGeometry& fvGeometry)
29 {
30 static_assert(FVElementGeometry::GridGeometry::discMethod == DiscretizationMethods::cctpfa);
31 using VelocityVector = typename FVElementGeometry::GridGeometry::GlobalCoordinate;
32 VelocityVector result(0.0);
33
34 const auto directionIndex = [&](const auto& vector)
35 {
36 return std::find_if(vector.begin(), vector.end(), [](const auto& x) { return std::abs(x) > 1e-8; } ) - vector.begin();
37 };
38
39 for (const auto& scvf : scvfs(fvGeometry))
40 {
41 const auto dirIdx = directionIndex(scvf.unitOuterNormal());
42 result[dirIdx] += 0.5*getFaceVelocity(fvGeometry, scvf)[dirIdx];
43 }
44
45 return result;
46 }
47};
48
49} // end namespace Dumux
50
51#endif // DUMUX_NAVIERSTOKES_STAGGERED_VELOCITYRECONSTRUCTION_HH
static unsigned int directionIndex(Vector &&vector)
Returns the direction index of the facet (0 = x, 1 = y, 2 = z)
Definition: staggeredgeometryhelper.hh:121
The available discretization methods in Dumux.
constexpr CCTpfa cctpfa
Definition: method.hh:145
Definition: adapt.hh:17
Helper class for reconstructing the velocity.
Definition: velocityreconstruction.hh:24
static auto cellCenterVelocity(const VelocityHelper &getFaceVelocity, const FVElementGeometry &fvGeometry)
Return the velocity vector at the center of the primal grid.
Definition: velocityreconstruction.hh:27