VMEC 8.52
3D Equilibrium solver with nested flux surfaces.
Loading...
Searching...
No Matches
restart_iter.f90
Go to the documentation of this file.
1
3
7SUBROUTINE restart_iter(time_step)
8
9 USE vmec_main
10 USE xstuff
11
12 IMPLICIT NONE
13
14 REAL(rprec), intent(inout) :: time_step
15
16 REAL(rprec), PARAMETER :: c1p03 = 1.03_dp
17 REAL(rprec), PARAMETER :: cp90 = 0.90_dp
18
19! if (first .ne. 1) then
20! print *, "bad jacobian --> restart_iter (first = ", first, ")"
21! end if
22
23 SELECT CASE (first)
24 case(2)
25 ! restore previous good state
26 xcdot(:neqs) = zero
27 xc(:neqs) = xstore(:neqs)
28
29 ! ---- reduce time step ----
30 time_step = time_step * cp90
31
32 ijacob = ijacob + 1
33 iter1 = iter2
34
35 first = 1
36
37 RETURN
38 CASE (3)
39
40 ! restore previous good state
41 xcdot(:neqs) = zero
42 xc(:neqs) = xstore(:neqs)
43
44 ! ---- reduce time step ----
45 time_step = time_step / c1p03
46
47 first = 1
48
49 RETURN
50 CASE DEFAULT ! 1, 4
51 ! save current state vector, e.g. first=1
52 xstore(:neqs) = xc(:neqs)
53 RETURN
54 END SELECT
55
56END SUBROUTINE restart_iter
integer iter1
number of iterations at which the currently active evolution was branched off from
integer neqs
total number of equations to evolve (size of xc)
integer first
"counter" monitoring sign of jacobian; resets R, Z, and Lambda when jacobian changes sign and decreas...
integer ijacob
counter for number of times jacobian changes sign
integer iter2
total number of iterations
real(rprec), dimension(:), allocatable, target xc
stacked array of scaled R, Z, Lambda Fourier coefficients (see above for stack order)
Definition xstuff.f90:40
real(rprec), dimension(:), allocatable xcdot
"velocity": change of Fourier coefficients per time step
Definition xstuff.f90:43
real(rprec), dimension(:), allocatable xstore
backup copy of last-known-good xc
Definition xstuff.f90:48
subroutine restart_iter(time_step)
Save current or restore previous good state vector and reduce time step.