Quinoa all test code coverage report
Current view: top level - PDE/CompFlow/Problem - TaylorGreen.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 27 27 100.0 %
Date: 2024-04-29 14:59:56 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 24 48 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CompFlow/Problem/TaylorGreen.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 "TaylorGreen.hpp"
      16                 :            : #include "FieldOutput.hpp"
      17                 :            : 
      18                 :            : using inciter::CompFlowProblemTaylorGreen;
      19                 :            : 
      20                 :            : tk::InitializeFn::result_type
      21                 :    1676178 : CompFlowProblemTaylorGreen::initialize( ncomp_t,
      22                 :            :                                         const std::vector< EOS >& mat_blk,
      23                 :            :                                         tk::real x,
      24                 :            :                                         tk::real y,
      25                 :            :                                         tk::real,
      26                 :            :                                         tk::real )
      27                 :            : // *****************************************************************************
      28                 :            : //! Initialize numerical solution
      29                 :            : //! \param[in] x X coordinate where to evaluate the solution
      30                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      31                 :            : //! \return Values of all components evaluated at (x)
      32                 :            : //! \note The function signature must follow tk::InitializeFn
      33                 :            : // *****************************************************************************
      34                 :            : {
      35                 :            :   using std::sin; using std::cos;
      36                 :            : 
      37                 :            :   // density
      38                 :    1676178 :   auto r = 1.0;
      39                 :            :   // pressure
      40                 :    1676178 :   auto p = 10.0 + r/4.0*(cos(2.0*M_PI*x) + cos(2.0*M_PI*y));
      41                 :            :   // velocity
      42                 :    1676178 :   auto u =  sin(M_PI*x) * cos(M_PI*y);
      43                 :    1676178 :   auto v = -cos(M_PI*x) * sin(M_PI*y);
      44                 :    1676178 :   auto w = 0.0;
      45                 :            :   // total specific energy
      46         [ +  - ]:    1676178 :   auto rE = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
      47                 :            : 
      48         [ +  - ]:    1676178 :   return {{ r, r*u, r*v, r*w, rE }};
      49                 :            : }
      50                 :            : 
      51                 :            : tk::InitializeFn::result_type
      52                 :      26370 : CompFlowProblemTaylorGreen::analyticSolution( ncomp_t,
      53                 :            :                                               const std::vector< EOS >& mat_blk,
      54                 :            :                                               tk::real x,
      55                 :            :                                               tk::real y,
      56                 :            :                                               tk::real,
      57                 :            :                                               tk::real )
      58                 :            : // *****************************************************************************
      59                 :            : //  Evaluate analytical solution at (x,y,z,t) for all components
      60                 :            : //! \param[in] x X coordinate where to evaluate the solution
      61                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      62                 :            : //! \return Values of all components evaluated at (x)
      63                 :            : //! \note The function signature must follow tk::InitializeFn
      64                 :            : // *****************************************************************************
      65                 :            : {
      66                 :            :   using std::sin; using std::cos;
      67                 :            : 
      68                 :            :   // density
      69                 :      26370 :   auto r = 1.0;
      70                 :            :   // pressure
      71                 :      26370 :   auto p = 10.0 + r/4.0*(cos(2.0*M_PI*x) + cos(2.0*M_PI*y));
      72                 :            :   // velocity
      73                 :      26370 :   auto u =  sin(M_PI*x) * cos(M_PI*y);
      74                 :      26370 :   auto v = -cos(M_PI*x) * sin(M_PI*y);
      75                 :      26370 :   auto w = 0.0;
      76                 :            :   // total specific energy
      77         [ +  - ]:      26370 :   auto E = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
      78                 :            : 
      79         [ +  - ]:      26370 :   return {{ r, u, v, w, E, p }};
      80                 :            : }
      81                 :            : 
      82                 :            : std::vector< std::string >
      83                 :         90 : CompFlowProblemTaylorGreen::analyticFieldNames( ncomp_t ) const
      84                 :            : // *****************************************************************************
      85                 :            : // Return analytic field names to be output to file
      86                 :            : //! \return Vector of strings labelling analytic fields output in file
      87                 :            : // *****************************************************************************
      88                 :            : {
      89                 :         90 :   std::vector< std::string > n;
      90 [ +  - ][ +  - ]:         90 :   n.push_back( "density_analytical" );
      91 [ +  - ][ +  - ]:         90 :   n.push_back( "x-velocity_analytical" );
      92 [ +  - ][ +  - ]:         90 :   n.push_back( "y-velocity_analytical" );
      93 [ +  - ][ +  - ]:         90 :   n.push_back( "z-velocity_analytical" );
      94 [ +  - ][ +  - ]:         90 :   n.push_back( "specific_total_energy_analytical" );
      95 [ +  - ][ +  - ]:         90 :   n.push_back( "pressure_analytical" );
      96                 :            : 
      97                 :         90 :   return n;
      98                 :            : }
      99                 :            : 
     100                 :            : std::vector< std::string >
     101                 :          7 : CompFlowProblemTaylorGreen::names( ncomp_t ) const
     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 [ +  - ][ +  - ]:         42 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
     108                 :            : }

Generated by: LCOV version 1.14