Quinoa all test code coverage report
Current view: top level - PDE/MultiMat - MultiMatIndexing.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 10 15 66.7 %
Date: 2024-12-12 08:36:05 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 79 624 12.7 %

           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                 :            : inline std::size_t volfracIdx( std::size_t /*nmat*/, std::size_t kmat )
      27                 :            : { 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                 :            : inline std::size_t densityIdx( std::size_t nmat, std::size_t kmat )
      34 [ +  + ][ +  + ]:  234461309 : { 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                 :            : inline std::size_t momentumIdx( std::size_t nmat, std::size_t idir )
      44 [ +  - ][ -  - ]:   77186345 : { 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                 :            : inline std::size_t energyIdx( std::size_t nmat, std::size_t kmat )
      51 [ +  - ][ +  - ]:  201497181 : { return (2*nmat+3+kmat); }
         [ +  + ][ +  + ]
         [ -  - ][ +  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ +  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  + ]
         [ -  - ][ -  - ]
         [ +  - ][ +  - ]
      52                 :            : 
      53                 :            : //! Get the index of the required material deformation gradient equation
      54                 :            : //! \param[in] nmat Number of materials
      55                 :            : //! \param[in] ksld Index of required solid
      56                 :            : //! \param[in] i Row-index of required tensor component
      57                 :            : //! \param[in] j Column-index of required tensor component
      58                 :            : //! \return Index of the required material deformation gradient equation
      59                 :            : inline std::size_t deformIdx( std::size_t nmat, std::size_t ksld,
      60                 :            :   std::size_t i, std::size_t j )
      61         [ -  - ]:          0 : { return (2*nmat+3+nmat + 9*(ksld-1)+3*i+j); }
      62                 :            : 
      63                 :            : //! Get the index of the required velocity component from vector of primitives
      64                 :            : //! \param[in] nmat Number of materials
      65                 :            : //! \param[in] idir Required component direction;
      66                 :            : //!   0: X-component,
      67                 :            : //!   1: Y-component,
      68                 :            : //!   2: Z-component.
      69                 :            : //! \return Index of the required velocity component from vector of primitives
      70                 :            : inline std::size_t velocityIdx( std::size_t nmat, std::size_t idir )
      71 [ +  - ][ +  - ]:   48033759 : { return nmat+idir; }
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
      72                 :            : 
      73                 :            : //! Get the index of the required material pressure from vector of primitives
      74                 :            : //! \param[in] kmat Index of required material
      75                 :            : //! \return Index of the required material pressure from vector of primitives
      76                 :            : inline std::size_t pressureIdx( std::size_t /*nmat*/, std::size_t kmat )
      77                 :            : { return kmat; }
      78                 :            : 
      79                 :            : //! Get the index of the required material stress component from primitives
      80                 :            : //! \param[in] nmat Number of materials
      81                 :            : //! \param[in] ksld Index of required solid
      82                 :            : //! \param[in] i Index of required stress component
      83                 :            : //! \return Index of the required material Cauchy stress component from vector
      84                 :            : //!   of primitives
      85                 :            : inline std::size_t stressIdx( std::size_t nmat, std::size_t ksld,
      86                 :            :   std::size_t i )
      87                 :          0 : { return (nmat+3 + 6*(ksld-1)+i); }
      88                 :            : 
      89                 :            : //! \brief Get the index of the required DOF of material volume fraction from
      90                 :            : //!   the DG solution vector
      91                 :            : //! \param[in] nmat Number of materials
      92                 :            : //! \param[in] kmat Index of required material
      93                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
      94                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
      95                 :            : //! \return Index of the required material volume fraction
      96                 :            : //! \details This function is used to get the index of the required DOF in the
      97                 :            : //!   solution vector, which is of type tk::Fields.
      98                 :            : inline std::size_t volfracDofIdx( std::size_t nmat, std::size_t kmat,
      99                 :            :   std::size_t ndof, std::size_t idof )
     100 [ +  + ][ +  - ]:  189808563 : { return volfracIdx(nmat, kmat)*ndof+idof; }
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
         [ +  + ][ -  - ]
         [ -  - ][ -  - ]
         [ +  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     101                 :            : 
     102                 :            : //! \brief Get the index of the required DOF of material continuity equation
     103                 :            : //!   from the DG solution vector
     104                 :            : //! \param[in] nmat Number of materials
     105                 :            : //! \param[in] kmat Index of required material
     106                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     107                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     108                 :            : //! \return Index of the required material continuity equation
     109                 :            : //! \details This function is used to get the index of the required DOF in the
     110                 :            : //!   solution vector, which is of type tk::Fields.
     111                 :            : inline std::size_t densityDofIdx( std::size_t nmat, std::size_t kmat,
     112                 :            :   std::size_t ndof, std::size_t idof )
     113 [ +  + ][ +  - ]:   49207089 : { return densityIdx(nmat, kmat)*ndof+idof; }
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
         [ +  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     114                 :            : 
     115                 :            : //! \brief Get the index of the required DOF of momentum equation component from
     116                 :            : //!   the DG solution vector
     117                 :            : //! \param[in] nmat Number of materials
     118                 :            : //! \param[in] idir Required component direction;
     119                 :            : //!   0: X-component,
     120                 :            : //!   1: Y-component,
     121                 :            : //!   2: Z-component.
     122                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     123                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     124                 :            : //! \return Index of the required momentum equation component
     125                 :            : //! \details This function is used to get the index of the required DOF in the
     126                 :            : //!   solution vector, which is of type tk::Fields.
     127                 :            : inline std::size_t momentumDofIdx( std::size_t nmat, std::size_t idir,
     128                 :            :   std::size_t ndof, std::size_t idof )
     129                 :    1719324 : { return momentumIdx(nmat, idir)*ndof+idof; }
     130                 :            : 
     131                 :            : //! \brief Get the index of the required DOF of material total energy equation
     132                 :            : //!   from the DG solution vector
     133                 :            : //! \param[in] nmat Number of materials
     134                 :            : //! \param[in] kmat Index of required material
     135                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     136                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     137                 :            : //! \return Index of the required material total energy equation
     138                 :            : //! \details This function is used to get the index of the required DOF in the
     139                 :            : //!   solution vector, which is of type tk::Fields.
     140                 :            : inline std::size_t energyDofIdx( std::size_t nmat, std::size_t kmat,
     141                 :            :   std::size_t ndof, std::size_t idof )
     142 [ +  + ][ +  - ]:   51693617 : { return energyIdx(nmat, kmat)*ndof+idof; }
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ +  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     143                 :            : 
     144                 :            : //! \brief Get the index of the required DOF of material deformation gradient
     145                 :            : //!   equation from the DG solution vector
     146                 :            : //! \param[in] nmat Number of materials
     147                 :            : //! \param[in] ksld Index of required solid
     148                 :            : //! \param[in] i Row-index of required tensor component
     149                 :            : //! \param[in] j Column-index of required tensor component
     150                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     151                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     152                 :            : //! \return Index of the required material total energy equation
     153                 :            : //! \details This function is used to get the index of the required DOF in the
     154                 :            : //!   solution vector, which is of type tk::Fields.
     155                 :            : inline std::size_t deformDofIdx( std::size_t nmat, std::size_t ksld,
     156                 :            :   std::size_t i, std::size_t j, std::size_t ndof, std::size_t idof )
     157                 :          0 : { return deformIdx(nmat, ksld, i, j)*ndof+idof; }
     158                 :            : 
     159                 :            : //! \brief Get the index of the required DOF of velocity component from the DG
     160                 :            : //!   vector of primitives
     161                 :            : //! \param[in] nmat Number of materials
     162                 :            : //! \param[in] idir Required component direction;
     163                 :            : //!   0: X-component,
     164                 :            : //!   1: Y-component,
     165                 :            : //!   2: Z-component.
     166                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     167                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     168                 :            : //! \return Index of the required velocity component from vector of primitives
     169                 :            : //! \details This function is used to get the index of the required DOF in the
     170                 :            : //!   solution vector, which is of type tk::Fields.
     171                 :            : inline std::size_t velocityDofIdx( std::size_t nmat, std::size_t idir,
     172                 :            :   std::size_t ndof, std::size_t idof )
     173         [ +  - ]:    8812623 : { return velocityIdx(nmat, idir)*ndof+idof; }
     174                 :            : 
     175                 :            : //! \brief Get the index of the required DOF of material pressure from the DG
     176                 :            : //!   vector of primitives
     177                 :            : //! \param[in] nmat Number of materials
     178                 :            : //! \param[in] kmat Index of required material
     179                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     180                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     181                 :            : //! \return Index of the required material pressure from vector of primitives
     182                 :            : //! \details This function is used to get the index of the required DOF in the
     183                 :            : //!   solution vector, which is of type tk::Fields.
     184                 :            : inline std::size_t pressureDofIdx( std::size_t nmat, std::size_t kmat,
     185                 :            :   std::size_t ndof, std::size_t idof )
     186 [ +  - ][ +  - ]:   26579401 : { return pressureIdx(nmat, kmat)*ndof+idof; }
         [ +  - ][ +  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ +  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     187                 :            : 
     188                 :            : //! \brief Get the index of the required DOF of material stress component from
     189                 :            : //!   the DG vector of primitives
     190                 :            : //! \param[in] nmat Number of materials
     191                 :            : //! \param[in] ksld Index of required solid
     192                 :            : //! \param[in] i Index of required stress component
     193                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     194                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     195                 :            : //! \return Index of the required material Cauchy stress component from vector
     196                 :            : //!   of primitives
     197                 :            : //! \details This function is used to get the index of the required DOF in the
     198                 :            : //!   primitives vector, which is of type tk::Fields.
     199                 :            : inline std::size_t stressDofIdx( std::size_t nmat, std::size_t ksld,
     200                 :            :   std::size_t i, std::size_t ndof, std::size_t idof )
     201                 :          0 : { return stressIdx(nmat, ksld, i)*ndof+idof; }
     202                 :            : 
     203                 :            : inline bool matExists( tk::real volfrac )
     204                 :            : { return (volfrac > 1e-10) ? true : false; }
     205                 :            : 
     206                 :            : inline tk::real volfracPRelaxLim()
     207                 :            : { return 1.0e-02; }
     208                 :            : 
     209                 :            : //! \brief Get the index of the quantity vel[l]*g[i][j] computed inside the
     210                 :            : //!   Riemann flux solver.
     211                 :            : //! \param[in] kmat Index of required material
     212                 :            : //! \param[in] i Row of inverse deformation tensor
     213                 :            : //! \param[in] j Column of inverse deformation tensor
     214                 :            : //! \param[in] l Velocity component
     215                 :            : //! \return Index of the quantity vel[l]*g[i][j] computed inside the
     216                 :            : //!   Riemann flux solver.
     217                 :            : //! \details This function is used to get the index of the quantity
     218                 :            : //!   vel[l]*g[i][j] computed inside the Riemann flux solver.
     219                 :            : inline std::size_t newSolidsAccFn( std::size_t kmat,
     220                 :            :   std::size_t i, std::size_t j, std::size_t l)
     221                 :            : { return 3*9*kmat+3*(3*i+j)+l; }
     222                 :            : 
     223                 :            : //! \brief Index for Cauchy stress components, since only the 6 independent
     224                 :            : //!   components are stored.
     225                 :            : const std::array< std::array< std::size_t, 3 >, 3 > stressCmp{{
     226                 :            :   {{0, 3, 4}},
     227                 :            :   {{3, 1, 5}},
     228                 :            :   {{4, 5, 2}} }};
     229                 :            : 
     230                 :            : //! Get the index of the required material deformation gradient equation
     231                 :            : //! in the context of a list where only the g's of solid materials are present.
     232                 :            : //! If one needs to access the deformation tensor within the state array one
     233                 :            : //! should use deformIdx instead!
     234                 :            : //! \param[in] ksld Index of required solid
     235                 :            : //! \param[in] i Row-index of required tensor component
     236                 :            : //! \param[in] j Column-index of required tensor component
     237                 :            : //! \return Index of the required material deformation gradient equation
     238                 :            : //! in the context of a list where only the g's of solid materials are present.
     239                 :            : inline std::size_t solidTensorIdx( std::size_t ksld, std::size_t i, std::size_t j )
     240                 :          0 : { return 9*ksld+(3*i+j); }
     241                 :            : 
     242                 :            : 
     243                 :            : //@}
     244                 :            : 
     245                 :            : } //inciter::
     246                 :            : 
     247                 :            : #endif // MultiMatIndexing_h

Generated by: LCOV version 1.14