Quinoa all test code coverage report
Current view: top level - PDE/Transport/Problem - GaussHump.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 13 13 100.0 %
Date: 2024-11-22 08:51:48 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 10 70.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/Transport/Problem/GaussHump.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 transport equations
       9                 :            :   \details   This file defines a Problem policy class for the transport
      10                 :            :     equations, defined in PDE/Transport/CGTransport.h implementing
      11                 :            :     node-centered continuous Galerkin (CG) and PDE/Transport/DGTransport.h
      12                 :            :     implementing cell-centered discontinuous Galerkin (DG) discretizations.
      13                 :            :     See PDE/Transport/Problem.h for general requirements on Problem policy
      14                 :            :     classes for cg::Transport and dg::Transport.
      15                 :            : */
      16                 :            : // *****************************************************************************
      17                 :            : 
      18                 :            : #include "GaussHump.hpp"
      19                 :            : 
      20                 :            : using inciter::TransportProblemGaussHump;
      21                 :            : 
      22                 :            : std::vector< tk::real >
      23                 :    2821222 : TransportProblemGaussHump::initialize( ncomp_t ncomp,
      24                 :            :   const std::vector< EOS >&, tk::real x, tk::real y, tk::real,
      25                 :            :   tk::real t )
      26                 :            : // *****************************************************************************
      27                 :            : //  Evaluate analytical solution at (x,y,t) for all components
      28                 :            : //! \param[in] ncomp Number of components in this transport equation system
      29                 :            : //! \param[in] x X coordinate where to evaluate the solution
      30                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      31                 :            : //! \param[in] t Time where to evaluate the solution
      32                 :            : //! \return Values of all components evaluated at (x,y,t)
      33                 :            : // *****************************************************************************
      34                 :            : {
      35         [ +  - ]:    5642444 :   const auto vel = prescribedVelocity( ncomp, x, y, 0.0, t );
      36                 :            : 
      37         [ +  - ]:    2821222 :   std::vector< tk::real > s( ncomp, 0.0 );
      38         [ +  + ]:    5642444 :   for (ncomp_t c=0; c<ncomp; ++c)
      39                 :            :   {
      40                 :            :     // center of the hump
      41                 :    2821222 :     auto x0 = 0.25 + vel[c][0]*t;
      42                 :    2821222 :     auto y0 = 0.25 + vel[c][1]*t;
      43                 :            : 
      44                 :            :     // hump
      45                 :    2821222 :     s[c] = 1.0 * exp( -((x-x0)*(x-x0) + (y-y0)*(y-y0))/(2.0 * 0.005) );
      46                 :            :   }
      47                 :    5642444 :   return s;
      48                 :            : }
      49                 :            : 
      50                 :            : std::vector< std::array< tk::real, 3 > >
      51                 :   36216922 : TransportProblemGaussHump::prescribedVelocity( ncomp_t ncomp, tk::real,
      52                 :            :                                                tk::real, tk::real, tk::real )
      53                 :            : // *****************************************************************************
      54                 :            : //! Assign prescribed velocity at a point
      55                 :            : //! \param[in] ncomp Number of components in this transport equation
      56                 :            : //! \return Velocity assigned to all vertices of a tetrehedron, size:
      57                 :            : //!   ncomp * ndim = [ncomp][3]
      58                 :            : // *****************************************************************************
      59                 :            : {
      60         [ +  - ]:   36216922 :   std::vector< std::array< tk::real, 3 > > vel( ncomp );
      61                 :            : 
      62         [ +  + ]:   72433844 :   for (ncomp_t c=0; c<ncomp; ++c)
      63                 :   36216922 :     vel[c] = {{ 0.1, 0.1, 0.0 }};
      64                 :            : 
      65                 :   36216922 :   return vel;
      66                 :            : }

Generated by: LCOV version 1.14