Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e6d78d7
powspace stabscan gridding
d-burg May 1, 2024
37e04e7
broken, but setting up stabscan loop
d-burg May 3, 2024
5632eb3
1st draft gamma calculation
d-burg May 23, 2024
e04745f
WIP: layer inputs routine
d-burg Jun 6, 2024
1d80801
WIP: runs, but netcdf errors
d-burg Jun 27, 2024
c873bd6
WIP: building growthrate outputs
d-burg Jul 4, 2024
7384150
WIP: adding GUI compatibility
d-burg Jul 5, 2024
f636803
WIP: cleaned SLAYER, stability plots
d-burg Jul 26, 2024
ca094bb
WIP: new arraylike inPr handling
d-burg Jul 28, 2024
a06471b
WIP: dynamic gridding root find backup
d-burg Jul 30, 2024
91b3ab0
WIP: backing up SLAYER AMR
Sep 16, 2024
5c48a44
WIP: SLAYER gamma refinement algo
d-burg Oct 3, 2024
2716878
WIP: new centered AMR algo
d-burg Oct 17, 2024
0ae4888
no AMR if small deltaprime
d-burg Oct 27, 2024
27dcf0a
function call bug fixes
d-burg Oct 28, 2024
b29bf49
change gamma scan tolerances
d-burg Nov 8, 2024
a5e4789
clean up slayer growthrate scans
d-burg Nov 14, 2024
09bdb8c
add Pe_flag
d-burg Nov 14, 2024
f1761b1
reverting Pe_flag commit
d-burg Nov 22, 2024
5841610
restoring Pe_flag commit
d-burg Nov 25, 2024
75e1441
WIP: add riccati_del_s function
d-burg Feb 3, 2025
ce180dc
WIP: layer thickness delta.f functions
d-burg Feb 6, 2025
b912356
WIP: slayer LAR gamma netcdf upgrades
d-burg Feb 12, 2025
00c18d7
WIP: adjust error tolerances
d-burg Feb 17, 2025
35514d1
generalized growth rates to full eq!!
d-burg Feb 28, 2025
af3bb30
WIP: layer thickness usability updates
d-burg Mar 17, 2025
295ff40
SLAYER delta netcdf updates
d-burg Mar 31, 2025
4e1e98d
Revert "WIP: layer thickness usability updates"
d-burg Mar 31, 2025
bff2187
netcdf working again, minor slayer fixes
d-burg Apr 4, 2025
74e1c1d
Merge develop into slayer_growthrate
d-burg Apr 4, 2025
25292b2
Bug fixes and ease of use
d-burg Apr 12, 2025
066a371
layfac=tau_R, STRIDE effective rs in netcdf
d-burg Apr 15, 2025
d600258
STRIDE rs flux avg, SLAYER fixes
d-burg Apr 18, 2025
610914f
draft of rfitzp growth rate solve
d-burg Apr 22, 2025
64d45d3
old stabscan architecture backup
d-burg May 6, 2025
096a60d
new architecture! toggle fitz vs JKP
d-burg May 9, 2025
54369b0
bug and sign fixes
d-burg May 9, 2025
5a533c3
SLAYER print statement cleanups
d-burg May 21, 2025
832c9e3
pre-merge updates
d-burg Jun 11, 2025
10529d7
merge with develop
d-burg Jun 11, 2025
633821b
small changes post merge
d-burg Jun 24, 2025
609787f
toroidal Delta_crit
d-burg Jul 2, 2025
56f9dc5
WIP: SLAYER in/out struct overhaul
d-burg Aug 19, 2025
5ff13d5
working: SLAYER structs
d-burg Aug 20, 2025
7e7de3f
WIP: P_perp and P_tor
d-burg Aug 20, 2025
762f854
WIP: 2x2 coupling
d-burg Aug 21, 2025
b90a844
WIP: improved scan logic
d-burg Sep 12, 2025
0348b2a
WIP: backup, working version
d-burg Oct 9, 2025
e6a825f
WIP: reverting coupling workflow to fix gamma bug
d-burg Oct 10, 2025
ee8cef4
Revert "WIP: backup, working version"
d-burg Oct 10, 2025
ce0b1f9
checkpoint: working with brute force scans
d-burg Oct 14, 2025
83465f8
WIP: latest working version
d-burg Dec 15, 2025
b26cf41
WIP: cleanups and prep for PR
d-burg Dec 17, 2025
357aadf
WIP: SLAYER AMR using hash table
d-burg Jan 23, 2026
8f45f09
WIP: AMR V2 with cell types
d-burg Jan 23, 2026
2a73a46
WIP: fixes for coupled AMR scans
d-burg Jan 30, 2026
4849e00
WIP: big cleanup, not compiling yet
d-burg Feb 14, 2026
e5397cb
WIP: fix line excursion
d-burg Feb 14, 2026
aca19c5
WIP: bug fixes
d-burg Feb 19, 2026
c658f45
WIP: fix NF90_GLOBAL integers in read_stride
d-burg Feb 19, 2026
a42fc48
WIP: working on params bug
d-burg Feb 19, 2026
4f5a7d9
WIP: fix tau_perp bug, m_AMR bug
d-burg Feb 19, 2026
7390807
WIP: delta.f speedup attempt
d-burg Feb 19, 2026
2548310
Merge branch 'slayer_growthrate' of github.com:PrincetonUniversity/GP…
d-burg Feb 19, 2026
a072e31
delta.f arithmetic error
d-burg Feb 19, 2026
c61f15e
WIP: AMR speedup
d-burg Feb 19, 2026
175413f
WIP: hashed midpoint computation fix
d-burg Feb 19, 2026
01039e5
WIP: ongoing diagnosing of erroneous nyquist diagrams
d-burg Feb 19, 2026
32985ec
WIP: fix makefile ordering
d-burg Feb 19, 2026
4fb3329
WIP: set coupling via msing_max
d-burg Feb 21, 2026
631b9c8
WIP: fix determinant msing_max case
d-burg Feb 21, 2026
b7c2936
new SLAYER cleanup complete, first pass
d-burg Feb 24, 2026
ab42586
final STRIDE, br_th cleanups
d-burg Feb 24, 2026
0d2eb45
MERGE with origin/develop
d-burg Feb 25, 2026
88f7f7c
fix stale dependencies
d-burg Feb 25, 2026
3acd396
fix version.inc
d-burg Feb 25, 2026
0bd79b0
further module dependency bug fixes
d-burg Feb 25, 2026
7415dda
fix slayer.f line excursion
d-burg Feb 25, 2026
02079a7
fix slayer linking
d-burg Feb 25, 2026
c115854
fix stride_netcdf_out call
d-burg Feb 25, 2026
cd5626c
fix further makefile ordering issues
d-burg Feb 25, 2026
9cc2c66
further deps fixes
d-burg Feb 25, 2026
11370ee
fix slayer line excursion
d-burg Feb 25, 2026
7de735c
address PR review bugs and suggestions
d-burg Feb 25, 2026
cb66042
WIP: STRIDE debug WRITE statements
d-burg Feb 25, 2026
912154e
WIP: more debug statements
d-burg Feb 25, 2026
3ad5ef1
WIP: try changing identityMat to allocatable
d-burg Feb 25, 2026
e0a209b
WIP: remove STRIDE debug statements
d-burg Feb 25, 2026
8955716
address @Claudes comment, a10 example needs future overhaul anyways
d-burg Feb 25, 2026
0c30074
WIP: split off growth rate functionality from gslayer.f
d-burg Mar 3, 2026
2ed9a6c
WIP: clean up dispersion_det gamma specification
d-burg Mar 3, 2026
8512d7a
increase max pts
d-burg Mar 9, 2026
e2f5df6
STRIDE - BUGFIX - Move identityMat to heap allocation and harden ZVOD…
d-burg Apr 1, 2026
ed3e51b
Merge branch 'stride_allocatable_fix' into slayer_growthrate
d-burg Apr 1, 2026
ee6d765
SLAYER - ENHANCEMENT - Make MAX_PTS a soft limit in AMR
d-burg Apr 1, 2026
f13fcc3
update growthrates.f header
d-burg Apr 1, 2026
ad53d67
WIP - bug fixes to Fitz tau normalization timescale
d-burg Apr 16, 2026
8d4a86d
correct prefactors for toroidal delta_crit
d-burg Apr 18, 2026
77d3419
add no-op delta_c matrix to determinant
d-burg Apr 18, 2026
c834fbc
fix Q_e sign error
d-burg Apr 19, 2026
335ce31
WIP - SLAYER + RMATCH benchmarking patches
d-burg Apr 25, 2026
9ea6367
SLAYER - NEW FEATURE - Allow STRIDE msing > coupled-dispersion msing_max
d-burg Apr 26, 2026
c0988c6
fix dr_rationals to use locstab%f(2) index
d-burg Jun 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/examples/a10_ideal_example/slayer.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

!!! FOR READING IN ASCII TABLE, SET INPUT_FLAG
input_flag=f ! reads profile quantities (n_e, t_e, etc.) from an ascii table
infile='/fusion/projects/codes/gpec/GPEC-1.5/docs/examples/a10_ideal_example/a10_prof1.txt' ! Path to ascii table of profile quantities read when using input_flag

infile='' ! Path to ascii table of profile quantities read when using input_flag
ncfile='' ! Path to netCDF file of STRIDE outputs
!!! FOR MANUALLY ENTERING KINETIC QUANTITIES @ RATIONAL SURFACE, SET PARAMS_FLAG
params_flag=t ! calculates normalized parameters from profile quantities
params_flag=f ! calculates normalized parameters from profile quantities
mm=2 ! poloidal mode number
nn=1 ! toroidal mode number
n_e=7.77E+17 ! electron density [m^-3]
t_e=25.8 ! electron temperature [eV]
t_i=25.8 ! ion temperature [eV]
sval=729.0 ! magnetic shear at the layer
sval=2.0 ! magnetic shear at the layer
bt=1.0 ! toroidal field [T]
rs=0.17 ! minor radius of resonant surface [m]
R0=2.0 ! major radius of magnetic axis [m]
Expand All @@ -21,7 +21,7 @@
qval=2.0 ! q of resonant surface
mu_i=2.0 ! ion mass ratio to proton ??
zeff=2.0 ! plasma Z_effective
inpr=0.0001 ! Prantdl number
inpr=0.1 ! Prantdl number
inpe=0.0 ! Electron viscosity

!!! IF INPUT_FLAG & PARAMS_FLAG ARE FALSE, MANUALLY ENTER DIMENSIONLESS QUANTITIES @ RATIONAL SURFACE
Expand Down Expand Up @@ -56,7 +56,8 @@
bin_flag=t ! writes results to binary files
netcdf_flag=f ! writes results to netcdf files
stability_flag=f ! calculate delta dependence on complex Q
bal_flag=t ! calculate the resonant field penetration threshold from torque balance
est_gamma_flag=t ! Calculate estimated growth rates on each rational surface
!bal_flag=f ! calculate the resonant field penetration threshold from torque balance
/
&SLAYER_DIAGNOSE
riccati_out=f ! writes LSDOE Riccati integration to an ascii file
Expand Down
88 changes: 56 additions & 32 deletions input/slayer.in
Original file line number Diff line number Diff line change
@@ -1,45 +1,60 @@
&SLAYER_INPUT

!!! FOR READING IN ASCII TABLE, SET INPUT_FLAG = TRUE
input_flag=f ! reads profile quantities (n_e, t_e, etc.) from an ascii table
infile='' ! Path to ascii table of profile quantities read when using input_flag
ncfile='' ! Path to netCDF file of STRIDE outputs

!!! FOR MANUALLY ENTERING KINETIC QUANTITIES @ RATIONAL SURFACE, SET PARAMS_FLAG = TRUE
infile='' ! Path to ascii table of profile quantities read when using input_flag
ncfile='' ! Path to netCDF file of STRIDE outputs
params_flag=f ! calculates normalized parameters from profile quantities
! >>>
! >>> Input rational surface quantities
! >>>
mm=2 ! poloidal mode number
nn=1 ! toroidal mode number
n_e=7.77E+17 ! electron density [m^-3]
t_e=25.8 ! electron temperature [eV]
t_i=25.8 ! ion temperature [eV]
sval=2.0 ! magnetic shear at the layer
bt=1.0 ! toroidal field [T]
rs=0.17 ! minor radius of resonant surface [m]
R0=2.0 ! major radius of magnetic axis [m]
omega=5.45E+04 ! ExB frequency [1/s]
n_e=5.50E+19 ! electron density [m^-3]
t_e=1000.0 ! electron temperature [eV]
t_i=1000.0 ! ion temperature [eV]
sval=1.5 ! magnetic shear at the layer
bt=2.0 ! toroidal field [T]
rs=0.5 ! minor radius of resonant surface [m]
R0=1.67 ! major radius of magnetic axis [m]
omega=5.00E+03 ! ExB frequency [Hz]
l_t=0.11 ! temperature gradient scale length
l_n=0.25 ! density gradient scale length
qval=2.0 ! q of resonant surface
mu_i=2.0 ! ion mass ratio to proton ??
mu_i=2.0 ! ion mass ratio to proton mass, 2 for deuterium plasma
zeff=2.0 ! plasma Z_effective
inpr=10.0 ! Prantdl number
inpr_prof=10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0 ! Prandtl number profile
inpe=0.0 ! Electron viscosity (if > 0.0, Pe_flag=t will be overridden and this value used instead)

!!! IF INPUT_FLAG & PARAMS_FLAG ARE FALSE, MANUALLY ENTER DIMENSIONLESS QUANTITIES @ RATIONAL SURFACE HERE
inQ=23.0 ! normalized ExB frequency
inQ_e=2.0 ! normalized electron diamagnetic frequency
inQ_i=-2.0 ! normalized ion diamagnetic frequency
inc_beta=0.7 ! dimensionless measure of the plasma pressure
inds=6.0 ! normalized ion sound radius
intau=1.0 ! ion temperature divided by electron temperature
Q0=4.0 ! unnecessary placeholder variable for inQ?
delta_n_p=0 ! delta offset used for jxb calculations. Default is (1e-2,1e-2).
dr_val=-0.1 ! GGJ resistive interchange criterion D_R
dgeo_val=10.0 ! J.W. Connor geometric prefactor for Delta_crit
chi_p_prof=0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2 ! Rational surface anomalous perpendicular energy diffusivity profile
chi_t_prof=0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2 ! Rational surface anomalous perpendicular ion momentum diffusivity profile
kappa_prof=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 ! Rational surface thermal conductivity profile (NOTE: set > 0 to override chi_p_prof)
! >>>
! >>> Input normalized layer parameters. If read_eq=f, each will individually override internal calcuation using above inputs
! >>>
inpr=0.0 ! Prantdl number. Set /= 0.0 to override internal calculation
inpe=0.0 ! electron viscosity
inQ=1.0 ! normalized ExB frequency. TO DO: update for mode rotation frequency calculation!
inQ_e=0.0 ! normalized electron diamagnetic frequency. Set /= 0.0 to override internal calculation
inQ_i=0.0 ! normalized ion diamagnetic frequency. Set /= 0.0 to override internal calculation
inc_beta=0.0 ! dimensionless measure of the plasma pressure. Set /= 0.0 to override internal calculation
inds=0.0 ! normalized ion sound radius, or normalized ion skin depth. Set /= 0.0 to override internal calculation
intau=1.0 ! ratio of ion to electron temperature
Q0=1.0 ! unnecessary placeholder variable for inQ?
delta_prime=(0.0,0.0) ! input Delta' or (Delta' - Delta_crit) for growth rate calculation, set /= 0.0 to override internal calculation
delta_n_p=(0.01,0.01) ! delta offset used for jxb calculations. Default for latter is (1e-2,1e-2).
ingamma=(0.0,0.0) ! input (Re(Q),Im(Q)) to calculate inner layer Delta. Set /= 0.0 to override internal root finding
/

&SLAYER_CONTROL
inum=400 ! resolution to find error field thresholds.
jnum=100 ! resolution for 2d scan along with Q,omega.
knum=100 ! resolution for 2d scan alont with the other.
knum=100 ! resolution for 2d scan along with the other.
Q_num=100 ! resolution for stability scan along Re(Q),Im(Q) axes
scan_width=1.5 ! stability scan width for Re(Q),Im(Q) scan
AMR_passes=4
msing_max=2 ! number of surfaces to include in coupled tearing growth rate calculation
dc_type="toroidal" ! Delta_crit type, options are "toroidal", "lar", and "rfitzp"
read_eq=f ! read in equilibrium quantities from STRIDE and kinetic file. Set all normalized params to 0.0
Pperp_Ptor_flag=t ! Use R. Fitzpatrick formalism (inc. anomalous diffusion) for growth rate calculation
coupling_flag=t ! Solve determinant problem and output 2D scan
QPscan_flag=f ! scan (Q,P) space for delta and torque.
Qscan_flag=f ! scan Q space
QPescan_flag=f ! scan (Q,Pe) space for delta and torque.
Expand All @@ -50,18 +65,27 @@
nbtscan_flag=f ! scan (n,bt) space for error fields.
parflow_flag=f ! set parallel flow on
PeOhmOnly_flag=t ! only include Pe from Ohm's law
Pe_flag=f ! Not operational yet. If true, it will calculate classical inpe value from inpr and include in SLAYER run
Pe_flag=f ! if true, calculate classical inpe value from inpr and include in SLAYER run
layfac=0.02 ! layfac*EXP(ifac*ATAN2(AIMAG(Q-Q_e),REAL(Q-Q_e)) is added to Q_e if ABS(Q-Q_e)<layfac). Default is 0.02.
/

&SLAYER_OUTPUT
verbose=t ! prints progress to terminal
ascii_flag=t ! writes results to ascii files
ascii_flag=f ! writes results to ascii files
bin_flag=f ! writes results to binary files
netcdf_flag=f ! writes results to netcdf files
est_gamma_flag=t ! Calculate and output growth rate estimate
match_gamma_flag=t ! Find Delta_hat = Delta_prime match to solve for growth rate
stability_flag=f ! calculate delta dependence on complex Q
stabscan_flag=f ! Generate Re(Q),Im(Q) scan and output as ASCII
coupled_stabscan_flag=f ! Generate Re(Q),Im(Q) scan and output as ASCII
amr_flag=t ! Generate Re(Q),Im(Q) scan and output as ASCII
br_th_flag=f ! Calculate br_th
bal_flag=f ! calculate the resonant field penetration threshold from torque balance
/

&SLAYER_DIAGNOSE
riccati_out=f ! writes LSDOE Riccati integration to an ascii file
params_check=t ! prints the primary parameters to the terminal when they are calculated
riccatiscan_flag=f
params_check=f ! prints the primary parameters to the terminal when they are calculated
/
7 changes: 5 additions & 2 deletions install/DEPENDENCIES.inc
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@
../slayer/sglobal.o: ../equil/local.o
../slayer/params.o : ../slayer/sglobal.o
../slayer/delta.o : ../slayer/sglobal.o
../slayer/gslayer.o : ../slayer/sglobal.o ../slayer/delta.o
../slayer/slayer.o : ../slayer/sglobal.o ../slayer/params.o ../slayer/delta.o
../slayer/slayer_netcdf.o : ../slayer/sglobal.o ../slayer/version.inc
../slayer/layerinputs.o : ../slayer/sglobal.o ../slayer/params.o ../slayer/slayer_netcdf.o ../pentrc/inputs.o ../equil/equil.o ../equil/spline.o ../equil/bicube.o
../slayer/gslayer.o : ../slayer/sglobal.o ../slayer/params.o ../slayer/delta.o ../slayer/layerinputs.o ../slayer/slayer_netcdf.o
../slayer/growthrates.o : ../slayer/sglobal.o ../slayer/params.o ../slayer/delta.o ../slayer/layerinputs.o ../slayer/slayer_netcdf.o
../slayer/slayer.o : ../slayer/sglobal.o ../slayer/params.o ../slayer/delta.o ../slayer/gslayer.o ../slayer/growthrates.o ../slayer/layerinputs.o

# COIL
../coil/coil.o: ../equil/local.o ../equil/bicube.o ../coil/version.inc
Expand Down
2 changes: 1 addition & 1 deletion install/RULES.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ FCMULTI = $(FC) $(FFLAGS) -I../equil
$(FCMULTI) $(MODFLAG) ../multi -c $< -o $@

# SLAYER
FCSLAYER = $(FC) $(FFLAGS) $(OMPFLAG) -I$(MATHINC) -I$(NETCDFINC) -I../equil
FCSLAYER = $(FC) $(FFLAGS) $(OMPFLAG) -I$(MATHINC) -I$(NETCDFINC) -I../equil -I../slayer -I../pentrc
../slayer/%.o: ../slayer/%.f
$(FCSLAYER) $(MODFLAG) ../slayer -c $< -o $@
../slayer/%.o: ../slayer/%.F
Expand Down
14 changes: 13 additions & 1 deletion install/TARGETS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,29 @@ rmatch: v neededdeps $(RMATCH_OBJS) equil lsode
$(call print_success,rmatch -> $(BINDIR)/rmatch)

# SLAYER
../slayer/version.inc:
@ver="`git describe --tags`"; \
if [ ! -f $@ ] || ! grep -F "'$$ver'" $@ >/dev/null 2>&1; then \
echo ">>> Updating version file"; \
echo " CHARACTER(len=*), PARAMETER :: version ='$$ver'" | tee $@; \
else \
echo ">>> Git version unchanged!"; \
fi
$(call print_success,version file updated: $@)

SLAYER_LIBS = \
-lpentrc \
-llsode \
-lequil \
-lharvest \
$(MATHLIBS) \
$(NETCDFLIBS) \
$(NETCDF_EXTRA_LIBS)
SLAYER_LIBDIRS = \
-L$(LIBDIR) \
-L$(MATHDIR) \
-L$(NETCDFDIR)
slayer: v neededdeps $(SLAYER_OBJS) lsode equil
slayer: v neededdeps $(SLAYER_OBJS) lsode equil pentrc harvest
mkdir -p $(BINDIR)
rm -f ../slayer/slayer
$(FCSLAYER) -o ../slayer/slayer $(SLAYER_OBJS) $(SLAYER_LIBDIRS) $(SLAYER_LIBS) $(LDFLAGS)
Expand Down
1 change: 1 addition & 0 deletions pentrc/inputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ subroutine read_kin(file,zi,zimp,mi,mimp,nfac,tfac,wefac,wpfac,write_log)
do i=1,5
tmp%fs(0:,i) = table(1:,i+1)
enddo

call spline_fit(tmp,"extrap")
if(write_log) print *,"Formed temporary spline"

Expand Down
74 changes: 71 additions & 3 deletions rmatch/match.f
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ MODULE match_mod
$ deltac_flag=.FALSE.,deltaj_flag=.FALSE.,
$ match_flag=.FALSE.
LOGICAL :: bin_rpecsol=.FALSE.,out_rpecsol=.FALSE.
LOGICAL :: detgrid_flag=.FALSE.
CHARACTER(10) :: model="deltac"
INTEGER :: msing,totmsing,nstep=32,qscan_ising=1
INTEGER :: scan_nstep, scan_estep
INTEGER :: nroot=1,iroot,totnsol,ising_output=1,itermax=500
INTEGER :: detgrid_nre=64, detgrid_nim=64
REAL(r8) :: eta(20),dlim=1000,massden(20),rotation(20)=0,ntor=1
REAL(r8) :: scan_x0,scan_x1,relax_fac,scan_e0,scan_e1
REAL(r8) :: detgrid_re_min=-1.0, detgrid_re_max=1.0,
$ detgrid_im_min=-1.0, detgrid_im_max=1.0
REAL(r8), DIMENSION(:), ALLOCATABLE :: taur_save
REAL(r8), DIMENSION(:), ALLOCATABLE :: zo_out,zi_in
COMPLEX(r8) :: initguess
Expand Down Expand Up @@ -137,7 +141,10 @@ SUBROUTINE match_run
$ deflate,nroot,match_flag,ising_output,
$ match_sol,matrix_diagnose,fulldomain,
$ coil,itermax,relax_fac,init_scan_flag,
$ scan_e0,scan_e1,eqscan_flag,scan_estep
$ scan_e0,scan_e1,eqscan_flag,scan_estep,
$ detgrid_flag,detgrid_nre,detgrid_nim,
$ detgrid_re_min,detgrid_re_max,
$ detgrid_im_min,detgrid_im_max
NAMELIST/rmatch_output/ bin_rpecsol,out_rpecsol
NAMELIST/nyquist_input/nyquist
10 FORMAT(1x,"Eigenvalue=",1p,2e11.3)
Expand Down Expand Up @@ -246,7 +253,12 @@ SUBROUTINE match_run
c-----------------------------------------------------------------------
c scan eigen value (Q) for different inner models.
c-----------------------------------------------------------------------
IF(qscan_flag) CALL match_qscan
IF(qscan_flag) CALL match_qscan
c-----------------------------------------------------------------------
c 2D complex-Q grid scan of the full match_delta determinant
c (patch added for Julia↔Fortran apples-to-apples comparison).
c-----------------------------------------------------------------------
IF(detgrid_flag) CALL match_detgrid
c-----------------------------------------------------------------------
c nyquist plot.
c-----------------------------------------------------------------------
Expand Down Expand Up @@ -475,6 +487,17 @@ FUNCTION match_delta(guess,mat) RESULT(det)
zi_in(ising)=0
q_in(ising)=q_deltac
sol=0
c -- PATCH (Julia/Fortran benchmark) --
c Dump per-surface Δ for each match_delta call so we can compare
c Julia's Galerkin output to Fortran's at the same Q. Writes to
c delta_per_surface.out (appended each call; nuke before a run).
OPEN(UNIT=42, FILE='delta_per_surface.out',
$ POSITION='APPEND')
WRITE(42,'(2e22.14, i5, 4e22.14)')
$ REAL(guess_modify), AIMAG(guess_modify), ising,
$ REAL(deltar(ising,1)), AIMAG(deltar(ising,1)),
$ REAL(deltar(ising,2)), AIMAG(deltar(ising,2))
CLOSE(UNIT=42)
END SELECT
c-----------------------------------------------------------------------
c construct the matching matrix.
Expand Down Expand Up @@ -963,7 +986,52 @@ SUBROUTINE match_qscan
c-----------------------------------------------------------------------
CALL program_stop("Normal termination for q scan.")
END SUBROUTINE match_qscan


c-----------------------------------------------------------------------
c subprogram 7b. match_detgrid.
c scan match_delta on a 2D Q_re × Q_im grid and write an ascii dump
c (detgrid.out, format "qre qim re_det im_det") plus a binary
c (detgrid.bin). Patch added for Julia↔Fortran apples-to-apples
c comparison of the coupled GGJ dispersion relation.
c-----------------------------------------------------------------------
SUBROUTINE match_detgrid
INTEGER :: ire, iim
REAL(r8) :: qre, qim, dre, dim
COMPLEX(r8) :: guess, det
COMPLEX(r8), DIMENSION(4*msing,4*msing) :: mat
10 FORMAT(1p,4e20.11)
WRITE(*,*) "DETGRID: 2D scan of match_delta(Q, mat)"
WRITE(*,'(2x,a,i4,a,i4)') "nre=",detgrid_nre," nim=",detgrid_nim
WRITE(*,'(2x,a,2e12.3)') "Re(Q) range:",
$ detgrid_re_min, detgrid_re_max
WRITE(*,'(2x,a,2e12.3)') "Im(Q) range:",
$ detgrid_im_min, detgrid_im_max
OPEN(UNIT=bin_unit,FILE="detgrid.bin",STATUS="REPLACE",
$ FORM="UNFORMATTED")
CALL ascii_open(out_unit,"detgrid.out","REPLACE")
WRITE(out_unit,'(a)') "# Q_re Q_im Re(det) Im(det)"
WRITE(bin_unit) detgrid_nre, detgrid_nim, msing
dre = (detgrid_re_max - detgrid_re_min) / MAX(1, detgrid_nre - 1)
dim = (detgrid_im_max - detgrid_im_min) / MAX(1, detgrid_nim - 1)
DO iim = 1, detgrid_nim
qim = detgrid_im_min + (iim-1) * dim
DO ire = 1, detgrid_nre
qre = detgrid_re_min + (ire-1) * dre
guess = CMPLX(qre, qim, r8)
det = match_delta(guess, mat)
WRITE(out_unit,10) qre, qim, REAL(det,r8), AIMAG(det)
WRITE(bin_unit) REAL(qre,4), REAL(qim,4),
$ REAL(REAL(det,r8),4), REAL(AIMAG(det),4)
ENDDO
IF (MOD(iim, MAX(1,detgrid_nim/10)) == 0)
$ WRITE(*,'(4x,a,i4,a,i4)') "row ",iim," /",detgrid_nim
ENDDO
CALL ascii_close(out_unit)
WRITE(bin_unit)
CLOSE(UNIT=bin_unit)
WRITE(*,*) "DETGRID: wrote detgrid.out and detgrid.bin"
CALL program_stop("Normal termination for detgrid scan.")
END SUBROUTINE match_detgrid
c-----------------------------------------------------------------------
c subprogram 8. match_delta_jardin.
c finite differential method of GGJ.
Expand Down
Loading