Quinoa all test code coverage report
Current view: top level - PDE/Transport/Problem - ShearDiff.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 2 4 50.0 %
Date: 2024-12-11 15:55:14 Functions: 1 2 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/Transport/Problem/ShearDiff.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     Problem configuration for scalar transport equations
       9                 :            :   \details   This file declares a Problem policy class for the transport
      10                 :            :     equations, defined in PDE/Transport/CGTransport.h implementing
      11                 :            :     node-centered continuous Galerkin (CG) and PDE/Transport/DGTransport.h
      12                 :            :     implementing cell-centered discontinuous Galerkin (DG) discretizations.
      13                 :            :     See PDE/Transport/Problem.h for general requirements on Problem policy
      14                 :            :     classes for cg::Transport and dg::Transport.
      15                 :            : */
      16                 :            : // *****************************************************************************
      17                 :            : #ifndef TransportProblemShearDiff_h
      18                 :            : #define TransportProblemShearDiff_h
      19                 :            : 
      20                 :            : #include <vector>
      21                 :            : #include <array>
      22                 :            : 
      23                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      24                 :            : #include "Inciter/Options/Problem.hpp"
      25                 :            : #include "EoS/EOS.hpp"
      26                 :            : 
      27                 :            : namespace inciter {
      28                 :            : 
      29                 :            : /*! Transport PDE problem: diffusion of a shear layer
      30                 :            :     \details This class implements the analytical solutions for the test
      31                 :            :     problem, adopted from Okubo Akira Karweit Michael J. , (1969),
      32                 :            :     [DIFFUSION FROM A CONTINUOUS SOURCE IN A UNIFORM SHEAR
      33                 :            :     FLOW](http://onlinelibrary.wiley.com/doi/10.4319/lo.1969.14.4.0514/abstract),
      34                 :            :     Limnology and Oceanography, 14, doi: 10.4319/lo.1969.14.4.0514. In essence,
      35                 :            :     this is a test problem for the advection-diffusion equation in 3D where the
      36                 :            :     analytical solution is known in a closed form as the solution evolves in
      37                 :            :     time. The initial solution is a Gaussian that is advected and diffused in
      38                 :            :     time with an imposed constant-in-time velocity field that features
      39                 :            :     advection and shear. Also, the diffusion coefficients can be different in
      40                 :            :     the three coordinate directions. Note that t0 as well as all three
      41                 :            :     components of the diffusion must be larger than zero at t=t0 to have a
      42                 :            :     well-defined initial condition.
      43                 :            :    
      44                 :            :     In a nutshell, the equation solved is
      45                 :            :     \f[
      46                 :            :       \frac{\partial S}{\partial t} + \left(V_0 + \Omega_y y + \Omega_z z
      47                 :            :       \right) \frac{\partial S}{\partial x} =
      48                 :            :       A_x \frac{\partial^2S}{\partial x^2} +
      49                 :            :       A_y \frac{\partial^2S}{\partial y^2} +
      50                 :            :       A_z \frac{\partial^2S}{\partial z^2}
      51                 :            :     \f]
      52                 :            :     whose solution is given by
      53                 :            :     \f[
      54                 :            :       S(t,x,y,z,) = \frac{1}{8\pi^{3/2}(A_xA_yA_z)^{1/2}t^{3/2}
      55                 :            :                              (1+\phi_3^2t^2)^{1/2}}
      56                 :            :                     \exp\left[ -\frac{x-V_0t-(\Omega_yy+\Omega_zz)^2/2}
      57                 :            :                                      {4A_xt(1+\phi_3^2t^2}
      58                 :            :                                -\frac{y^2}{4A_yt}
      59                 :            :                                -\frac{z^2}{4A_zt} \right]
      60                 :            :     \f]
      61                 :            :     where \f$ \phi_3^2 = (\Omega_y^2A_y/A_x + \Omega_z^2A_z/A_x)/12\f$.
      62                 :            :     See also the paper.
      63                 :            : */
      64                 :            : class TransportProblemShearDiff {
      65                 :            :   private:
      66                 :            :     using ncomp_t = tk::ncomp_t;
      67                 :            :     using eq = tag::transport;
      68                 :            : 
      69                 :            :   public:
      70                 :            :     //! Initialize numerical solution
      71                 :            :     static std::vector< tk::real >
      72                 :            :     initialize( ncomp_t ncomp,
      73                 :            :                 const std::vector< EOS >& mat_blk, tk::real x, tk::real y,
      74                 :            :                 tk::real z, tk::real t );
      75                 :            : 
      76                 :            :     //! Evaluate analytical solution at (x,y,z,t) for all components
      77                 :            :     static std::vector< tk::real >
      78                 :          0 :     analyticSolution( ncomp_t ncomp,
      79                 :            :                       const std::vector< EOS >& mat_blk, tk::real x,
      80                 :            :                       tk::real y, tk::real z, tk::real t )
      81                 :          0 :     { return initialize( ncomp, mat_blk, x, y, z, t ); }
      82                 :            : 
      83                 :            :     //! Do error checking on PDE parameters
      84                 :            :     void errchk( ncomp_t ncomp ) const;
      85                 :            : 
      86                 :            :     //! Assign prescribed shear velocity at a point
      87                 :            :     static std::vector< std::array< tk::real, 3 > >
      88                 :            :     prescribedVelocity( ncomp_t ncomp,
      89                 :            :                         tk::real,
      90                 :            :                         tk::real y,
      91                 :            :                         tk::real z,
      92                 :            :                         tk::real );
      93                 :            : 
      94                 :            :     //! Return problem type
      95                 :       6930 :     static ctr::ProblemType type() noexcept
      96                 :       6930 :     { return ctr::ProblemType::SHEAR_DIFF; }
      97                 :            : };
      98                 :            : 
      99                 :            : } // inciter::
     100                 :            : 
     101                 :            : #endif // TransportProblemShearDiff_h

Generated by: LCOV version 1.14