Purpose
- The package "River" solves the 2-D advection equation in a rectangular domain. A nodal discontinuous Galerkin method was used for the spatial discretization in $x$, and a pseudo-Fourier method was used in $y$. The temporal discretization are multi-step strong stability-preserving (SSP) schemes. It is partially based on packages "Sea" and "Ion".
Specifications
- Name: River.
- Author: Feng Chen.
- Finishing date: 11/26/2012.
- Languages: Fortran 90.
- Required libraries: BLAS, LAPACK.
Simple Example
- Equation: \begin{equation} \begin{aligned} & \Psi_t + \boldsymbol{u} \cdot \nabla \Psi = f, \\ & \Psi(x,y,0) = \Psi_0(x,y), \\ & \Psi \text{ periodic in } x, \\ & \Psi \text{ no boundary condition in } y, \end{aligned} \end{equation} where $\boldsymbol{u}$ satisfies \begin{equation} \nabla \cdot \boldsymbol{u} = 0, \quad \boldsymbol{u} \cdot \boldsymbol{n} |_{y=\pm 1}= 0. \end{equation}
- Parameters: \begin{equation} \Omega =(-\pi,\pi)\times (-1,1), \, T=1, \, \delta t = 0.0001, \, N_x = 64, \, N_y = 10, \, K_y = 10. \end{equation}
- Exact solution and input functions: \begin{equation} \begin{aligned} & \Psi(x,y,t) = \cos(x+t) \sin(y+t),\\ & u_1(x,y,t) = \pi \cos(x+t) \cos(\pi y), \\ &u_2(x,y,t) = \sin(x+t) \sin(\pi y), \end{aligned} \end{equation} then $f(x,y)$ is calculated accordingly.
Quick Start
- Compiling and running:
cd ./River make library gfortran River_Main.cu -llibrary -llapack -lblas ./a.out
- Output:
Order 2 step 2 scheme was used. Max error of f at step 0 : 0.0000000000000000 Max error of f at step 1000 : 9.98779896381751797E-005 Max error of f at step 2000 : 1.94693442869153799E-004 Max error of f at step 3000 : 2.73449928127500463E-004 Max error of f at step 4000 : 3.29979540826086382E-004 Max error of f at step 5000 : 3.62972114978599159E-004 Max error of f at step 6000 : 3.74585022890339125E-004 Max error of f at step 7000 : 3.72236244570209318E-004 Max error of f at step 8000 : 3.67233888585664914E-004 Max error of f at step 9000 : 3.52135748568682683E-004 Max error of f at step 10000 : 3.52689697006920710E-004 ...
- CPU: Intel(R) Xeon(R) CPU X5550 @2.67GHz.
- OS: CentOS release 6.4 (Final).
- Compiler: gfortran 4.5.1.
References
- Gottlieb, S. and Shu, C. W. and Tadmor, E. Strong stability-preserving high-order time discretization methods, SIAM Review, No. 43 (2001).
Code Highlights
!< !! RiverTime_Solo propagates one step forward !! using the multi-step SSP scheme: first-order !! and second-order scheme are illustrated. !< subroutine RiverTime_Solo(co, ct, T, SI, SF, LI) !! order of the scheme integer, intent(in) :: co !! local time real(kind=8), intent(in) :: ct !! temporal discretization module type(AtomTime) :: T !! dynamics variables storing the solution type(RiverIce) :: LI !! spatial discretization module (y) type(domain), intent(in) :: SF !! spatial discretization module (x) type(IonSpace1D), intent(in) :: SI integer :: io if (co .eq. 0) then !! initialization LI%f(:,:,:,0) = LI%fi LI%f(:,:,:,1) = LI%fi elseif (co .eq. 1) then !! first-order call RiverTime_Solo_Flux(co, ct, T, SI, SF, LI) LI%f(:,:,:,1) = LI%f(:,:,:,0) + T%dt*LI%fb(:,:,:,0) elseif (co .eq. 2) then !! second-order call RiverTime_Solo_Flux(co, ct, T, SI, SF, LI) LI%f(:,:,:,2) = (4d0/5d0)*LI%f(:,:,:,1) + & (1d0/5d0)*LI%f(:,:,:,0) + & T%dt*(8d0/5d0)*LI%fb(:,:,:,1) + & T%dt*(-2d0/5d0)*LI%fb(:,:,:,0) endif end subroutine RiverTime_Solo
No comments:
Post a Comment