Quinoa all test code coverage report
Current view: top level - PDE/MultiMat - MultiMatIndexing.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 11 16 68.8 %
Date: 2025-08-06 10:30:55 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 92 740 12.4 %

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

Generated by: LCOV version 1.14