Skip to content

Commit 89e4516

Browse files
committed
FEATURE - Add sol_num parameter to match routine. Adding sol_num parameter and set the wanted number of solution component then this will make Solution{sol_num}.bin file containing the {sol_num}th solution on Wt. If there aren't any sol_num then this will work just as same as before.
1 parent f71f5b9 commit 89e4516

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

match/ideal.f

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ END SUBROUTINE ideal_transform
305305
c-----------------------------------------------------------------------
306306
c declarations.
307307
c-----------------------------------------------------------------------
308-
SUBROUTINE ideal_build
308+
SUBROUTINE ideal_build(sol_num)
309+
310+
INTEGER, INTENT(IN) :: sol_num
309311

310312
INTEGER :: istep,ifix,jfix,kfix,ieq,info
311313
INTEGER, DIMENSION(mpert) :: ipiv
@@ -319,7 +321,8 @@ SUBROUTINE ideal_build
319321
uedge=0
320322
uedge(mripple-mlow+1)=1
321323
ELSE
322-
uedge=wt(:,1)
324+
WRITE(*,*)"sol_num = ",sol_num
325+
uedge=wt(:,sol_num)
323326
ENDIF
324327
temp2=soltype(mstep)%u(:,1:mpert,1)
325328
CALL zgetrf(mpert,mpert,temp2,mpert,ipiv,info)
@@ -357,12 +360,15 @@ END SUBROUTINE ideal_build
357360
c-----------------------------------------------------------------------
358361
c declarations.
359362
c-----------------------------------------------------------------------
360-
SUBROUTINE ideal_write
363+
SUBROUTINE ideal_write(sol_num)
364+
365+
INTEGER, INTENT(IN) :: sol_num
361366

362367
LOGICAL, PARAMETER :: diagnose=.FALSE.
363368
INTEGER :: ipert,istep,m
364369
REAL(r8), DIMENSION(mpert) :: singfac
365370
COMPLEX(r8), DIMENSION(mpert,0:mstep) :: b
371+
CHARACTER(128) :: outputname
366372
c-----------------------------------------------------------------------
367373
c compute normal perturbed magnetic field.
368374
c-----------------------------------------------------------------------
@@ -375,7 +381,14 @@ SUBROUTINE ideal_write
375381
c write binary output for graphs.
376382
c-----------------------------------------------------------------------
377383
WRITE(*,*)"Write binary output for graphs."
378-
CALL bin_open(bin_unit,"solutions.bin","UNKNOWN","REWIND","none")
384+
385+
IF (sol_num == 1) THEN
386+
outputname = "solutions.bin"
387+
ELSE
388+
WRITE(outputname, '(A,I0,A)') "solutions", sol_num, ".bin"
389+
END IF
390+
391+
CALL bin_open(bin_unit, outputname, "UNKNOWN", "REWIND", "none")
379392
DO ipert=1,mpert
380393
DO istep=0,mstep
381394
WRITE(bin_unit)REAL(psifac(istep),4),REAL(rho(istep),4),

match/match.f

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PROGRAM match_main
2929
$ big,small,ns,root,scan_flag,root_flag,contour_flag,full,
3030
$ z_level_type,phi_level,transform_flag,poly_form_type,
3131
$ poly_test_type,scan0,scan1,nscan,delta0,delta1,condense,
32-
$ ripple_flag,mripple
32+
$ ripple_flag,mripple,sol_num
3333
c-----------------------------------------------------------------------
3434
c format statements.
3535
c-----------------------------------------------------------------------
@@ -55,8 +55,8 @@ PROGRAM match_main
5555
c-----------------------------------------------------------------------
5656
IF(ideal_flag)THEN
5757
CALL ideal_transform
58-
CALL ideal_build
59-
CALL ideal_write
58+
CALL ideal_build(sol_num)
59+
CALL ideal_write(sol_num)
6060
CALL ideal_chord
6161
IF(contour_flag)CALL ideal_contour
6262
ENDIF

match/match_mod.f

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ MODULE match_mod
4242
$ kin_flag=.FALSE.,con_flag=.FALSE.
4343
LOGICAL, DIMENSION(:), POINTER :: sing_flag
4444
INTEGER :: mfix,mhigh,mlow,mpert,mstep,nn,msing,mmatch,mbit,mterm
45+
INTEGER :: sol_num = 1
4546
INTEGER, DIMENSION(:), POINTER :: fixstep
4647
REAL(r8) :: sfac0=1
4748
REAL(r8), DIMENSION(:), POINTER :: psifac,rho,q

0 commit comments

Comments
 (0)