Quinoa all test code coverage report
Current view: top level - PDE/MultiMat/Problem - ShockDensityWave.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 0 32 0.0 %
Date: 2024-04-22 13:03:21 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 26 0.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiMat/Problem/ShockDensityWave.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 multi-material
      10                 :            :     compressible flow equations, defined in PDE/MultiMat/MultiMat.hpp. See
      11                 :            :     PDE/MultiMat/Problem.hpp for general requirements on Problem policy classes
      12                 :            :     for MultiMat.
      13                 :            : */
      14                 :            : // *****************************************************************************
      15                 :            : 
      16                 :            : #include "ShockDensityWave.hpp"
      17                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      18                 :            : #include "MultiMat/MultiMatIndexing.hpp"
      19                 :            : 
      20                 :            : namespace inciter {
      21                 :            : 
      22                 :            : extern ctr::InputDeck g_inputdeck;
      23                 :            : 
      24                 :            : } // ::inciter
      25                 :            : 
      26                 :            : using inciter::MultiMatProblemShockDensityWave;
      27                 :            : 
      28                 :            : tk::InitializeFn::result_type
      29                 :          0 : MultiMatProblemShockDensityWave::initialize( ncomp_t ncomp,
      30                 :            :                                              const std::vector< EOS >& mat_blk,
      31                 :            :                                              tk::real x,
      32                 :            :                                              tk::real,
      33                 :            :                                              tk::real,
      34                 :            :                                              tk::real )
      35                 :            : // *****************************************************************************
      36                 :            : //! Evaluate analytical solution at (x,y,z,t) for all components
      37                 :            : //! \param[in] ncomp Number of scalar components in this PDE system
      38                 :            : //! \param[in] x X coordinate where to evaluate the solution
      39                 :            : //! \return Values of all components evaluated at (x)
      40                 :            : //! \note The function signature must follow tk::InitializeFn
      41                 :            : //! \details This function only initializes the Shock-density wave problem, but
      42                 :            : //!   does not actually give the analytical solution at time greater than 0.
      43                 :            : //!   This problem does not have an analytical solution.
      44                 :            : // *****************************************************************************
      45                 :            : {
      46                 :          0 :   auto nmat = g_inputdeck.get< eq, tag::nmat >();
      47                 :            : 
      48                 :            :   // see also Control/Inciter/InputDeck/Grammar.hpp
      49                 :            :   Assert( ncomp == 3*nmat+3, "Number of scalar components must be 6 or 9" );
      50                 :            : 
      51                 :          0 :   std::vector< tk::real > s( ncomp, 0.0 );
      52                 :            :   tk::real r, p, u, v, w;
      53                 :            :   auto alphamin = 1.0e-12;
      54                 :            : 
      55         [ -  - ]:          0 :   if(nmat > 1) {                  // If this is multi-material test
      56         [ -  - ]:          0 :     if(x > -4.0) {
      57                 :          0 :       s[volfracIdx(nmat, 0)] = 1.0-alphamin;
      58                 :          0 :       s[volfracIdx(nmat, 1)] = alphamin;
      59                 :            :     } else {
      60                 :          0 :       s[volfracIdx(nmat, 0)] = alphamin;
      61                 :          0 :       s[volfracIdx(nmat, 1)] = 1.0-alphamin;
      62                 :            :     }
      63         [ -  - ]:          0 :   } else if(nmat == 1){           // If this is a single-material test
      64                 :          0 :       s[volfracIdx(nmat, 0)] = 1.0;
      65                 :            :   } else {
      66 [ -  - ][ -  - ]:          0 :     Throw("The test is not configured for nmat > 2");
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
      67                 :            :   }
      68                 :            : 
      69         [ -  - ]:          0 :   if (x > -4.0) {
      70                 :            :     // density
      71                 :          0 :     r = 1.0 + 0.2 * sin(5.0 * x);
      72                 :            :     // pressure
      73                 :          0 :     p = 1.0;
      74                 :            :     // velocity
      75                 :          0 :     u = 0.0;
      76                 :          0 :     v = 0.0;
      77                 :          0 :     w = 0.0;
      78                 :            :   }
      79                 :            :   else {
      80                 :            :     // density
      81                 :          0 :     r = 3.8571;
      82                 :            :     // pressure
      83                 :          0 :     p = 10.3333;
      84                 :            :     // velocity
      85                 :          0 :     u = 2.6294;
      86                 :          0 :     v = 0.0;
      87                 :          0 :     w = 0.0;
      88                 :            :   }
      89                 :            : 
      90                 :            :   // bulk density
      91                 :            :   tk::real rb(0.0);
      92                 :            : 
      93         [ -  - ]:          0 :   for(std::size_t imat = 0; imat < nmat; imat++) {
      94                 :            :     // partial density
      95         [ -  - ]:          0 :     s[densityIdx(nmat, imat)] = s[volfracIdx(nmat, imat)]*r;
      96                 :            : 
      97                 :            :     // total specific energy
      98                 :          0 :     s[energyIdx(nmat, imat)] = s[volfracIdx(nmat, imat)]*
      99         [ -  - ]:          0 :       mat_blk[imat].compute< EOS::totalenergy >( r, u, v, w, p );
     100                 :            : 
     101                 :          0 :     rb += s[densityIdx(nmat, imat)];
     102                 :            :   }
     103                 :            : 
     104                 :            :   // momentum
     105                 :          0 :   s[momentumIdx(nmat, 0)] = rb * u;
     106                 :          0 :   s[momentumIdx(nmat, 1)] = rb * v;
     107                 :          0 :   s[momentumIdx(nmat, 2)] = rb * w;
     108                 :            : 
     109                 :          0 :   return s;
     110                 :            : }

Generated by: LCOV version 1.14