Quinoa all test code coverage report
Current view: top level - PDE/MultiMat/Problem - SodShocktube.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 25 25 100.0 %
Date: 2024-04-22 13:03:21 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 14 57.1 %

           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 "MultiMat/MultiMatIndexing.hpp"
      19                 :            : 
      20                 :            : namespace inciter {
      21                 :            : 
      22                 :            : extern ctr::InputDeck g_inputdeck;
      23                 :            : 
      24                 :            : } // ::inciter
      25                 :            : 
      26                 :            : using inciter::MultiMatProblemSodShocktube;
      27                 :            : 
      28                 :            : tk::InitializeFn::result_type
      29                 :     664008 : MultiMatProblemSodShocktube::initialize( ncomp_t ncomp,
      30                 :            :                                          const std::vector< EOS >& mat_blk,
      31                 :            :                                          tk::real x,
      32                 :            :                                          tk::real,
      33                 :            :                                          tk::real,
      34                 :            :                                          tk::real )
      35                 :            : // *****************************************************************************
      36                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      37                 :            : //! \param[in] ncomp Number of scalar components in this PDE system
      38                 :            : //! \param[in] x X coordinate where to evaluate the solution
      39                 :            : //! \return Values of all components evaluated at (x)
      40                 :            : //! \note The function signature must follow tk::InitializeFn
      41                 :            : //! \details This function only initializes the Sod shock tube problem, but does
      42                 :            : //!   not actually give the analytical solution at time greater than 0. The
      43                 :            : //!   analytical solution would require an exact Riemann solver, which has not
      44                 :            : //!   been implemented yet.
      45                 :            : // *****************************************************************************
      46                 :            : {
      47                 :            :   // see also Control/Inciter/InputDeck/Grammar.hpp
      48                 :            :   Assert( ncomp == 9, "Number of scalar components must be 9" );
      49                 :            : 
      50                 :     664008 :   auto nmat = g_inputdeck.get< eq, tag::nmat >();
      51                 :            : 
      52                 :     664008 :   std::vector< tk::real > s( ncomp, 0.0 );
      53                 :            :   tk::real r, p, u, v, w;
      54                 :            :   auto alphamin = 1.0e-12;
      55                 :            : 
      56         [ +  + ]:     664008 :   if (x<0.5) {
      57                 :            :     // volume-fraction
      58                 :     332148 :     s[volfracIdx(nmat, 0)] = 1.0-alphamin;
      59                 :     332148 :     s[volfracIdx(nmat, 1)] = alphamin;
      60                 :            :     // density
      61                 :     332148 :     r = 1.0;
      62                 :            :     // pressure
      63                 :     332148 :     p = 1.0;
      64                 :            :     // velocity
      65                 :     332148 :     u = 0.0;
      66                 :     332148 :     v = 0.0;
      67                 :     332148 :     w = 0.0;
      68                 :            :   }
      69                 :            :   else {
      70                 :            :     // volume-fraction
      71                 :     331860 :     s[volfracIdx(nmat, 0)] = alphamin;
      72                 :     331860 :     s[volfracIdx(nmat, 1)] = 1.0-alphamin;
      73                 :            :     // density
      74                 :     331860 :     r = 0.125;
      75                 :            :     // pressure
      76                 :     331860 :     p = 0.1;
      77                 :            :     // velocity
      78                 :     331860 :     u = 0.0;
      79                 :     331860 :     v = 0.0;
      80                 :     331860 :     w = 0.0;
      81                 :            :   }
      82         [ +  - ]:     664008 :   s[densityIdx(nmat, 0)] = s[volfracIdx(nmat, 0)]*r;
      83         [ +  - ]:     664008 :   s[densityIdx(nmat, 1)] = s[volfracIdx(nmat, 1)]*r;
      84                 :            :   // total specific energy
      85         [ +  - ]:     664008 :   s[energyIdx(nmat, 0)] = s[volfracIdx(nmat, 0)]*
      86         [ +  - ]:     664008 :     mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
      87                 :     664008 :   s[energyIdx(nmat, 1)] = s[volfracIdx(nmat, 1)]*
      88 [ +  - ][ +  - ]:    1328016 :     mat_blk[1].compute< EOS::totalenergy >( r, u, v, w, p );
      89                 :            : 
      90                 :     664008 :   return s;
      91                 :            : }

Generated by: LCOV version 1.14