Quinoa all test code coverage report
Current view: top level - PDE/CompFlow/Problem - NLEnergyGrowth.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 44 44 100.0 %
Date: 2024-04-29 14:59:56 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 50 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CompFlow/Problem/NLEnergyGrowth.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 "NLEnergyGrowth.hpp"
      16                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      17                 :            : #include "FieldOutput.hpp"
      18                 :            : 
      19                 :            : namespace inciter {
      20                 :            : 
      21                 :            : extern ctr::InputDeck g_inputdeck;
      22                 :            : 
      23                 :            : } // ::inciter
      24                 :            : 
      25                 :            : using inciter::CompFlowProblemNLEnergyGrowth;
      26                 :            : 
      27                 :            : tk::real
      28                 :    3120537 : CompFlowProblemNLEnergyGrowth::hx( tk::real bx, tk::real by, tk::real bz,
      29                 :            :                                    tk::real x, tk::real y, tk::real z )
      30                 :            : // *****************************************************************************
      31                 :            : //  Compute internal energy parameter
      32                 :            : //! \param[in] bx Parameter betax
      33                 :            : //! \param[in] by Parameter betay
      34                 :            : //! \param[in] bz Parameter betaz
      35                 :            : //! \param[in] x X coordinate to evaluate at
      36                 :            : //! \param[in] y Y coordinate to evaluate at
      37                 :            : //! \param[in] z Z coordinate to evaluate at
      38                 :            : //! \return Internal energy parameter
      39                 :            : // *****************************************************************************
      40                 :            : {
      41                 :    3120537 :   return std::cos(bx*M_PI*x) * std::cos(by*M_PI*y) * std::cos(bz*M_PI*z);
      42                 :            : }
      43                 :            : 
      44                 :            : tk::real
      45                 :    3120537 : CompFlowProblemNLEnergyGrowth::ec( tk::real ce, tk::real kappa, tk::real t,
      46                 :            :                                    tk::real h, tk::real p )
      47                 :            : // *****************************************************************************
      48                 :            : //  Compute a power of the internal energy
      49                 :            : //! \param[in] ce Internal energy parameter
      50                 :            : //! \param[in] kappa Internal energy parameter
      51                 :            : //! \param[in] t Physical time
      52                 :            : //! \param[in] h Internal energy parameter
      53                 :            : //! \param[in] p Power
      54                 :            : //! \return Internal energy raised to power p
      55                 :            : // *****************************************************************************
      56                 :            : {
      57                 :    3120537 :   return std::pow( -3.0*(ce + kappa*h*h*t), p );
      58                 :            : }
      59                 :            : 
      60                 :            : tk::InitializeFn::result_type
      61                 :     861732 : CompFlowProblemNLEnergyGrowth::initialize( ncomp_t,
      62                 :            :                                            const std::vector< EOS >&,
      63                 :            :                                            tk::real x,
      64                 :            :                                            tk::real y,
      65                 :            :                                            tk::real z,
      66                 :            :                                            tk::real t )
      67                 :            : // *****************************************************************************
      68                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      69                 :            : //! \param[in] x X coordinate where to evaluate the solution
      70                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      71                 :            : //! \param[in] z Z coordinate where to evaluate the solution
      72                 :            : //! \param[in] t Time where to evaluate the solution
      73                 :            : //! \return Values of all components evaluated at (x,y,z,t)
      74                 :            : //! \note The function signature must follow tk::InitializeFn
      75                 :            : // *****************************************************************************
      76                 :            : {
      77                 :            :   // manufactured solution parameters
      78                 :     861732 :   auto ce = g_inputdeck.get< eq, tag::ce >();
      79                 :     861732 :   auto r0 = g_inputdeck.get< eq, tag::r0 >();
      80                 :     861732 :   auto a = g_inputdeck.get< eq, tag::alpha >();
      81                 :     861732 :   auto k = g_inputdeck.get< eq, tag::kappa >();
      82                 :     861732 :   auto bx = g_inputdeck.get< eq, tag::betax >();
      83                 :     861732 :   auto by = g_inputdeck.get< eq, tag::betay >();
      84                 :     861732 :   auto bz = g_inputdeck.get< eq, tag::betaz >();
      85                 :            :   // spatial component of density field
      86                 :     861732 :   auto gx = 1.0 - x*x - y*y - z*z;
      87                 :            :   // internal energy parameter
      88                 :     861732 :   auto h = hx( bx, by, bz, x, y, z );
      89                 :            :   // temporal component of the density field
      90                 :     861732 :   tk::real ft = std::exp( -a*t );
      91                 :            :   // density
      92                 :     861732 :   auto r = r0 + ft*gx;
      93                 :            :   // energy
      94                 :     861732 :   auto re = r*ec(ce,k,t,h,-1.0/3.0);
      95                 :            : 
      96         [ +  - ]:     861732 :   return {{ r, 0.0, 0.0, 0.0, re }};
      97                 :            : }
      98                 :            : 
      99                 :            : tk::InitializeFn::result_type
     100                 :      16245 : CompFlowProblemNLEnergyGrowth::analyticSolution(
     101                 :            :   ncomp_t,
     102                 :            :   const std::vector< EOS >& mat_blk,
     103                 :            :   tk::real x,
     104                 :            :   tk::real y,
     105                 :            :   tk::real z,
     106                 :            :   tk::real t )
     107                 :            : // *****************************************************************************
     108                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
     109                 :            : //! \param[in] x X coordinate where to evaluate the solution
     110                 :            : //! \param[in] y Y coordinate where to evaluate the solution
     111                 :            : //! \param[in] z Z coordinate where to evaluate the solution
     112                 :            : //! \param[in] t Time where to evaluate the solution
     113                 :            : //! \return Values of all components evaluated at (x,y,z,t)
     114                 :            : //! \note The function signature must follow tk::InitializeFn
     115                 :            : // *****************************************************************************
     116                 :            : {
     117                 :            :   // manufactured solution parameters
     118                 :      16245 :   auto ce = g_inputdeck.get< eq, tag::ce >();
     119                 :      16245 :   auto r0 = g_inputdeck.get< eq, tag::r0 >();
     120                 :      16245 :   auto a = g_inputdeck.get< eq, tag::alpha >();
     121                 :      16245 :   auto k = g_inputdeck.get< eq, tag::kappa >();
     122                 :      16245 :   auto bx = g_inputdeck.get< eq, tag::betax >();
     123                 :      16245 :   auto by = g_inputdeck.get< eq, tag::betay >();
     124                 :      16245 :   auto bz = g_inputdeck.get< eq, tag::betaz >();
     125                 :            :   // spatial component of density field
     126                 :      16245 :   auto gx = 1.0 - x*x - y*y - z*z;
     127                 :            :   // internal energy parameter
     128         [ +  - ]:      16245 :   auto h = hx( bx, by, bz, x, y, z );
     129                 :            :   // temporal component of the density field
     130                 :      16245 :   tk::real ft = std::exp( -a*t );
     131                 :            :   // density
     132                 :      16245 :   auto r = r0 + ft*gx;
     133                 :            :   // energy
     134         [ +  - ]:      16245 :   auto re = r*ec(ce,k,t,h,-1.0/3.0);
     135                 :            :   // pressure
     136         [ +  - ]:      16245 :   auto p = mat_blk[0].compute< EOS::pressure >( r, 0.0, 0.0, 0.0, re );
     137                 :            : 
     138         [ +  - ]:      16245 :   return {{ r, 0.0, 0.0, 0.0, re/r, p }};
     139                 :            : }
     140                 :            : 
     141                 :            : std::vector< std::string >
     142                 :         90 : CompFlowProblemNLEnergyGrowth::analyticFieldNames( ncomp_t ) const
     143                 :            : // *****************************************************************************
     144                 :            : // Return analytic field names to be output to file
     145                 :            : //! \return Vector of strings labelling fields output in file
     146                 :            : // *****************************************************************************
     147                 :            : {
     148                 :         90 :   std::vector< std::string > n;
     149 [ +  - ][ +  - ]:         90 :   n.push_back( "density_analytical" );
     150 [ +  - ][ +  - ]:         90 :   n.push_back( "x-velocity_analytical" );
     151 [ +  - ][ +  - ]:         90 :   n.push_back( "y-velocity_analytical" );
     152 [ +  - ][ +  - ]:         90 :   n.push_back( "z-velocity_analytical" );
     153 [ +  - ][ +  - ]:         90 :   n.push_back( "specific_total_energy_analytical" );
     154 [ +  - ][ +  - ]:         90 :   n.push_back( "pressure_analytical" );
     155                 :            : 
     156                 :         90 :   return n;
     157                 :            : }
     158                 :            : 
     159                 :            : std::vector< std::string >
     160                 :          4 : CompFlowProblemNLEnergyGrowth::names( ncomp_t ) const
     161                 :            : // *****************************************************************************
     162                 :            : //  Return names of integral variables to be output to diagnostics file
     163                 :            : //! \return Vector of strings labelling integral variables output
     164                 :            : // *****************************************************************************
     165                 :            : {
     166 [ +  - ][ +  - ]:         24 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
     167                 :            : }

Generated by: LCOV version 1.14