Skip to content

Commit

Permalink
add dbgout for greenf
Browse files Browse the repository at this point in the history
  • Loading branch information
jons-pf committed Oct 21, 2024
1 parent c9bf68c commit 66c8735
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions Sources/NESTOR_vacuum/scalpot.f
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ SUBROUTINE scalpot(bvec, amatrix, ivacskip)
STOP 'AMATSAV: Allocation error in scalpot'
END IF

dbgout_greenf = open_dbg_context("vac1n_greenf", &
& num_eqsolve_retries)

ALLOCATE (grpmn(nuv3*mnpd2), stat=ip)
IF (ip .NE. 0) STOP 'GRPMN: Allocation error in scalpot'
!
Expand All @@ -41,10 +38,12 @@ SUBROUTINE scalpot(bvec, amatrix, ivacskip)
!
! FOR ivacskip != 0, USE PREVIOUSLY COMPUTED bvecsav FOR SPEED
!

ndim = mnpd2/mnpd
CALL analyt (grpmn, bvec, ivacskip, ndim)

dbgout_greenf = open_dbg_context("vac1n_greenf", &
& num_eqsolve_retries)

IF (ivacskip .NE. 0) THEN
bvec = bvec + bvecsav
ELSE
Expand Down Expand Up @@ -98,8 +97,19 @@ SUBROUTINE scalpot(bvec, amatrix, ivacskip)
! AND STORE IN GRPMN (NOTE THAT GRPMN IS ADDED TO THE ANALYTIC PIECE IN EQ. 2.14,
! - COMPUTED IN ANALYT - WHICH HAS THE APPROPRIATE SIN, COS FACTORS ALREADY)
!

IF (istore.EQ.istore_max .OR. ip.EQ.nuv3max) THEN
if (dbgout_greenf) then
! if in debugging, this will only be called once

! in educational_VMEC, we save every intermediate value of `green` - not here
! call add_real_4d("green", nv, nu, nv, nu3, green)

call add_real_4d("greenp", nv, nu, nv, nu3, greenp)
call add_real_2d("gstore", nv, nu, gstore)

call close_dbg_out()
end if

CALL fourp (grpmn, greenp, istore, istart, ip, ndim)
END IF

Expand All @@ -114,18 +124,6 @@ SUBROUTINE scalpot(bvec, amatrix, ivacskip)
allreduce_time = allreduce_time + (toff - ton)
timer_vac(tallr) = timer_vac(tallr) + (toff-ton)

if (dbgout_greenf) then

! in educational_VMEC, we save every intermediate value of `green` - not here
! call add_real_4d("green", nv, nu, nv, nu3, green)

call add_real_4d("greenp", nv, nu, nv, nu3, greenp)

call add_real_2d("gstore", nv, nu, gstore)

call close_dbg_out()
end if

!
! COMPUTE FOURIER INTEGRAL OF GRADIENT (GRPMN) OVER PRIMED MESH IN EQ. 2.14
! AND SOURCE (GSTORE) OVER UNPRIMED MESH IN EQ. 2.16
Expand Down

0 comments on commit 66c8735

Please sign in to comment.