Quinoa all test code coverage report
Current view: top level - PDE/CompFlow/Problem - UserDefined.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 18 24 75.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: 11 34 32.4 %

           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                 :            : #include "EoS/GetMatProp.hpp"
      21                 :            : 
      22                 :            : namespace inciter {
      23                 :            : 
      24                 :            : extern ctr::InputDeck g_inputdeck;
      25                 :            : 
      26                 :            : } // ::inciter
      27                 :            : 
      28                 :            : using inciter::CompFlowProblemUserDefined;
      29                 :            : 
      30                 :            : tk::InitializeFn::result_type
      31                 :     391987 : CompFlowProblemUserDefined::initialize( ncomp_t ncomp,
      32                 :            :                                         const std::vector< EOS >& mat_blk,
      33                 :            :                                         tk::real,
      34                 :            :                                         tk::real,
      35                 :            :                                         tk::real,
      36                 :            :                                         tk::real )
      37                 :            : // *****************************************************************************
      38                 :            : //! Set initial conditions
      39                 :            : //! \param[in] ncomp Number of scalar components in this PDE system
      40                 :            : //! \return Values of all components
      41                 :            : //! \note The function signature must follow tk::InitializeFn
      42                 :            : // *****************************************************************************
      43                 :            : {
      44         [ +  - ]:     391987 :   tk::InitializeFn::result_type u( ncomp, 0.0 );
      45                 :            : 
      46                 :            :   // Set background ICs
      47                 :     391987 :   const auto& ic = g_inputdeck.get< tag::ic >();
      48                 :     391987 :   const auto& bgrhoic = ic.get< tag::density >();
      49                 :     391987 :   const auto& bgvelic = ic.get< tag::velocity >();
      50                 :     391987 :   const auto& bgpreic = ic.get< tag::pressure >();
      51                 :     391987 :   const auto& bgenic = ic.get< tag::energy >();
      52                 :     391987 :   const auto& bgtempic = ic.get< tag::temperature >();
      53                 :            : 
      54                 :     391987 :   u[0] = bgrhoic;
      55                 :     391987 :   u[1] = u[0] * bgvelic[0];
      56                 :     391987 :   u[2] = u[0] * bgvelic[1];
      57                 :     391987 :   u[3] = u[0] * bgvelic[2];
      58                 :            : 
      59         [ +  - ]:     391987 :   if (bgpreic > 1e-12) {
      60         [ +  - ]:     783974 :     u[4] = mat_blk[0].compute< EOS::totalenergy >( u[0], u[1]/u[0], u[2]/u[0],
      61                 :     783974 :       u[3]/u[0], bgpreic );
      62         [ -  - ]:          0 :   } else if (bgenic > 1e-12) {
      63                 :          0 :     u[4] = u[0] * bgenic;
      64         [ -  - ]:          0 :   } else if (bgtempic > 1e-12) {
      65         [ -  - ]:          0 :     const auto& c_v = getmatprop< tag::cv >();
      66                 :          0 :     u[4] = u[0] * bgtempic * c_v;
      67 [ -  - ][ -  - ]:          0 :   } else Throw( "IC background energy cannot be computed. User must specify "
                 [ -  - ]
      68                 :            :                 "one of background pressure, energy, or temperature." );
      69                 :            : 
      70                 :     391987 :   return u;
      71                 :            : }
      72                 :            : 
      73                 :            : std::vector< std::string >
      74                 :         14 : CompFlowProblemUserDefined::names( ncomp_t ) const
      75                 :            : // *****************************************************************************
      76                 :            : //  Return names of integral variables to be output to diagnostics file
      77                 :            : //! \return Vector of strings labelling integral variables output
      78                 :            : // *****************************************************************************
      79                 :            : {
      80 [ +  - ][ +  - ]:         84 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
      81                 :            : }

Generated by: LCOV version 1.14