Quinoa all test code coverage report
Current view: top level - PDE/MultiMat/Problem - UnderwaterEx.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 0 33 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 22 0.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiMat/Problem/UnderwaterEx.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 multi-material flow equations
       9                 :            :   \details   This file defines a Problem policy class for the multi-material
      10                 :            :     compressible flow equations, defined in PDE/MultiMat/DGMultiMat.hpp. See
      11                 :            :     PDE/MultiMat/Problem.hpp for general requirements on Problem policy classes
      12                 :            :     for MultiMat.
      13                 :            : */
      14                 :            : // *****************************************************************************
      15                 :            : 
      16                 :            : #include "UnderwaterEx.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::MultiMatProblemUnderwaterEx;
      27                 :            : 
      28                 :            : tk::InitializeFn::result_type
      29                 :          0 : MultiMatProblemUnderwaterEx::initialize( ncomp_t ncomp,
      30                 :            :                                          const std::vector< EOS >& mat_blk,
      31                 :            :                                          tk::real x,
      32                 :            :                                          tk::real y,
      33                 :            :                                          tk::real z,
      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                 :            : //! \param[in] y Y coordinate where to evaluate the solution
      40                 :            : //! \param[in] z Z coordinate where to evaluate the solution
      41                 :            : //! \return Values of all components evaluated at (x)
      42                 :            : //! \note The function signature must follow tk::InitializeFn
      43                 :            : //! \details This function only initializes the underwater explosion problem,
      44                 :            : //!   but does not actually give the analytical solution at time greater than 0.
      45                 :            : // *****************************************************************************
      46                 :            : {
      47                 :            :   // see also Control/Inciter/InputDeck/Grammar.hpp
      48                 :            :   Assert( ncomp == 12, "Number of scalar components must be 12" );
      49                 :            : 
      50                 :          0 :   auto nmat = g_inputdeck.get< eq, tag::nmat >();
      51                 :            : 
      52 [ -  - ][ -  - ]:          0 :   std::vector< tk::real > s(ncomp, 0.0), r(nmat, 0.0);
      53                 :            :   tk::real p, u, v, w, temp;
      54                 :            :   auto alphamin = 1.0e-12;
      55                 :            : 
      56                 :            :   // velocity
      57                 :          0 :   u = 0.0;
      58                 :          0 :   v = 0.0;
      59                 :          0 :   w = 0.0;
      60                 :            : 
      61                 :            :   // background state (air)
      62                 :            :   // volume-fraction
      63                 :          0 :   s[volfracIdx(nmat, 0)] = alphamin;
      64                 :          0 :   s[volfracIdx(nmat, 1)] = alphamin;
      65                 :          0 :   s[volfracIdx(nmat, 2)] = 1.0-2.0*alphamin;
      66                 :            :   // pressure
      67                 :          0 :   p = 1.01325e5;
      68                 :            :   // temperature
      69                 :          0 :   temp = 288.2;
      70                 :            : 
      71                 :          0 :   auto radb = std::sqrt((y-1.0)*(y-1.0) + x*x + z*z);
      72                 :            : 
      73                 :            :   // high-pressure gas bubble
      74         [ -  - ]:          0 :   if (radb <= 0.3) {
      75                 :            :     // volume-fraction
      76                 :          0 :     s[volfracIdx(nmat, 0)] = alphamin;
      77                 :          0 :     s[volfracIdx(nmat, 1)] = 1.0-2.0*alphamin;
      78                 :          0 :     s[volfracIdx(nmat, 2)] = alphamin;
      79                 :            :     // pressure
      80                 :          0 :     p = 1.0e9;
      81                 :            :     // temperature
      82                 :          0 :     temp = 2000.0;
      83                 :            :   }
      84                 :            :   // water level
      85         [ -  - ]:          0 :   else if (y <= 1.5) {
      86                 :            :     // volume-fraction
      87                 :          0 :     s[volfracIdx(nmat, 0)] = 1.0-2.0*alphamin;
      88                 :          0 :     s[volfracIdx(nmat, 1)] = alphamin;
      89                 :          0 :     s[volfracIdx(nmat, 2)] = alphamin;
      90                 :            :     // temperature
      91                 :          0 :     temp = 185.52;
      92                 :            :   }
      93                 :            : 
      94                 :            :   auto rb(0.0);
      95         [ -  - ]:          0 :   for (std::size_t k=0; k<nmat; ++k)
      96                 :            :   {
      97                 :            :     // densities
      98 [ -  - ][ -  - ]:          0 :     r[k] = mat_blk[k].compute< EOS::density >( p, temp );
      99                 :            :     // partial density
     100         [ -  - ]:          0 :     s[densityIdx(nmat, k)] = s[volfracIdx(nmat, k)]*r[k];
     101                 :            :     // total specific energy
     102                 :          0 :     s[energyIdx(nmat, k)] = s[volfracIdx(nmat, k)]*
     103         [ -  - ]:          0 :       mat_blk[k].compute< EOS::totalenergy >( r[k], u, v, w, p );
     104                 :          0 :     rb += s[densityIdx(nmat, k)];
     105                 :            :   }
     106                 :            : 
     107         [ -  - ]:          0 :   s[momentumIdx(nmat, 0)] = rb * u;
     108                 :          0 :   s[momentumIdx(nmat, 1)] = rb * v;
     109         [ -  - ]:          0 :   s[momentumIdx(nmat, 2)] = rb * w;
     110                 :            : 
     111                 :          0 :   return s;
     112                 :            : }

Generated by: LCOV version 1.14