Quinoa all test code coverage report
Current view: top level - PDE/Riemann - Upwind.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 9 9 100.0 %
Date: 2024-05-15 17:17:09 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 12 33.3 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/Riemann/Upwind.hpp
       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     Upwind Riemann flux function
       9                 :            :   \details   This file implements the upwind Riemann solver.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef Upwind_h
      13                 :            : #define Upwind_h
      14                 :            : 
      15                 :            : #include <vector>
      16                 :            : 
      17                 :            : #include "Fields.hpp"
      18                 :            : #include "Vector.hpp"
      19                 :            : #include "FunctionPrototypes.hpp"
      20                 :            : #include "Inciter/Options/Flux.hpp"
      21                 :            : #include "EoS/EOS.hpp"
      22                 :            : 
      23                 :            : namespace inciter {
      24                 :            : 
      25                 :            : //! Upwind Riemann solver
      26                 :            : struct Upwind {
      27                 :            : 
      28                 :            :     //! Upwind Riemann solver flux function
      29                 :            :     //! \param[in] fn Face/Surface normal
      30                 :            :     //! \param[in] u Left and right unknown/state vector
      31                 :            :     //! \param[in] v Prescribed velocity evaluated at the integration point
      32                 :            :     //!   where this flux function is used for all scalar components in the
      33                 :            :     //!   system of PDEs integrated
      34                 :            :     //! \return Riemann solution using a central difference method
      35                 :            :     //! \note The function signature must follow tk::RiemannFluxFn
      36                 :            :     static tk::RiemannFluxFn::result_type
      37                 :   46094685 :     flux( const std::vector< EOS >,
      38                 :            :           const std::array< tk::real, 3 >& fn,
      39                 :            :           const std::array< std::vector< tk::real >, 2 >& u,
      40                 :            :           const std::vector< std::array< tk::real, 3 > >& v )
      41                 :            :     {
      42 [ -  + ][ -  - ]:   46094685 :       if (u[0].size() != v.size()) Throw( "Unequal components in transport" );
         [ -  - ][ -  - ]
      43         [ +  - ]:   46094685 :       std::vector< tk::real > flx( u[0].size(), 0 );
      44                 :            : 
      45         [ +  + ]:   92189370 :       for(std::size_t c=0; c<v.size(); ++c)
      46                 :            :       {
      47                 :            :         // wave speed based on prescribed velocity
      48                 :   46094685 :         auto swave = tk::dot( v[c], fn );
      49                 :            :       
      50                 :            :         // upwinding
      51                 :   46094685 :         tk::real splus  = 0.5 * (swave + fabs(swave));
      52                 :   46094685 :         tk::real sminus = 0.5 * (swave - fabs(swave));
      53                 :            :       
      54                 :   46094685 :         flx[c] = splus * u[0][c] + sminus * u[1][c];
      55                 :            :       }
      56                 :            :       
      57                 :   46094685 :       return flx;
      58                 :            :     }
      59                 :            :   
      60                 :            :     //! Flux type accessor
      61                 :            :     //! \return Flux type
      62                 :            :     static ctr::FluxType type() noexcept { return ctr::FluxType::UPWIND; }
      63                 :            : };
      64                 :            : 
      65                 :            : } // inciter::
      66                 :            : 
      67                 :            : #endif // Upwind_h

Generated by: LCOV version 1.14