Quinoa regression test code coverage report
Current view: top level - PDE/CompFlow/Problem - UserDefined.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 20 26 76.9 %
Date: 2021-11-11 13:17:06 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 82 30.5 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CompFlow/Problem/UserDefined.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 the compressible flow equations
       9                 :            :   \details   This file defines a Problem policy class for the compressible flow
      10                 :            :     equations, defined in PDE/CompFlow/CompFlow.h. See PDE/CompFlow/Problem.h
      11                 :            :     for general requirements on Problem policy classes for CompFlow.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : 
      15                 :            : #include <limits>
      16                 :            : 
      17                 :            : #include "UserDefined.hpp"
      18                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      19                 :            : #include "FieldOutput.hpp"
      20                 :            : 
      21                 :            : namespace inciter {
      22                 :            : 
      23                 :            : extern ctr::InputDeck g_inputdeck;
      24                 :            : 
      25                 :            : } // ::inciter
      26                 :            : 
      27                 :            : using inciter::CompFlowProblemUserDefined;
      28                 :            : 
      29                 :            : tk::InitializeFn::result_type
      30                 :     216318 : CompFlowProblemUserDefined::initialize( ncomp_t system,
      31                 :            :                                         ncomp_t ncomp,
      32                 :            :                                         tk::real,
      33                 :            :                                         tk::real,
      34                 :            :                                         tk::real,
      35                 :            :                                         tk::real )
      36                 :            : // *****************************************************************************
      37                 :            : //! Set initial conditions
      38                 :            : //! \param[in] system Equation system index, i.e., which compressible
      39                 :            : //!   flow equation system we operate on among the systems of PDEs
      40                 :            : //! \param[in] ncomp Number of scalar components in this PDE system
      41                 :            : //! \return Values of all components
      42                 :            : //! \note The function signature must follow tk::InitializeFn
      43                 :            : // *****************************************************************************
      44                 :            : {
      45         [ +  - ]:     216318 :   tk::InitializeFn::result_type u( ncomp, 0.0 );
      46                 :            : 
      47                 :            :   // Set background ICs
      48                 :     216318 :   const auto& ic = g_inputdeck.get< tag::param, eq, tag::ic >();
      49                 :     216318 :   const auto& bgrhoic = ic.get< tag::density >();
      50                 :     216318 :   const auto& bgvelic = ic.get< tag::velocity >();
      51                 :     216318 :   const auto& bgpreic = ic.get< tag::pressure >();
      52                 :     216318 :   const auto& bgenic = ic.get< tag::energy >();
      53                 :     216318 :   const auto& bgtempic = ic.get< tag::temperature >();
      54                 :            : 
      55 [ -  + ][ -  - ]:     216318 :   Assert( bgrhoic.size() > system, "No background density IC" );
         [ -  - ][ -  - ]
      56 [ -  + ][ -  - ]:     216318 :   Assert( bgvelic.size() > 3*system, "No background velocity IC" );
         [ -  - ][ -  - ]
      57                 :            : 
      58 [ +  - ][ +  - ]:     216318 :   u[0] = bgrhoic.at(system).at(0);
      59 [ +  - ][ +  - ]:     216318 :   u[1] = u[0] * bgvelic.at(system).at(0);
      60 [ +  - ][ +  - ]:     216318 :   u[2] = u[0] * bgvelic.at(system).at(1);
      61 [ +  - ][ +  - ]:     216318 :   u[3] = u[0] * bgvelic.at(system).at(2);
      62                 :            : 
      63 [ +  - ][ +  - ]:     216318 :   if (bgpreic.size() > system && !bgpreic[system].empty()) {
                 [ +  - ]
      64         [ +  - ]:     216318 :     u[4] = eos_totalenergy< eq >( system, u[0], u[1]/u[0], u[2]/u[0], u[3]/u[0],
      65 [ +  - ][ +  - ]:     216318 :                                   bgpreic.at(system).at(0) );
      66 [ -  - ][ -  - ]:          0 :   } else if (bgenic.size() > system && !bgenic[system].empty()) {
                 [ -  - ]
      67                 :          0 :     u[4] = u[0] * bgenic[system][0];
      68 [ -  - ][ -  - ]:          0 :   } else if (bgtempic.size() > system && !bgtempic[system].empty()) {
                 [ -  - ]
      69         [ -  - ]:          0 :     const auto& c_v = cv< tag::compflow >(system);
      70                 :          0 :     u[4] = u[0] * bgtempic[system][0] * c_v;
      71 [ -  - ][ -  - ]:          0 :   } else Throw( "IC background energy cannot be computed. User must specify "
                 [ -  - ]
      72                 :            :                 "one of background pressure, energy, or velocity." );
      73                 :            : 
      74                 :     216318 :   return u;
      75                 :            : }
      76                 :            : 
      77                 :            : std::vector< std::string >
      78                 :          7 : CompFlowProblemUserDefined::names( ncomp_t ) const
      79                 :            : // *****************************************************************************
      80                 :            : //  Return names of integral variables to be output to diagnostics file
      81                 :            : //! \return Vector of strings labelling integral variables output
      82                 :            : // *****************************************************************************
      83                 :            : {
      84 [ +  - ][ +  - ]:         42 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
      85                 :            : }

Generated by: LCOV version 1.14