Skip to content
Snippets Groups Projects
Commit 5fbf3794 authored by Timo Koch's avatar Timo Koch
Browse files

[cvfe] Introduce Navier-Stokes CVFEIndices to avoid code duplication

parent d56ead20
No related branches found
No related tags found
1 merge request!3349Feature/cvfe improvements
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup NavierStokesModel
* \copydoc Dumux::NavierStokesIndices
*/
#ifndef DUMUX_NAVIERSTOKES_MOMENTUM_CVFE_INDICES_HH
#define DUMUX_NAVIERSTOKES_MOMENTUM_CVFE_INDICES_HH
namespace Dumux {
/*!
* \ingroup NavierStokesModel
* \brief The common indices for the isothermal Navier-Stokes model.
*
* \tparam dimension The dimension of the problem
*/
template <int dimension>
struct NavierStokesMomentumCVFEIndices
{
static constexpr int dimXIdx = 0; //!< Index of the x-component of a vector of size dim
static constexpr int dimYIdx = 1; //!< Index of the y-component of a vector of size dim
static constexpr int dimZIdx = 2; //!< Index of the z-component of a vector of size dim
static constexpr auto dim = dimension;
static constexpr int momentumXBalanceIdx = 0; //!< Index of the momentum balance equation
static constexpr int momentumYBalanceIdx = 1; //!< Index of the momentum balance equation
static constexpr int momentumZBalanceIdx = 2; //!< Index of the momentum balance equation
static constexpr int velocityXIdx = 0; //!< Index of the velocity in a solution vector
static constexpr int velocityYIdx = 1; //!< Index of the velocity in a solution vector
static constexpr int velocityZIdx = 2; //!< Index of the velocity in a solution vector
/*!
* \brief Index of the velocity in a solution vector given a certain direction.
* \param dirIdx The index of the direction.
*/
static constexpr int velocity(int dirIdx)
{
return dirIdx;
}
/*!
* \brief Index of the momentum balance equation given the direction
* \param dirIdx The index of the direction.
*/
static constexpr int momentumBalanceIdx(int dirIdx)
{
return dirIdx;
}
};
} // end namespace Dumux
#endif
...@@ -24,49 +24,14 @@ ...@@ -24,49 +24,14 @@
#ifndef DUMUX_NAVIERSTOKES_MOMENTUM_DIAMOND_INDICES_HH #ifndef DUMUX_NAVIERSTOKES_MOMENTUM_DIAMOND_INDICES_HH
#define DUMUX_NAVIERSTOKES_MOMENTUM_DIAMOND_INDICES_HH #define DUMUX_NAVIERSTOKES_MOMENTUM_DIAMOND_INDICES_HH
namespace Dumux { #warning "This header is deprecated and will be removed after 3.7"
/*!
* \ingroup NavierStokesModel
* \brief The common indices for the isothermal Navier-Stokes model.
*
* \tparam dimension The dimension of the problem
*/
template <int dimension>
struct NavierStokesMomentumDiamondIndices
{
static constexpr int dimXIdx = 0; //!< Index of the x-component of a vector of size dim
static constexpr int dimYIdx = 1; //!< Index of the y-component of a vector of size dim
static constexpr int dimZIdx = 2; //!< Index of the z-component of a vector of size dim
static constexpr auto dim = dimension;
static constexpr int momentumXBalanceIdx = 0; //!< Index of the momentum balance equation
static constexpr int momentumYBalanceIdx = 1; //!< Index of the momentum balance equation
static constexpr int momentumZBalanceIdx = 2; //!< Index of the momentum balance equation
static constexpr int velocityXIdx = 0; //!< Index of the velocity in a solution vector #include <dumux/freeflow/navierstokes/momentum/cvfe/indices.hh>
static constexpr int velocityYIdx = 1; //!< Index of the velocity in a solution vector
static constexpr int velocityZIdx = 2; //!< Index of the velocity in a solution vector
/*! namespace Dumux {
* \brief Index of the velocity in a solution vector given a certain direction.
* \param dirIdx The index of the direction.
*/
static constexpr int velocity(int dirIdx)
{
return dirIdx;
}
/*! template <int dimension>
* \brief Index of the momentum balance equation given the direction using NavierStokesMomentumDiamondIndices [[deprecated("Use NavierStokesMomentumCVFEIndices")]] = NavierStokesMomentumCVFEIndices<dimension>;
* \param dirIdx The index of the direction.
*/
static constexpr int momentumBalanceIdx(int dirIdx)
{
return dirIdx;
}
};
} // end namespace Dumux } // end namespace Dumux
......
...@@ -58,8 +58,7 @@ ...@@ -58,8 +58,7 @@
#include <dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh> #include <dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh>
#include <dumux/freeflow/navierstokes/momentum/cvfe/volumevariables.hh> #include <dumux/freeflow/navierstokes/momentum/cvfe/volumevariables.hh>
#include <dumux/freeflow/navierstokes/momentum/cvfe/indices.hh>
#include "indices.hh"
namespace Dumux { namespace Dumux {
...@@ -102,7 +101,7 @@ struct NavierStokesMomentumDiamondModelTraits ...@@ -102,7 +101,7 @@ struct NavierStokesMomentumDiamondModelTraits
{ return TurbulenceModel::none; } { return TurbulenceModel::none; }
//! the indices //! the indices
using Indices = NavierStokesMomentumDiamondIndices<dim()>; using Indices = NavierStokesMomentumCVFEIndices<dim()>;
}; };
/*! /*!
......
...@@ -24,18 +24,15 @@ ...@@ -24,18 +24,15 @@
#ifndef DUMUX_NAVIERSTOKES_MOMENTUM_PQ1BUBBLE_INDICES_HH #ifndef DUMUX_NAVIERSTOKES_MOMENTUM_PQ1BUBBLE_INDICES_HH
#define DUMUX_NAVIERSTOKES_MOMENTUM_PQ1BUBBLE_INDICES_HH #define DUMUX_NAVIERSTOKES_MOMENTUM_PQ1BUBBLE_INDICES_HH
#include <dumux/freeflow/navierstokes/momentum/diamond/indices.hh>
#warning "This header is deprecated and will be removed after 3.7"
#include <dumux/freeflow/navierstokes/momentum/cvfe/indices.hh>
namespace Dumux { namespace Dumux {
/*!
* \ingroup NavierStokesModel
* \brief The common indices for the isothermal Navier-Stokes model.
*
* \tparam dimension The dimension of the problem
*/
template <int dimension> template <int dimension>
using NavierStokesMomentumPQ1BubbleIndices = NavierStokesMomentumDiamondIndices<dimension>; using NavierStokesMomentumPQ1BubbleIndices [[deprecated("Use NavierStokesMomentumCVFEIndices")]] = NavierStokesMomentumCVFEIndices<dimension>;
} // end namespace Dumux } // end namespace Dumux
......
...@@ -58,8 +58,7 @@ ...@@ -58,8 +58,7 @@
#include <dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh> #include <dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh>
#include <dumux/freeflow/navierstokes/momentum/cvfe/volumevariables.hh> #include <dumux/freeflow/navierstokes/momentum/cvfe/volumevariables.hh>
#include <dumux/freeflow/navierstokes/momentum/cvfe/indices.hh>
#include "indices.hh"
namespace Dumux { namespace Dumux {
...@@ -102,7 +101,7 @@ struct NavierStokesMomentumPQ1BubbleModelTraits ...@@ -102,7 +101,7 @@ struct NavierStokesMomentumPQ1BubbleModelTraits
{ return TurbulenceModel::none; } { return TurbulenceModel::none; }
//! the indices //! the indices
using Indices = NavierStokesMomentumPQ1BubbleIndices<dim()>; using Indices = NavierStokesMomentumCVFEIndices<dim()>;
}; };
/*! /*!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment