16 mpol=>mpol_i, ntor=>ntor_i, nuv=>nuv_i, mnmax=>mnmax_i,
18 USE descriptor_mod,
ONLY: iam, nprocs, siesta_comm
20 USE nscalingtools,
ONLY: startglobrow, endglobrow, parsolver, mpi_err
21 USE utilities,
ONLY: to_half_mesh, to_full_mesh
44 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupsmnsh
47 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupumnch
50 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupvmnch
53 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jpmnch
56 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupsmnsf
59 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupumncf
62 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupvmncf
65 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djpmnch
68 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupsmnsh
71 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupumnch
74 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupvmnch
78 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupsmncf
81 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupumnsf
84 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupvmnsf
87 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubsmncf
90 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubumnsf
93 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubvmnsf
96 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupsmncf
99 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupumnsf
102 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupvmnsf
106 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupsmnch
109 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupumnsh
112 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jbsupvmnsh
115 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jpmnsh
118 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupsmncf
121 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupumnsf
124 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupvmnsf
127 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djpmnsh
130 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupsmnch
133 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupumnsh
136 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: djbsupvmnsh
140 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupsmnsf
143 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupumncf
146 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: jvsupvmncf
149 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubsmnsf
152 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubumncf
155 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsubvmncf
158 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupsmnsf
161 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupumncf
164 REAL (dp),
POINTER,
DIMENSION(:,:,:) :: fsupvmncf
167 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:,:) :: pwr_spec_s
169 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:,:) :: pwr_spec_a
172 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jvsupsijf
174 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jvsupuijf
176 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jvsupvijf
178 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jacobh
180 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: jacobf
182 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: wint
185 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupsijf0
187 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupuijf0
189 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupvijf0
192 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupsijh0
195 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupuijh0
198 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupvijh0
201 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupsijf
204 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupuijf
207 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsupvijf
209 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsubsijf
211 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsubuijf
213 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsubvijf
215 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: bsq
217 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksubsijf
219 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksubuijf
221 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksubvijf
223 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupsijf0
225 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupuijf0
227 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupvijf0
229 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupsijf
231 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupuijf
233 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: ksupvijf
236 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: pijh0
238 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: pijh0_du
240 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: pijh0_dv
242 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: pijf0
244 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: pijf0_ds
247 REAL (dp) :: fbdy(13)
257 SUBROUTINE init_quantities
258 USE descriptor_mod,
ONLY: lscalapack
264 USE prof_mod,
ONLY: setupscalingallgather
275 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: tempmn
280 ELSE IF (lscalapack)
THEN
291 CALL alloc_quantities
293 p_factor = 1.0_dp/abs(wb_i)
294 b_factor = sqrt(p_factor)
295 gnorm_i = abs(wb_i)/(wb_i + wp_i/(gamma - 1.0))
299 jacobh(:,:,:) = reshape(
sqrtg, shape(jacobh))
304 signjac = jacobh(1,1,2)/abs(jacobh(1,1,2))
308 ALLOCATE(tempmn(0:mpol,-ntor:ntor,
SIZE(jacobh,3)))
317 CALL assert(all(jacobh*signjac .gt. 0),
'FILTERED JACOBIAN CHANGED SIGN!'
319 IF (iam .eq. 0 .and. lverbose)
THEN
320 sum1 = sum((jacobh(:,:,2:) - jacobf(:,:,2:))**2 /
321 (jacobh(:,:,2:) + jacobf(:,:,2:))**2)
322 WRITE (*,1000) sqrt(sum1/
SIZE(jacobh))
325 CALL to_full_mesh(jacobh, jacobf)
328 jacobf(:,:,1) = jacobh(:,:,1)
329 jacobf(:,:,ns)= jacobh(:,:,ns)
335 ALLOCATE (vp_f(ns), stat=istat)
336 CALL assert_eq(0, istat,
'Allocation error in init_quantities')
337 CALL surfaverage(vp_f, jacobf, 1, ns)
341 sum1 = 0.5*hs_i*(sum(vp_f(2:ns)) + sum(vp_f(1:ns - 1)))*signjac
342 sum1 = twopi*twopi*sum1
343 IF (abs((sum1 - volume_i)/volume_i) .GT. 1.e-3_dp)
THEN
344 IF (iam .EQ. 0 .and. lverbose)
THEN
345 WRITE (*,1001) volume_i, sum1
349 1000
FORMAT(
' JACOBIAN SPECTRAL TRUNCATION ERROR: ',1pe8.2)
350 1001
FORMAT(
' VMEC VOLUME: ', 1pe8.2,
' SIESTA VOLUME: ',1pe8.2)
360 SUBROUTINE init_fields
363 USE vmec_info,
ONLY: lmns_i, lmnc_i, iflipj
374 REAL(dp),
DIMENSION(:),
ALLOCATABLE :: phiph
375 REAL(dp),
DIMENSION(:),
ALLOCATABLE :: chiph
376 REAL(dp),
DIMENSION(:,:,:),
ALLOCATABLE :: presif
377 REAL(dp),
DIMENSION(:,:,:),
ALLOCATABLE :: presih
380 nsmin = max(1, startglobrow)
381 nsmax = min(endglobrow, ns)
383 ALLOCATE(phiph(ns), chiph(ns))
385 phipf_i = signjac*iflipj*phipf_i
386 chipf_i = signjac*iflipj*chipf_i
388 phiph(2:ns) = (phipf_i(2:ns) + phipf_i(1:nsh))/2
389 chiph(2:ns) = (chipf_i(2:ns) + chipf_i(1:nsh))/2
394 CALL recompute_lambda(lmns_i, lmnc_i, jacobh,
399 CALL init_bfield(jbsupsmnsh, jbsupumnch, jbsupvmnch,
400 lmns_i, phiph, chiph, nsmin, nsmax,
f_sin)
402 CALL init_bfield(jbsupsmnch, jbsupumnsh, jbsupvmnsh,
403 lmnc_i, phiph, chiph, nsmin, nsmax,
f_cos)
406 DEALLOCATE (phiph, chiph, stat=istat)
407 CALL assert(istat.EQ.0,
'Deallocate error #1 in init_fields')
410 nloc = max(1,startglobrow - 1)
411 ALLOCATE(presih(ntheta,nzeta,nloc:nsmax),
412 presif(ntheta,nzeta,nloc:nsmax), stat=istat)
413 CALL assert(istat.EQ.0,
'Allocate error #1 in init_fields')
416 presif(:,:,js) = p_factor*presf_i(js)
419 CALL to_half_mesh(presif, presih)
422 presih(:,:,nsmin:nsmax) =
423 & presih(:,:,nsmin:nsmax)*jacobh(:,:,nsmin:nsmax)
427 jpmnch(:,:,nsmin:nsmax),
f_cos)
429 jpmnch(
m0,:,1) = jpmnch(
m0,:,2)
432 jpmnsh(:,:,nsmin:nsmax),
f_sin)
434 jpmnsh(
m0,:,1) = jpmnsh(
m0,:,2)
437 DEALLOCATE(presif, presih, stat=istat)
438 CALL assert_eq(istat, 0,
'Deallocate error #2 in init_fields')
459 SUBROUTINE init_bfield(jbsupsmnh, jbsupumnh, jbsupvmnh, &
460 lmn, phiph, chiph, nsmin, nsmax, parity)
463 USE utilities,
ONLY: set_bndy_fouier_m0
469 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:),
INTENT(inout) :: jbsupsmnh
470 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:),
INTENT(inout) :: jbsupumnh
471 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:),
INTENT(inout) :: jbsupvmnh
472 REAL (dp),
ALLOCATABLE,
DIMENSION(:,:,:),
INTENT(in) :: lmn
473 REAL (dp),
DIMENSION(:),
INTENT(in) :: phiph
474 REAL (dp),
DIMENSION(:),
INTENT(in) :: chiph
475 INTEGER,
INTENT(in) :: nsmin
476 INTEGER,
INTENT(in) :: nsmax
477 INTEGER,
INTENT(in) :: parity
488 IF (parity .eq.
f_sin)
THEN
501 jbsupumnh(m,n,i) = phiph(i)*(-np*lmn(m,n,i))
502 jbsupvmnh(m,n,i) = phiph(i)*( mp*lmn(m,n,i))
506 IF (parity .eq.
f_sin)
THEN
507 jbsupumnh(
m0,
n0,i) = chiph(i)
509 jbsupvmnh(
m0,
n0,i) = phiph(i)
517 jbsupsmnh(:,:,nsmin:nsmax) = b_factor*jbsupsmnh(:,:,nsmin:nsmax)
518 jbsupumnh(:,:,nsmin:nsmax) = b_factor*jbsupumnh(:,:,nsmin:nsmax)
519 jbsupvmnh(:,:,nsmin:nsmax) = b_factor*jbsupvmnh(:,:,nsmin:nsmax)
521 CALL set_bndy_fouier_m0(jbsupsmnh, jbsupumnh, jbsupvmnh, parity)
525 IF (nsmin .eq. 1)
THEN
527 jbsupsmnh(
m1,:,1) = jbsupsmnh(
m1,:,2)
529 jbsupumnh(
m0:
m1,:,1) = jbsupumnh(
m0:
m1,:,2)
530 jbsupvmnh(
m0,:,1) = jbsupvmnh(
m0,:,2)
531 jbsupvmnh(
m1:,:,1) = 0
579 SUBROUTINE recompute_lambda(lmns, lmnc, jacobh, orthonorm, &
580 phiph, chiph, nsmin, nsmax)
582 nfp => nfp_i, ntheta => nu_i, nzeta => nv_i
588 REAL (dp),
DIMENSION(mnmax,ns),
INTENT(out) :: lmns
589 REAL (dp),
DIMENSION(mnmax,ns),
INTENT(out) :: lmnc
590 REAL (dp),
DIMENSION(nuv,ns),
INTENT(in) :: jacobh
591 REAL (dp),
DIMENSION(mnmax),
INTENT(in) :: orthonorm
592 REAL (dp),
DIMENSION(ns),
INTENT(in) :: phiph
593 REAL (dp),
DIMENSION(ns),
INTENT(in) :: chiph
594 INTEGER,
INTENT(in) :: nsmin
595 INTEGER,
INTENT(in) :: nsmax
611 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: amat
612 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: brhs
613 REAL (dp),
DIMENSION(:),
ALLOCATABLE :: atemp
614 REAL (dp),
DIMENSION(:),
ALLOCATABLE :: btemp
615 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: cosmni(:,:)
616 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: cosmnp(:,:)
617 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: sinmni(:,:)
618 REAL (dp),
DIMENSION(:,:),
ALLOCATABLE :: sinmnp(:,:)
632 ALLOCATE(atemp(nuv), btemp(nuv), cosmni(nuv,mnmax), cosmnp(nuv,mnmax
633 brhs(mnmax,n2), amat(mnmax*n2, mnmax*n2), stat=info)
634 CALL assert(info.EQ.0,
'Allocation error in Recompute_Lambda')
637 ALLOCATE (sinmni(nuv,mnmax), sinmnp(nuv,mnmax), stat=info)
638 CALL assert(info.EQ.0,
'Allocation error in Recompute_Lambda')
680 IF (m .eq. 0 .and. n .lt. 0)
THEN
692 DO js = max(nsmin,2), nsmax
700 btemp = (-m* (chiph(js)*
guv(:,js) + phiph(js)*
gvv(:,js
701 n*nfp*(chiph(js)*
guu(:,js) + phiph(js)*
guv(:,js
704 brhs(mn,1) = sum(cosmni(:,mn)*btemp)
706 brhs(mn,2) = -sum(sinmni(:,mn)*btemp)
715 atemp = (m*mp*
gvv(:,js) + n*nfp*np*nfp*
guu(:,js) -
716 nfp*(m*np + mp*n)*
guv(:,js))/jacobh(:,js)
718 amat(mn,mnp) = sum(cosmni(:,mn)*cosmnp(:,mnp)*atemp
719 IF (mnp .eq. mn .and. amat(mn,mnp) .eq. zero)
THEN
720 amat(mn,mnp) = signjac
725 -sum(cosmni(:,mn)*sinmnp(:,mnp)*atemp)
727 -sum(sinmni(:,mn)*cosmnp(:,mnp)*atemp)
728 amat(mn+mnmax,mnp+mnmax) =
729 sum(sinmni(:,mn)*sinmnp(:,mnp)*atemp)
730 IF (mnp .eq. mn .and.
731 amat(mn+mnmax,mnp+mnmax).eq. zero)
THEN
732 amat(mn+mnmax,mnp+mnmax) = signjac
740 CALL solver(amat, brhs, mnmax*n2, 1, info)
741 CALL assert(info.EQ.0,
'INFO != 0 IN RECOMPUTE_LAMBDA')
744 lmns(:,js) = brhs(:,1)/(orthonorm*phiph(js))
747 lmnc(:,js) = brhs(:,2)/(orthonorm*phiph(js))
752 CALL assert(mn .eq. mnmax .and. mnp .eq. mnmax,
753 'mn or mnp != mnmax in RECOMPUTE_LAMBDA')
755 DEALLOCATE(atemp, btemp, cosmni, cosmnp, brhs, amat)
757 DEALLOCATE(sinmni, sinmnp)
762 WRITE (*,1000) toff - ton
765 1000
FORMAT(
' RECOMPUTE_LAMBDA - TIME: ',f10.2,
' S')
774 SUBROUTINE alloc_quantities
783 ALLOCATE(jbsupsmnsh(0:mpol,-ntor:ntor,ns),
784 jbsupumnch(0:mpol,-ntor:ntor,ns),
785 jbsupvmnch(0:mpol,-ntor:ntor,ns),
786 jpmnch(0:mpol,-ntor:ntor,ns), stat=istat)
787 CALL assert_eq(0, istat,
'Allocation #1 failed in alloc_quantities'
793 ALLOCATE(pwr_spec_s(0:mpol,-ntor:ntor,ns,4),
794 pwr_spec_a(0:mpol,-ntor:ntor,ns,4), stat=istat)
795 CALL assert_eq(0, istat,
'Allocation #2 failed in alloc_quantities'
799 ALLOCATE(jbsupsmnch(0:mpol,-ntor:ntor,ns),
800 jbsupumnsh(0:mpol,-ntor:ntor,ns),
801 jbsupvmnsh(0:mpol,-ntor:ntor,ns),
802 jpmnsh(0:mpol,-ntor:ntor,ns), stat=istat)
803 CALL assert_eq(0, istat,
'Allocation #3 failed in alloc_quantities'
810 ALLOCATE(bsq(ntheta,nzeta,ns), jacobh(ntheta,nzeta,ns),
811 jacobf(ntheta,nzeta,ns), wint(ntheta,nzeta,ns), stat=istat
813 CALL assert_eq(0, istat,
'Allocation #4 failed in alloc_quantities'
823 SUBROUTINE dealloc_quantities
829 DEALLOCATE(jpmnch, jbsupsmnsh, jbsupumnch, jbsupvmnch)
830 DEALLOCATE(pwr_spec_s, pwr_spec_a)
833 DEALLOCATE(djpmnch, djbsupsmnsh, djbsupumnch, djbsupvmnch,
834 ksupsmnsf, ksupumncf, ksupvmncf)
835 DEALLOCATE(jacobh, jacobf, jvsupsijf, jvsupuijf, jvsupvijf,
836 ksubsijf, ksubuijf, ksubvijf, pijh0, pijf0,
837 pijf0_ds, bsupuijf0,
vp_f, bsq, wint,
838 bsupvijf0, bsupsijf0, pijh0_du, pijh0_dv)
839 IF (
ALLOCATED(bsupsijf0))
THEN
840 DEALLOCATE(bsupsijf0, bsupuijf0, bsupvijf0)
842 IF (
ALLOCATED(bsupsijh0))
THEN
843 DEALLOCATE(bsupsijh0, bsupuijh0, bsupvijh0)
845 IF (
ALLOCATED(ksupsijf0))
THEN
846 DEALLOCATE(ksupsijf0, ksupuijf0, ksupvijf0)
848 IF (
ALLOCATED(bsubsijf))
THEN
849 DEALLOCATE(bsubsijf, bsubuijf, bsubvijf)
855 DEALLOCATE(jpmnsh, jbsupsmnch, jbsupumnsh, jbsupvmnsh)
857 DEALLOCATE(djpmnsh, djbsupsmnch, djbsupumnsh, djbsupvmnsh,
858 ksupsmncf, ksupumnsf, ksupvmnsf)
866 SUBROUTINE toupper_forces
868 mpol=>mpol_i, ntor=>ntor_i, &
872 USE utilities,
ONLY: set_bndy_full_origin
875 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsubsijf
876 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsubuijf
877 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsubvijf
878 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsupsijf
879 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsupuijf
880 REAL(dp),
ALLOCATABLE,
DIMENSION(:,:,:) :: fsupvijf
886 nsmin = max(1, startglobrow)
887 nsmax = min(ns, endglobrow)
889 ALLOCATE(fsubsijf(ntheta,nzeta,nsmin:nsmax),
890 fsubuijf(ntheta,nzeta,nsmin:nsmax),
891 fsubvijf(ntheta,nzeta,nsmin:nsmax),
892 fsupsijf(ntheta,nzeta,nsmin:nsmax),
893 fsupuijf(ntheta,nzeta,nsmin:nsmax),
894 fsupvijf(ntheta,nzeta,nsmin:nsmax), stat=istat)
895 CALL assert(istat.eq.0,
' Allocation error in toupper_forces')
913 IF (nsmin .eq. 1)
THEN
918 CALL toupper(fsubsijf, fsubuijf, fsubvijf,
919 fsupsijf, fsupuijf, fsupvijf, nsmin, nsmax)
920 DEALLOCATE(fsubsijf, fsubuijf, fsubvijf)
926 IF (nsmin .eq. 1)
THEN
927 CALL set_bndy_full_origin(fsupsmncf, fsupumnsf, fsupvmnsf)
938 IF (nsmin .eq. 1)
THEN
939 CALL set_bndy_full_origin(fsupsmnsf, fsupumncf, fsupvmncf)
943 DEALLOCATE(fsupsijf, fsupuijf, fsupvijf, stat=istat)
950 SUBROUTINE gatherfields
956 CALL gather_fields(jbsupsmnsh, jbsupumnch, jbsupvmnch, jpmnch)
958 CALL gather_fields(jbsupsmnch, jbsupumnsh, jbsupvmnsh, jpmnsh
975 SUBROUTINE gather_fields(jbsupsmnh, jbsupumnh, jbsupvmnh, jpmnh)
981 REAL (dp),
DIMENSION(:,:,:),
INTENT(inout) :: jbsupsmnh
982 REAL (dp),
DIMENSION(:,:,:),
INTENT(inout) :: jbsupumnh
983 REAL (dp),
DIMENSION(:,:,:),
INTENT(inout) :: jbsupvmnh
984 REAL (dp),
DIMENSION(:,:,:),
INTENT(inout) :: jpmnh
988 'Radial array size needs to be ns in GATHER_FIELDS'
1008 SUBROUTINE surfaverage(average, q3d, nsmin, nsmax)
1009 USE stel_kinds,
ONLY: dp
1010 USE island_params,
ONLY: ns=>ns_i, ntheta=>nu_i, nzeta=>nv_i
1015 REAL(dp),
DIMENSION(nsmin:nsmax),
INTENT(out) :: average
1016 REAL(dp),
DIMENSION(ntheta,nzeta,nsmin:nsmax),
INTENT(in) :: q3d
1017 INTEGER,
INTENT(in) :: nsmin
1018 INTEGER,
INTENT(in) :: nsmax
1024 DO js = nsmin, nsmax
1025 average(js) = sum(q3d(:,:,js)*wint(:,:,js))