V3FIT
init_modular_currents.f
1  SUBROUTINE init_modular_currents (nvariables, xvariables)
2 !-----------------------------------------------
3 ! M o d u l e s
4 !-----------------------------------------------
5  USE modular_coils
6  IMPLICIT NONE
7 !-----------------------------------------------
8 ! L o c a l V a r i a b l e s
9 !-----------------------------------------------
10  INTEGER :: nc, i, n
11  INTEGER :: nvariables
12  REAL(rprec) :: xvariables(*)
13 !-----------------------------------------------
14 
15  nvariables = 0
16  nmod_currents = 0
17  nc = nmod_coils_per_period
18 
19  IF (.not.lmodcur .or. nc.le.0) RETURN
20 
21 
22 ! Initialize the variables to values of coil currents
23 ! and count the number of variables
24 
25  n = 0
26  DO i = 1, nmid
27  n = n + 1
28  xvariables(n) = curmod(i)
29  END DO
30 
31  nmod_currents = n
32  nvariables = n
33 
34  END SUBROUTINE init_modular_currents