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 [ + - ][ - - ]: 11703990 : { 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 [ + - ][ + - ]: 4733666 : { return (nspec+3+kmode); } [ - - ][ + - ] [ - - ][ + - ] 49 : : 50 : : //! Get the index of the required mode of the temperature from primitives vector 51 : : // //! \param[in] nspec Number of species 52 : : //! \param[in] kmode Index of required energy mode; 53 : : //! 0: translational-rotational-vibrational 54 : : //! \return Index of the required mode of temperature 55 : : inline std::size_t temperatureIdx( std::size_t /*nspec*/, std::size_t kmode ) 56 : : { return (kmode); } 57 : : 58 : : //! \brief Get the index of the required DOF of species continuity equation 59 : : //! from the DG solution vector 60 : : //! \param[in] nspec Number of species 61 : : //! \param[in] kspec Index of required species 62 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 63 : : //! \param[in] idof Index of required solution DOF from DG solution vector 64 : : //! \return Index of the required species continuity equation 65 : : //! \details This function is used to get the index of the required DOF in the 66 : : //! solution vector, which is of type tk::Fields. 67 : : inline std::size_t densityDofIdx( std::size_t nspec, std::size_t kspec, 68 : : std::size_t ndof, std::size_t idof ) 69 [ + - ][ + - ]: 352 : { return densityIdx(nspec, kspec)*ndof+idof; } [ + - ][ + - ] 70 : : 71 : : //! \brief Get the index of the required DOF of momentum equation component from 72 : : //! the DG solution vector 73 : : //! \param[in] nspec Number of species 74 : : //! \param[in] idir Required component direction; 75 : : //! 0: X-component, 76 : : //! 1: Y-component, 77 : : //! 2: Z-component. 78 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 79 : : //! \param[in] idof Index of required solution DOF from DG solution vector 80 : : //! \return Index of the required momentum equation component 81 : : //! \details This function is used to get the index of the required DOF in the 82 : : //! solution vector, which is of type tk::Fields. 83 : : inline std::size_t momentumDofIdx( std::size_t nspec, std::size_t idir, 84 : : std::size_t ndof, std::size_t idof ) 85 [ + - ][ + - ]: 528 : { return momentumIdx(nspec, idir)*ndof+idof; } [ + - ] 86 : : 87 : : //! \brief Get the index of the required DOF of total energy equation 88 : : //! from the DG solution vector 89 : : //! \param[in] nspec Number of species 90 : : //! \param[in] kmode Index of required species 91 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 92 : : //! \param[in] idof Index of required solution DOF from DG solution vector 93 : : //! \return Index of the required species total energy equation 94 : : //! \details This function is used to get the index of the required DOF in the 95 : : //! solution vector, which is of type tk::Fields. 96 : : inline std::size_t energyDofIdx( std::size_t nspec, std::size_t kmode, 97 : : std::size_t ndof, std::size_t idof ) 98 : 2274176 : { return energyIdx(nspec, kmode)*ndof+idof; } 99 : : 100 : : //! \brief Get the index of the required DOF of temperature from the DG vector 101 : : //! of primitives 102 : : //! \param[in] nspec Number of species 103 : : //! \param[in] kmode Index of required species 104 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector 105 : : //! \param[in] idof Index of required solution DOF from DG solution vector 106 : : //! \return Index of the required species total energy equation 107 : : //! \details This function is used to get the index of the required DOF in the 108 : : //! solution vector, which is of type tk::Fields. 109 : : inline std::size_t temperatureDofIdx( std::size_t nspec, std::size_t kmode, 110 : : std::size_t ndof, std::size_t idof ) 111 : : { return temperatureIdx(nspec, kmode)*ndof+idof; } 112 : : 113 : : //@} 114 : : 115 : : } //multispecies:: 116 : : 117 : : } //inciter:: 118 : : 119 : : #endif // MultiSpeciesIndexing_h