V3FIT
gmres.f90
Go to the documentation of this file.
1 
5  MODULE gmres
6  USE v3_utilities, ONLY: assert
7  USE stel_kinds
8  USE stel_constants, ONLY: zero, one
9  USE descriptor_mod, ONLY: siesta_comm, iam, nprocs
10  USE shared_data, etak=>etak_tol
11  USE shared_functions, ONLY: funct_island, linesearch
12  USE siesta_state, ONLY: update_state, update_state
13  USE nscalingtools, ONLY: parfunctisl, mpi_err, startglobrow, &
14  endglobrow, parsolver
15  USE timer_mod
16  USE mpi_inc
17 
18  IMPLICIT NONE
19 
20  CONTAINS
21 
24  SUBROUTINE gmres_fun
25  USE hessian, ONLY: levmarq_param, dmin=>mindiag, apply_precond, &
26  levmarq_param0, l_diagonal_only, gather_array, &
27  mupar
28  USE siesta_namelist, ONLY: lresistive, ftol
29  USE blocktridiagonalsolver_s, ONLY: refactorhessian
30 
31 !-----------------------------------------------
32 ! L o c a l V a r i a b l e s
33 !-----------------------------------------------
34  INTEGER :: j, iter, istat
35  REAL(dp), PARAMETER :: levscan(1) = (/16._dp/) !!007C
36 ! REAL(dp), PARAMETER :: levscan(2) = (/4._dp, 16._dp/) !!007B
37  REAL(dp) :: wmhd, fmhd, skston, skstoff, eps, lm0, fsq_min, &
38  xmax_lin, mupars, scale_fac
39  REAL(dp), ALLOCATABLE :: xc1(:), xcmin(:), brhs(:)
40  LOGICAL :: bTerm
41 !-----------------------------------------------
42 
43 ! SPH: ONLY works with 0 restart each time
44 ! EXTERNALLY, l_init_state = .TRUE.
45 
46  xc = 0
47  l_linearize = .false.
48  l_applyprecon = .false. !LET GMRES APPLY PRECONDITIONER ITSELF
49  mupars = mupar
50 
51 !
52 ! STORE INITIAL UNPRECONDITIONED RESIDUE (BRHS=-GC AT INIT PT)
53 ! SO DEVIATIONS FROM THEM CAN BE COMPUTED REPEATEDLY
54 !
55  l_getfsq =.true.
56  l_init_state=.true.
57  fmhd=fsq_total1 !!initial fsq BEFORE application of resistive diffusion
58 
59  ALLOCATE (brhs(neqs), stat=istat)
60  CALL assert(istat.eq.0,'ALLOCATION ERROR IN GMRES_FUN')
61  l_getwmhd=.true.
62 
63 
64  CALL second0(skston)
65  CALL funct_island
66  brhs = -gc
67  IF (parfunctisl) THEN
68  CALL gather_array(brhs)
69  END IF
70  l_getwmhd=.false.
71  CALL second0(skstoff)
72  gmres_funct_island_time=gmres_funct_island_time+(skstoff-skston)
73 
74  wmhd = wtotal
75  fsq_min = fsq_total1
76 
77 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FAST CONVERGENCE - SPH 083016 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
78  ALLOCATE(xc1(neqs), xcmin(neqs), stat=istat)
79  CALL assert(istat.eq.0,'Allocation error in GMRES')
80  xcmin = 0
81 
82  iter = 0
83  lm0 = levmarq_param
84  scale_fac = 1
85 
86 920 CONTINUE
87 !
88 ! FAST CONVERGENCE GUESS
89 ! ITERATIVELY SOLVE (A* - eps*I) x = b, WHERE A* = A + eps*I
90 ! eps = lev_marq_param*Dmin
91 ! THEN x = x0 + x1 + ...,
92 ! x0 = P*b where P* = (A*)^-1
93 ! xn = eps*P*(x[n-1])
94 !
95  lfast: IF (.NOT.l_diagonal_only .AND. lcolscale) THEN
96 
97  IF (iam.EQ.0 .AND. lverbose) print 925, dmin
98 925 FORMAT(' DMIN: ',1pe12.3,/,1x,'FAST CONVERGENCE SUMMARY', &
99  /,' -------------',/,1x,'ITER',7x,'FSQ_NL', &
100  10x,'||X||',9x,'MAX|X|')
101  CALL assert(all(xc.EQ.zero),' XC != 0')
102  l_getfsq=.true.
103  l_linearize = .false.
104  CALL funct_island
105  xc = -gc
106  eps = abs(levmarq_param)*dmin
107  IF (.not.l_applyprecon) THEN
108  CALL apply_precond(xc)
109  END IF
110  xc1 = xc
111  DO j = 1, 10
112  IF (j .GT. 1) THEN
113  IF (eps .EQ. zero) GOTO 927
114  gc = xc1
115  CALL apply_precond(gc)
116  xc1 = eps*gc !nth partial sum: store for next j iteration
117  xc = xc + xc1
118  END IF
119  CALL funct_island
120 
121  IF (fsq_total1 .GT. fsq_min) THEN
122  bterm = (j .GT. 1)
123  ELSE
124  xcmin = xc
125  bterm = (fsq_total1 .GE. 0.95_dp*fsq_min)
126  fsq_min = fsq_total1
127  END IF
128  IF (iam.EQ.0 .AND. lverbose) print 912, j, fsq_total1, &
129  sqrt(sum(xc*xc)), maxval(abs(xc))
130  IF (fsq_min.LE.ftol .OR. bterm .OR. eps.EQ.zero) EXIT
131  END DO
132 
133 ! ELSE IF (l_backslv) THEN
134 ! IF (.NOT.l_ApplyPrecon) CALL Apply_Precond(gc)
135  ENDIF lfast
136 
137  927 CONTINUE
138 
139  lgmres: IF (fsq_min.GT.ftol .AND. fsq_min.GT.fmhd/10) THEN
140 
141 !!!START GMRES CONVERGENCE
142 !
143 ! THIS IS STANDARD GMRES CALL
144 !
145  CALL second0(skston)
146  xc = xcmin
147  CALL gmres_wrap (xc, brhs)
148  CALL second0(skstoff)
149  gmres_wrap_time=gmres_wrap_time+(skstoff-skston)
150 
151  IF (fsq_total1.LT.fsq_min .OR. all(xcmin.EQ.zero)) THEN
152  xcmin = xc
153  fsq_min = fsq_total1
154  IF (lm0 .GT. zero) scale_fac = levmarq_param/lm0
155  END IF
156 !!!END GMRES CONVERGENCE
157 !FOR NOW, THIS IS ONLY IMPLEMENTED FOR PARSOLVER=TRUE: MUST IMPLEMENT
158 !RefactorHessian FOR LSCALAPACK=T
159  IF (.false.) THEN
160 ! IF (.NOT.l_Diagonal_Only .AND. PARSOLVER) THEN
161  IF (fsq_min.GE.0.95_dp*fmhd .AND. iter.LT.SIZE(levscan)) THEN
162  iter = iter+1
163  levmarq_param = lm0*levscan(iter)
164  IF (levmarq_param .LT. levm_ped) levmarq_param = 100*levm_ped
165  IF (levmarq_param .GE. levmarq_param0) levmarq_param = levmarq_param0/10._dp**iter
166  IF (iam.EQ.0 .AND. lverbose) print 930,' Refactoring Hessian: LM = ',levmarq_param
167  CALL refactorhessian(levmarq_param)
168  GOTO 920
169  END IF
170  END IF
171  END IF lgmres
172 
173  912 FORMAT(i5,3(3x,1pe12.3))
174  930 FORMAT (/,a,1pe12.3)
175 
176 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
177 
178  DEALLOCATE(xc1)
179  l_getfsq = .true.
180 
181  1100 CONTINUE
182 
183  xmax_lin = maxval(abs(xcmin))
184  IF (iam .EQ. 0) THEN
185 ! PRINT 1020,' ||X||-GMRES = ', SQRT(SUM(xcmin*xcmin)), ' MAX(|X|) = ',xmax_lin
186  WRITE (unit_out, 1020) ' ||X||-GMRES = ', sqrt(sum(xcmin*xcmin)), ' MAX(|X|) = ',xmax_lin
187  END IF
188  1020 FORMAT(2(a,1p,e11.3))
189 
191  l_linearize = .false.
192 
193 !UPDATE EVOLUTION FIRST
194  IF (fsq_min .GT. ftol) THEN
195 
196 ! TURN OFF NEXT 2 LINES FOR TESTING f1=levm IN EVOLUTION
197  levm_scale = levm_scale*scale_fac
198  levm_scale = min(100._dp, levm_scale)
199 !
200 ! SIMPLE LINE SEARCH SCAN OF |F| FOR VARIOUS |X|
201  mupar = 0
202  CALL linesearch(xcmin, fsq_min)
203 
204  END IF
205 
206  xc = xcmin
207 !
208 ! RECOMPUTE PERTURBED FIELDS, PRESSURE FOR MINIMUM STATE
209 ! THEN UPDATE NONLINEAR STATE BY ADDING XC (PERTURBATION)
210 !
211 
212  l_printoriginforces=.true.
213  l_init_state=.true.
214  l_getwmhd= .true.
215  CALL second0(skston)
216  CALL funct_island
217 ! CALL update_state(.FALSE., zero, zero) !Get this in evolution, line 455
218  CALL second0(skstoff)
219  gmres_funct_island_time=gmres_funct_island_time+(skstoff-skston)
220  l_printoriginforces=.false.
221 
222  mupar = mupars
223 
224  DEALLOCATE (xcmin, brhs)
225 
226  END SUBROUTINE gmres_fun
227 
228  SUBROUTINE init_gmres0 (icntl, cntl, etak, m, n)
229  INTEGER, INTENT(OUT) :: icntl(9), m, n
230  REAL(dp),INTENT(OUT) :: cntl(5)
231  REAL(dp), INTENT(IN) :: etak
232  REAL(dp) :: skston, skstoff
233  INTEGER, PARAMETER :: noPrec=0, leftprec=1, rightprec=2, dbleprec=3
234 
235  CALL second0(skston)
236  CALL init_dgmres(icntl ,cntl)
237  CALL second0(skstoff)
238  gmres_init_dgmres_time=gmres_init_dgmres_time+(skstoff-skston)
239 
240 !*************************
241 !* Tune some parameters
242 !*************************
243 ! Tolerance
244  cntl(1) = etak
245 ! cntl(1) = 1.E-5_dp
246 ! Write errors to fort.21
247 ! icntl(1) = 21 !21
248 ! Write warnings to fort.21
249  icntl(2) = 21
250 ! Save the convergence history in file fort.20
251  IF (nprecon .gt. 1) icntl(3) = 20
252 ! Preconditioning INPUT flags (note: different than revcom flags in driver)
253 ! icntl(4) = leftPrec
254  icntl(4) = rightprec
255 ! icntl(4) = dblePrec
256 !! ICGS orthogonalization
257  icntl(5) = 3
258 ! Initial guess
259  icntl(6) = 0
260 ! icntl(6) = 1
261 ! Maximum number of iterations at each step (~ns/5)
262  icntl(7) = ngmres_steps
263 
264  icntl(8) = 1 !Default
265  icntl(9) = 1 !Steps for peek at progress during rev com loop
266 !*********************************
267 ! Choose the restart parameter
268 !*********************************
269 ! write(*,*) 'Restart <', ldstrt
270 ! read(*,*) m
271 !
272 ! m <= n
273 !
274  n = neqs
275  m = 200
276 
277  END SUBROUTINE init_gmres0
278 
279  SUBROUTINE gmres_wrap (x0, b)
280  USE siesta_namelist, ONLY: ftol
281  USE nscalingtools, ONLY: pargmres, rcounts, disp
282  USE hessian, ONLY: apply_precond
283  USE gmres_lib, ONLY: gmres_info, gmres_par, gmres_ser
284 !-----------------------------------------------
285 ! D u m m y A r g u m e n t s
286 !-----------------------------------------------
287  REAL(dp), INTENT(IN) :: b(:)
288  REAL(dp), INTENT(INOUT) :: x0(:)
289 !-----------------------------------------------
290 ! L o c a l V a r i a b l e s
291 !-----------------------------------------------
292  TYPE(gmres_info) :: gi
293  INTEGER :: n
294 !-----------------------------------------------
295  l_linearize = .true.
296  l_getfsq = .false. !So call to funct in matvec does not include gc0
297 
298 !******************************************************
299 !* Initialize GMRES control parameters and Load GMRES_INFO structure
300 !*******************************************************
301  CALL init_gmres0(gi%icntl, gi%cntl, etak, gi%m, n)
302  gi%ftol=ftol
303  gi%lverbose = lverbose
304  gi%icntl(6) = 1
305 
306 !
307 ! EASY-TO-USE WRAPPER FOR GMRES DRIVER CALL
308 !
309 ! X0: on input, initial guess if icntl(6) == 1
310 ! on output, solution of Ax = b
311 ! NOTE: it is not overwritten UNTIL the end of this routine
312  gi%iam=iam; gi%nprocs=nprocs; gi%ngmres_type=ngmres_type
313  IF (parsolver .AND. pargmres) THEN
314  gi%endglobrow=endglobrow; gi%startglobrow=startglobrow
315  gi%mblk_size=mblk_size; gi%rcounts=>rcounts; gi%disp=>disp
316 
317  gi%my_comm = siesta_comm
318  gi%my_comm_world = siesta_comm
319 ! gi%lactive = lactive
320  CALL gmres_par (n, gi, matvec_par, apply_precond, getnlforce, &
321  x0, b)
322  ELSE
323  CALL gmres_ser (n, gi, matvec, apply_precond, getnlforce, &
324  x0, b)
325  END IF
326 
327  fsq_total1 = gi%ftol
328  CALL assert(all(xc.EQ.x0),'XC != X0 IN GMRES_WRAP')
329 
330  END SUBROUTINE gmres_wrap
331 
332  SUBROUTINE matvec_par (ploc, Ap, nloc)
333  USE island_params, ONLY: ns=>ns_i
334  USE hessian, ONLY: eps_factor, mupar, gather_array
335  USE blocktridiagonalsolver_s, ONLY: parmatvec, padsides
336 !-----------------------------------------------
337 ! D u m m y A r g u m e n t s
338 !-----------------------------------------------
339  INTEGER, INTENT(IN) :: nloc
340  REAL(dp), INTENT(IN), DIMENSION(nloc) :: ploc
341  REAL(dp), INTENT(OUT), DIMENSION(nloc) :: Ap
342 !-----------------------------------------------
343  LOGICAL, PARAMETER :: LPARMATVEC=.false.
344  INTEGER :: myrowstart, myrowend, istat
345  REAL(dp), ALLOCATABLE :: p(:)
346  REAL(dp) :: delta, skston, skstoff
347 !-----------------------------------------------
348 !SPH NOTE 032713: EVENTUALLY REMOVE CALL TO ParMatVec IF THE FUNCT_ISLAND IS FASTER
349 !
350 ! NOTE: DO NOT CALL ParMatVec WHEN nprecon_type==PREDIAG
351 ! SINCE IN HESSIAN, WE SET ALL THE OFF-DIAGONAL COMPONENTS OF
352 ! THE A-MATRIX (USED IN ParMatVec) TO ZERO
353 !
354 ! AT PRESENT, ParMatVec WILL NOT WORK IF mupar != 0
355 !
356  CALL assert(.NOT.l_init_state,'l_init_state = T in matvec_par')
357  istat = (endglobrow-startglobrow+1)*mblk_size
358  CALL assert(istat.EQ.nloc, 'nloc wrong in matvec_par')
359 
360  myrowstart=(startglobrow-1)*mblk_size+1
361  myrowend=myrowstart+nloc-1
362 
363  CALL second0(skston)
364  ALLOCATE (p(ns*mblk_size), stat=istat)
365  CALL assert(istat.eq.0,'Allocation error in matvec_par')
366  p = 0
367 
368  p(myrowstart:myrowend) = ploc
369  CALL padsides(p, mblk_size, 1, 1)
370 
371  CALL second0(skstoff)
372  gmres_wrap_allgather_time=gmres_wrap_allgather_time+(skstoff-skston)
373 
374  CALL second0(skston)
375 
376  IF (.NOT.lparmatvec .OR. nprecon_type.EQ.prediag &
377  .OR. mupar.NE.zero) THEN
378  delta = sqrt(epsilon(delta))*eps_factor
379  xc = delta*p
380 
381  l_linearize=.true.
382  CALL funct_island
383  ap = gc(myrowstart:myrowend)/delta
384 
385  ELSE
386  CALL parmatvec(p,ap,nloc)
387  END IF
388 
389  DEALLOCATE (p)
390 
391  WHERE (abs(ap) .LT. 1.e-10_dp) ap = 0
392 
393  CALL second0(skstoff)
394 
395  paryax_time=paryax_time+(skstoff-skston)
396 
397  END SUBROUTINE matvec_par
398 
399  SUBROUTINE matvec (p, Ap, ndim)
400  USE stel_kinds
401  USE hessian, ONLY: eps_factor, gather_array
402 #if defined(MPI_OPT)
403  USE mpi_inc
404 #endif
405 !-----------------------------------------------
406 ! D u m m y A r g u m e n t s
407 !-----------------------------------------------
408  INTEGER, INTENT(IN) :: ndim
409  REAL(dp), INTENT(IN) :: p(ndim)
410  REAL(dp), INTENT(OUT) :: Ap(ndim)
411 !-----------------------------------------------
412 ! L o c a l V a r i a b l e s
413 !-----------------------------------------------
414  REAL(dp), PARAMETER :: zero=0
415  REAL(dp) :: delta
416 !-----------------------------------------------
417  CALL assert(.not.l_init_state,'l_init_state = T in matvec')
418 
419  delta = sqrt(epsilon(delta))*eps_factor
420 
421 ! Note: GMRES without Preconditioner has pnorm = 1 (checked!)
422 ! pnorm = SUM(p*p)
423 ! delta = delta/SQRT(pnorm)
424 ! delta = delta*(pnorm + SUM(p*xc0))/pnorm
425 
426 !IF CALLED IN PAR MODE, FIRST GATHER THE xc's
427  CALL assert(SIZE(gc).EQ.SIZE(ap),'gc and Ap wrong sizes')
428  xc = delta*p
429 
430  l_getwmhd=.true.
431  CALL funct_island
432  l_getwmhd=.false.
433 
434  IF (l_linearize) THEN
435  ap = gc/delta
436  ELSE
437  ap = (gc-gc0)/delta
438  END IF
439 
440  WHERE (abs(ap) .LT. 1.e-10_dp) ap = 0
441 
442  END SUBROUTINE matvec
443 
444 
445  SUBROUTINE get_etak(fk, fkm, ftol, etak)
446 !-----------------------------------------------
447 ! D u m m y A r g u m e n t s
448 !-----------------------------------------------
449  REAL(dp), INTENT(in) :: fk, fkm, ftol
450  REAL(dp), INTENT(inout) :: etak
451 !-----------------------------------------------
452 ! L o c a l V a r i a b l e s
453 !-----------------------------------------------
454  REAL(dp), PARAMETER :: gamma1=0.9_dp, alpha=1.5_dp, eta0 = 1.e-02_dp
455  REAL(dp) :: etakm
456 !-----------------------------------------------
457 ! ROUTINE PROVIDED L. CHACON (11/09/06)
458  etakm = etak
459 
460 ! Superlinear convergence
461  etak = gamma1*(fk/fkm)**alpha
462 
463 ! Safeguard avoid sharp decrease in etak
464  etak = min(eta0, max(etak, gamma1*etakm**alpha))
465 
466 ! Safeguard avoid "oversolving"
467  etak = min(eta0, max(etak, gamma1*ftol/fk))
468 
469  END SUBROUTINE get_etak
470 
471 
472  SUBROUTINE getnlforce(xcstate, fsq_nl, bnorm)
473 #if defined(MPI_OPT)
474  USE blocktridiagonalsolver_s, ONLY: padsides
475 #endif
476 !-----------------------------------------------
477 ! D u m m y A r g u m e n t s
478 !-----------------------------------------------
479  REAL(dp),INTENT(IN) :: xcstate(neqs), bnorm
480  REAL(dp),INTENT(OUT) :: fsq_nl
481 !-----------------------------------------------
482 ! L o c a l V a r i a b l e s
483 !-----------------------------------------------
484  INTEGER :: nloc, myrowstart, myrowend
485  LOGICAL :: l_linloc, l_Apploc, l_getloc
486 !-----------------------------------------------
487  CALL assert(.not.l_init_state,'l_init_state=T in GetNLForce!')
488 !Store state
489  l_linloc = l_linearize
490  l_apploc = l_applyprecon
491  l_getloc = l_getfsq
492 
493  nloc=(endglobrow-startglobrow+1)*mblk_size
494  myrowstart=(startglobrow-1)*mblk_size+1
495  myrowend=myrowstart+nloc-1
496 
497 
498 !Set state variables
499  xc(myrowstart:myrowend) = bnorm*xcstate(myrowstart:myrowend) !undo internal gmres normalization
500 #if defined(MPI_OPT)
501  IF (parsolver) CALL padsides(xc, mblk_size, 1, 1)
502 #endif
503  l_init_state = .false.
504  l_linearize = .false.
505  l_getfsq = .true.
506  l_applyprecon=.false.
507 
508  CALL funct_island
509  fsq_nl = fsq_total1
510 
511 !Restore state variables
512  l_linearize = l_linloc
513  l_applyprecon = l_apploc
514  l_getfsq = l_getloc
515 
516  END SUBROUTINE getnlforce
517 
518  SUBROUTINE qmr_fun
519 !-----------------------------------------------
520 ! L o c a l V a r i a b l e s
521 !-----------------------------------------------
522  INTEGER :: ndim, nlen, nlim, ierr, info(4), j
523  INTEGER :: revcom, colx, colb
524  REAL(dp), DIMENSION(:,:), ALLOCATABLE :: vecs
525  REAL(dp) :: tol = 1.e-4_dp, gnorm
526 !-----------------------------------------------
527 !
528 ! STORE INITIAL POINT AND INITIAL RESIDUE (AT INIT PT)
529 ! SO DEVIATIONS FROM THEM CAN BE COMPUTED REPEATEDLY
530 !
531  ALLOCATE(xc0(neqs), gc0(neqs), vecs(neqs,9), stat=j)
532  CALL assert(j.eq.0,'Allocation error in qmr_fun')
533 
534  ndim = SIZE(vecs,1)
535  nlen = ndim
536  nlim = 100
537 
538 ! SPH: ONLY works with 0 restart each time??!!!
539  l_linearize = .false.
540  l_applyprecon = .true.
541 
542  xc = 0
543  CALL funct_island
544  xc0 = xc
545  gc0 = gc
546 
547  l_linearize = .true.
548 !
549 ! INITIALIZE vecs
550 !
551  gnorm = sum(gc*gc)
552  gnorm = sqrt(gnorm)
553  vecs(:ndim,2) = -gc(:ndim)/gnorm
554  vecs(:ndim,3) = gc(:ndim)/gnorm
555 
556  ierr = 100000
557  info = 0
558  info(1) = ierr
559 
560  10 CALL dutfx (ndim,nlen,nlim,vecs,tol,info)
561  revcom = info(2)
562  colx = info(3)
563  colb = info(4)
564  IF (revcom .eq. 1) THEN
565  CALL matvec (vecs(1,colx), vecs(1,colb), ndim)
566  GO TO 10
567  END IF
568 
569  xc(1:ndim) = xc0(1:ndim) + gnorm*vecs(:,1)
570 
571 !
572 ! RECOMPUTE delta current,pressure prior to update_state call
573 !
574  CALL funct_island
576 
577  l_linearize = .false.
578  CALL funct_island
579 
580  DEALLOCATE (xc0, gc0, vecs)
581 
582  END SUBROUTINE qmr_fun
583 
584  END MODULE gmres
shared_data::etak_tol
real(dp) etak_tol
FIXME: UNKNOWN.
Definition: shared_data.f90:117
shared_data::nprecon
integer nprecon
Preconditioner flag.
Definition: shared_data.f90:68
shared_data::lverbose
logical lverbose
Use verbose screen output.
Definition: shared_data.f90:234
shared_data::l_getfsq
logical l_getfsq
Compute |F|^2.
Definition: shared_data.f90:216
shared_functions
Module contained subroutines and functions updating MHD forces and Wmhd.
Definition: shared_functions.f90:4
shared_data::xc
real(dp), dimension(:), allocatable xc
1D array of Fourier mode displacement components.
Definition: shared_data.f90:97
hessian::gather_array
Definition: hessian.f90:31
shared_data::fsq_total
real(dp) fsq_total
|F|^2 WITH column scaling.
Definition: shared_data.f90:91
shared_data::l_applyprecon
logical l_applyprecon
Apply preconditioner.
Definition: shared_data.f90:218
siesta_state
This file contains subroutines for aupdating from t to t + delta_t the magnetic field and pressure as...
Definition: siesta_state.f90:12
shared_data::ngmres_type
integer ngmres_type
GMRES control flag.
Definition: shared_data.f90:74
shared_data::l_init_state
logical l_init_state
Store initial field/pressure state.
Definition: shared_data.f90:222
shared_data::l_printoriginforces
logical l_printoriginforces
Print forces at the origin.
Definition: shared_data.f90:220
v3_utilities::assert
Definition: v3_utilities.f:55
shared_data::levm_ped
real(dp), parameter levm_ped
FIXME: UNKNOWN.
Definition: shared_data.f90:29
shared_data::wtotal
real(dp) wtotal
MHD energy sum of magnetic and thermal.
Definition: shared_data.f90:121
mpi_inc
Umbrella module avoid multiple inlcudes of the mpif.h header.
Definition: mpi_inc.f:11
shared_data::lcolscale
logical lcolscale
Apply column scaling to hessian.
Definition: shared_data.f90:228
island_params
This file contains fix parameters related to the computational grids.
Definition: island_params.f90:10
shared_data::l_linearize
logical l_linearize
Use linearized forces.
Definition: shared_data.f90:210
gmres_lib::gmres_info
Definition: gmres_lib.f:7
shared_data::unit_out
integer, parameter unit_out
File output io unit.
Definition: shared_data.f90:39
shared_data::nprecon_type
integer nprecon_type
Preconditioner type.
Definition: shared_data.f90:70
blocktridiagonalsolver_s
Module contains subroutines for solver for block tri-diagonal matrices.
Definition: blocktridiagonalsolver_s.f90:7
siesta_namelist::ftol
real(dp) ftol
Force tolarance.
Definition: siesta_namelist.f90:146
shared_data::gc
real(dp), dimension(:), allocatable, target gc
1D Array of Fourier mode MHD force components
Definition: shared_data.f90:99
shared_data::xc0
real(dp), dimension(:), allocatable xc0
Saved fouier displacements.
Definition: shared_data.f90:106
siesta_namelist::lresistive
logical lresistive
Use resistive perturbaton.
Definition: siesta_namelist.f90:126
shared_data::l_getwmhd
logical l_getwmhd
Compute MHD energy.
Definition: shared_data.f90:214
shared_data::fsq_total1
real(dp) fsq_total1
|F|^2 WITHOUT column scaling.
Definition: shared_data.f90:93
shared_data::mblk_size
integer mblk_size
Block size. (mpol + 1)*(2*ntor + 1)*ndims.
Definition: shared_data.f90:62
shared_data::prediag
integer, parameter prediag
Diagonal preconditioning flag.
Definition: shared_data.f90:23
shared_data::levm_scale
real(dp) levm_scale
FIXME: UNKNOWN.
Definition: shared_data.f90:119
siesta_namelist
This file contains all the variables and maximum sizes of the inputs for a SIESTA namelist input file...
Definition: siesta_namelist.f90:103
shared_data
This file contains variables and parameters used by many modules in SIESTA.
Definition: shared_data.f90:10
shared_data::fsq_lin
real(dp) fsq_lin
Linear |F|^2.
Definition: shared_data.f90:115
shared_data::neqs
integer neqs
Number of elements in the xc array.
Definition: shared_data.f90:54
shared_data::gc0
real(dp), dimension(:), allocatable gc0
Saved fouier MHD forces.
Definition: shared_data.f90:108
shared_data::ngmres_steps
integer, parameter ngmres_steps
Max number of gmres steps (10-100) should scale with ns.
Definition: shared_data.f90:21