Quinoa all test code coverage report
Current view: top level - PDE/Transport/Problem - CylAdvect.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 16 16 100.0 %
Date: 2021-11-09 15:14:18 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                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      20                 :            : 
      21                 :            : namespace inciter {
      22                 :            : 
      23                 :            : extern ctr::InputDeck g_inputdeck;
      24                 :            : 
      25                 :            : } // ::inciter
      26                 :            : 
      27                 :            : using inciter::TransportProblemCylAdvect;
      28                 :            : 
      29                 :            : std::vector< tk::real >
      30                 :    1093137 : TransportProblemCylAdvect::initialize( ncomp_t system, ncomp_t ncomp,
      31                 :            :           tk::real x, tk::real y, tk::real, tk::real t )
      32                 :            : // *****************************************************************************
      33                 :            : //  Evaluate analytical solution at (x,y,t) for all components
      34                 :            : //! \param[in] system Equation system index
      35                 :            : //! \param[in] ncomp Number of components in this transport equation system
      36                 :            : //! \param[in] x X coordinate where to evaluate the solution
      37                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      38                 :            : //! \param[in] t Time where to evaluate the solution
      39                 :            : //! \return Values of all components evaluated at (x,y,t)
      40                 :            : // *****************************************************************************
      41                 :            : {
      42                 :    1093137 :   const auto vel = prescribedVelocity( system, ncomp, x, y, 0.0, t );
      43                 :            : 
      44 [ +  - ][ -  - ]:    1093137 :   std::vector< tk::real > s( ncomp, 0.0 );
      45         [ +  + ]:    2186274 :   for (ncomp_t c=0; c<ncomp; ++c)
      46                 :            :   {
      47                 :            :     // center of the cylinder
      48         [ +  + ]:    1093137 :     auto x0 = 0.25 + vel[c][0]*t;
      49                 :    1093137 :     auto y0 = 0.25 + vel[c][1]*t;
      50                 :            : 
      51                 :            :     // square wave
      52                 :    1093137 :     auto r = sqrt((x-x0)*(x-x0) + (y-y0)*(y-y0));
      53         [ +  + ]:    1093137 :     if (r<0.2)
      54                 :      80594 :       s[c] = 1.0;
      55                 :            :     else
      56                 :    1012543 :       s[c] = 0.0;
      57                 :            :   }
      58                 :            : 
      59                 :    1093137 :   return s;
      60                 :            : }
      61                 :            : 
      62                 :            : std::vector< std::array< tk::real, 3 > >
      63                 :   37320387 : TransportProblemCylAdvect::prescribedVelocity( ncomp_t, ncomp_t ncomp, tk::real,
      64                 :            :                                                tk::real, tk::real, tk::real )
      65                 :            : // *****************************************************************************
      66                 :            : //! Assign prescribed velocity at a point
      67                 :            : //! \param[in] ncomp Number of components in this transport equation
      68                 :            : //! \return Velocity assigned to all vertices of a tetrehedron, size:
      69                 :            : //!   ncomp * ndim = [ncomp][3]
      70                 :            : // *****************************************************************************
      71                 :            : {
      72                 :   37320387 :   std::vector< std::array< tk::real, 3 > > vel( ncomp );
      73                 :            : 
      74         [ +  + ]:   74640774 :   for (ncomp_t c=0; c<ncomp; ++c)
      75                 :   37320387 :     vel[c] = {{ 0.1, 0.1, 0.0 }};
      76                 :            : 
      77                 :   37320387 :   return vel;
      78                 :            : }

Generated by: LCOV version 1.14