1 SUBROUTINE profil3d_par(rmn, zmn, lreset, linterp)
4 USE vspline,
ONLY: sknots, pknots, hstark, hthom
8 USE angle_constraints,
ONLY: store_init_array
10 USE parallel_include_module
15 REAL(dp),
DIMENSION(0:ntor,0:mpol1,ns,ntmax),
INTENT(inout) ::
17 LOGICAL,
INTENT(in) :: lreset, linterp
22 INTEGER :: js, l, lk, lt, lz, ntype, m, n, mn
23 REAL(dp),
DIMENSION(0:ntor,ntmax) :: rold, zold
24 REAL(dp) :: sm0, t1, facj, si, rax1, zax1
25 INTEGER :: jcount, jk, k
26 INTEGER :: i, j, nsmin, nsmax, lpar
27 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:) :: bcast_buf
41 nsmin = t1lglob; nsmax = t1rglob
43 pphip(:,js) = phips(js)
44 pchip(:,js) = chips(js)
50 pfaclam(:,:,nsmin:nsmax,:)=0
66 pwint_ns(lk) = cosmui3(lt,0)/mscale(0)
67 DO js = max(2, t1lglob), t1rglob
68 pwint(lk,js) = pwint_ns(lk)
75 IF (.NOT.
ALLOCATED(uminus))
THEN
76 ALLOCATE(uminus(nznt))
98 rold(0:ntor,1:ntmax) = rmn(0:ntor,0,1,1:ntmax)
99 zold(0:ntor,1:ntmax) = zmn(0:ntor,0,1,1:ntmax)
101 IF (nranks.GT.1)
THEN
102 ALLOCATE(bcast_buf(0:2*ntor+1,1:ntmax))
103 bcast_buf(0:ntor,1:ntmax) = rold(0:ntor,1:ntmax)
104 bcast_buf(ntor+1:2*ntor+1,1:ntmax) = zold(0:ntor,1:ntmax)
105 CALL mpi_bcast(bcast_buf, 2*(ntor + 1)*ntmax, mpi_real8, 0,
107 rold(0:ntor,1:ntmax) = bcast_buf(0:ntor,1:ntmax)
108 zold(0:ntor,1:ntmax) = bcast_buf(ntor+1:2*ntor+1,1:ntmax)
109 DEALLOCATE(bcast_buf)
115 si = psqrts(1,js)*psqrts(1,js)
120 t1 = one/(mscale(m)*nscale(n))
122 lpar = mn+mnsize*(js - 1) + (ntype - 1)*mns + 1
123 IF (mod(m,2) .eq. 0)
THEN
126 pscalxc(lpar) = one/psqrts(1,max(2,js))
129 pscalxc(lpar+irzloff)=pscalxc(lpar)
130 pscalxc(lpar+2*irzloff)=pscalxc(lpar)
134 IF (.not.lreset .and. lfreeb) cycle
136 IF (.not.lreset) cycle
138 rmn(n,m,js,ntype) = rmn(n,m,js,ntype)
139 & + si*(rmn_bdy(n,m,ntype)*t1 -
141 zmn(n,m,js,ntype) = zmn(n,m,js,ntype)
142 & + si*(zmn_bdy(n,m,ntype)*t1 -
145 IF (ntype .eq. rcc) rax1 = raxis_cc(n)
146 IF (ntype .eq. zcs) zax1 =-zaxis_cs(n)
147 IF (ntype .eq. rcs) rax1 =-raxis_cs(n)
148 IF (ntype .eq. zcc) zax1 = zaxis_cc(n)
150 IF (ntype.eq.rcc .or. ntype.eq.rcs)
THEN
151 rmn(n,m,js,ntype) = rmn(n,m,js,ntype)
155 IF (ntype.eq.zcs .or. ntype.eq.zcc)
THEN
156 zmn(n,m,js,ntype) = zmn(n,m,js,ntype)
161 facj = psqrts(1,js)**m
162 rmn(n,m,js,ntype) = rmn(n,m,js,ntype)
163 & + (rmn_bdy(n,m,ntype)*t1 -
164 & rmn(n,m,ns,ntype))*facj
165 zmn(n,m,js,ntype) = zmn(n,m,js,ntype)
166 & + (zmn_bdy(n,m,ntype)*t1 -
167 & zmn(n,m,ns,ntype))*facj
175 IF (.NOT.linterp)
THEN
176 CALL store_init_array(xc)
180 END SUBROUTINE profil3d_par
182 SUBROUTINE profil3d(rmn, zmn, lreset, linterp)
185 USE vspline,
ONLY: sknots, pknots, hstark, hthom
189 USE angle_constraints,
ONLY: store_init_array
196 REAL(dp),
DIMENSION(ns,0:ntor,0:mpol1,ntmax),
INTENT(inout) ::
198 LOGICAL,
INTENT(in) :: lreset, linterp
202 INTEGER :: js, l, lk, lt, lz, ntype, m, n, mn
203 REAL(dp),
DIMENSION(0:ntor,ntmax) :: rold, zold
204 REAL(dp) :: sm0, t1, facj, si, rax1, zax1
205 INTEGER :: jcount, jk, k
220 phip(js:nrzt:ns) = phips(js)
221 chip(js:nrzt:ns) = chips(js)
234 wint(js+ns*(lk-1)) = cosmui3(lt,0)/mscale(0)
248 ireflect(jcount) = js + ns*(jk - 1)
254 IF (.NOT.
ALLOCATED(uminus))
THEN
255 ALLOCATE (uminus(nznt))
275 si = sqrts(js)*sqrts(js)
280 t1 = one/(mscale(m)*nscale(n))
282 l = js + ns*mn + (ntype - 1)*mns
283 IF (mod(m,2) .eq. 0)
THEN
286 scalxc(l) = one/max(sqrts(js),sqrts(2))
290 IF (.not.lreset .and. lfreeb) cycle
292 IF (.not.lreset) cycle
293 rmn(js,n,m,ntype) = rmn(js,n,m,ntype)
294 & + si*(rmn_bdy(n,m,ntype)*t1 -
296 zmn(js,n,m,ntype) = zmn(js,n,m,ntype)
297 & + si*(zmn_bdy(n,m,ntype)*t1 -
300 rold(n,ntype) = rmn(1,n,0,ntype)
301 zold(n,ntype) = zmn(1,n,0,ntype)
303 IF (ntype .eq. rcc) rax1 = raxis_cc(n)
304 IF (ntype .eq. zcs) zax1 =-zaxis_cs(n)
305 IF (ntype .eq. rcs) rax1 =-raxis_cs(n)
306 IF (ntype .eq. zcc) zax1 = zaxis_cc(n)
307 IF (ntype.eq.rcc .or. ntype.eq.rcs)
THEN
308 rmn(js,n,m,ntype) = rmn(js,n,m,ntype)
312 IF (ntype.eq.zcs .or. ntype.eq.zcc)
THEN
313 zmn(js,n,m,ntype) = zmn(js,n,m,ntype)
319 rmn(js,n,m,ntype) = rmn(js,n,m,ntype)
320 & + (rmn_bdy(n,m,ntype)*t1 -
321 & rmn(ns,n,m,ntype))*facj
322 zmn(js,n,m,ntype) = zmn(js,n,m,ntype)
323 & + (zmn_bdy(n,m,ntype)*t1 -
324 & zmn(ns,n,m,ntype))*facj
331 scalxc(1+irzloff:2*irzloff) = scalxc(:irzloff)
332 scalxc(1+2*irzloff:3*irzloff) = scalxc(:irzloff)
335 IF (.NOT.linterp)
CALL store_init_array(xc)
338 END SUBROUTINE profil3d