-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main_Grid.f95
176 lines (145 loc) · 2.65 KB
/
Main_Grid.f95
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
SUBROUTINE GRIDSETUP
USE GLOBAL
IMPLICIT NONE
CALL UGRID
XU(2)=0
DX=XL/REAL(NX)
DX=1.0/REAL(NX)
DO I=3,L1
XU(I)=XU(I-1)+DX
ENDDO
YV(2)=0
DY=YL/REAL(NY)
DY=1.0/REAL(NY) !引入了网格控制函数的重要变化
DO J=3,M1
YV(J)=YV(J-1)+DY
ENDDO
DO I=2,L1
XU(I)=XL*( 0.5+0.5*TANH( KEXIX*( 2*XU(I)-1 ) )/TANH( KEXIX ) )
ENDDO
XU(L1)=XL
DO J=2,M1
YV(J)=YL*( 0.5+0.5*TANH( KEXIY*( 2*YV(J)-1 ) )/TANH( KEXIY ) )
ENDDO
YV(M1)=YL
X(1)=XU(2)
DO I=2,L2
X(I)=0.5*(XU(I+1)+XU(I))
ENDDO
X(L1)=XU(L1)
Y(1)=YV(2)
DO J=2,M2
Y(J)=0.5*( YV(J+1)+YV(J) )
ENDDO
Y(M1)=YV(M1)
DO I=2,L1
XDIF(I)=X(I)-X(I-1)
ENDDO
XDIF(1)=XDIF(2)
DO I=2,L2
XCV(I)=XU(I+1)-XU(I)
ENDDO
XCV(1)=0.0
XCV(L1)=0.0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