VMEC
8.52
3D Equilibrium solver with nested flux surfaces.
Toggle main menu visibility
Loading...
Searching...
No Matches
restart_iter.f90
Go to the documentation of this file.
1
!> \file
2
!> \brief Save current or restore previous good state vector and reduce time step.
3
4
!> \brief Save current or restore previous good state vector and reduce time step.
5
!>
6
!> @param time_step time step to be modified if convergence is bad
7
SUBROUTINE
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
56
END SUBROUTINE
restart_iter
vmec_main
Definition
vmec_main.f90:2
vmec_main::iter1
integer iter1
number of iterations at which the currently active evolution was branched off from
Definition
vmec_main.f90:160
vmec_main::neqs
integer neqs
total number of equations to evolve (size of xc)
Definition
vmec_main.f90:156
vmec_main::first
integer first
"counter" monitoring sign of jacobian; resets R, Z, and Lambda when jacobian changes sign and decreas...
Definition
vmec_main.f90:152
vmec_main::ijacob
integer ijacob
counter for number of times jacobian changes sign
Definition
vmec_main.f90:159
vmec_main::iter2
integer iter2
total number of iterations
Definition
vmec_main.f90:161
xstuff
Definition
xstuff.f90:2
xstuff::xc
real(rprec), dimension(:), allocatable, target xc
stacked array of scaled R, Z, Lambda Fourier coefficients (see above for stack order)
Definition
xstuff.f90:40
xstuff::xcdot
real(rprec), dimension(:), allocatable xcdot
"velocity": change of Fourier coefficients per time step
Definition
xstuff.f90:43
xstuff::xstore
real(rprec), dimension(:), allocatable xstore
backup copy of last-known-good xc
Definition
xstuff.f90:48
restart_iter
subroutine restart_iter(time_step)
Save current or restore previous good state vector and reduce time step.
Definition
restart_iter.f90:8
src
restart_iter.f90
Generated on
for VMEC by
1.17.0