VMEC
8.52
3D Equilibrium solver with nested flux surfaces.
Loading...
Searching...
No Matches
flip_theta.f90
Go to the documentation of this file.
1
module
theta_flip
2
implicit none
3
4
! Subroutines with optional arguments need to be put into a separate module
5
! to get the detection of arguments to work correctly.
6
! See also: https://stackoverflow.com/a/3122736
7
contains
8
11
17
SUBROUTINE
flip_theta
(rmn, zmn, lmn)
18
USE
vmec_main
19
USE
vmec_params
,
ONLY
:
ntmax
,
rcc
,
rss
,
zsc
,
zcs
,
zcc
,
zss
,
rsc
,
rcs
20
implicit none
21
22
REAL
(rprec),
DIMENSION(0:ntor,0:mpol1,ntmax)
,
INTENT(inout)
:: rmn, zmn
23
REAL
(rprec),
DIMENSION(0:ntor,0:mpol1,ntmax)
,
INTENT(inout)
,
OPTIONAL
:: lmn
24
25
INTEGER
:: n, m
26
REAL
(rprec) :: mul1
27
LOGICAL
:: l_lmn
28
29
! FLIP THETA -> PI - THETA (INITIALLY, TO MAKE JACOBIAN < 0)
30
mul1=-1.0_dp
31
32
! logical flag to indicate that lambda coeffs shall be flipped as well
33
l_lmn =
PRESENT
(lmn)
34
35
DO
m=1,mpol1
36
37
! here, mul1 == (-1)**mod(m, 2)
38
! --> m even: mul1 == +1
39
! --> m odd: mul1 == -1
40
41
DO
n=0,ntor
42
43
rmn(n,m,
rcc
) = mul1*rmn(n,m,
rcc
)
44
zmn(n,m,
zsc
) =-mul1*zmn(n,m,
zsc
)
45
IF
(l_lmn) lmn(n,m,
zsc
) =-mul1*lmn(n,m,
zsc
)
46
47
IF
(
lthreed
)
THEN
48
rmn(n,m,
rss
) =-mul1*rmn(n,m,
rss
)
49
zmn(n,m,
zcs
) = mul1*zmn(n,m,
zcs
)
50
IF
(l_lmn) lmn(n,m,
zcs
) = mul1*lmn(n,m,
zcs
)
51
END IF
52
53
IF
(lasym)
THEN
54
55
rmn(n,m,
rsc
) =-mul1*rmn(n,m,
rsc
)
56
zmn(n,m,
zcc
) = mul1*zmn(n,m,
zcc
)
57
IF
(l_lmn) lmn(n,m,
zcc
) = mul1*lmn(n,m,
zcc
)
58
59
IF
(
lthreed
)
THEN
60
rmn(n,m,
rcs
) = mul1*rmn(n,m,
rcs
)
61
zmn(n,m,
zss
) =-mul1*zmn(n,m,
zss
)
62
IF
(l_lmn) lmn(n,m,
zss
) =-mul1*lmn(n,m,
zss
)
63
END IF
64
65
END IF
66
END DO
67
68
! flip mul1
69
mul1 = -mul1
70
71
END DO
72
73
END SUBROUTINE
flip_theta
74
75
end module
theta_flip
theta_flip
Definition
flip_theta.f90:1
theta_flip::flip_theta
subroutine flip_theta(rmn, zmn, lmn)
Flip the definition of the poloidal angle in the user-provided initial guess for the LCFS geometry.
Definition
flip_theta.f90:18
vmec_main
Definition
vmec_main.f90:2
vmec_main::lthreed
logical lthreed
Definition
vmec_main.f90:142
vmec_params
Definition
vmec_params.f90:2
vmec_params::rcs
integer rcs
Definition
vmec_params.f90:48
vmec_params::zcc
integer zcc
Definition
vmec_params.f90:51
vmec_params::zss
integer zss
Definition
vmec_params.f90:52
vmec_params::zsc
integer zsc
Definition
vmec_params.f90:49
vmec_params::rss
integer rss
Definition
vmec_params.f90:46
vmec_params::zcs
integer zcs
Definition
vmec_params.f90:50
vmec_params::ntmax
integer ntmax
number of contributing Fourier basis function (can be 1, 2 or 4); assigned in read_indata()
Definition
vmec_params.f90:43
vmec_params::rcc
integer rcc
Definition
vmec_params.f90:45
vmec_params::rsc
integer rsc
Definition
vmec_params.f90:47
src
flip_theta.f90
Generated on Tue Aug 13 2024 16:02:51 for VMEC by
1.12.0