4
5
6
7
8
9
10
11
12
13
14
15
16
21
22 implicit none
23
24
25
26 integer, intent(in) :: ng
27
28
29
30 integer :: i, j, iter
31
32# ifdef POWER_LAW
33 real(dp) :: gamma, scale
34# elif defined COSINE2
35 real(dp) :: arg
36# endif
37 real(dp) :: cff1, cff2
38
39 real(r16) :: wsum, shift, cff
40
41
42
43
44
45
46
51 END DO
52
53# ifdef POWER_LAW
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
72
73
74
75
76
78 DO iter=1,16
81 cff=scale*real(i,dp)
84 IF ((
nfast(ng).gt.0).and.(
weight(1,i,ng).lt.0.0_dp))
THEN
86 END IF
87 END DO
88 wsum=0.0_r16
89 shift=0.0_r16
92 shift=shift+
weight(1,i,ng)*real(i,dp)
93 END DO
94 scale=scale*shift/(wsum*real(
ndtfast(ng),dp))
95 END DO
96
97# elif defined COSINE2
98
99
100
101
102
106 IF ((2.0_dp*abs(arg)).lt.
pi)
THEN
107
108
109 weight(1,i,ng)=0.0882_dp+(cos(arg))**2
111 END IF
112 END DO
113# endif
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
132 wsum=0.0_r16
133 shift=0.0_r16
136 shift=shift+real(i,dp)*
weight(1,i,ng)
137 END DO
138 shift=shift/wsum
140
141
142
143
144 IF (cff.gt.1.0_r16) THEN
148 END DO
150 ELSE IF (cff.gt.0.0_r16) THEN
151 wsum=1.0_r16-cff
154 END DO
156 ELSE IF (cff.lt.-1.0_r16) THEN
160 END DO
162 ELSE IF (cff.lt.0.0_r16) THEN
163 wsum=1.0_r16+cff
164 DO i=1,
nfast(ng)-1,+1
166 END DO
168 END IF
169 END DO
170
171
172
173
174
177 DO i=1,j
179 END DO
180 END DO
181
182
183
184 wsum=0.0_r16
185 cff=0.0_r16
189 END DO
190 wsum=1.0_r16/wsum
191 cff=1.0_r16/cff
195 END DO
196
197
198
201 cff=0.0_r16
202 cff1=0.0_dp
203 cff2=0.0_dp
204 wsum=0.0_r16
205 shift=0.0_r16
208 cff1=cff1+
weight(1,i,ng)*real(i,dp)
209 cff2=cff2+
weight(1,i,ng)*real(i*i,dp)
211 shift=shift+
weight(2,i,ng)*(real(i,dp)-0.5_dp)
213 END DO
216 shift=shift/real(
ndtfast(ng),dp)
219# ifdef POWER_LAW
220 WRITE (
stdout,40) cff1, cff2, shift, cff, wsum,
fgamma, gamma
221 IF (cff2.lt.1.0001_dp)
WRITE (
stdout,50)
222# endif
223 END IF
224
225 10 FORMAT (/,' Time Splitting Weights for Grid ',i2.2, &
226 & ':',4x,'ndtfast = ',i3,4x,'nfast = ',i3,/, &
227 & ' ==================================',/, &
228 & /,4x,'Primary',12x,'Secondary',12x, &
229 & 'Accumulated to Current Step',/)
230 20 FORMAT (i3,4f19.16)
231 30 FORMAT (/,1x,'ndtfast, nfast = ',2i4,3x,'nfast/ndtfast = ',f8.5)
232# ifdef POWER_LAW
233 40 FORMAT (/,1x,'Centers of gravity and integrals ', &
234 & '(values must be 1, 1, approx 1/2, 1, 1):',/, &
235 & /,3x,5f15.12,/,/,1x,'Power filter parameters, ', &
236 & 'Fgamma, gamma = ', f8.5,2x,f8.5)
237 50 FORMAT (/,' WARNING: unstable weights, reduce parameter', &
238 & ' Fgamma in mod_scalars.F',/)
239# endif
240#else
242#endif
243 RETURN
real(dp), dimension(:,:,:), allocatable weight
integer, dimension(:), allocatable nfast
integer, dimension(:), allocatable ndtfast
logical, dimension(:), allocatable lwrtinfo
subroutine set_weights(ng)