Quinoa all test code coverage report
Current view: top level - PDE/CompFlow/Problem - SodShocktube.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 16 26 61.5 %
Date: 2024-04-29 14:42:33 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 38 31.6 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CompFlow/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 compressible flow
      10                 :            :     equations, defined in PDE/CompFlow/CompFlow.h. See PDE/CompFlow/Problem.h
      11                 :            :     for general requirements on Problem policy classes for CompFlow.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : 
      15                 :            : #include "SodShocktube.hpp"
      16                 :            : #include "FieldOutput.hpp"
      17                 :            : 
      18                 :            : using inciter::CompFlowProblemSodShocktube;
      19                 :            : 
      20                 :            : tk::InitializeFn::result_type
      21                 :     969989 : CompFlowProblemSodShocktube::initialize( ncomp_t,
      22                 :            :                                          const std::vector< EOS >& mat_blk,
      23                 :            :                                          tk::real x,
      24                 :            :                                          tk::real,
      25                 :            :                                          tk::real,
      26                 :            :                                          tk::real )
      27                 :            : // *****************************************************************************
      28                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      29                 :            : //! \param[in] x X coordinate where to evaluate the solution
      30                 :            : //! \return Values of all components evaluated at (x)
      31                 :            : //! \note The function signature must follow tk::InitializeFn
      32                 :            : //! \details This function only initializes the Sod shock tube problem, but does
      33                 :            : //!   not actually give the analytical solution at time greater than 0. The
      34                 :            : //!   analytical solution would require an exact Riemann solver, which has not
      35                 :            : //!   been implemented yet.
      36                 :            : // *****************************************************************************
      37                 :            : {
      38                 :            :   tk::real r, p, u, v, w, rE;
      39         [ +  + ]:     969989 :   if (x<0.5) {
      40                 :            :     // density
      41                 :     483235 :     r = 1.0;
      42                 :            :     // pressure
      43                 :     483235 :     p = 1.0;
      44                 :            :     // velocity
      45                 :     483235 :     u = 0.0;
      46                 :     483235 :     v = 0.0;
      47                 :     483235 :     w = 0.0;
      48                 :            :   }
      49                 :            :   else {
      50                 :            :     // density
      51                 :     486754 :     r = 0.125;
      52                 :            :     // pressure
      53                 :     486754 :     p = 0.1;
      54                 :            :     // velocity
      55                 :     486754 :     u = 0.0;
      56                 :     486754 :     v = 0.0;
      57                 :     486754 :     w = 0.0;
      58                 :            :   }
      59                 :            :   // total specific energy
      60         [ +  - ]:     969989 :   rE = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
      61                 :            : 
      62                 :     969989 :   return {{ r, r*u, r*v, r*w, rE }};
      63                 :            : }
      64                 :            : 
      65                 :            : tk::InitializeFn::result_type
      66                 :          0 : CompFlowProblemSodShocktube::analyticSolution(
      67                 :            :   ncomp_t,
      68                 :            :   const std::vector< EOS >& mat_blk,
      69                 :            :   tk::real x,
      70                 :            :   tk::real,
      71                 :            :   tk::real,
      72                 :            :   tk::real )
      73                 :            : // *****************************************************************************
      74                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      75                 :            : //! \param[in] x X coordinate where to evaluate the solution
      76                 :            : //! \return Values of all components evaluated at (x)
      77                 :            : //! \note The function signature must follow tk::InitializeFn
      78                 :            : //! \warning This is NOT the analytic solution at all times, only at t=0
      79                 :            : // *****************************************************************************
      80                 :            : {
      81                 :          0 :   return initialize( 0, mat_blk, x, 0, 0, 0 );
      82                 :            : }
      83                 :            : 
      84                 :            : std::vector< std::string >
      85         [ -  - ]:          0 : CompFlowProblemSodShocktube::analyticFieldNames( ncomp_t ) const
      86                 :            : // *****************************************************************************
      87                 :            : // Return analytic field names to be output to file
      88                 :            : //! \return Vector of strings labelling analytic fields output in file
      89                 :            : // *****************************************************************************
      90                 :            : {
      91                 :            :   std::vector< std::string > n;
      92         [ -  - ]:          0 :   n.push_back( "density_analytical" );
      93         [ -  - ]:          0 :   n.push_back( "x-velocity_analytical" );
      94         [ -  - ]:          0 :   n.push_back( "y-velocity_analytical" );
      95         [ -  - ]:          0 :   n.push_back( "z-velocity_analytical" );
      96         [ -  - ]:          0 :   n.push_back( "specific_total_energy_analytical" );
      97         [ -  - ]:          0 :   n.push_back( "pressure_analytical" );
      98                 :            : 
      99                 :          0 :   return n;
     100                 :            : }
     101                 :            : 
     102                 :            : std::vector< std::string >
     103                 :         16 : CompFlowProblemSodShocktube::names( ncomp_t ) const
     104                 :            : // *****************************************************************************
     105                 :            : //  Return names of integral variables to be output to diagnostics file
     106                 :            : //! \return Vector of strings labelling integral variables output
     107                 :            : // *****************************************************************************
     108                 :            : {
     109 [ +  - ][ +  - ]:         96 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
         [ +  + ][ -  + ]
         [ -  - ][ -  - ]
     110                 :            : }

Generated by: LCOV version 1.14