Quinoa regression test code coverage report
Current view: top level - PDE/MultiMat/Problem - SodShocktube.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 29 29 100.0 %
Date: 2021-11-11 13:17:06 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 32 43.8 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiMat/Problem/SodShocktube.cpp
       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     Problem configuration for the compressible flow equations
       9                 :            :   \details   This file defines a Problem policy class for the multi-material
      10                 :            :     compressible flow equations, defined in PDE/MultiMat/MultiMat.hpp. See
      11                 :            :     PDE/MultiMat/Problem.hpp for general requirements on Problem policy classes
      12                 :            :     for MultiMat.
      13                 :            : */
      14                 :            : // *****************************************************************************
      15                 :            : 
      16                 :            : #include "SodShocktube.hpp"
      17                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      18                 :            : #include "EoS/EoS.hpp"
      19                 :            : #include "MultiMat/MultiMatIndexing.hpp"
      20                 :            : 
      21                 :            : namespace inciter {
      22                 :            : 
      23                 :            : extern ctr::InputDeck g_inputdeck;
      24                 :            : 
      25                 :            : } // ::inciter
      26                 :            : 
      27                 :            : using inciter::MultiMatProblemSodShocktube;
      28                 :            : 
      29                 :            : tk::InitializeFn::result_type
      30                 :     542728 : MultiMatProblemSodShocktube::initialize( ncomp_t system,
      31                 :            :                                          ncomp_t ncomp,
      32                 :            :                                          tk::real x,
      33                 :            :                                          tk::real,
      34                 :            :                                          tk::real,
      35                 :            :                                          tk::real )
      36                 :            : // *****************************************************************************
      37                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      38                 :            : //! \param[in] system Equation system index, i.e., which compressible
      39                 :            : //!   flow equation system we operate on among the systems of PDEs
      40                 :            : //! \param[in] ncomp Number of scalar components in this PDE system
      41                 :            : //! \param[in] x X coordinate where to evaluate the solution
      42                 :            : //! \return Values of all components evaluated at (x)
      43                 :            : //! \note The function signature must follow tk::InitializeFn
      44                 :            : //! \details This function only initializes the Sod shock tube problem, but does
      45                 :            : //!   not actually give the analytical solution at time greater than 0. The
      46                 :            : //!   analytical solution would require an exact Riemann solver, which has not
      47                 :            : //!   been implemented yet.
      48                 :            : // *****************************************************************************
      49                 :            : {
      50                 :            :   // see also Control/Inciter/InputDeck/Grammar.hpp
      51 [ -  + ][ -  - ]:     542728 :   Assert( ncomp == 9, "Number of scalar components must be 9" );
         [ -  - ][ -  - ]
      52                 :            : 
      53                 :            :   auto nmat =
      54                 :     542728 :     g_inputdeck.get< tag::param, eq, tag::nmat >()[system];
      55                 :            : 
      56         [ +  - ]:     542728 :   std::vector< tk::real > s( ncomp, 0.0 );
      57                 :            :   tk::real r, p, u, v, w;
      58                 :     542728 :   auto alphamin = 1.0e-12;
      59                 :            : 
      60         [ +  + ]:     542728 :   if (x<0.5) {
      61                 :            :     // volume-fraction
      62                 :     271480 :     s[volfracIdx(nmat, 0)] = 1.0-alphamin;
      63                 :     271480 :     s[volfracIdx(nmat, 1)] = alphamin;
      64                 :            :     // density
      65                 :     271480 :     r = 1.0;
      66                 :            :     // pressure
      67                 :     271480 :     p = 1.0;
      68                 :            :     // velocity
      69                 :     271480 :     u = 0.0;
      70                 :     271480 :     v = 0.0;
      71                 :     271480 :     w = 0.0;
      72                 :            :   }
      73                 :            :   else {
      74                 :            :     // volume-fraction
      75                 :     271248 :     s[volfracIdx(nmat, 0)] = alphamin;
      76                 :     271248 :     s[volfracIdx(nmat, 1)] = 1.0-alphamin;
      77                 :            :     // density
      78                 :     271248 :     r = 0.125;
      79                 :            :     // pressure
      80                 :     271248 :     p = 0.1;
      81                 :            :     // velocity
      82                 :     271248 :     u = 0.0;
      83                 :     271248 :     v = 0.0;
      84                 :     271248 :     w = 0.0;
      85                 :            :   }
      86                 :     542728 :   s[densityIdx(nmat, 0)] = s[volfracIdx(nmat, 0)]*r;
      87                 :     542728 :   s[densityIdx(nmat, 1)] = s[volfracIdx(nmat, 1)]*r;
      88                 :            :   // total specific energy
      89                 :    1085456 :   s[energyIdx(nmat, 0)] = s[volfracIdx(nmat, 0)]*
      90         [ +  - ]:     542728 :                             eos_totalenergy< eq >( system, r, u, v, w, p, 0 );
      91                 :    1085456 :   s[energyIdx(nmat, 1)] = s[volfracIdx(nmat, 1)]*
      92         [ +  - ]:     542728 :                             eos_totalenergy< eq >( system, r, u, v, w, p, 1 );
      93                 :            : 
      94                 :     542728 :   return s;
      95                 :            : }
      96                 :            : 
      97                 :            : std::vector< std::string >
      98                 :          7 : MultiMatProblemSodShocktube::names( ncomp_t )
      99                 :            : // *****************************************************************************
     100                 :            : //  Return names of integral variables to be output to diagnostics file
     101                 :            : //! \return Vector of strings labelling integral variables output
     102                 :            : // *****************************************************************************
     103                 :            : {
     104 [ +  - ][ +  - ]:         42 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
     105                 :            : }

Generated by: LCOV version 1.14