Quinoa all test code coverage report
Current view: top level - PDE/MultiSpecies/Problem - FieldOutput.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 17 21 81.0 %
Date: 2025-12-04 16:13:45 Functions: 5 6 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 11 18 61.1 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiSpecies/Problem/FieldOutput.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     Field outputs for multi-species equation solver
       9                 :            :   \details   This file defines functions for field quantites to be output to
      10                 :            :     files for compressible multi-species equations.
      11                 :            : */
      12                 :            : // *****************************************************************************
      13                 :            : #ifndef FieldOutput_h
      14                 :            : #define FieldOutput_h
      15                 :            : 
      16                 :            : #include "Types.hpp"
      17                 :            : #include "Fields.hpp"
      18                 :            : #include "EoS/EOS.hpp"
      19                 :            : #include "FaceData.hpp"
      20                 :            : #include "FunctionPrototypes.hpp"
      21                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      22                 :            : #include "PDE/MultiSpecies/MultiSpeciesIndexing.hpp"
      23                 :            : #include "ContainerUtil.hpp"
      24                 :            : 
      25                 :            : namespace inciter {
      26                 :            : 
      27                 :            : extern ctr::InputDeck g_inputdeck;
      28                 :            : 
      29                 :            : using ncomp_t = tk::ncomp_t;
      30                 :            : 
      31                 :            : //! Return a map that associates user-specified strings to functions
      32                 :            : std::map< std::string, tk::GetVarFn > MultiSpeciesOutVarFn();
      33                 :            : 
      34                 :            : //! Return multi-species field names to be output to file
      35                 :            : std::vector< std::string >
      36                 :            : MultiSpeciesFieldNames( std::size_t nspec );
      37                 :            : 
      38                 :            : //! Return surface field names to be output to file
      39                 :            : std::vector< std::string > MultiSpeciesSurfNames();
      40                 :            : 
      41                 :            : //! Return element surface field output (on triangle faces) going to file
      42                 :            : std::vector< std::vector< tk::real > >
      43                 :            : MultiSpeciesSurfOutput(
      44                 :            :   const std::size_t nspec,
      45                 :            :   const std::size_t rdof,
      46                 :            :   const FaceData& fd,
      47                 :            :   const tk::Fields& U,
      48                 :            :   const tk::Fields& P );
      49                 :            : 
      50                 :            : //! Return time history field names to be output to file
      51                 :            : std::vector< std::string > MultiSpeciesHistNames();
      52                 :            : 
      53                 :            : //! Return diagnostic var names to be output to file
      54                 :            : std::vector< std::string > MultiSpeciesDiagNames(std::size_t nspec);
      55                 :            : 
      56                 :            : /** @name Functions that compute physics variables from the numerical solution for MultiSpecies */
      57                 :            : ///@{
      58                 :            : 
      59                 :            : #if defined(__clang__)
      60                 :            :   #pragma clang diagnostic push
      61                 :            :   #pragma clang diagnostic ignored "-Wunused-function"
      62                 :            : #endif
      63                 :            : 
      64                 :            : namespace multispecies {
      65                 :            : 
      66                 :            : //! Compute mixture density for output to file
      67                 :            : //! \note Must follow the signature in tk::GetVarFn
      68                 :            : //! \param[in] U Numerical solution
      69                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
      70                 :            : //! \return Bulk density ready to be output to file
      71                 :            : static tk::GetVarFn::result_type
      72                 :        176 : mixDensityOutVar( const tk::Fields& U, std::size_t rdof )
      73                 :            : {
      74                 :            :   using tk::operator+=;
      75                 :        176 :   auto nspec = g_inputdeck.get< tag::multispecies, tag::nspec >();
      76                 :        176 :   auto r = U.extract_comp( densityDofIdx(nspec,0,rdof,0) );
      77         [ +  + ]:        264 :   for (std::size_t k=1; k<nspec; ++k)
      78 [ +  - ][ +  - ]:         88 :     r += U.extract_comp( densityDofIdx(nspec,k,rdof,0) );
      79                 :        176 :   return r;
      80                 :            : }
      81                 :            : 
      82                 :            : ////! Compute pressure for output to file
      83                 :            : ////! \note Must follow the signature in tk::GetVarFn
      84                 :            : ////! \param[in] U Numerical solution
      85                 :            : ////! \param[in] rdof Number of reconstructed solution DOFs
      86                 :            : ////! \return Pressure ready to be output to file
      87                 :            : //static tk::GetVarFn::result_type
      88                 :            : //pressureOutVar( const tk::Fields& U, std::size_t rdof )
      89                 :            : //{
      90                 :            : //  using tk::operator+=;
      91                 :            : //  auto nspec = g_inputdeck.get< tag::multispecies, tag::nspec >();
      92                 :            : //  auto p = U.extract_comp( pressureDofIdx(nspec,0,rdof,0) );
      93                 :            : //  for (std::size_t k=1; k<nspec; ++k)
      94                 :            : //    p += U.extract_comp( pressureDofIdx(nspec,k,rdof,0) );
      95                 :            : //  return p;
      96                 :            : //}
      97                 :            : 
      98                 :            : //! Compute specific total energy (energy per unit volume) for output to file
      99                 :            : //! \note Must follow the signature in tk::GetVarFn
     100                 :            : //! \param[in] U Numerical solution
     101                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
     102                 :            : //! \return Specific total energy ready to be output to file
     103                 :            : static tk::GetVarFn::result_type
     104                 :        176 : specificTotalEnergyOutVar( const tk::Fields& U, std::size_t rdof )
     105                 :            : {
     106                 :        176 :   auto nspec = g_inputdeck.get< tag::multispecies, tag::nspec >();
     107                 :        176 :   return U.extract_comp( energyDofIdx(nspec,0,rdof,0) );
     108                 :            : }
     109                 :            : 
     110                 :            : //! Compute velocity component for output to file
     111                 :            : //! \note Must follow the signature in tk::GetVarFn
     112                 :            : //! \tparam dir Physical direction, encoded as 0:x, 1:y, 2:z
     113                 :            : //! \param[in] U Numerical solution
     114                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
     115                 :            : //! \return Velocity component ready to be output to file
     116                 :            : template< tk::ncomp_t dir >
     117                 :            : tk::GetVarFn::result_type
     118                 :        528 : velocityOutVar( const tk::Fields& U, std::size_t rdof )
     119                 :            : {
     120                 :            :   using tk::operator/=;
     121                 :            :   using tk::operator+=;
     122                 :        528 :   auto nspec = g_inputdeck.get< tag::multispecies, tag::nspec >();
     123                 :            : 
     124                 :            :   // mixture density
     125         [ +  - ]:       1056 :   auto r = U.extract_comp( densityDofIdx(nspec,0,rdof,0) );
     126         [ +  + ]:        792 :   for (std::size_t k=1; k<nspec; ++k)
     127 [ +  - ][ +  - ]:        264 :     r += U.extract_comp( densityDofIdx(nspec,k,rdof,0) );
     128                 :            : 
     129                 :            :   // momentum
     130         [ +  - ]:        528 :   auto u = U.extract_comp( momentumDofIdx(nspec,dir,rdof,0) );
     131                 :            : 
     132                 :            :   // velocity
     133         [ +  - ]:        528 :   u /= r;
     134                 :            : 
     135                 :       1056 :   return u;
     136                 :            : }
     137                 :            : 
     138                 :            : //! Compute mixture temperature for output to file
     139                 :            : //! \note Must follow the signature in tk::GetVarFn
     140                 :            : //! \param[in] U Numerical solution
     141                 :            : //! \param[in] rdof Number of reconstructed solution DOFs
     142                 :            : //! \return Mixture temperature ready to be output to file
     143                 :            : static tk::GetVarFn::result_type
     144                 :          0 : temperatureOutVar( const tk::Fields& U, std::size_t rdof )
     145                 :            : {
     146                 :          0 :   auto nspec = g_inputdeck.get< tag::multispecies, tag::nspec >();
     147                 :          0 :   auto r = U.extract_comp( temperatureDofIdx(nspec,0,rdof,0) );
     148                 :          0 :   return r;
     149                 :            : }
     150                 :            : 
     151                 :            : } // multispecies::
     152                 :            : 
     153                 :            : #if defined(__clang__)
     154                 :            :   #pragma clang diagnostic pop
     155                 :            : #endif
     156                 :            : 
     157                 :            : //@}
     158                 :            : 
     159                 :            : } //inciter::
     160                 :            : 
     161                 :            : #endif // FieldOutput_h

Generated by: LCOV version 1.14