Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/PDE/CompFlow/Problem/SodShocktube.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 Sod's shock-tube 9 : : \details This file defines a 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 : : #ifndef CompFlowProblemSodShocktube_h 15 : : #define CompFlowProblemSodShocktube_h 16 : : 17 : : #include <string> 18 : : #include <unordered_set> 19 : : 20 : : #include "Types.hpp" 21 : : #include "Fields.hpp" 22 : : #include "FunctionPrototypes.hpp" 23 : : #include "SystemComponents.hpp" 24 : : #include "Inciter/Options/Problem.hpp" 25 : : 26 : : namespace inciter { 27 : : 28 : : //! CompFlow system of PDEs problem: Sod shock-tube 29 : : //! \see G. A. Sod. A Survey of Several Finite Difference Methods for Systems of 30 : : //! Nonlinear Hyperbolic Conservation Laws. J. Comput. Phys., 27:1–31, 1978. 31 : : class CompFlowProblemSodShocktube { 32 : : 33 : : protected: 34 : : using ncomp_t = tk::ctr::ncomp_t; 35 : : using eq = tag::compflow; 36 : : 37 : : public: 38 : : //! Initialize numerical solution 39 : : static tk::InitializeFn::result_type 40 : : initialize( ncomp_t system, ncomp_t, tk::real x, tk::real, tk::real, 41 : : tk::real ); 42 : : 43 : : //! Evaluate analytical solution at (x,y,z,t) for all components 44 : : static tk::InitializeFn::result_type 45 : : analyticSolution( ncomp_t system, ncomp_t, tk::real x, tk::real, tk::real, 46 : : tk::real ); 47 : : 48 : : //! Compute and return source term for this problem 49 : : //! \param[in,out] r Density source 50 : : //! \param[in,out] ru X momentum source 51 : : //! \param[in,out] rv Y momentum source 52 : : //! \param[in,out] rw Z momentum source 53 : : //! \param[in,out] re Specific total energy source 54 : : //! \note The function signature must follow tk::SrcFn 55 : : static tk::CompFlowSrcFn::result_type 56 : 25484000 : src( ncomp_t, tk::real, tk::real, tk::real, tk::real, 57 : : tk::real& r, tk::real& ru, tk::real& rv, tk::real& rw, tk::real& re ) 58 : 25484000 : { r = ru = rv = rw = re = 0.0; } 59 : : 60 : : //! Return analytic field names to be output to file 61 : : std::vector< std::string > analyticFieldNames( ncomp_t ) const; 62 : : 63 : : //! Return names of integral variables to be output to diagnostics file 64 : : std::vector< std::string > names( ncomp_t ) const; 65 : : 66 : : //! Return problem type 67 : 4695 : static ctr::ProblemType type() noexcept 68 : 4695 : { return ctr::ProblemType::SOD_SHOCKTUBE; } 69 : : }; 70 : : 71 : : } // inciter:: 72 : : 73 : : #endif // CompFlowProblemSodShocktube_h