14 implicit none ;
private 40 integer,
intent(in) :: N
41 real,
dimension(:),
intent(in) :: h
42 real,
dimension(:),
intent(in) :: u
43 real,
dimension(:,:),
intent(inout) :: ppoly_E
44 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
49 real :: h_l, h_c, h_r, h_cn
50 real :: sigma_l, sigma_c, sigma_r
54 real :: u_min, u_max, e_l, e_r, edge
55 real :: almost_one, almost_two
56 real,
dimension(N) :: slp, mslp
58 almost_one = 1. - epsilon(slope)
59 almost_two = 2. * almost_one
65 u_l = u(k-1) ; u_c = u(k) ; u_r = u(k+1)
68 h_l = h(k-1) ; h_c = h(k) ; h_r = h(k+1)
85 sigma_c = 2.0 * ( u_r - u_l ) * ( h_c / ( h_l + 2.0*h_c + h_r +
h_neglect) )
87 if ( (sigma_l * sigma_r) > 0.0 )
then 90 u_min = min( u_l, u_c, u_r )
91 u_max = max( u_l, u_c, u_r )
92 slope = sign( min( abs(sigma_c), 2.*min( u_c - u_min, u_max - u_c ) ), sigma_c )
100 u_min = min( u_l, u_c, u_r )
101 u_max = max( u_l, u_c, u_r )
102 if (u_c - 0.5*abs(slope) < u_min .or. u_c + 0.5*abs(slope) > u_max)
then 103 slope = slope * almost_one
107 if (abs(slope) < 1.e-140) slope = 0.
122 ppoly_e(k,1) = u_c - 0.5 * slope
123 ppoly_e(k,2) = u_c + 0.5 * slope
135 u_l = u(k-1) ; u_c = u(k) ; u_r = u(k+1)
138 mslp(k) = abs(slp(k))
139 u_min = min(e_r, u_c)
140 u_max = max(e_r, u_c)
141 edge = u_c - 0.5 * slp(k)
142 if ( ( edge - e_r ) * ( u_c - edge ) < 0. )
then 143 edge = 0.5 * ( edge + e_r )
144 mslp(k) = min( mslp(k), abs( edge - u_c ) * almost_two )
146 edge = u_c + 0.5 * slp(k)
147 if ( ( edge - u_c ) * ( e_l - edge ) < 0. )
then 148 edge = 0.5 * ( edge + e_l )
149 mslp(k) = min( mslp(k), abs( edge - u_c ) * almost_two )
167 ppoly_coefficients(1,1) = u(1)
168 ppoly_coefficients(1,2) = 0.
170 slope = sign( mslp(k), slp(k) )
171 u_l = u(k) - 0.5 * slope
172 u_r = u(k) + 0.5 * slope
175 u_min = min( u(k-1), u(k) )
176 u_max = max( u(k-1), u(k) )
177 if (u_l<u_min .or. u_l>u_max)
then 178 write(0,*)
'u(k-1)=',u(k-1),
'u(k)=',u(k),
'slp=',slp(k),
'u_l=',u_l
179 stop
'Left edge out of bounds' 181 u_min = min( u(k+1), u(k) )
182 u_max = max( u(k+1), u(k) )
183 if (u_r<u_min .or. u_r>u_max)
then 184 write(0,*)
'u(k)=',u(k),
'u(k+1)=',u(k+1),
'slp=',slp(k),
'u_r=',u_r
185 stop
'Right edge out of bounds' 190 ppoly_coefficients(k,1) = u_l
191 ppoly_coefficients(k,2) = ( u_r - u_l )
194 edge = ppoly_coefficients(k,2) + ppoly_coefficients(k,1)
195 e_r = u(k+1) - 0.5 * sign( mslp(k+1), slp(k+1) )
196 if ( (edge-u(k))*(e_r-edge)<0.)
then 197 ppoly_coefficients(k,2) = ppoly_coefficients(k,2) * almost_one
202 ppoly_coefficients(n,1) = u(n)
203 ppoly_coefficients(n,2) = 0.
230 integer,
intent(in) :: N
231 real,
dimension(:),
intent(in) :: h
232 real,
dimension(:),
intent(in) :: u
233 real,
dimension(:,:),
intent(inout) :: ppoly_E
234 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
251 ppoly_e(1,2) = (u0*h1 + u1*h0) / (h0 + h1)
255 slope = 2.0 * ( ppoly_e(1,2) - u0 )
257 ppoly_e(1,1) = u0 - 0.5 * slope
258 ppoly_e(1,2) = u0 + 0.5 * slope
260 ppoly_coefficients(1,1) = ppoly_e(1,1)
261 ppoly_coefficients(1,2) = ppoly_e(1,2) - ppoly_e(1,1)
273 ppoly_e(n,1) = (u0*h1 + u1*h0) / (h0 + h1)
277 slope = 2.0 * ( u1 - ppoly_e(n,1) )
279 ppoly_e(n,1) = u1 - 0.5 * slope
280 ppoly_e(n,2) = u1 + 0.5 * slope
282 ppoly_coefficients(n,1) = ppoly_e(n,1)
283 ppoly_coefficients(n,2) = ppoly_e(n,2) - ppoly_e(n,1)
subroutine, public plm_boundary_extrapolation(N, h, u, ppoly_E, ppoly_coefficients)
subroutine, public plm_reconstruction(N, h, u, ppoly_E, ppoly_coefficients)
real, parameter h_neglect