Quinoa regression test code coverage report
Current view: top level - PDE/CompFlow/Problem - SodShocktube.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 6 16 37.5 %
Date: 2021-11-09 13:40:20 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 11 36 30.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 "Inciter/InputDeck/InputDeck.hpp"
      17                 :            : #include "FieldOutput.hpp"
      18                 :            : 
      19                 :            : namespace inciter {
      20                 :            : 
      21                 :            : extern ctr::InputDeck g_inputdeck;
      22                 :            : 
      23                 :            : } // ::inciter
      24                 :            : 
      25                 :            : using inciter::CompFlowProblemSodShocktube;
      26                 :            : 
      27                 :            : tk::InitializeFn::result_type
      28                 :    1154569 : CompFlowProblemSodShocktube::initialize( ncomp_t system,
      29                 :            :                                          ncomp_t,
      30                 :            :                                          tk::real x,
      31                 :            :                                          tk::real,
      32                 :            :                                          tk::real,
      33                 :            :                                          tk::real )
      34                 :            : // *****************************************************************************
      35                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      36                 :            : //! \param[in] system Equation system index, i.e., which compressible
      37                 :            : //!   flow equation system we operate on among the systems of PDEs
      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                 :            :   using tag::param;
      48                 :            : 
      49                 :            :   tk::real r, p, u, v, w, rE;
      50         [ +  + ]:    1154569 :   if (x<0.5) {
      51                 :            :     // density
      52                 :            :     r = 1.0;
      53                 :            :     // pressure
      54                 :            :     p = 1.0;
      55                 :            :     // velocity
      56                 :            :     u = 0.0;
      57                 :            :     v = 0.0;
      58                 :            :     w = 0.0;
      59                 :            :   }
      60                 :            :   else {
      61                 :            :     // density
      62                 :            :     r = 0.125;
      63                 :            :     // pressure
      64                 :            :     p = 0.1;
      65                 :            :     // velocity
      66                 :            :     u = 0.0;
      67                 :            :     v = 0.0;
      68                 :            :     w = 0.0;
      69                 :            :   }
      70                 :            :   // total specific energy
      71                 :    1154569 :   rE = eos_totalenergy< eq >( system, r, u, v, w, p );
      72                 :            : 
      73                 :    1154569 :   return {{ r, r*u, r*v, r*w, rE }};
      74                 :            : }
      75                 :            : 
      76                 :            : tk::InitializeFn::result_type
      77                 :          0 : CompFlowProblemSodShocktube::analyticSolution( ncomp_t system,
      78                 :            :                                                ncomp_t,
      79                 :            :                                                tk::real x,
      80                 :            :                                                tk::real,
      81                 :            :                                                tk::real,
      82                 :            :                                                tk::real )
      83                 :            : // *****************************************************************************
      84                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      85                 :            : //! \param[in] system Equation system index, i.e., which compressible
      86                 :            : //!   flow equation system we operate on among the systems of PDEs
      87                 :            : //! \param[in] x X coordinate where to evaluate the solution
      88                 :            : //! \return Values of all components evaluated at (x)
      89                 :            : //! \note The function signature must follow tk::InitializeFn
      90                 :            : //! \warning This is NOT the analytic solution at all times, only at t=0
      91                 :            : // *****************************************************************************
      92                 :            : {
      93                 :          0 :   return initialize( system, 0, x, 0, 0, 0 );
      94                 :            : }
      95                 :            : 
      96                 :            : std::vector< std::string >
      97         [ -  - ]:          0 : CompFlowProblemSodShocktube::analyticFieldNames( ncomp_t ) const
      98                 :            : // *****************************************************************************
      99                 :            : // Return analytic field names to be output to file
     100                 :            : //! \return Vector of strings labelling analytic fields output in file
     101                 :            : // *****************************************************************************
     102                 :            : {
     103                 :            :   std::vector< std::string > n;
     104         [ -  - ]:          0 :   n.push_back( "density_analytical" );
     105         [ -  - ]:          0 :   n.push_back( "x-velocity_analytical" );
     106         [ -  - ]:          0 :   n.push_back( "y-velocity_analytical" );
     107         [ -  - ]:          0 :   n.push_back( "z-velocity_analytical" );
     108         [ -  - ]:          0 :   n.push_back( "specific_total_energy_analytical" );
     109         [ -  - ]:          0 :   n.push_back( "pressure_analytical" );
     110                 :            : 
     111                 :          0 :   return n;
     112                 :            : }
     113                 :            : 
     114                 :            : std::vector< std::string >
     115                 :         23 : CompFlowProblemSodShocktube::names( ncomp_t ) const
     116                 :            : // *****************************************************************************
     117                 :            : //  Return names of integral variables to be output to diagnostics file
     118                 :            : //! \return Vector of strings labelling integral variables output
     119                 :            : // *****************************************************************************
     120                 :            : {
     121 [ +  - ][ +  - ]:        138 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
         [ +  + ][ -  + ]
         [ -  - ][ -  - ]
     122                 :            : }

Generated by: LCOV version 1.14