1 SUBROUTINE getfsq_par(gcr, gcz, gnormr, gnormz, gnorm, medge)
2 USE vmec_main,
ONLY: rprec, ns, ns1, mnsize
3 USE vmec_params,
ONLY: ntmax
4 USE parallel_include_module
9 INTEGER,
INTENT(in) :: medge
10 REAL(dp),
INTENT(out) :: gnormr, gnormz
11 REAL(dp),
INTENT(in) :: gnorm
12 REAL(dp),
DIMENSION(mnsize,ns,ntmax),
INTENT(IN) :: gcr, gcz
16 INTEGER :: jsmax, nsmin, nsmax, l
17 REAL(dp) :: tmpgcx(ns,2), totalgcx(2)
19 IF (.NOT. lactive)
RETURN
22 nsmin=tlglob; nsmax=min(trglob,jsmax)
23 IF (trglob .GT. jsmax) tmpgcx(jsmax+1:trglob,1:2) = 0
26 tmpgcx(l,1) = sum(gcr(:,l,:)**2)
27 tmpgcx(l,2) = sum(gcz(:,l,:)**2)
30 CALL gather1xarray(tmpgcx(:,l))
31 totalgcx(l) = sum(tmpgcx(:,l))
34 gnormr = gnorm * totalgcx(1)
35 gnormz = gnorm * totalgcx(2)
37 END SUBROUTINE getfsq_par
39 SUBROUTINE getfsq(gcr, gcz, gnormr, gnormz, gnorm, medge)
40 USE vmec_main,
ONLY: rprec, ns, ns1, mnsize
41 USE vmec_params,
ONLY: ntmax
42 USE parallel_include_module
47 INTEGER,
INTENT(in) :: medge
48 REAL(dp),
INTENT(out) :: gnormr, gnormz
49 REAL(dp),
INTENT(in) :: gnorm
50 REAL(dp),
DIMENSION(ns,mnsize*ntmax),
INTENT(in) :: gcr, gcz
57 gnormr = gnorm * sum(gcr(:jsmax,:)**2)
58 gnormz = gnorm * sum(gcz(:jsmax,:)**2)