This reposiry is only used for the academic purpose. It implements the direct Eulerian GRP scheme introduced in A direct Eulerian GRP scheme for compressible fluid flows The algorithm only completes the 1D case, and the Strang splitting method should be further implemented based on this version.
-
The 1D Riemann solver for the Euler equations.
Usage. Define the left and right states using
vec3d ul; vec3d ur;
, wherevec3d=Eigen::Vector3d
is an alias of the Eigen vector. Define the Riemann solver byauto solver=RPSolver(ul,ur)
. To solve the Riemman problem, callsolver.solve()
. The Riemann solution is obtained by calling an overloaded()
:vec3d solution=solver(x,t)
, wherex
: spatial coordinate andt
: time.Options. Call
solver.setGamma(gamma)
to change the value of gamma (default value: 1.4) . Callsolver.setTol(tol)
to change the tolerance of the error of the Riemann solution, which requires a solution to the nonlinear equation. -
The 1D direct Eulerian GRP solver for the Euler equations.
Usage. The class
GRPSolver
is directly inheritted fromRPSolver
, which means it preserves the full capability ofRPSolver
. Define the left and right slopes usingvec3d ulSlope; vec3d urSlope;
, and define the solver usingauto gSolver=GRPSolver(ul,ur,ulSlope,urSlope);
. To solve the generalized Riemman problem, callgSolver.solve()
. The Riemann solution is obtained by calling an overloaded()
:vec3d solution=gSolver(x,t)
, and the time derivatives is obtained by callingvec3d derivatives=gSolver.timeDerivatives()
.Options. Remains the same as Riemann solver.
-
The 1D finite volume algorithm.
Usage. Define the initial data
auto U0 = vector<vec3d>(n);
. Then define the FVM solver byFVM_1D solver(U0, lB, rB);
, wherelB,rB
represent the left/right boundaries of the spatial domain. Set the ending time by callingsolver.setEndingTime(T);
, and solve withvector<vec3d> result=solver.solve()
.Options. Set the ghost cell strategy by
solver.setGhostCellStrategy("reflective")
. Available strategies: "flat"(default), "reflective", "periodic". Set$\gamma$ by callingsetGamma(gamma)
. Set CFL by callingsetCFL(CFL)
. Set the parameter in the slope limiter by callingsetAlpha(alpha)
(1~2). You can set up your own ghost cell strategy by callingsetCustomCellTreatment(fun);
, wherefun
is a function that adds values to the ghost cells.
This repo only requires the Eigen library. Install it and the dependency should be OK. On Windows, revise the path to the Eigen in the CMakeLists.txt
. The Example__.cpp
and TestAccuracy.cpp
are both ready to execute.