Quinoa all test code coverage report
Current view: top level - PDE/Riemann - Upwind.hpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 8 8 100.0 %
Date: 2021-11-09 15:14:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 16 18.8 %

           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 "Types.hpp"
      18                 :            : #include "Fields.hpp"
      19                 :            : #include "Vector.hpp"
      20                 :            : #include "FunctionPrototypes.hpp"
      21                 :            : #include "Inciter/Options/Flux.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                 :   82341135 :     flux( const std::array< tk::real, 3 >& fn,
      38                 :            :           const std::array< std::vector< tk::real >, 2 >& u,
      39                 :            :           const std::vector< std::array< tk::real, 3 > >& v )
      40                 :            :     {
      41 [ -  + ][ -  - ]:   82341135 :       if (u[0].size() != v.size()) Throw( "Unequal components in transport" );
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
                 [ -  - ]
      42                 :   82341135 :       std::vector< tk::real > flx( u[0].size(), 0 );
      43                 :            : 
      44         [ +  + ]:  164682270 :       for(std::size_t c=0; c<v.size(); ++c)
      45                 :            :       {
      46                 :            :         // wave speed based on prescribed velocity
      47                 :            :         auto swave = tk::dot( v[c], fn );
      48                 :            :       
      49                 :            :         // upwinding
      50                 :   82341135 :         tk::real splus  = 0.5 * (swave + fabs(swave));
      51                 :   82341135 :         tk::real sminus = 0.5 * (swave - fabs(swave));
      52                 :            :       
      53                 :   82341135 :         flx[c] = splus * u[0][c] + sminus * u[1][c];
      54                 :            :       }
      55                 :            :       
      56                 :   82341135 :       return flx;
      57                 :            :     }
      58                 :            :   
      59                 :            :     //! Flux type accessor
      60                 :            :     //! \return Flux type
      61                 :            :     static ctr::FluxType type() noexcept { return ctr::FluxType::UPWIND; }
      62                 :            : };
      63                 :            : 
      64                 :            : } // inciter::
      65                 :            : 
      66                 :            : #endif // Upwind_h

Generated by: LCOV version 1.14