Quinoa all test code coverage report
Current view: top level - PDE - ConfigureCompFlow.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 26 30 86.7 %
Date: 2024-04-29 14:42:33 Functions: 6 10 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 30 53.3 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/ConfigureCompFlow.hpp
       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     Register and compile configuration for compressible flow PDE
       9                 :            :   \details   Register and compile configuration for compressible flow PDE.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef ConfigureCompFlow_h
      13                 :            : #define ConfigureCompFlow_h
      14                 :            : 
      15                 :            : #include <set>
      16                 :            : #include <map>
      17                 :            : #include <vector>
      18                 :            : 
      19                 :            : #include "PDEFactory.hpp"
      20                 :            : #include "Inciter/Options/PDE.hpp"
      21                 :            : #include "FunctionPrototypes.hpp"
      22                 :            : #include "ContainerUtil.hpp"
      23                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      24                 :            : #include "EoS/GetMatProp.hpp"
      25                 :            : 
      26                 :            : namespace inciter {
      27                 :            : 
      28                 :            : extern ctr::InputDeck g_inputdeck;
      29                 :            : 
      30                 :            : //! Register compressible flow PDEs into PDE factory
      31                 :            : void
      32                 :            : registerCompFlow( CGFactory& cf,
      33                 :            :                   DGFactory& df,
      34                 :            :                   std::set< ctr::PDEType >& cgt,
      35                 :            :                   std::set< ctr::PDEType >& dgt );
      36                 :            : 
      37                 :            : //! Return information on the compressible flow PDE
      38                 :            : std::vector< std::pair< std::string, std::string > >
      39                 :            : infoCompFlow( std::map< ctr::PDEType, tk::ncomp_t >& cnt );
      40                 :            : 
      41                 :            : /** @name Functions that compute physics variables from the numerical solution for CompFlow */
      42                 :            : ///@{
      43                 :            : 
      44                 :            : #if defined(__clang__)
      45                 :            :   #pragma clang diagnostic push
      46                 :            :   #pragma clang diagnostic ignored "-Wunused-function"
      47                 :            : #endif
      48                 :            : 
      49                 :            : namespace compflow {
      50                 :            : 
      51                 :            : //! Compute density for output to file
      52                 :            : //! \note Must follow the signature in tk::GetVarFn
      53                 :            : //! \param[in] U Numerical solution
      54                 :            : //! \return Fluid density ready to be output to file
      55                 :            : static tk::GetVarFn::result_type
      56                 :       1747 : densityOutVar( const tk::Fields& U, std::size_t )
      57                 :            : {
      58                 :       1747 :   return U.extract_comp( 0 );
      59                 :            : }
      60                 :            : 
      61                 :            : //! Compute velocity component for output to file
      62                 :            : //! \note Must follow the signature in tk::GetVarFn
      63                 :            : //! \tparam dir Physical direction, encoded as 0:x, 1:y, 2:z
      64                 :            : //! \param[in] U Numerical solution
      65                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
      66                 :            : //! \return Velocity component ready to be output to file
      67                 :            : template< tk::ncomp_t dir >
      68                 :            : tk::GetVarFn::result_type
      69                 :       5181 : velocityOutVar( const tk::Fields& U, std::size_t rdof )
      70                 :            : {
      71                 :            :   using tk::operator/=;
      72         [ +  - ]:       5181 :   auto r = U.extract_comp( 0 ), u = U.extract_comp( (dir+1)*rdof );
      73         [ +  - ]:       5181 :   u /= r;
      74                 :       5181 :   return u;
      75                 :            : }
      76                 :            : 
      77                 :            : //! Compute volumetric total energy (energy per unit volume) for output to file
      78                 :            : //! \note Must follow the signature in tk::GetVarFn
      79                 :            : //! \param[in] U Numerical solution
      80                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
      81                 :            : //! \return Volumetric total energy ready to be output to file
      82                 :            : static tk::GetVarFn::result_type
      83                 :          0 : volumetricTotalEnergyOutVar( const tk::Fields& U, std::size_t rdof )
      84                 :            : {
      85                 :          0 :   return U.extract_comp( 4*rdof );
      86                 :            : }
      87                 :            : 
      88                 :            : //! Compute specific total energy (energy per unit mass) for output to file
      89                 :            : //! \note Must follow the signature in tk::GetVarFn
      90                 :            : //! \param[in] U Numerical solution
      91                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
      92                 :            : //! \return Specific total energy ready to be output to file
      93                 :            : static tk::GetVarFn::result_type
      94                 :       1747 : specificTotalEnergyOutVar( const tk::Fields& U, std::size_t rdof )
      95                 :            : {
      96                 :            :   using tk::operator/=;
      97         [ +  - ]:       1747 :   auto r = U.extract_comp( 0 ), e = U.extract_comp( 4*rdof );
      98         [ +  - ]:       1747 :   e /= r;
      99                 :       1747 :   return e;
     100                 :            : }
     101                 :            : 
     102                 :            : //! Compute momentum component for output to file
     103                 :            : //! \note Must follow the signature in tk::GetVarFn
     104                 :            : //! \tparam dir Physical direction, encoded as 0:x, 1:y, 2:z
     105                 :            : //! \param[in] U Numerical solution
     106                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
     107                 :            : //! \return Momentum component ready to be output to file
     108                 :            : template< tk::ncomp_t dir >
     109                 :            : tk::GetVarFn::result_type
     110                 :          0 : momentumOutVar( const tk::Fields& U, std::size_t rdof )
     111                 :            : {
     112                 :          0 :   return U.extract_comp( (dir+1)*rdof );
     113                 :            : }
     114                 :            : 
     115                 :            : //! Compute pressure for output to file
     116                 :            : //! \note Must follow the signature in tk::GetVarFn
     117                 :            : //! \param[in] U Numerical solution
     118                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
     119                 :            : //! \return Pressure ready to be output to file
     120                 :            : static tk::GetVarFn::result_type
     121                 :       1747 : pressureOutVar( const tk::Fields& U, std::size_t rdof )
     122                 :            : {
     123                 :            :   using tk::operator/=;
     124                 :       1747 :   auto r = U.extract_comp( 0 ),
     125         [ +  - ]:       1747 :        u = U.extract_comp( 1*rdof ),
     126         [ +  - ]:       1747 :        v = U.extract_comp( 2*rdof ),
     127         [ +  - ]:       1747 :        w = U.extract_comp( 3*rdof ),
     128         [ +  - ]:       1747 :        re = U.extract_comp( 4*rdof );
     129         [ +  - ]:       1747 :   u /= r;
     130         [ +  - ]:       1747 :   v /= r;
     131         [ +  - ]:       1747 :   w /= r;
     132         [ +  - ]:       1747 :   auto p = r;
     133         [ +  + ]:     583780 :   for (std::size_t i=0; i<U.nunk(); ++i) {
     134                 :            :     // \brief This uses the old eos_pressure call for now, because we didn't 
     135                 :            :     // want to change the GetVarFn function signature right now. It's only in
     136                 :            :     // the single material CompFlow class, so it shouldn't need multi-material
     137                 :            :     // EOSs anyway.
     138         [ +  - ]:     582033 :     auto g = getmatprop< tag::gamma >();
     139         [ +  - ]:     582033 :     auto p_c = getmatprop< tag::pstiff >();
     140                 :     582033 :     p[i] = (re[i] - 0.5 * r[i] * (u[i]*u[i] + v[i]*v[i] + w[i]*w[i]) - p_c)
     141                 :     582033 :                             * (g-1.0) - p_c;
     142                 :            : //    p[i] = m_mat_blk[0]->eos_pressure( sys, r[i], u[i], v[i], w[i], re[i] );
     143                 :            :   }
     144                 :       1747 :   return p;
     145                 :            : }
     146                 :            : 
     147                 :            : } // compflow::
     148                 :            : 
     149                 :            : #if defined(__clang__)
     150                 :            :   #pragma clang diagnostic pop
     151                 :            : #endif
     152                 :            : 
     153                 :            : //@}
     154                 :            : 
     155                 :            : } // inciter::
     156                 :            : 
     157                 :            : #endif // ConfigureCompFlow_h

Generated by: LCOV version 1.14