-
Notifications
You must be signed in to change notification settings - Fork 2
/
MODULE_ELEMENT.f90
144 lines (112 loc) · 4.62 KB
/
MODULE_ELEMENT.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
MODULE MODULE_ELEMENT
USE MODULE_PRECISION
USE MODULE_COMPUTATIONALSYSTEM
USE MODULE_MATERIALCOMPONENT
USE MODULE_CORRECTIONPOLYNOMIAL
USE MODULE_SOLVERINFORMATION
USE MODULE_NONDIMENSIONALNUMBER
USE MODULE_MATHUTILITY
PUBLIC
TYPE, PUBLIC :: ELEMENT
INTEGER(IP) :: ORDER
INTEGER(Ip) :: INDEX
INTEGER(IP) :: NVAL
TYPE(ELEMENT), DIMENSION(:), POINTER :: LEFT
TYPE(ELEMENT), DIMENSION(:), POINTER :: RIGHT
REAL(WP) :: VX(2)
REAL(WP) :: XC
REAL(WP) :: DX
REAL(WP), DIMENSION(:), POINTER :: XK
REAL(WP), DIMENSION(:), POINTER :: RX
REAL(WP) :: LOCALTIME
REAL(WP), DIMENSION(:,:), POINTER :: CONSERVATIVE
REAL(WP), DIMENSION(:,:), POINTER :: PRIMATIVE
REAL(WP), DIMENSION(:,:), POINTER :: CONS_RHS
REAL(WP), DIMENSION(:,:), POINTER :: RES_CONS
REAL(WP), DIMENSION(:,:), POINTER :: EPSILON
REAL(WP), DIMENSION(:), POINTER :: C
REAL(WP), DIMENSION(:,:), POINTER :: Q
REAL(WP), DIMENSION(:,:), POINTER :: U_XX
TYPE(MATERIALCOMPONENT), DIMENSION(:), POINTER :: MATERIALINFO
TYPE(CORRECTIONPOLYNOMIAL), DIMENSION(:), POINTER :: CP_COEF
TYPE(NONDIMENSIONALNUMBER), DIMENSION(:), POINTER :: DIMENSIONALINFO
TYPE(SOLVERINFORMATION), DIMENSION(:), POINTER :: SOLVERINFO
TYPE(COMPUTATIONALSYSTEM), DIMENSION(:), POINTER :: COMSYS
CONTAINS
PROCEDURE :: MAKE => MAKE_ELEMENT
PROCEDURE :: DELETE => DELETE_ELEMENT
PROCEDURE :: CONS2PRIM => CONSERVATIVETOPRIMATIVE
END TYPE
CONTAINS
SUBROUTINE MAKE_ELEMENT(THIS, ORDER, NVAL, INDEX, XL, XR, COMSYS, MATERIALINFO, CP_COEF, DIMENSIONALINFO, SOLVERINFO)
IMPLICIT NONE
INTEGER(IP), INTENT(IN) :: ORDER, NVAL, INDEX
REAL(WP), INTENT(IN) :: XL, XR
TYPE(MATERIALCOMPONENT), INTENT(IN), DIMENSION(:), TARGET :: MATERIALINFO
TYPE(CORRECTIONPOLYNOMIAL), INTENT(IN), DIMENSION(:), TARGET :: CP_COEF
TYPE(NONDIMENSIONALNUMBER), INTENT(IN), DIMENSION(:), TARGET :: DIMENSIONALINFO
TYPE(SOLVERINFORMATION), INTENT(IN), DIMENSION(:), TARGET :: SOLVERINFO
TYPE(COMPUTATIONALSYSTEM), INTENT(IN), DIMENSION(:), TARGET :: COMSYS
CLASS(ELEMENT), INTENT(INOUT) :: THIS
INTEGER(IP) :: N1
N1 = ORDER + 1
THIS%ORDER = ORDER
THIS%INDEX = INDEX
THIS%NVAL = NVAL
THIS%VX(1) = XL; THIS%VX(2) = XR
THIS%DX = (XR - XL)
THIS%XC = 0.5_WP*(XR - XL)
THIS%LOCALTIME = 0._WP
ALLOCATE(THIS%CONSERVATIVE(N1, NVAL))
ALLOCATE(THIS%PRIMATIVE(N1, NVAL))
ALLOCATE(THIS%CONS_RHS(N1, NVAL))
ALLOCATE(THIS%RES_CONS(N1, NVAL))
!ALLOCATE(THIS%EPSILON(NVAL))
ALLOCATE(THIS%EPSILON(N1, NVAL))
ALLOCATE(THIS%C(N1))
ALLOCATE(THIS%Q(N1, NVAL))
ALLOCATE(THIS%U_XX(N1, NVAL))
THIS%MATERIALINFO => MATERIALINFO
THIS%COMSYS => COMSYS
THIS%SOLVERINFO => SOLVERINFO
THIS%CP_COEF => CP_COEF
THIS%DIMENSIONALINFO => DIMENSIONALINFO
ALLOCATE(THIS%XK(N1))
ALLOCATE(THIS%RX(N1))
CALL JACOBIAN(ORDER, THIS%VX, COMSYS(1)%R, COMSYS(1)%DR, THIS%XK, THIS%RX)
RETURN
END SUBROUTINE MAKE_ELEMENT
SUBROUTINE DELETE_ELEMENT(THIS)
IMPLICIT NONE
CLASS(ELEMENT), INTENT(INOUT) :: THIS
THIS%ORDER = 0._WP
THIS%INDEX = 0._WP
THIS%NVAL = 0._WP
THIS%VX(1) = 0._WP; THIS%VX(2) = 0._WP
THIS%DX = 0._WP
THIS%XC = 0._WP
THIS%LOCALTIME = 0._WP
DEALLOCATE(THIS%CONSERVATIVE)
DEALLOCATE(THIS%PRIMATIVE)
DEALLOCATE(THIS%CONS_RHS)
DEALLOCATE(THIS%RES_CONS)
DEALLOCATE(THIS%EPSILON)
DEALLOCATE(THIS%C)
DEALLOCATE(THIS%EPSILON)
DEALLOCATE(THIS%Q)
DEALLOCATE(THIS%U_XX)
DEALLOCATE(THIS%XK)
DEALLOCATE(THIS%RX)
RETURN
END SUBROUTINE DELETE_ELEMENT
SUBROUTINE CONSERVATIVETOPRIMATIVE(THIS)
IMPLICIT NONE
CLASS(ELEMENT), INTENT(INOUT) :: THIS
INTEGER(IP) :: IORDER
DO IORDER = 1, THIS%ORDER + 1
THIS%PRIMATIVE(IORDER, 1) = (THIS%CONSERVATIVE(IORDER, 3) - 0.5_WP*THIS%CONSERVATIVE(IORDER,2)*THIS%CONSERVATIVE(IORDER,2)/THIS%CONSERVATIVE(IORDER,1))*(THIS%MATERIALINFO(1)%GAMMA - 1._WP)
THIS%PRIMATIVE(IORDER, 2) = THIS%CONSERVATIVE(IORDER, 2)/THIS%CONSERVATIVE(IORDER, 1)
THIS%PRIMATIVE(IORDER, 3) = THIS%PRIMATIVE(IORDER, 1)/THIS%MATERIALINFO(1)%R_GAS_CONSTANT/THIS%CONSERVATIVE(IORDER, 1)
END DO
END SUBROUTINE CONSERVATIVETOPRIMATIVE
END MODULE MODULE_ELEMENT