Skip to content

Commit

Permalink
add dbgout for printout
Browse files Browse the repository at this point in the history
  • Loading branch information
jons-pf committed Oct 15, 2024
1 parent b9948ce commit fdafea4
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions Sources/Input_Output/printout.f
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
USE parallel_include_module
USE parallel_vmec_module, ONLY: CopyLastNtype
USE vmec_params, ONLY: ntmax
USE dbgout

IMPLICIT NONE
C-----------------------------------------------
C D u m m y A r g u m e n t s
C-----------------------------------------------
INTEGER :: i0
REAL(dp) :: delt0, w0
LOGICAL :: lscreen
LOGICAL :: lscreen, dbgout_printout
C-----------------------------------------------
C L o c a l P a r a m e t e r s
C-----------------------------------------------
CHARACTER(LEN=*), PARAMETER ::
CHARACTER(LEN=*), PARAMETER ::
#ifdef _HBANGLE
1 iter_line = " ITER FSQRHO FSQ(m=0) FSQL ",
1 iter_lines= " ITER FSQRHO FSQ(m=0) FSQL ",
Expand All @@ -39,7 +41,7 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
REAL(dp) :: betav, w, avm, den, tbroadon, tbroadoff
REAL(dp), ALLOCATABLE :: bcastbuf(:)
CHARACTER(len=LEN(iter_line) + LEN(fsq_line) +
1 LEN(raxis_line) + LEN(zaxis_line)) ::
1 LEN(raxis_line) + LEN(zaxis_line)) ::
2 print_line
INTEGER :: i, j, k, l, lk
C-----------------------------------------------
Expand All @@ -54,16 +56,23 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
den = zero
specw(1) = one

IF(PARVMEC) THEN
IF(PARVMEC) THEN
CALL CopyLastNtype(pxstore, pgc)
ELSE
gc = xstore
END IF
#ifdef _HBANGLE
CALL getrz(gc)
#endif
#endif

IF (PARVMEC) THEN
dbgout_printout = open_dbg_context("printout", num_eqsolve_retries)
if (dbgout_printout) then
! dump gc before it gets modified by spectrum() below
call add_real_5d("gc", 3, ntmax, ns, ntor1, mpol, gc, &
& order=(/ 4, 5, 3, 2, 1 /) )
end if ! dbgout_printout

IF (PARVMEC) THEN
CALL spectrum_par (pgc(:irzloff), pgc(1+irzloff:2*irzloff))
CALL Gather1XArray(vp)
CALL Gather1XArray(specw)
Expand Down Expand Up @@ -109,10 +118,20 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
END IF
END IF

if (dbgout_printout) then
call add_real("betav", betav)
call add_real("avm", avm)
call add_real("delbsq", delbsq)

call add_real_1d("specw", ns, specw)

call close_dbg_out()
end if ! printout

IF (i0.EQ.1 .AND. lfreeb) THEN
print_line = iter_lines // " " // raxis_line
print_line = iter_lines // " " // raxis_line
IF (lasym) print_line = TRIM(print_line) // " " // zaxis_line
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 20, TRIM(print_line)//delt_line !J Geiger 20101118
print_line = iter_line // fsq_line // raxis_line
IF (lasym) print_line = TRIM(print_line) // " " // zaxis_line
Expand All @@ -122,9 +141,9 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
IF(grank.EQ.0) WRITE (nthreed, 16) TRIM(print_line)
ENDIF
ELSE IF (i0.eq.1 .and. .not.lfreeb) THEN
print_line = raxis_line
print_line = raxis_line
IF (lasym) print_line = raxis_line // zaxis_line
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 30, iter_lines, TRIM(print_line)//delt_line !J Geiger 2010118
print_line = iter_line // fsq_line // raxis_line // " "
IF (lasym) print_line = iter_line // fsq_line // raxis_line
Expand All @@ -139,13 +158,13 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)

IF (.not. lasym) THEN
IF (.not.lfreeb) THEN
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 45, i0, fsqr, fsqz, fsql, r00, delt0, w !J Geiger 20101118
IF(grank.EQ.0) WRITE (nthreed, 40) i0, fsqr, fsqz, fsql,
1 fsqr1, fsqz1, fsql1, delt0, r00, w, betav, avm
RETURN
ENDIF
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 50, i0, fsqr, fsqz, fsql, r00, delt0, w,
2 delbsq !J Geiger 20101118
IF (imatch_phiedge .eq. 1) THEN
Expand All @@ -157,17 +176,17 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
1 fsqr1, fsqz1, fsql1, delt0, r00, w, betav,
2 ABS(phiedge), delbsq, fedge
ENDIF

ELSE
IF (.not.lfreeb) THEN
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 65, i0, fsqr, fsqz, fsql, r00, z00, !J Geiger 20101118
2 delt0, w !J Geiger 20101118
IF(grank.EQ.0) WRITE (nthreed, 60) i0, fsqr, fsqz, fsql,
1 fsqr1, fsqz1, fsql1, delt0, r00, z00, w, betav, avm
RETURN
ENDIF
IF (lscreen.AND.grank.EQ.0)
IF (lscreen.AND.grank.EQ.0)
1 PRINT 70, i0, fsqr, fsqz, fsql, r00, z00,
2 delt0, w, delbsq !J Geiger 20101118
IF (imatch_phiedge .eq. 1) THEN
Expand All @@ -176,7 +195,7 @@ SUBROUTINE printout(i0, delt0, w0, lscreen)
2 delbsq, fedge
ELSE
IF(grank.EQ.0) WRITE (nthreed, 60) i0, fsqr, fsqz, fsql,
1 fsqr1, fsqz1, fsql1, delt0, r00, z00, w, betav,
1 fsqr1, fsqz1, fsql1, delt0, r00, z00, w, betav,
2 ABS(phiedge), delbsq, fedge
ENDIF
END IF
Expand Down

0 comments on commit fdafea4

Please sign in to comment.