Quinoa all test code coverage report
Current view: top level - PDE/MultiMat/Problem - WaterAirShocktube.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 19 19 100.0 %
Date: 2021-11-09 15:14:18 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 18 32 56.2 %

           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 "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::MultiMatProblemWaterAirShocktube;
      28                 :            : 
      29                 :            : tk::InitializeFn::result_type
      30                 :     385064 : MultiMatProblemWaterAirShocktube::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 multi-material
      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 Water-Air shock tube problem,
      45                 :            : //!   but does not actually give the analytical solution at time greater than 0.
      46                 :            : //!   The analytical solution would require an exact Riemann solver for
      47                 :            : //!   stiffened gas EoS, which has not been implemented yet.
      48                 :            : // *****************************************************************************
      49                 :            : {
      50                 :            :   // see also Control/Inciter/InputDeck/Grammar.hpp
      51                 :            :   Assert( ncomp == 9, "Number of scalar components must be 9" );
      52                 :            : 
      53                 :            :   auto nmat =
      54                 :     385064 :     g_inputdeck.get< tag::param, eq, tag::nmat >()[system];
      55                 :            : 
      56 [ +  - ][ -  - ]:     385064 :   std::vector< tk::real > s(ncomp, 0.0), r(nmat, 0.0);
      57                 :            :   tk::real p, u, v, w;
      58                 :            :   auto alphamin = 1.0e-12;
      59                 :            : 
      60         [ +  + ]:     385064 :   if (x<0.75) {
      61                 :            :     // volume-fraction
      62                 :     293048 :     s[volfracIdx(nmat, 0)] = 1.0-alphamin;
      63                 :     293048 :     s[volfracIdx(nmat, 1)] = alphamin;
      64                 :            :     // pressure
      65                 :            :     p = 1.0e9;
      66                 :            :     // densities
      67         [ +  + ]:     879144 :     for (std::size_t k=0; k<nmat; ++k)
      68                 :     586096 :       r[k] = eos_density< eq >( system, p, 494.646, k );
      69                 :            :     // velocity
      70                 :            :     u = 0.0;
      71                 :            :     v = 0.0;
      72                 :            :     w = 0.0;
      73                 :            :   }
      74                 :            :   else {
      75                 :            :     // volume-fraction
      76                 :      92016 :     s[volfracIdx(nmat, 0)] = alphamin;
      77                 :      92016 :     s[volfracIdx(nmat, 1)] = 1.0-alphamin;
      78                 :            :     // pressure
      79                 :            :     p = 1.0e5;
      80                 :            :     // densities
      81         [ +  + ]:     276048 :     for (std::size_t k=0; k<nmat; ++k)
      82                 :     184032 :       r[k] = eos_density< eq >( system, p, 34.844, k );
      83                 :            :     // velocity
      84                 :            :     u = 0.0;
      85                 :            :     v = 0.0;
      86                 :            :     w = 0.0;
      87                 :            :   }
      88         [ +  + ]:    1155192 :   for (std::size_t k=0; k<nmat; ++k)
      89                 :            :   {
      90                 :            :     // partial density
      91                 :     770128 :     s[densityIdx(nmat, k)] = s[volfracIdx(nmat, k)]*r[k];
      92                 :            :     // total specific energy
      93                 :     770128 :     s[energyIdx(nmat, k)] = s[volfracIdx(nmat, k)]*
      94                 :     770128 :       eos_totalenergy< eq >( system, r[k], u, v, w, p, k );
      95                 :            :   }
      96                 :            : 
      97                 :     385064 :   return s;
      98                 :            : }
      99                 :            : 
     100                 :            : std::vector< std::string >
     101                 :          3 : MultiMatProblemWaterAirShocktube::names( ncomp_t )
     102                 :            : // *****************************************************************************
     103                 :            : //  Return names of integral variables to be output to diagnostics file
     104                 :            : //! \return Vector of strings labelling integral variables output
     105                 :            : // *****************************************************************************
     106                 :            : {
     107 [ +  - ][ +  - ]:         18 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
         [ +  + ][ -  + ]
         [ -  - ][ -  - ]
     108                 :            : }

Generated by: LCOV version 1.14