-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathRKmarching.f90
64 lines (52 loc) · 1.64 KB
/
RKmarching.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
63
64
subroutine RKmarching
use globalvar
implicit none
!**********************************************************************
!
! Function: Runge-Kutta (explicit multistage scheme)
!
!**********************************************************************
! Local variables
real*8, allocatable :: RHS(:,:),RHSV(:,:),cvari0(:,:)
real*8 :: cellvol,ddt
integer :: irk,i,n,adcell,adflag
allocate(RHS(nmet,ncell),RHSV(nmet,ncell),cvari0(nmet,ncell))
!******************************
RHSV(:,:) = 0.0D0
do i=1,ncell
do n=1,nmet
cvari0(n,i)=cellinfo%cvar(n,i)
end do
end do
cellinfo%cvar0(:,:)=cvari0(:,:)
!******************************
! Compute local timestep
call dtcompute(ddt)
! Runge-Kutta iteration
do irk=1,nrk
! Calculate convective flux
call esolver(RHS)
! Calculate viscous flux
if(keyvis .eq. 0) RHSV=0.0D0
if(keyvis .eq. 1) call viscoslam(RHSV)
! if(keyvis .eq. 2) call viscousturb(RHSV)
! Compute convervative variables of i-stage
do i=1,ncell
cellvol = cellinfo%vol(i)
if(timeid .eq. 1) ddt = cellinfo%deltt(i)
do n=1,nmet
cellinfo%cvar(n,i)=cvari0(n,i)-ark(irk)*ddt*(RHS(n,i)-RHSV(n,i))/cellvol
end do
end do
! Boundary conditions
do i=ncell+1,nvitgho
adcell=cellinfo%neighbour(1,i)
do n=1,ncellface
adflag=cellinfo%nflag(n,adcell)
call bcond(i,adcell,adflag,n)
end do
end do
end do
deallocate(RHS,RHSV,cvari0)
return
end subroutine RKmarching