Quinoa all test code coverage report
Current view: top level - PDE/Transport/Problem - CylVortex.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 0 23 0.0 %
Date: 2021-11-11 18:25:50 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 34 0.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/Transport/Problem/CylVortex.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.hpp implementing
      11                 :            :     node-centered continuous Galerkin (CG) and PDE/Transport/DGTransport.hpp
      12                 :            :     implementing cell-centered discontinuous Galerkin (DG) discretizations.
      13                 :            :     See PDE/Transport/Problem.hpp for general requirements on Problem policy
      14                 :            :     classes for cg::Transport and dg::Transport.
      15                 :            : */
      16                 :            : // *****************************************************************************
      17                 :            : 
      18                 :            : #include "CylVortex.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::TransportProblemCylVortex;
      28                 :            : 
      29                 :            : std::vector< tk::real >
      30                 :          0 : TransportProblemCylVortex::initialize( ncomp_t system, ncomp_t ncomp,
      31                 :            :           tk::real x, tk::real y, tk::real, tk::real t )
      32                 :            : // *****************************************************************************
      33                 :            : //  Evaluate initial 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=0)
      40                 :            : //! \details This function only gives the initial condition for the cylinder,
      41                 :            : //!   and not the solution at any time t>0.
      42                 :            : // *****************************************************************************
      43                 :            : {
      44         [ -  - ]:          0 :   const auto vel = prescribedVelocity( system, ncomp, x, y, 0.0, t );
      45                 :            : 
      46 [ -  - ][ -  - ]:          0 :   if (ncomp != 4) Throw("Cylinder deformation in vortex is only set up for 4 "
         [ -  - ][ -  - ]
      47                 :            :     "components");
      48                 :            : 
      49         [ -  - ]:          0 :   std::vector< tk::real > s( ncomp, 0.0 );
      50                 :            : 
      51                 :            :   // center of the cylinder
      52                 :          0 :   auto x0 = 0.5;
      53                 :          0 :   auto y0 = 0.75;
      54                 :          0 :   auto r = sqrt((x-x0)*(x-x0) + (y-y0)*(y-y0));
      55                 :            : 
      56         [ -  - ]:          0 :   if (r<=0.15) {
      57 [ -  - ][ -  - ]:          0 :     if (x<x0 && y>=y0) s[0] = 1.0;
      58 [ -  - ][ -  - ]:          0 :     else if (x>=x0 && y>=y0) s[1] = 1.0;
      59 [ -  - ][ -  - ]:          0 :     else if (x>=x0 && y<y0) s[2] = 1.0;
      60 [ -  - ][ -  - ]:          0 :     else if (x<x0 && y<y0) s[3] = 1.0;
      61                 :            :   }
      62                 :            : 
      63                 :          0 :   return s;
      64                 :            : }
      65                 :            : 
      66                 :            : std::vector< std::array< tk::real, 3 > >
      67                 :          0 : TransportProblemCylVortex::prescribedVelocity( ncomp_t, ncomp_t ncomp,
      68                 :            :   tk::real x, tk::real y, tk::real, tk::real t )
      69                 :            : // *****************************************************************************
      70                 :            : //! Assign prescribed velocity at a point
      71                 :            : //! \param[in] ncomp Number of components in this transport equation
      72                 :            : //! \param[in] x x coordinate at which to assign velocity
      73                 :            : //! \param[in] y y coordinate at which to assign velocity
      74                 :            : //! \param[in] t time at which to assign velocity
      75                 :            : //! \return Velocity assigned to all vertices of a tetrehedron, size:
      76                 :            : //!   ncomp * ndim = [ncomp][3]
      77                 :            : // *****************************************************************************
      78                 :            : {
      79         [ -  - ]:          0 :   std::vector< std::array< tk::real, 3 > > vel( ncomp );
      80                 :            : 
      81                 :          0 :   auto pi = 4.0 * std::atan(1.0);
      82         [ -  - ]:          0 :   for (ncomp_t c=0; c<ncomp; ++c) {
      83                 :          0 :     vel[c][0] = - 2.0*std::cos(t*pi/4.0) * std::pow(std::sin(pi*x), 2)
      84                 :          0 :       * std::sin(pi*y) * std::cos(pi*y);
      85                 :          0 :     vel[c][1] = 2.0*std::cos(t*pi/4.0) * std::pow(std::sin(pi*y), 2)
      86                 :          0 :       * std::sin(pi*x) * std::cos(pi*x);
      87                 :          0 :     vel[c][2] = 0.0;
      88                 :            :   }
      89                 :            : 
      90                 :          0 :   return vel;
      91                 :            : }

Generated by: LCOV version 1.14