Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/PDE/MultiSpecies/MultiSpeciesIndexing.hpp 4 : : \copyright 2012-2015 J. Bakosi, 5 : : 2016-2018 Los Alamos National Security, LLC., 6 : : 2019-2021 Triad National Security, LLC. 7 : : All rights reserved. See the LICENSE file for details. 8 : : \brief Multi-species system indexing functions 9 : : \details This file defines functions that return indices to specific 10 : : equations for the system of multi-species compressible fluid dynamics. 11 : : */ 12 : : // ***************************************************************************** 13 : : #ifndef MultiSpeciesIndexing_h 14 : : #define MultiSpeciesIndexing_h 15 : : 16 : : namespace inciter { 17 : : 18 : : namespace multispecies { 19 : : 20 : : /** @name Functions that compute indices for physics variables for MultiSpecies */ 21 : : ///@{ 22 : : 23 : : // The functions below must follow the signature of MultiSpeciesIdxFn. 24 : : 25 : : //! Get the index of the required species continuity equation 26 : : // //! \param[in] nspec Number of species 27 : : //! \param[in] kspec Index of required species 28 : : //! \return Index of the required species continuity equation 29 : : inline std::size_t densityIdx( std::size_t /*nspec*/, std::size_t kspec ) 30 : : { return (kspec); } 31 : : 32 : : //! Get the index of the required momentum equation component 33 : : //! \param[in] nspec Number of species 34 : : //! \param[in] idir Required component direction; 35 : : //! 0: X-component, 36 : : //! 1: Y-component, 37 : : //! 2: Z-component. 38 : : //! \return Index of the required momentum equation component 39 : : inline std::size_t momentumIdx( std::size_t nspec, std::size_t idir ) 40 [ - - ][ - - ]: 0 : { return (nspec+idir); } [ - - ][ - - ] [ - - ][ - - ] [ - - ][ - - ] 41 : : 42 : : //! Get the index of the required mode of the total energy equation 43 : : //! \param[in] nspec Number of species 44 : : //! \param[in] kmode Index of required energy mode; 45 : : //! 0: translational-rotational-vibrational 46 : : //! \return Index of the required species total energy equation 47 : : inline std::size_t energyIdx( std::size_t nspec, std::size_t kmode ) 48 [ - - ][ - - ]: 0 : { return (nspec+3+kmode); } [ - - ][ - - ] [ - - ] 49 : : 50 : : //! \brief Get the index of the required DOF of species continuity equation 51 : : //! from the DG solution vector 52 : : //! \param[in] nspec Number of species 53 : : //! \param[in] kspec Index of required species 54 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 55 : : //! \param[in] idof Index of required solution DOF from DG solution vector 56 : : //! \return Index of the required species continuity equation 57 : : //! \details This function is used to get the index of the required DOF in the 58 : : //! solution vector, which is of type tk::Fields. 59 : : inline std::size_t densityDofIdx( std::size_t nspec, std::size_t kspec, 60 : : std::size_t ndof, std::size_t idof ) 61 [ - - ][ - - ]: 0 : { return densityIdx(nspec, kspec)*ndof+idof; } [ - - ][ - - ] 62 : : 63 : : //! \brief Get the index of the required DOF of momentum equation component from 64 : : //! the DG solution vector 65 : : //! \param[in] nspec Number of species 66 : : //! \param[in] idir Required component direction; 67 : : //! 0: X-component, 68 : : //! 1: Y-component, 69 : : //! 2: Z-component. 70 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 71 : : //! \param[in] idof Index of required solution DOF from DG solution vector 72 : : //! \return Index of the required momentum equation component 73 : : //! \details This function is used to get the index of the required DOF in the 74 : : //! solution vector, which is of type tk::Fields. 75 : : inline std::size_t momentumDofIdx( std::size_t nspec, std::size_t idir, 76 : : std::size_t ndof, std::size_t idof ) 77 [ - - ][ - - ]: 0 : { return momentumIdx(nspec, idir)*ndof+idof; } [ - - ] 78 : : 79 : : //! \brief Get the index of the required DOF of total energy equation 80 : : //! from the DG solution vector 81 : : //! \param[in] nspec Number of species 82 : : //! \param[in] kmode Index of required species 83 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 84 : : //! \param[in] idof Index of required solution DOF from DG solution vector 85 : : //! \return Index of the required species total energy equation 86 : : //! \details This function is used to get the index of the required DOF in the 87 : : //! solution vector, which is of type tk::Fields. 88 : : inline std::size_t energyDofIdx( std::size_t nspec, std::size_t kmode, 89 : : std::size_t ndof, std::size_t idof ) 90 : 0 : { return energyIdx(nspec, kmode)*ndof+idof; } 91 : : 92 : : //@} 93 : : 94 : : } //multispecies:: 95 : : 96 : : } //inciter:: 97 : : 98 : : #endif // MultiSpeciesIndexing_h