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 "Types.hpp" 24 : : #include "SystemComponents.hpp" 25 : : #include "Inciter/Options/Problem.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::ctr::ncomp_t; 67 : : using eq = tag::transport; 68 : : 69 : : public: 70 : : //! Initialize numerical solution 71 : : static std::vector< tk::real > 72 : : initialize( ncomp_t system, ncomp_t ncomp, tk::real x, tk::real y, 73 : : tk::real z, tk::real t ); 74 : : 75 : : //! Evaluate analytical solution at (x,y,z,t) for all components 76 : : static std::vector< tk::real > 77 : : analyticSolution( ncomp_t system, ncomp_t ncomp, tk::real x, tk::real y, 78 : : tk::real z, tk::real t ) 79 : 64893 : { return initialize( system, ncomp, x, y, z, t ); } 80 : : 81 : : //! Do error checking on PDE parameters 82 : : void errchk( ncomp_t system, ncomp_t ncomp ) const; 83 : : 84 : : //! Assign prescribed shear velocity at a point 85 : : static std::vector< std::array< tk::real, 3 > > 86 : : prescribedVelocity( ncomp_t system, 87 : : ncomp_t ncomp, 88 : : tk::real, 89 : : tk::real y, 90 : : tk::real z, 91 : : tk::real ); 92 : : 93 : : //! Return problem type 94 : : static ctr::ProblemType type() noexcept 95 : : { return ctr::ProblemType::SHEAR_DIFF; } 96 : : }; 97 : : 98 : : } // inciter:: 99 : : 100 : : #endif // TransportProblemShearDiff_h