28 CHARACTER(LEN=*),
PARAMETER :: bad_jacobian =
"The jacobian was non-definite!"
29 CHARACTER(LEN=*),
PARAMETER :: Warning =
"Error deallocating global memory!"
31 CHARACTER(LEN=120),
DIMENSION(10) :: command_arg
32 CHARACTER(LEN=120) :: arg
33 CHARACTER(LEN=120) :: input_file
52 CALL getarg(iseq, command_arg(iseq))
55 IF (numargs .lt. 1)
THEN
56 stop
'Invalid command line'
57 ELSE IF (command_arg(1).eq.
'-h' .or. command_arg(1).eq.
'/h')
THEN
59 print *,
' ENTER INPUT FILE NAME OR INPUT-FILE SUFFIX ON COMMAND LINE'
61 print *,
' For example: '
62 print *,
' xvmec input.tftr OR xvmec tftr OR xvmec ../input.tftr'
69 index_dat = index(arg,
'.')
70 index_end = len_trim(arg)
71 IF (index_dat .gt. 0)
THEN
74 input_file = trim(arg)
94 CALL readin (input_file, ier_flag)
96 IF (ier_flag .eq. 0)
then
10630
FORMAT(
' FSQR, FSQZ = Normalized Physical Force Residuals',/, &
107 ' fsqr, fsqz = Preconditioned Force Residuals',/,1x,23(
'-'),/,&
108 ' BEGIN FORCE ITERATIONS',/,1x,23(
'-'),/)
118 IF (
lfreeb .and. jacob_off.eq.1)
then
133 IF (igrid .lt. 1)
THEN
148 IF (nsval .lt. ns_min)
then
160 IF (ns_old .le. nsval)
then
180 call add_int(
"ns", nsval)
181 call add_int(
"iter2",
iter2)
182 call add_int(
"ncurr",
ncurr)
183 call add_real(
"phiedge",
phiedge)
184 call add_int(
"ntmax",
ntmax)
186 call add_real_1d(
"pres", ns-1,
pres(2:ns))
187 call add_real_1d(
"iotas", ns-1,
iotas(2:ns))
188 call add_real_1d(
"chips", ns-1,
chips(2:ns))
190 call add_real_5d(
"xc", 3,
ntmax, ns, ntor1,
mpol,
xc, order=(/ 3, 4, 5, 2, 1 /) )
191 call add_real_5d(
"scalxc", 3,
ntmax, ns, ntor1,
mpol,
scalxc, order=(/ 3, 4, 5, 2, 1 /) )
223 IF (
ALLOCATED(cosmu))
then
224 DEALLOCATE(cosmu, sinmu, cosmum, sinmum, cosmui, cosmumi, &
225 sinmui, sinmumi, cosnv, sinnv, cosnvn, sinnvn, &
226 cosmui3, cosmumi3, cos01, sin01, stat=istat1)
227 IF (istat1 .ne. 0) print *, warning //
"#1"
230 IF (
ALLOCATED(xm))
then
231 DEALLOCATE (xm, xn, ixm, xm_nyq, xn_nyq, &
233 IF (istat1 .ne. 0) print *, warning //
"#2"
243 IF (istat1.ne.0)
THEN
244 print *,
'problem in free_mgrid'
245 print *,
' istat1 = ',istat1
249 SELECT CASE (ier_flag)
252 WRITE ( 6,
'(/,1x,a)') bad_jacobian
253 WRITE (
nthreed,
'(/,1x,a)') bad_jacobian
subroutine eqsolve(ier_flag)
Iteratively evolve the Fourier coefficients that specify the equilibrium.
subroutine fileout(ier_flag)
Write the output files.
subroutine fixaray
allocate and fill some fixed-size arrays (only depending on Fourier resolution).
subroutine free_mem_funct3d
Free memory required by funct3d()
subroutine free_mem_ns
Free memory depending on the number of flux surfaces ns.
subroutine free_mem_nunv
Free arrays depending on the number of Fourier coefficients nunv.
subroutine initialize_radial(nsval, ns_old, delt0)
Allocates memory for radial arrays and initializes radial profiles.
logical function open_dbg_context(context_name, repetition, id)
check if any output is desired for the current iteration check if the given context should be openend...
subroutine free_mgrid(istat)
fault-tolerant file opening routines
real(rprec), dimension(:), allocatable chips
poloidal flux (same as chip), one-dimensional array
integer iequi
counter used to call -EQFOR- at end of run
integer ivac
counts number of free-boundary iterations
real(rprec), dimension(:), allocatable pres
pressure profile
integer niterv
max iterations for current multi-grid iteration
integer num_eqsolve_retries
integer iter2
total number of iterations
real(rprec), dimension(:), allocatable iotas
rotational transform , on half radial mesh
integer, parameter bad_jacobian_flag
real(rprec), dimension(:), allocatable mscale
array for norming theta-trig functions (internal use only) so that the discrete SUM[cos(mu)*cos(m'u)]...
integer, dimension(:), allocatable uminus
integer, parameter successful_term_flag
real(rprec), dimension(:), allocatable nscale
array for norming zeta -trig functions (internal use only)
integer ntmax
number of contributing Fourier basis function (can be 1, 2 or 4); assigned in read_indata()
integer, parameter norm_term_flag
real(rprec), dimension(:), allocatable, target xc
stacked array of scaled R, Z, Lambda Fourier coefficients (see above for stack order)
real(rprec), dimension(:), allocatable scalxc
subroutine readin(input_file, ier_flag)
Read the input file.
subroutine reset_params
Reset some flow-control parameters to their default values.
subroutine vmec
Main driver for VMEC.
program xvmec
Main program of VMEC.