Quinoa all test code coverage report
Current view: top level - PDE/Transport/Problem - CylAdvect.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 16 16 100.0 %
Date: 2024-11-08 10:55:28 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 12 75.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/Transport/Problem/CylAdvect.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 "CylAdvect.hpp"
      19                 :            : 
      20                 :            : using inciter::TransportProblemCylAdvect;
      21                 :            : 
      22                 :            : std::vector< tk::real >
      23                 :    1169640 : TransportProblemCylAdvect::initialize( ncomp_t ncomp,
      24                 :            :           const std::vector< EOS >&, tk::real x, tk::real y,
      25                 :            :           tk::real, 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         [ +  - ]:    2339280 :   const auto vel = prescribedVelocity( ncomp, x, y, 0.0, t );
      36                 :            : 
      37         [ +  - ]:    1169640 :   std::vector< tk::real > s( ncomp, 0.0 );
      38         [ +  + ]:    2339280 :   for (ncomp_t c=0; c<ncomp; ++c)
      39                 :            :   {
      40                 :            :     // center of the cylinder
      41                 :    1169640 :     auto x0 = 0.25 + vel[c][0]*t;
      42                 :    1169640 :     auto y0 = 0.25 + vel[c][1]*t;
      43                 :            : 
      44                 :            :     // square wave
      45                 :    1169640 :     auto r = sqrt((x-x0)*(x-x0) + (y-y0)*(y-y0));
      46         [ +  + ]:    1169640 :     if (r<0.2)
      47                 :      89610 :       s[c] = 1.0;
      48                 :            :     else
      49                 :    1080030 :       s[c] = 0.0;
      50                 :            :   }
      51                 :            : 
      52                 :    2339280 :   return s;
      53                 :            : }
      54                 :            : 
      55                 :            : std::vector< std::array< tk::real, 3 > >
      56                 :   37396890 : TransportProblemCylAdvect::prescribedVelocity( ncomp_t ncomp, tk::real,
      57                 :            :                                                tk::real, tk::real, tk::real )
      58                 :            : // *****************************************************************************
      59                 :            : //! Assign prescribed velocity at a point
      60                 :            : //! \param[in] ncomp Number of components in this transport equation
      61                 :            : //! \return Velocity assigned to all vertices of a tetrehedron, size:
      62                 :            : //!   ncomp * ndim = [ncomp][3]
      63                 :            : // *****************************************************************************
      64                 :            : {
      65         [ +  - ]:   37396890 :   std::vector< std::array< tk::real, 3 > > vel( ncomp );
      66                 :            : 
      67         [ +  + ]:   74793780 :   for (ncomp_t c=0; c<ncomp; ++c)
      68                 :   37396890 :     vel[c] = {{ 0.1, 0.1, 0.0 }};
      69                 :            : 
      70                 :   37396890 :   return vel;
      71                 :            : }

Generated by: LCOV version 1.14