Quinoa all test code coverage report
Current view: top level - PDE/MultiMat/Problem - WaterAirShocktube.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: 13 22 59.1 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiMat/Problem/WaterAirShocktube.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 multi-material 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 "WaterAirShocktube.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::MultiMatProblemWaterAirShocktube;
      27                 :            : 
      28                 :            : tk::InitializeFn::result_type
      29                 :     385064 : MultiMatProblemWaterAirShocktube::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 Water-Air shock tube problem,
      42                 :            : //!   but does not actually give the analytical solution at time greater than 0.
      43                 :            : //!   The analytical solution would require an exact Riemann solver for
      44                 :            : //!   stiffened gas EoS, which has not 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                 :     385064 :   auto nmat = g_inputdeck.get< eq, tag::nmat >();
      51                 :            : 
      52 [ +  - ][ -  - ]:     385064 :   std::vector< tk::real > s(ncomp, 0.0), r(nmat, 0.0);
      53                 :            :   tk::real p, u, v, w;
      54                 :            :   auto alphamin = 1.0e-12;
      55                 :            : 
      56         [ +  + ]:     385064 :   if (x<0.75) {
      57                 :            :     // volume-fraction
      58                 :     293048 :     s[volfracIdx(nmat, 0)] = 1.0-alphamin;
      59                 :     293048 :     s[volfracIdx(nmat, 1)] = alphamin;
      60                 :            :     // pressure
      61                 :     293048 :     p = 1.0e9;
      62                 :            :     // densities
      63         [ +  + ]:     879144 :     for (std::size_t k=0; k<nmat; ++k)
      64         [ +  - ]:     586096 :       r[k] = mat_blk[k].compute< EOS::density >( p, 494.646 );
      65                 :            :     // velocity
      66                 :     293048 :     u = 0.0;
      67                 :     293048 :     v = 0.0;
      68                 :     293048 :     w = 0.0;
      69                 :            :   }
      70                 :            :   else {
      71                 :            :     // volume-fraction
      72                 :      92016 :     s[volfracIdx(nmat, 0)] = alphamin;
      73                 :      92016 :     s[volfracIdx(nmat, 1)] = 1.0-alphamin;
      74                 :            :     // pressure
      75                 :      92016 :     p = 1.0e5;
      76                 :            :     // densities
      77         [ +  + ]:     276048 :     for (std::size_t k=0; k<nmat; ++k)
      78 [ +  - ][ -  - ]:     368064 :       r[k] = mat_blk[k].compute< EOS::density >( p, 34.844 );
      79                 :            :     // velocity
      80                 :      92016 :     u = 0.0;
      81                 :      92016 :     v = 0.0;
      82                 :      92016 :     w = 0.0;
      83                 :            :   }
      84         [ +  + ]:    1155192 :   for (std::size_t k=0; k<nmat; ++k)
      85                 :            :   {
      86                 :            :     // partial density
      87         [ +  - ]:     770128 :     s[densityIdx(nmat, k)] = s[volfracIdx(nmat, k)]*r[k];
      88                 :            :     // total specific energy
      89                 :     770128 :     s[energyIdx(nmat, k)] = s[volfracIdx(nmat, k)]*
      90         [ +  - ]:     770128 :       mat_blk[k].compute< EOS::totalenergy >( r[k], u, v, w, p );
      91                 :            :   }
      92                 :            : 
      93                 :     385064 :   return s;
      94                 :            : }

Generated by: LCOV version 1.14