Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge THRIFT_DKES_PENTA into develop #304

Merged
merged 52 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
becdad2
PENTA: Added wrapper main function so PENTA can be called like a subr…
lazersos Aug 22, 2024
8fbfe43
DKES: Added missing vimatrix dependency file.
lazersos Aug 22, 2024
31a03cf
THRIFT: Added interface to DKES (for testing).
lazersos Aug 22, 2024
fcd45a1
PENTA: Make possible to read namelist from input.ext file.
lazersos Aug 24, 2024
3f2aff7
THRIFT: Now links to PENTA sources
lazersos Aug 24, 2024
96ef208
PENTA: Fixed call to vmec_2 routine.
lazersos Aug 26, 2024
e7aca02
PENTA: Added routine to set profiles via subroutine call.
lazersos Aug 26, 2024
7cd76c8
PENTA: Added routine to set LMNIJ coefficients.
lazersos Aug 28, 2024
9a39744
PENTA: Cleanup of routine a bit.
lazersos Aug 28, 2024
0c45d24
PENTA: Changed name for VMEC reading routine.
lazersos Aug 28, 2024
a4cb861
PENTA: Changed VMEC reading routine name and added Utilde2 setting ro…
lazersos Aug 28, 2024
308d4ac
PENTA: Fixed bug
lazersos Aug 28, 2024
536471c
PENTA: Added PENTA input module.
lazersos Sep 2, 2024
c2fd6a8
Merge in of develop
lazersos Oct 9, 2024
dbda463
Merge branch 'develop' into feature/THRIFT_DKES_PENTA
lazersos Oct 16, 2024
9b7a5fb
LIBSTELL: Added thrift_globals.f90 for future python interfacing.
lazersos Oct 16, 2024
81901ab
LIBSTELL: Added thrift_input_mod.f90 to LIBSTELL
lazersos Oct 16, 2024
41ff46d
THRIFT: Cleanup after creating thrift_globals.f90 in LIBSTELL
lazersos Oct 16, 2024
1871667
THRIFT: Added cleanup routines from STELLOPT.
lazersos Oct 16, 2024
2bc3ba6
PENTA: Added interface module to simplify interfacing to other codes.
lazersos Oct 17, 2024
9b8e4c5
PENTA: Change unit numbers from parameters to variables.
lazersos Oct 17, 2024
cd12712
PENTA: Subroutine interface checked.
lazersos Oct 17, 2024
d94e7be
PENTA: Added subroutines for outputting namelists.
lazersos Oct 17, 2024
61a523d
PENTA: Removed extra files.
lazersos Oct 17, 2024
1e750f7
THIFT: Added prototype of call to PENTA.
lazersos Oct 17, 2024
515faed
PENTA: Added unique output file names possible.
lazersos Oct 17, 2024
0f10b84
THRIFT: PENTA interface uses unique output file names.
lazersos Oct 17, 2024
94330d2
PENTA: Added wrapper routines for ion namelist, command line, and vme…
lazersos Oct 18, 2024
b559f28
Merge branch 'develop' into feature/THRIFT_DKES_PENTA
lazersos Oct 18, 2024
6608bc5
PENTA: Added the missing interfaces to avoid using files.
lazersos Oct 18, 2024
5636ea4
PENTA: Fixed a variable name to reflect dVds value not Volume.
lazersos Oct 18, 2024
b42c44d
THRIFT: Added buco, bvco, and bsq splines to support PENTA integration.
lazersos Oct 18, 2024
9ba34b7
THRIFT: PENTA interface updated.
lazersos Oct 18, 2024
ba14122
PENTA: Fixed type of Smax in interface routine.
lazersos Oct 18, 2024
32d1db3
THRIFT: Added VMEC ns helper
lazersos Oct 18, 2024
15c86ac
THRIFT: Made AMU available through the profiles module.
lazersos Oct 18, 2024
8ceb5ce
THRIFT: PENTA added, missing DXX coefficient handling.
lazersos Oct 18, 2024
abfab33
DKES: Added some helper vars for THRIFT.
lazersos Oct 18, 2024
1ea2341
THRIFT: DKES and PENTA now integrated.
lazersos Oct 18, 2024
311aa7f
Merge in of develop w/ THRIFT mods.
lazersos Oct 28, 2024
e21c9e1
Merge in of develop
lazersos Oct 30, 2024
1ac11b6
THRIFT: allow possibility of ntimesteps=1 (which corresponds to dt=0)
ajchcoelho Nov 13, 2024
61826a5
THRIFT: add comment when running Bootstrap
ajchcoelho Nov 13, 2024
26aee6b
THRIFT: printing of vprime was not being done correctly; not it is
ajchcoelho Nov 13, 2024
ea70e71
DKES: remove prints
ajchcoelho Nov 13, 2024
09baaa6
THRIFT: fix integration of DKES+PENTA in THRIFT
ajchcoelho Nov 13, 2024
a28e4ef
THRIFT: print to screen
ajchcoelho Nov 13, 2024
d7e6f6c
pySTEL: fix bug in plasma class
ajchcoelho Nov 13, 2024
b6a4702
THRIFT: Er_min and Er_max now read from input namelist
ajchcoelho Nov 13, 2024
cef7043
THRIFT: Close PENTA files in interface
ajchcoelho Nov 13, 2024
f65ce10
PENTA: comment lscreen
ajchcoelho Nov 13, 2024
e81300a
THRIFT: Improve prints to command line
ajchcoelho Nov 14, 2024
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
5 changes: 4 additions & 1 deletion DKES/DKES.dep
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ residue_dkes.o : \

vcmain.o : \
../../LIBSTELL/$(LOCTYPE)/stel_kinds.o


vimatrix.o :


vnamecl2.o : \
Expand All @@ -88,7 +91,7 @@ wrout.o : \
dkes_input.o \
dkes_realspace.o \
vnamecl2.o


dkes_input_prepare.o : \
../../LIBSTELL/$(LOCTYPE)/date_and_computer.o \
Expand Down
1 change: 1 addition & 0 deletions DKES/Sources/General/dkes_realspace.f
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ MODULE dkes_realspace
1 DKES_L11p, DKES_L33p, DKES_L31p,
2 DKES_L11m, DKES_L33m, DKES_L31m,
3 DKES_scal11, DKES_scal33, DKES_scal31
INTEGER :: DKES_NK, DKES_NC, DKES_NE

CONTAINS

Expand Down
2 changes: 0 additions & 2 deletions DKES/Sources/General/printout.f
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ SUBROUTINE dkes_printout(fz1p, fz1m, fz3p, fz3m, srces)
c in the main DKES routine, only the STELLOPT routine changes this
c and allocates these arrays
IF (ALLOCATED(DKES_L11p) .and. (DKES_rad_dex > 0)) THEN
! PRINT *,'got here0'
DKES_L11p(DKES_rad_dex) = L11p
DKES_L33p(DKES_rad_dex) = L33p
DKES_L31p(DKES_rad_dex) = L31p
Expand All @@ -155,7 +154,6 @@ SUBROUTINE dkes_printout(fz1p, fz1m, fz3p, fz3m, srces)
DKES_scal11(DKES_rad_dex) = scal11
DKES_scal33(DKES_rad_dex) = scal33
DKES_scal31(DKES_rad_dex) = scal13
! PRINT *,'got here1'
END IF

c output results summary
Expand Down
8 changes: 8 additions & 0 deletions LIBSTELL/LIBSTELL.dep
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ beams3d_input_mod.o: \
beams3d_globals.o : \
stel_kinds.o

thrift_globals.o : \
stel_kinds.o

thrift_input_mod.o: \
stel_kinds.o \
safe_open_mod.o \
thrift_globals.o

diagno_runtime.o : \
ezspline.o \
stel_kinds.o
Expand Down
2 changes: 2 additions & 0 deletions LIBSTELL/ObjectList
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ObjectFiles = \
thrift_input_mod.o \
thrift_globals.o \
read_nescoil_mod.o \
stellopt_targets.o \
stellopt_vars.o \
Expand Down
76 changes: 76 additions & 0 deletions LIBSTELL/Sources/Modules/thrift_globals.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
!-----------------------------------------------------------------------
! Module: thrift_globals
! Authors: S. Lazerson ([email protected])
! Date: 10/16/2024
! Description: This module contains the THRIFT global variables
! needed by the input namelist.
!-----------------------------------------------------------------------
MODULE thrift_globals
!-----------------------------------------------------------------------
! Libraries
!-----------------------------------------------------------------------
USE stel_kinds, ONLY: rprec

!-----------------------------------------------------------------------
! Module Variables
!-----------------------------------------------------------------------
IMPLICIT NONE

! Moved from thrift_vars
LOGICAL :: lverbj, leccd, lnbcd, lohmic
INTEGER :: nrho, ntimesteps, n_eq, npicard, nsj
REAL(rprec) :: tstart, tend, jtol, picard_factor, boot_factor

! Moved from thrift_vars (For ECCD in general)
INTEGER, PARAMETER :: ntime_ecrh = 200
REAL(rprec), DIMENSION(ntime_ecrh) :: PECRH_AUX_T, PECRH_AUX_F
REAL(rprec) :: ecrh_rc, ecrh_w

! Moved from thrift_vars (for TRAVIS)
INTEGER, PARAMETER :: nsys = 16
INTEGER :: nra_ecrh, nphi_ecrh
INTEGER, DIMENSION(nsys) :: wmode_ecrh
REAL(rprec), DIMENSION(nsys) :: freq_ecrh, power_ecrh
REAL(rprec), DIMENSION(nsys,3) :: antennaposition_ecrh, &
targetposition_ecrh, rbeam_ecrh, rfocus_ecrh

! Moved from thrift_vars (For DKES)
INTEGER, PARAMETER :: DKES_NS_MAX = 64
INTEGER, PARAMETER :: DKES_NSTAR_MAX = 32
INTEGER :: nruns_dkes
INTEGER, DIMENSION(:), POINTER :: DKES_rundex
INTEGER, DIMENSION(DKES_NS_MAX) :: DKES_K
REAL(rprec), DIMENSION(DKES_NSTAR_MAX) :: DKES_Erstar, DKES_Nustar

! Moved from thrift_runtime
INTEGER :: nparallel_runs, mboz, nboz
CHARACTER(256) :: bootstrap_type, eccd_type, vessel_ecrh, &
mirror_ecrh, targettype_ecrh, antennatype_ecrh, &
etapar_type



CONTAINS

! These expose the global variables through ctypes
INTEGER FUNCTION getmaxtimeecrh()
IMPLICIT NONE
getmaxtimeecrh = ntime_ecrh
END FUNCTION getmaxtimeecrh

INTEGER FUNCTION getmaxsys()
IMPLICIT NONE
getmaxsys = nsys
END FUNCTION getmaxsys

INTEGER FUNCTION getmaxns()
IMPLICIT NONE
getmaxns = DKES_NS_MAX
END FUNCTION getmaxns

INTEGER FUNCTION getmaxnstar()
IMPLICIT NONE
getmaxnstar =DKES_NSTAR_MAX
END FUNCTION getmaxnstar

END MODULE thrift_globals
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ MODULE thrift_input_mod
! Libraries
!-----------------------------------------------------------------------
USE stel_kinds, ONLY: rprec
USE thrift_vars
USE thrift_runtime
USE thrift_globals
USE safe_open_mod

!-----------------------------------------------------------------------
Expand All @@ -36,6 +35,7 @@ MODULE thrift_input_mod
rfocus_ecrh, nra_ecrh, nphi_ecrh, &
freq_ecrh, power_ecrh, &
pecrh_aux_t, pecrh_aux_f, ecrh_rc, ecrh_w, &
dkes_k, dkes_Erstar, dkes_Nustar, &
etapar_type

!-----------------------------------------------------------------------
Expand Down Expand Up @@ -86,6 +86,10 @@ SUBROUTINE init_thrift_input
rfocus_ecrh = 0
nra_ecrh = 0
nphi_ecrh = 8
! DKES Vars
dkes_k = -1
dkes_Erstar = 1E10
dkes_Nustar = 1E10
RETURN
END SUBROUTINE init_thrift_input

Expand All @@ -104,21 +108,29 @@ SUBROUTINE read_thrift_input(filename, istat)
INQUIRE(FILE=TRIM(filename),EXIST=lexist)
IF (.not.lexist) stop 'Could not find input file'
CALL safe_open(iunit,istat,TRIM(filename),'old','formatted')
IF (istat /= 0) CALL handle_err(NAMELIST_READ_ERR,'thrift_input in: '//TRIM(filename),istat)
IF (istat /= 0) THEN
WRITE(6,'(A)') 'ERROR opening file: ',TRIM(filename)
CALL FLUSH(6)
STOP
END IF
READ(iunit,NML=thrift_input,IOSTAT=istat)
IF (istat /= 0) THEN
WRITE(6,'(A)') 'ERROR reading namelist THRIFT_INPUT from file: ',TRIM(filename)
backspace(iunit)
read(iunit,fmt='(A)') line
write(6,'(A)') 'Invalid line in namelist: '//TRIM(line)
CALL handle_err(NAMELIST_READ_ERR,'thrift_input in: '//TRIM(filename),istat)
CALL FLUSH(6)
STOP
END IF
CLOSE(iunit)
END IF

CALL tolower(bootstrap_type)
CALL tolower(etapar_type)
CALL tolower(eccd_type)
leccd = eccd_type .ne. ''
nsj = nrho;
nsj = nrho
nruns_dkes = COUNT(dkes_k>0)*COUNT(dkes_Erstar<1E10)*COUNT(dkes_Nustar<1E10)
RETURN
END SUBROUTINE read_thrift_input

Expand Down Expand Up @@ -154,6 +166,7 @@ SUBROUTINE write_thrift_namelist(iunit_out, istat)
WRITE(iunit_out,outint) 'MBOZ',nboz
WRITE(iunit_out,'(A)') '!---------- ECCD PARAMETERS ------------'
WRITE(iunit_out,outstr) 'ECCD_TYPE',eccd_type
WRITE(iunit_out,'(A)') '!---------- DKES PARAMETERS ------------'
WRITE(iunit_out,'(A)') '/'
RETURN
END SUBROUTINE write_thrift_namelist
Expand Down
1 change: 1 addition & 0 deletions PENTA/ObjectList
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ObjectFiles = \
penta_interface_mod.o \
bspline.o \
coeff_var_pass.o \
io_unit_spec.o \
Expand Down
15 changes: 15 additions & 0 deletions PENTA/PENTA.dep
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Microsoft Developer Studio Generated Dependency File, included by DKES.mak
penta_main.o : \
penta_modules.o


bspline.o :

Expand All @@ -17,6 +20,18 @@ penta.o : \
penta_math_routines_mod.o \
penta_subroutines.o

penta_interface_mod.o : \
penta_kind_mod.o \
io_unit_spec.o \
read_input_file_mod.o \
vmec_var_pass.o \
pprof_pass.o \
coeff_var_pass.o \
phys_const.o \
penta_functions_mod.o \
penta_math_routines_mod.o \
penta_subroutines.o

penta_functions_mod.o : \
penta_kind_mod.o \
phys_const.o \
Expand Down
2 changes: 1 addition & 1 deletion PENTA/Sources/io_unit_spec.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Module io_unit_spec

Implicit none

Integer, parameter :: &
Integer :: &
iu_nl=21, & ! Ion parameter namelist file (input)
iu_vmec=22, & ! VMEC data file (input)
iu_pprof=23, & ! Plasma profile file (input)
Expand Down
Loading