-
Notifications
You must be signed in to change notification settings - Fork 2
/
MODULE_RUNGEKUTTASOLVER.f90
75 lines (59 loc) · 3 KB
/
MODULE_RUNGEKUTTASOLVER.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
65
66
67
68
69
70
71
72
73
74
75
MODULE MODULE_RUNGEKUTTASOLVER
USE MODULE_PRECISION
USE MODULE_ELEMENT
USE MODULE_RIGHTHANDSIDE
USE MODULE_ARTIFICIALVISCOUSITY
CONTAINS
SUBROUTINE EX_RUNGEKUTTA(FIRST, LAST, NELE, ELE)
IMPLICIT NONE
INTEGER(IP), INTENT(IN) :: FIRST, LAST, NELE
TYPE(ELEMENT), DIMENSION(:), INTENT(INOUT) :: ELE
INTEGER(IP) :: IRK, IELE, ORDER1, IVAL, IORDER
DO IRK = 1, ELE(1)%SOLVERINFO(1)%NSTEP, 1
DO IELE = FIRST, LAST, 1
ELE(IELE)%LOCALTIME = ELE(IELE)%SOLVERINFO(1)%GLOBALTIME + ELE(IELE)%SOLVERINFO(1)%RKC(IRK) * ELE(IELE)%SOLVERINFO(1)%DT
END DO
! COMPUTE RIGHT HAND SIDE
CALL COMPUTE_RIGHTHANDSIDE(FIRST, LAST, NELE, ELE)
!CALL COMPUTE_RIGHTHANDSIDE_ADV(FIRST, LAST, NELE, ELE)
! COMPUTE ARTIFICAL VISCOUS SITY COEF
CALL COMPUTE_ARTIFICIALVISCOUSITYCOEF(5._WP, 1, FIRST, LAST, NELE, ELE )
CALL COMPUTE_ARTIFICIALVISCOUSITYCOEF(1._WP, 2, FIRST, LAST, NELE, ELE )
CALL COMPUTE_ARTIFICIALVISCOUSITYCOEF(1._WP, 3, FIRST, LAST, NELE, ELE )
! COMPUTE AUTILIARY
CALL COMPUTE_AUXILIARYCONS(1, FIRST, LAST, NELE, ELE)
CALL COMPUTE_AUXILIARYCONS(2, FIRST, LAST, NELE, ELE)
CALL COMPUTE_AUXILIARYCONS(3, FIRST, LAST, NELE, ELE)
! COMPUTE ARTIFICAL VISCOUSITY TERM
CALL COMPUTE_ARTIFICIALVISCOUSITY(1, FIRST, LAST, NELE, ELE)
CALL COMPUTE_ARTIFICIALVISCOUSITY(2, FIRST, LAST, NELE, ELE)
CALL COMPUTE_ARTIFICIALVISCOUSITY(3, FIRST, LAST, NELE, ELE)
! ADD ARTIFICIAL VISCOUSITY TO RIGHT HAND SIDE TERM
CALL ADD_ARTIFICALVISCOSITY2RHS(1, FIRST, LAST, NELE, ELE)
CALL ADD_ARTIFICALVISCOSITY2RHS(2, FIRST, LAST, NELE, ELE)
CALL ADD_ARTIFICALVISCOSITY2RHS(3, FIRST, LAST, NELE, ELE)
! RUNGE KUTTA
DO IELE = FIRST, LAST, 1
ORDER1 = ELE(IELE)%ORDER + 1
DO IVAL = 1, ELE(IELE)%NVAL
DO IORDER = 1, ORDER1, 1
ELE(IELE)%RES_CONS(IORDER, IVAL) = ELE(IELE)%SOLVERINFO(1)%RKA(IRK) * ELE(IELE)%RES_CONS(IORDER, IVAL) &
- ELE(IELE)%SOLVERINFO(1)%DT*ELE(IELE)%CONS_RHS(IORDER, IVAL)
ELE(IELE)%CONSERVATIVE(IORDER, IVAL) = ELE(IELE)%CONSERVATIVE(IORDER, IVAL) &
- ELE(IELE)%SOLVERINFO(1)%RKB(IRK) * ELE(IELE)%RES_CONS(IORDER, IVAL)
END DO
END DO
END DO
! CONVERT FROM CONSERVATIVE TO PRIMATIVE
DO IELE = FIRST, LAST, 1
CALL ELE(IELE)%CONS2PRIM()
END DO
END DO
! COMPUTE TIME
DO IELE = FIRST, LAST, 1
ELE(IELE)%SOLVERINFO(1)%GLOBALTIME = ELE(IELE)%SOLVERINFO(1)%GLOBALTIME + ELE(IELE)%SOLVERINFO(1)%DT
ELE(IELE)%LOCALTIME = ELE(IELE)%SOLVERINFO(1)%GLOBALTIME
END DO
RETURN
END SUBROUTINE EX_RUNGEKUTTA
END MODULE MODULE_RUNGEKUTTASOLVER