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:
Ψt+u⋅∇Ψ=f,Ψ(x,y,0)=Ψ0(x,y),Ψ periodic in x,Ψ no boundary condition in y,where u satisfies ∇⋅u=0,u⋅n|y=±1=0.
- Parameters:
Ω=(−π,π)×(−1,1),T=1,δt=0.0001,Nx=64,Ny=10,Ky=10.
- Exact solution and input functions:
Ψ(x,y,t)=cos(x+t)sin(y+t),u1(x,y,t)=πcos(x+t)cos(πy),u2(x,y,t)=sin(x+t)sin(πy),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