-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathic.f90
executable file
·62 lines (51 loc) · 1.35 KB
/
ic.f90
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
55
56
57
58
59
60
61
62
subroutine getic(x,uc,up,ucsol)
use doubleprecision
use prms
use conv
implicit none
real(kind = dp), intent(out) :: uc(3,0:n), up(3,0:n), ucsol(0:nsteps,3,0:n)
real(kind = dp) :: x(0:n), udum(0:n)
integer :: i
forall(i=0:n:1) x(i) = i*h
x(:) = x(:) - L/2.
do i=0,n
!! Gaussian pulse
! x(:) = x(:) - L/2.
! up(1,i) = amp * ( exp( -(x(i)**2.) ) + 1 )
! up(2,:) = 1; up(3,:) = 1./g
!! Some sort of shock
! if (x(i) > 0 ) then
! up(1,i) = amp
! else
! up(1,i) = 2.*amp
! end if
!! Sod Shock tube
if (x(i) > 0 ) then
up(1,i) = 0.125
up(2,i) = 0.000
up(3,i) = 0.100
else
up(1,i) = 1.000
up(2,i) = 0.000
up(3,i) = 1.000
end if
!! Shu-Osher
! if (x(i) < -4.0 ) then
! up(1,i) = 27./7.
! up(2,i) = 4.*sqrt(35.)/7.0
! up(3,i) = 31./3.
! else
! up(1,i) = 1. + 0.2*sin(5*x(i))
! up(2,i) = 0.0
! up(3,i) = 1.0
! end if
end do
! Smoothing
udum(:) = up(1,:)
do i = 1,n-1
up(1,i) = 1./6.*(udum(i-1) + 4.*udum(i) + udum(i+1))
end do
call p_to_c(up,uc)
call output(uc(1,:),x,'rho.',0)
ucsol(0,:,:) = uc(:,:)
end subroutine getic