Quinoa all test code coverage report
Current view: top level - PDE/CompFlow/Problem - RayleighTaylor.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 19 45 42.2 %
Date: 2024-04-29 14:59:56 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 48 20.8 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CompFlow/Problem/RayleighTaylor.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 "RayleighTaylor.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::CompFlowProblemRayleighTaylor;
      26                 :            : 
      27                 :            : tk::InitializeFn::result_type
      28                 :     194158 : CompFlowProblemRayleighTaylor::initialize( ncomp_t,
      29                 :            :                                            const std::vector< EOS >& mat_blk,
      30                 :            :                                            tk::real x,
      31                 :            :                                            tk::real y,
      32                 :            :                                            tk::real z,
      33                 :            :                                            tk::real t )
      34                 :            : // *****************************************************************************
      35                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      36                 :            : //! \param[in] x X coordinate where to evaluate the solution
      37                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      38                 :            : //! \param[in] z Z coordinate where to evaluate the solution
      39                 :            : //! \param[in] t Time where to evaluate the solution
      40                 :            : //! \return Values of all components evaluated at (x,y,z,t)
      41                 :            : //! \note The function signature must follow tk::InitializeFn
      42                 :            : // *****************************************************************************
      43                 :            : {
      44                 :            :   using std::sin; using std::cos;
      45                 :            : 
      46                 :            :   // manufactured solution parameters
      47                 :     194158 :   const auto a = g_inputdeck.get< eq, tag::alpha >();
      48                 :     194158 :   const auto bx = g_inputdeck.get< eq, tag::betax >();
      49                 :     194158 :   const auto by = g_inputdeck.get< eq, tag::betay >();
      50                 :     194158 :   const auto bz = g_inputdeck.get< eq, tag::betaz >();
      51                 :     194158 :   const auto p0 = g_inputdeck.get< eq, tag::p0 >();
      52                 :     194158 :   const auto r0 = g_inputdeck.get< eq, tag::r0 >();
      53                 :     194158 :   const auto k = g_inputdeck.get< eq, tag::kappa >();
      54                 :            :   // spatial component of density and pressure fields
      55                 :     194158 :   const tk::real gx = bx*x*x + by*y*y + bz*z*z;
      56                 :            :   // density
      57                 :     194158 :   const tk::real r = r0 - gx;
      58                 :            :   // pressure
      59                 :     194158 :   const tk::real p = p0 + a*gx;
      60                 :            :   // velocity
      61                 :     194158 :   const tk::real ft = cos(k*M_PI*t);
      62                 :     194158 :   const tk::real u = ft*z*sin(M_PI*x);
      63                 :     194158 :   const tk::real v = ft*z*cos(M_PI*y);
      64                 :     194158 :   const tk::real w = ft*(-0.5*M_PI*z*z*(cos(M_PI*x)-sin(M_PI*y)));
      65                 :            :   // total specific energy
      66         [ +  - ]:     194158 :   const tk::real rE = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
      67                 :            : 
      68         [ +  - ]:     194158 :   return {{ r, r*u, r*v, r*w, rE }};
      69                 :            : }
      70                 :            : 
      71                 :            : tk::InitializeFn::result_type
      72                 :          0 : CompFlowProblemRayleighTaylor::analyticSolution(
      73                 :            :   ncomp_t,
      74                 :            :   const std::vector< EOS >& mat_blk,
      75                 :            :   tk::real x,
      76                 :            :   tk::real y,
      77                 :            :   tk::real z,
      78                 :            :   tk::real t )
      79                 :            : // *****************************************************************************
      80                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      81                 :            : //! \param[in] x X coordinate where to evaluate the solution
      82                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      83                 :            : //! \param[in] z Z coordinate where to evaluate the solution
      84                 :            : //! \param[in] t Time where to evaluate the solution
      85                 :            : //! \return Values of all components evaluated at (x,y,z,t)
      86                 :            : //! \note The function signature must follow tk::InitializeFn
      87                 :            : // *****************************************************************************
      88                 :            : {
      89                 :            :   using std::sin; using std::cos;
      90                 :            : 
      91                 :            :   // manufactured solution parameters
      92                 :          0 :   auto a = g_inputdeck.get< eq, tag::alpha >();
      93                 :          0 :   auto bx = g_inputdeck.get< eq, tag::betax >();
      94                 :          0 :   auto by = g_inputdeck.get< eq, tag::betay >();
      95                 :          0 :   auto bz = g_inputdeck.get< eq, tag::betaz >();
      96                 :          0 :   auto p0 = g_inputdeck.get< eq, tag::p0 >();
      97                 :          0 :   auto r0 = g_inputdeck.get< eq, tag::r0 >();
      98                 :          0 :   auto k = g_inputdeck.get< eq, tag::kappa >();
      99                 :            :   // spatial component of density and pressure fields
     100                 :          0 :   auto gx = bx*x*x + by*y*y + bz*z*z;
     101                 :            :   // density
     102                 :          0 :   auto r = r0 - gx;
     103                 :            :   // pressure
     104                 :          0 :   auto p = p0 + a*gx;
     105                 :            :   // velocity
     106                 :          0 :   auto ft = cos(k*M_PI*t);
     107                 :          0 :   auto u = ft*z*sin(M_PI*x);
     108                 :          0 :   auto v = ft*z*cos(M_PI*y);
     109                 :          0 :   auto w = ft*(-0.5*M_PI*z*z*(cos(M_PI*x)-sin(M_PI*y)));
     110                 :            :   // total specific energy
     111         [ -  - ]:          0 :   auto E = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p ) / r;
     112                 :            : 
     113         [ -  - ]:          0 :   return {{ r, u, v, w, E, p }};
     114                 :            : }
     115                 :            : 
     116                 :            : std::vector< std::string >
     117                 :          0 : CompFlowProblemRayleighTaylor::analyticFieldNames( ncomp_t ) const
     118                 :            : // *****************************************************************************
     119                 :            : // Return analytic field names to be output to file
     120                 :            : //! \return Vector of strings labelling fields output in file
     121                 :            : // *****************************************************************************
     122                 :            : {
     123                 :          0 :   std::vector< std::string > n;
     124                 :            : 
     125 [ -  - ][ -  - ]:          0 :   n.push_back( "density_analytical" );
     126 [ -  - ][ -  - ]:          0 :   n.push_back( "x-velocity_analytical" );
     127 [ -  - ][ -  - ]:          0 :   n.push_back( "y-velocity_analytical" );
     128 [ -  - ][ -  - ]:          0 :   n.push_back( "z-velocity_analytical" );
     129 [ -  - ][ -  - ]:          0 :   n.push_back( "specific_total_energy_analytical" );
     130 [ -  - ][ -  - ]:          0 :   n.push_back( "pressure_analytical" );
     131                 :            : 
     132                 :          0 :   return n;
     133                 :            : }
     134                 :            : 
     135                 :            : std::vector< std::string >
     136                 :          2 : CompFlowProblemRayleighTaylor::names( ncomp_t /*ncomp*/ ) const
     137                 :            : // *****************************************************************************
     138                 :            : //  Return names of integral variables to be output to diagnostics file
     139                 :            : //! \return Vector of strings labelling integral variables output
     140                 :            : // *****************************************************************************
     141                 :            : {
     142 [ +  - ][ +  - ]:         12 :   return { "r", "ru", "rv", "rw", "re" };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ -  - ]
     143                 :            : }

Generated by: LCOV version 1.14