Repository navigation
Expand file tree
/
Copy pathrp1_advection.f90
More file actions
54 lines (41 loc) · 1.86 KB
/
Copy pathrp1_advection.f90
File metadata and controls
54 lines (41 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
! =========================================================
subroutine rp1(maxmx,meqn,mwaves,maux,mbc,mx,ql,qr,auxl,auxr,wave,s,amdq,apdq)
! =========================================================
! solve Riemann problems for the 1D advection equation q_t + u*q_x = 0.
! For constant advection velocity u, passed in common block.
! waves: 1
! equations: 1
! Conserved quantities:
! 1 q
! The advection speed u is passed in the common block cparam
! On input, ql contains the state vector at the left edge of each cell
! qr contains the state vector at the right edge of each cell
! On output, wave contains the waves,
! s the speeds,
! amdq the left-going flux difference A^- \Delta q
! apdq the right-going flux difference A^+ \Delta q
! Note that the i'th Riemann problem has left state qr(i-1,:)
! and right state ql(i,:)
! From the basic clawpack routine step1, rp is called with ql = qr = q.
implicit none
integer, intent(in) :: maxmx, meqn, mwaves, maux, mbc, mx
real(kind=8), intent(in) :: ql(meqn,1-mbc:maxmx+mbc)
real(kind=8), intent(in) :: qr(meqn,1-mbc:maxmx+mbc)
real(kind=8), intent(in) :: auxl(maux,1-mbc:maxmx+mbc)
real(kind=8), intent(in) :: auxr(maux,1-mbc:maxmx+mbc)
real(kind=8), intent(out) :: s(mwaves,1-mbc:maxmx+mbc)
real(kind=8), intent(out) :: wave(meqn, mwaves,1-mbc:maxmx+mbc)
real(kind=8), intent(out) :: amdq(meqn,1-mbc:maxmx+mbc)
real(kind=8), intent(out) :: apdq(meqn,1-mbc:maxmx+mbc)
real(kind=8) :: u
integer :: i
common /cparam/ u
do i = 2-mbc,mx+mbc
! # Compute the wave and speed
wave(1,1,i) = ql(1,i) - qr(1,i-1)
s(1,i) = u
amdq(1,i) = dmin1(u, 0.d0) * wave(1,1,i)
apdq(1,i) = dmax1(u, 0.d0) * wave(1,1,i)
end do
return
end subroutine rp1