Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/MultiMat/MultiMatIndexing.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-material system indexing functions
9 : : \details This file defines functions that return indices to specific
10 : : equations for the system of multi-material compressible hydrodynamics.
11 : : */
12 : : // *****************************************************************************
13 : : #ifndef MultiMatIndexing_h
14 : : #define MultiMatIndexing_h
15 : :
16 : : namespace inciter {
17 : :
18 : : /** @name Functions that compute indices for physics variables for MultiMat */
19 : : ///@{
20 : :
21 : : // The functions below must follow the signature of MultiMatIdxFn.
22 : :
23 : : //! Get the index of the required material volume fraction
24 : : //! \param[in] kmat Index of required material
25 : : //! \return Index of the required material volume fraction
26 : 26 : inline std::size_t volfracIdx( std::size_t /*nmat*/, std::size_t kmat )
27 : 26 : { return kmat; }
28 : :
29 : : //! Get the index of the required material continuity equation
30 : : //! \param[in] nmat Number of materials
31 : : //! \param[in] kmat Index of required material
32 : : //! \return Index of the required material continuity equation
33 : 0 : inline std::size_t densityIdx( std::size_t nmat, std::size_t kmat )
34 [ + + ][ - - ]: 140524755 : { return (nmat+kmat); }
[ - - ][ + - ]
[ + - ][ + - ]
[ - - ][ - - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ + - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
35 : :
36 : : //! Get the index of the required momentum equation component
37 : : //! \param[in] nmat Number of materials
38 : : //! \param[in] idir Required component direction;
39 : : //! 0: X-component,
40 : : //! 1: Y-component,
41 : : //! 2: Z-component.
42 : : //! \return Index of the required momentum equation component
43 : 0 : inline std::size_t momentumIdx( std::size_t nmat, std::size_t idir )
44 [ + - ][ + - ]: 67251478 : { return (2*nmat+idir); }
[ + - ][ + - ]
[ - - ][ - - ]
45 : :
46 : : //! Get the index of the required material total energy equation
47 : : //! \param[in] nmat Number of materials
48 : : //! \param[in] kmat Index of required material
49 : : //! \return Index of the required material total energy equation
50 : 0 : inline std::size_t energyIdx( std::size_t nmat, std::size_t kmat )
51 [ + + ][ + - ]: 133951414 : { return (2*nmat+3+kmat); }
[ + - ][ + - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
52 : :
53 : : //! Get the index of the required velocity component from vector of primitives
54 : : //! \param[in] nmat Number of materials
55 : : //! \param[in] idir Required component direction;
56 : : //! 0: X-component,
57 : : //! 1: Y-component,
58 : : //! 2: Z-component.
59 : : //! \return Index of the required velocity component from vector of primitives
60 : 0 : inline std::size_t velocityIdx( std::size_t nmat, std::size_t idir )
61 [ + - ][ - - ]: 31239396 : { return nmat+idir; }
[ - - ][ - + ]
[ - - ][ - + ]
[ - - ][ + + ]
[ - - ][ - - ]
[ - - ][ - - ]
62 : :
63 : : //! Get the index of the required material pressure from vector of primitives
64 : : //! \param[in] kmat Index of required material
65 : : //! \return Index of the required material pressure from vector of primitives
66 : 0 : inline std::size_t pressureIdx( std::size_t /*nmat*/, std::size_t kmat )
67 : 0 : { return kmat; }
68 : :
69 : : //! \brief Get the index of the required DOF of material volume fraction from
70 : : //! the DG solution vector
71 : : //! \param[in] nmat Number of materials
72 : : //! \param[in] kmat Index of required material
73 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
74 : : //! \param[in] idof Index of required solution DOF from DG solution vector
75 : : //! \return Index of the required material volume fraction
76 : : //! \details This function is used to get the index of the required DOF in the
77 : : //! solution vector, which is of type tk::Fields.
78 : : inline std::size_t volfracDofIdx( std::size_t nmat, std::size_t kmat,
79 : : std::size_t ndof, std::size_t idof )
80 [ + + ][ + + ]: 101626881 : { return volfracIdx(nmat, kmat)*ndof+idof; }
[ + - ][ + + ]
[ + + ][ - + ]
[ + + ][ + + ]
[ - + ][ + + ]
[ + + ][ - + ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
81 : :
82 : : //! \brief Get the index of the required DOF of material continuity equation
83 : : //! from the DG solution vector
84 : : //! \param[in] nmat Number of materials
85 : : //! \param[in] kmat Index of required material
86 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
87 : : //! \param[in] idof Index of required solution DOF from DG solution vector
88 : : //! \return Index of the required material continuity equation
89 : : //! \details This function is used to get the index of the required DOF in the
90 : : //! solution vector, which is of type tk::Fields.
91 : : inline std::size_t densityDofIdx( std::size_t nmat, std::size_t kmat,
92 : : std::size_t ndof, std::size_t idof )
93 [ - - ][ - - ]: 19827342 : { return densityIdx(nmat, kmat)*ndof+idof; }
[ - + ][ - + ]
[ - + ][ - + ]
[ + + ][ - + ]
[ - - ][ - - ]
[ - - ][ - - ]
[ + - ]
94 : :
95 : : //! \brief Get the index of the required DOF of momentum equation component from
96 : : //! the DG solution vector
97 : : //! \param[in] nmat Number of materials
98 : : //! \param[in] idir Required component direction;
99 : : //! 0: X-component,
100 : : //! 1: Y-component,
101 : : //! 2: Z-component.
102 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
103 : : //! \param[in] idof Index of required solution DOF from DG solution vector
104 : : //! \return Index of the required momentum equation component
105 : : //! \details This function is used to get the index of the required DOF in the
106 : : //! solution vector, which is of type tk::Fields.
107 : : inline std::size_t momentumDofIdx( std::size_t nmat, std::size_t idir,
108 : : std::size_t ndof, std::size_t idof )
109 : 974799 : { return momentumIdx(nmat, idir)*ndof+idof; }
110 : :
111 : : //! \brief Get the index of the required DOF of material total energy equation
112 : : //! from the DG solution vector
113 : : //! \param[in] nmat Number of materials
114 : : //! \param[in] kmat Index of required material
115 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
116 : : //! \param[in] idof Index of required solution DOF from DG solution vector
117 : : //! \return Index of the required material total energy equation
118 : : //! \details This function is used to get the index of the required DOF in the
119 : : //! solution vector, which is of type tk::Fields.
120 : : inline std::size_t energyDofIdx( std::size_t nmat, std::size_t kmat,
121 : : std::size_t ndof, std::size_t idof )
122 [ - - ][ - + ]: 14290719 : { return energyIdx(nmat, kmat)*ndof+idof; }
[ - + ][ + + ]
[ - - ][ - - ]
[ + - ]
123 : :
124 : : //! \brief Get the index of the required DOF of velocity component from the DG
125 : : //! vector of primitives
126 : : //! \param[in] nmat Number of materials
127 : : //! \param[in] idir Required component direction;
128 : : //! 0: X-component,
129 : : //! 1: Y-component,
130 : : //! 2: Z-component.
131 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
132 : : //! \param[in] idof Index of required solution DOF from DG solution vector
133 : : //! \return Index of the required velocity component from vector of primitives
134 : : //! \details This function is used to get the index of the required DOF in the
135 : : //! solution vector, which is of type tk::Fields.
136 : : inline std::size_t velocityDofIdx( std::size_t nmat, std::size_t idir,
137 : : std::size_t ndof, std::size_t idof )
138 [ - - ][ - + ]: 3107730 : { return velocityIdx(nmat, idir)*ndof+idof; }
[ - + ][ + + ]
[ - - ][ - - ]
139 : :
140 : : //! \brief Get the index of the required DOF of material pressure from the DG
141 : : //! vector of primitives
142 : : //! \param[in] nmat Number of materials
143 : : //! \param[in] kmat Index of required material
144 : : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
145 : : //! \param[in] idof Index of required solution DOF from DG solution vector
146 : : //! \return Index of the required material pressure from vector of primitives
147 : : //! \details This function is used to get the index of the required DOF in the
148 : : //! solution vector, which is of type tk::Fields.
149 : : inline std::size_t pressureDofIdx( std::size_t nmat, std::size_t kmat,
150 : : std::size_t ndof, std::size_t idof )
151 [ - - ][ - + ]: 4799837 : { return pressureIdx(nmat, kmat)*ndof+idof; }
[ - + ][ + + ]
[ - - ][ - - ]
[ + - ]
152 : :
153 : : inline bool matExists( tk::real volfrac )
154 : : { return (volfrac > 1e-10) ? true : false; }
155 : :
156 : : //@}
157 : :
158 : : } //inciter::
159 : :
160 : : #endif // MultiMatIndexing_h
|