|
| 1 | +// The libMesh Finite Element Library. |
| 2 | +// Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner |
| 3 | + |
| 4 | +// This library is free software; you can redistribute it and/or |
| 5 | +// modify it under the terms of the GNU Lesser General Public |
| 6 | +// License as published by the Free Software Foundation; either |
| 7 | +// version 2.1 of the License, or (at your option) any later version. |
| 8 | + |
| 9 | +// This library is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +// Lesser General Public License for more details. |
| 13 | + |
| 14 | +// You should have received a copy of the GNU Lesser General Public |
| 15 | +// License along with this library; if not, write to the Free Software |
| 16 | +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | + |
| 18 | +// <h1>Transient Example 3 - DG/FV formulation of the 2D Advection Equation with Explicit timestepping</h1> |
| 19 | +// \author David Knezevic |
| 20 | +// \date 2012 |
| 21 | +// \author John W. Peterson |
| 22 | +// \date 2025 (modernization and libmesh example) |
| 23 | +// |
| 24 | +// This example program demonstrates one way to implement an explicit |
| 25 | +// timestepping Discontinous Galerkin/Finite Volume formulation of the |
| 26 | +// 2D advection equation. The example comes with an input file which |
| 27 | +// is set up as a finite volume model by default, but it can be |
| 28 | +// changed into a DG formulation by changing the fe_order and |
| 29 | +// fe_family parameters in the input file appropriately. The example |
| 30 | +// uses the Lax-Friedrichs numerical flux. This is known to be more |
| 31 | +// diffusive than e.g. upwinding, but it is also relatively simple |
| 32 | +// to implement since one does not need to consider the advective |
| 33 | +// velocity direction during assembly. Finally, the example comes |
| 34 | +// with two different time discretization options: explicit "forward" |
| 35 | +// Euler and explicit fourth-order Runge-Kutta (RK4). The latter |
| 36 | +// is used by default, but the "temporal_discretization_type" can |
| 37 | +// be changed to ForwardEuler in the input file to test that option. |
| 38 | + |
1 | 39 | // Basic include file needed for the mesh functionality. |
2 | 40 | #include "libmesh/libmesh.h" |
3 | 41 | #include "libmesh/mesh.h" |
|
0 commit comments