PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
driver_eq.f90
Go to the documentation of this file.
1 !------------------------------------------------------------------------------!
3 !------------------------------------------------------------------------------!
4 module driver_eq
5 #include <PB3D_macros.h>
6  use str_utilities
7  use output_ops
8  use messages
9  use num_vars, only: dp, pi, max_str_ln
10  use grid_vars, only: grid_type
11  use eq_vars, only: eq_1_type, eq_2_type
12  use vac_vars, only: vac_type
13 
14  implicit none
15  private
16  public run_driver_eq
17 
18  ! global variables
19 #if ldebug
20  logical :: plot_info = .false.
21 #endif
22 
23 contains
47  integer function run_driver_eq(grid_eq_out,grid_eq_B_out,eq_1_out,&
48  &eq_2_out,vac) result(ierr)
49 
62  use num_utilities, only: derivs
63  use mpi_utilities, only: wait_mpi
64  use rich_vars, only: rich_lvl
65  use hdf5_ops, only: create_output_hdf5
66  use vac_ops, only: store_vac
67  !!use num_utilities, only: calc_aux_utilities
68 
69  character(*), parameter :: rout_name = 'run_driver_eq'
70 
71  ! input / output
72  type(grid_type), intent(inout), target :: grid_eq_out
73  type(grid_type), intent(inout), pointer :: grid_eq_b_out
74  type(eq_1_type), intent(inout) :: eq_1_out
75  type(eq_2_type), intent(inout) :: eq_2_out
76  type(vac_type), intent(inout) :: vac
77 
78  ! local variables
79  type(eq_1_type) :: eq_1 ! flux equilibrium variables
80  type(eq_2_type) :: eq_2 ! metric equilibrium variables
81  type(grid_type) :: grid_eq ! equilibrium grid
82  type(grid_type) :: grid_eq_b ! field-aligned equilibrium grid
83  integer :: eq_limits(2) ! min. and max. index of eq. grid of this process
84  integer :: rich_lvl_name ! either the Richardson level or zero, to append to names
85  logical :: do_eq_1_ops ! whether specific calculations for eq_1 are necessary
86  logical :: do_eq_2_ops ! whether specific calculations for eq_2 are necessary
87  logical :: only_half_grid ! calculate only half grid
88  logical :: dealloc_vars ! whether to deallocate variables to save memory
89  character(len=8) :: flux_name ! toroidal or poloidal
90  character(len=max_str_ln) :: grid_eq_b_name ! name of grid_eq_B
91 
92  ! initialize ierr
93  ierr = 0
94 
95  ! decide whether to append Richardson level to name
96  select case (eq_style)
97  case (1) ! VMEC
98  rich_lvl_name = rich_lvl ! append richardson level
99  case (2) ! HELENA
100  rich_lvl_name = 0 ! do not append name
101  end select
102 
103  ! Divide equilibrium grid under group processes, calculating the limits
104  ! and the normal coordinate.
105  ierr = calc_norm_range('PB3D_eq',eq_limits=eq_limits)
106  chckerr('')
107 
108  ! jump to solution if requested
109  if (rich_lvl.eq.rich_restart_lvl .and. jump_to_sol) then
110  call writo('Prepare to jump to solution')
111  call lvl_ud(1)
112 
113  ! grid_eq_out
114  select case (x_grid_style)
115  case (1,3) ! equilibrium or optimized
116  ! perturbation quantities are calculated on equilibrium
117  ! normal grid or optimized variant
118  ierr = reconstruct_pb3d_grid(grid_eq_out,'eq',&
119  &rich_lvl=rich_lvl_name,grid_limits=eq_limits)
120  chckerr('')
121  case (2) ! solution
122  ! start from equilibrium grid in equilibrium limits and then
123  ! redistribute it
124  ierr = reconstruct_pb3d_grid(grid_eq,'eq',&
125  &rich_lvl=rich_lvl_name,grid_limits=eq_limits)
126  chckerr('')
127  ierr = redistribute_output_grid(grid_eq,grid_eq_out)
128  chckerr('')
129  call grid_eq%dealloc()
130  end select
131 
132  ! eq_1_out
133  ierr = reconstruct_pb3d_eq_1(grid_eq_out,eq_1_out,'eq_1')
134  chckerr('')
135 
136  ! eq_2_out
137  if (eq_style.eq.2) then
138  ierr = reconstruct_pb3d_eq_2(grid_eq_out,eq_2_out,'eq_2')
139  chckerr('')
140  end if
141 
142  call lvl_ud(-1)
143  call writo('Skipping rest to jump to solution')
144  return
145  end if
146 
147  ! set up whether to deallocate variables
148  dealloc_vars = .true.
149 #if ldebug
150  if (plot_info) dealloc_vars = .false.
151  if (ltest) dealloc_vars = .false.
152 #endif
153  if (plot_b .or. plot_j .or. plot_kappa) dealloc_vars = .false. ! need transformation matrices
154 
155  ! user output
156  call writo('The equilibrium variables are processed')
157  call lvl_ud(1)
158 
159  select case (alpha_style)
160  case (1) ! single field line, multiple turns
161  call writo('With a single field-line')
162  call lvl_ud(1)
163  call writo('with label alpha = '//&
164  &trim(r2strt(alpha(1))))
165  call writo('with parallel range '//trim(r2strt(min_par_x))//&
166  &'..'//trim(r2strt(max_par_x)))
167  call lvl_ud(-1)
168  case (2) ! multiple field lines, single turns
169  call writo('With '//trim(i2str(n_alpha))//' field-lines')
170  end select
171  if (use_pol_flux_f) then
172  flux_name = 'poloidal'
173  else
174  flux_name = 'toroidal'
175  end if
176  call writo('using the '//trim(flux_name)//' flux as the normal &
177  &variable')
178 
179  call lvl_ud(-1)
180 
181  ! set up whether half or full parallel grid has to be calculated
182  if (rich_lvl.eq.1) then
183  only_half_grid = .false.
184  else
185  only_half_grid = .true.
186  end if
187 
188  ! decide whether to do certain equilibrium calculations
189  if (rich_lvl.eq.rich_restart_lvl .and. eq_job_nr.eq.1) then
190  do_eq_1_ops = .true.
191  else
192  do_eq_1_ops = .false.
193  end if
194  select case (eq_style)
195  case (1) ! VMEC
196  do_eq_2_ops = .true.
197  case (2) ! HELENA
198  if (rich_lvl.eq.rich_restart_lvl .and. eq_job_nr.eq.1) then
199  do_eq_2_ops = .true.
200  else
201  do_eq_2_ops = .false.
202  end if
203  end select
204 
205  ! setup equilibrium grid
206  call writo('Determine the equilibrium grid')
207  call lvl_ud(1)
208  ierr = setup_grid_eq(grid_eq,eq_limits)
209  call lvl_ud(-1)
210  chckerr('')
211 
212  ! Calculate the flux equilibrium quantities.
213  ! Note: There are some E quantities that are needed in to set up the
214  ! equilibrium grid and that are not present in eq_1_out.
215  ierr = calc_eq(grid_eq,eq_1)
216  chckerr('')
217 
218  ! Write to HDF5 only for first calculation
219  if (rich_lvl.eq.1 .and. eq_job_nr.eq.1) then
220  ! write flux equilibrium variables to output
221  ierr = print_output_eq(grid_eq,eq_1,'eq_1')
222  chckerr('')
223 
224  ! plot flux quantities if requested
225  if (plot_flux_q) then
226  ierr = flux_q_plot(grid_eq,eq_1)
227  chckerr('')
228  else
229  call writo('Flux quantities plot not requested')
230  end if
231  end if
232 
233  ! grid_eq and grid_eq_B
234  ! VMEC: The equilibrium grid is field-aligned but its angular variables
235  ! need to be set up still.
236  ! HELENA: The equilibrium grid is not field-aligned but taken from
237  ! the equilibrium output. The field-aligned grid has to be set up
238  ! separately.
239  select case (eq_style)
240  case (1) ! VMEC
241  ! calculate angular grid points for equilibrium grid
242  call writo('Calculate angular equilibrium grid')
243  ierr = calc_ang_grid_eq_b(grid_eq,eq_1,only_half_grid=&
244  &only_half_grid)
245  chckerr('')
246  case (2) ! HELENA
247  ! set up field-aligned equilibrium grid
248  call writo('Determine the field-aligned equilibrium grid')
249  ierr = setup_grid_eq_b(grid_eq,grid_eq_b,eq_1,&
250  &only_half_grid=only_half_grid)
251  chckerr('')
252 
253  ! write field-aligned equilibrium grid variables to output
254  ierr = print_output_grid(grid_eq_b,'field-aligned equilibrium',&
255  &'eq_B',rich_lvl=rich_lvl,par_div=.true.)
256  chckerr('')
257  end select
258 
259  ! only do when needed
260  if (do_eq_2_ops) then
261  ! write equilibrium grid variables to output
262  ierr = print_output_grid(grid_eq,'equilibrium','eq',&
263  &rich_lvl=rich_lvl_name,par_div=size(eq_jobs_lims,2).gt.1)
264  chckerr('')
265 
266  ! Calculate the metric equilibrium quantities
267  ierr = calc_eq(grid_eq,eq_1,eq_2,dealloc_vars=dealloc_vars)
268  chckerr('')
269 
270 #if ldebug
271  if (plot_info) then
272  ! plot info for comparison between VMEC and HELENA
273  call plot_info_for_vmec_hel_comparision()
274  end if
275 #endif
276 
277  if (rich_lvl.eq.1 .and. eq_style.eq.2) then ! only if first Richardson level
278  ! write metric equilibrium variables to output
279  ierr = print_output_eq(grid_eq,eq_2,'eq_2',par_div=.false.)
280  chckerr('')
281  end if
282 
283  ! store vacuum variables
284  ierr = store_vac(grid_eq,eq_1,eq_2,vac)
285  chckerr('')
286  end if
287 
288  ! set output variables
289  select case (x_grid_style)
290  case (1,3) ! equilibrium or enriched
291  call writo('Copy the equilibrium grids and variables to &
292  &output grid')
293  case (2) ! solution
294  call writo('Redistribute the equilibrium grids and variables &
295  &to output grid')
296  end select
297  call lvl_ud(1)
298 
299  ! grid_eq_out
300  if (do_eq_2_ops) then
301  if (associated(grid_eq_out%r_F)) call grid_eq_out%dealloc() ! deallocate if necessary
302  select case (x_grid_style)
303  case (1,3) ! equilibrium or enriched
304  ierr = grid_eq%copy(grid_eq_out)
305  chckerr('')
306  case (2) ! solution
307  ierr = redistribute_output_grid(grid_eq,grid_eq_out)
308  chckerr('')
309  end select
310  end if
311 
312  ! eq_1_out
313  if (do_eq_1_ops) then
314  if (allocated(eq_1_out%pres_FD)) call eq_1_out%dealloc() ! deallocate if necessary
315  select case (x_grid_style)
316  case (1,3) ! equilibrium or optimized
317  call eq_1%copy(grid_eq,eq_1_out)
318  case (2) ! solution
319  ierr = redistribute_output_eq(grid_eq,grid_eq_out,eq_1,&
320  &eq_1_out)
321  chckerr('')
322  end select
323  end if
324 
325  ! eq_2_out
326  if (do_eq_2_ops) then
327  if (allocated(eq_2_out%jac_FD)) call eq_2_out%dealloc() ! deallocate if necessary
328  select case (x_grid_style)
329  case (1,3) ! equilibrium or optimized
330  call eq_2%copy(grid_eq,eq_2_out)
331  case (2) ! solution
332  ierr = redistribute_output_eq(grid_eq,grid_eq_out,eq_2,&
333  &eq_2_out)
334  chckerr('')
335  end select
336  end if
337 
338  ! grid_eq_B_out
339  select case (eq_style)
340  case (1) ! VMEC
341  grid_eq_b_out => grid_eq_out
342  case (2) ! HELENA
343  if (associated(grid_eq_b_out)) then
344  call grid_eq_b_out%dealloc()
345  deallocate(grid_eq_b_out)
346  nullify(grid_eq_b_out)
347  end if
348  allocate(grid_eq_b_out)
349  select case (x_grid_style)
350  case (1,3) ! equilibrium or optimized
351  ierr = grid_eq_b%copy(grid_eq_b_out)
352  chckerr('')
353  case (2) ! solution
354  ierr = redistribute_output_grid(grid_eq_b,grid_eq_b_out)
355  chckerr('')
356  end select
357  end select
358 
359  ! clean up
360  call grid_eq%dealloc()
361  call eq_1%dealloc() ! eq_1 is always calculated because there are some quantities that are not present in eq_1_out
362  if (do_eq_2_ops) then
363  call eq_2%dealloc()
364  end if
365  if (eq_style.eq.2) then
366  call grid_eq_b%dealloc()
367  end if
368 
369  call lvl_ud(-1)
370 
371  ! plot magnetic field if requested
372  ! (done in parts, for every parallel job)
373  if (plot_b) then
374  select case (eq_style)
375  case (1) ! VMEC
376  ierr = b_plot(grid_eq_out,eq_1_out,eq_2_out,&
378  chckerr('')
379  case (2) ! HELENA
380  if (rich_lvl.eq.1) then
381  ierr = b_plot(grid_eq_out,eq_1_out,eq_2_out)
382  chckerr('')
383  end if
384  end select
385  else
386  if (eq_job_nr.eq.1) call writo('Magnetic field plot not requested')
387  end if
388 
389  ! plot current if requested
390  ! (done in parts, for every parallel job)
391  if (plot_j) then
392  select case (eq_style)
393  case (1) ! VMEC
394  ierr = j_plot(grid_eq_out,eq_1_out,eq_2_out,&
396  chckerr('')
397  case (2) ! HELENA
398  if (rich_lvl.eq.1) then
399  ierr = j_plot(grid_eq_out,eq_1_out,eq_2_out)
400  chckerr('')
401  end if
402  end select
403  else
404  if (eq_job_nr.eq.1) call writo('Current plot not requested')
405  end if
406 
407  ! plot curvature if requested
408  ! (done in parts, for every parallel job)
409  if (plot_kappa) then
410  select case (eq_style)
411  case (1) ! VMEC
412  ierr = kappa_plot(grid_eq_out,eq_1_out,eq_2_out,&
414  chckerr('')
415  case (2) ! HELENA
416  if (rich_lvl.eq.1) then
417  ierr = kappa_plot(grid_eq_out,eq_1_out,eq_2_out)
418  chckerr('')
419  end if
420  end select
421  else
422  if (eq_job_nr.eq.1) call writo('Curvature plot not requested')
423  end if
424 
425  ! plot full field-aligned grid if requested
426  ! Note: As this needs a total grid, it cannot be easiliy created like
427  ! plot_B, where the output is updated for every equilibrium job.
428  if (plot_magn_grid) then
429  if (eq_job_nr.eq.size(eq_jobs_lims,2)) then
430  ! set up the name of grid_eq_B
431  select case (eq_style)
432  case (1) ! VMEC
433  grid_eq_b_name = 'eq' ! already field-aligned
434  case (2) ! HELENA
435  grid_eq_b_name = 'eq_B' ! not already field-aligned
436  end select
437 
438  ! reconstruct the full field-aligned grid
439  ierr = reconstruct_pb3d_grid(grid_eq_b,trim(grid_eq_b_name),&
440  &rich_lvl=rich_lvl,tot_rich=.true.,grid_limits=eq_limits)
441  chckerr('')
442 
443  ! wait for all processes (sometimes necessary to finish lock)
444  ierr = wait_mpi()
445  chckerr('')
446 
447  ! plot it
448  ierr = magn_grid_plot(grid_eq_b)
449  chckerr('')
450 
451  ! deallocate
452  call grid_eq_b%dealloc()
453  end if
454  else
455  if (eq_job_nr.eq.1) call writo('Magnetic grid plot not requested')
456  end if
457 #if ldebug
458  contains
459  ! Plots information for comparison between HELENA and VMEC.
461  subroutine plot_info_for_vmec_hel_comparision()
462  use helena_vars, only: r_h, z_h
464 
465  ! local variables
466  real(dp), allocatable :: x_plot(:,:,:), y_plot(:,:,:), z_plot(:,:,:)
467  integer :: id
468  integer :: d(3)
469  logical :: not_ready
470 
471  call writo('Plotting information for comparison between VMEC and &
472  &HELENA',alert=.true.)
473  not_ready = .true.
474  do while (not_ready)
475  call writo('derivative in dim 1?')
476  d(1) = get_int(lim_lo=0)
477  call writo('derivative in dim 2?')
478  d(2) = get_int(lim_lo=0)
479  call writo('derivative in dim 3?')
480  d(3) = get_int(lim_lo=0)
481 
482  ! x, y, z
483  allocate(x_plot(grid_eq%n(1),grid_eq%n(2),grid_eq%loc_n_r))
484  allocate(y_plot(grid_eq%n(1),grid_eq%n(2),grid_eq%loc_n_r))
485  allocate(z_plot(grid_eq%n(1),grid_eq%n(2),grid_eq%loc_n_r))
486  x_plot = grid_eq%theta_F
487  y_plot = 0._dp
488  do id = 1,grid_eq%loc_n_r
489  z_plot(:,:,id) = grid_eq%loc_r_F(id)/maxval(grid_eq%r_F)
490  end do
491  call plot_hdf5('x_plot','x_plot',x_plot)
492  call plot_hdf5('y_plot','y_plot',y_plot)
493  call plot_hdf5('z_plot','z_plot',z_plot)
494 
495  ! flux quantities
496  call print_ex_2d('pres_FD','pres_FD',eq_1%pres_FD(:,d(2)),&
497  &x=grid_eq%loc_r_F,draw=.false.)
498  call draw_ex(['pres_FD'],'pres_FD',1,1,.false.)
499  call print_ex_2d('q_saf_FD','q_saf_FD',eq_1%q_saf_FD(:,d(2)),&
500  &x=grid_eq%loc_r_F,draw=.false.)
501  call draw_ex(['q_saf_FD'],'q_saf_FD',1,1,.false.)
502  call print_ex_2d('flux_p_FD','flux_p_FD',&
503  &eq_1%flux_p_FD(:,d(2)),x=grid_eq%loc_r_F,draw=.false.)
504  call draw_ex(['flux_p_FD'],'flux_p_FD',1,1,.false.)
505  call print_ex_2d('flux_t_FD','flux_t_FD',&
506  &eq_1%flux_t_FD(:,d(2)),x=grid_eq%loc_r_F,draw=.false.)
507  call draw_ex(['flux_t_FD'],'flux_t_FD',1,1,.false.)
508 
509  ! R and Z
510  select case (eq_style)
511  case(1)
512  call plot_hdf5('R_V','R_V',&
513  &eq_2%R_E(:,:,:,d(1),d(2),d(3)),x=x_plot,y=y_plot,&
514  &z=z_plot)
515  call plot_hdf5('Z_V','Z_V',&
516  &eq_2%Z_E(:,:,:,d(1),d(2),d(3)),x=x_plot,y=y_plot,&
517  &z=z_plot)
518  call plot_hdf5('L_V','L_V',&
519  &eq_2%L_E(:,:,:,d(1),d(2),d(3)),x=x_plot,y=y_plot,&
520  &z=z_plot)
521  case(2)
522  if (sum(d).eq.0) then
523  call plot_hdf5('R_H','R_H',&
524  &reshape(r_h(:,grid_eq%i_min:grid_eq%i_max),&
525  &[grid_eq%n(1:2),grid_eq%loc_n_r]),&
526  &x=x_plot,y=y_plot,z=z_plot)
527  call plot_hdf5('Z_H','Z_H',&
528  &reshape(z_h(:,grid_eq%i_min:grid_eq%i_max),&
529  &[grid_eq%n(1:2),grid_eq%loc_n_r]),&
530  &x=x_plot,y=y_plot,z=z_plot)
531  else
532  call writo('R and Z can only be plot for d = 0')
533  end if
534  end select
535 
536  ! metric fators
537  call plot_hdf5('jac_FD','jac_FD',&
538  &eq_2%jac_FD(:,:,:,d(1),d(2),d(3)),&
539  &x=x_plot,y=y_plot,z=z_plot)
540  do id = 1,6
541  call plot_hdf5('g_FD_'//trim(i2str(id)),&
542  &'g_FD_'//trim(i2str(id)),&
543  &eq_2%g_FD(:,:,:,id,d(1),d(2),d(3)),&
544  &x=x_plot,y=y_plot,z=z_plot)
545  call plot_hdf5('h_FD_'//trim(i2str(id)),&
546  &'h_FD_'//trim(i2str(id)),&
547  &eq_2%h_FD(:,:,:,id,d(1),d(2),d(3)),&
548  &x=x_plot,y=y_plot,z=z_plot)
549  end do
550 
551  ! clean up
552  deallocate(x_plot,y_plot,z_plot)
553 
554  call writo('Want to redo the plotting?')
555  not_ready = get_log(.true.)
556  end do
557 
558  ! reset not_ready
559  not_ready = .true.
560 
561  call writo('Done, paused',alert=.true.)
562  call pause_prog()
563  end subroutine plot_info_for_vmec_hel_comparision
564 #endif
565  end function run_driver_eq
566 end module driver_eq
num_vars::x_grid_style
integer, public x_grid_style
style for normal component of X grid (1: eq, 2: sol, 3: enriched)
Definition: num_vars.f90:99
grid_ops::setup_grid_eq_b
integer function, public setup_grid_eq_b(grid_eq, grid_eq_B, eq, only_half_grid)
Sets up the field-aligned equilibrium grid.
Definition: grid_ops.f90:601
num_vars::dp
integer, parameter, public dp
double precision
Definition: num_vars.f90:46
eq_vars
Variables that have to do with equilibrium quantities and the grid used in the calculations:
Definition: eq_vars.f90:27
mpi_utilities
Numerical utilities related to MPI.
Definition: MPI_utilities.f90:20
num_vars
Numerical variables used by most other modules.
Definition: num_vars.f90:4
input_utilities::get_log
logical function, public get_log(yes, ind)
Queries for a logical value yes or no, where the default answer is also to be provided.
Definition: input_utilities.f90:22
num_vars::max_str_ln
integer, parameter, public max_str_ln
maximum length of strings
Definition: num_vars.f90:50
rich_vars
Variables concerning Richardson extrapolation.
Definition: rich_vars.f90:4
str_utilities::i2str
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Definition: str_utilities.f90:18
hdf5_ops
Operations on HDF5 and XDMF variables.
Definition: HDF5_ops.f90:27
grid_vars::max_par_x
real(dp), public max_par_x
max. of parallel coordinate [ ] in field-aligned grid
Definition: grid_vars.f90:25
eq_ops::calc_eq
Calculate the equilibrium quantities on a grid determined by straight field lines.
Definition: eq_ops.f90:48
num_vars::eq_job_nr
integer, public eq_job_nr
nr. of eq job
Definition: num_vars.f90:79
eq_ops::b_plot
integer function, public b_plot(grid_eq, eq_1, eq_2, rich_lvl, plot_fluxes, XYZ)
Plots the magnetic fields.
Definition: eq_ops.f90:5700
output_ops::print_ex_2d
Print 2-D output on a file.
Definition: output_ops.f90:47
vac_ops::store_vac
integer function, public store_vac(grid, eq_1, eq_2, vac)
Stores calculation of the vacuum response by storing the necessary variables.
Definition: vac_ops.f90:113
grid_ops::calc_norm_range
integer function, public calc_norm_range(style, in_limits, eq_limits, X_limits, sol_limits, r_F_eq, r_F_X, r_F_sol, jq)
Calculates normal range for the input grid, the equilibrium grid and/or the solution grid.
Definition: grid_ops.f90:46
str_utilities
Operations on strings.
Definition: str_utilities.f90:4
num_vars::plot_magn_grid
logical, public plot_magn_grid
whether to plot the grid in real coordinates
Definition: num_vars.f90:103
eq_ops::redistribute_output_eq
Redistribute the equilibrium variables, but only the Flux variables are saved.
Definition: eq_ops.f90:103
grid_ops::print_output_grid
integer function, public print_output_grid(grid, grid_name, data_name, rich_lvl, par_div, remove_previous_arrs)
Print grid variables to an output file.
Definition: grid_ops.f90:1489
grid_vars::grid_type
Type for grids.
Definition: grid_vars.f90:59
str_utilities::r2strt
elemental character(len=max_str_ln) function, public r2strt(k)
Convert a real (double) to string.
Definition: str_utilities.f90:54
eq_vars::eq_1_type
flux equilibrium type
Definition: eq_vars.f90:63
eq_ops::j_plot
integer function, public j_plot(grid_eq, eq_1, eq_2, rich_lvl, plot_fluxes, XYZ)
Plots the current.
Definition: eq_ops.f90:5803
hdf5_ops::create_output_hdf5
integer function, public create_output_hdf5(HDF5_name)
Creates an HDF5 output file.
Definition: HDF5_ops.f90:1075
num_vars::ltest
logical, public ltest
whether or not to call the testing routines
Definition: num_vars.f90:112
vac_vars
Variables pertaining to the vacuum quantities.
Definition: vac_vars.f90:4
grid_vars::alpha
real(dp), dimension(:), allocatable, public alpha
field line label alpha
Definition: grid_vars.f90:28
helena_vars::r_h
real(dp), dimension(:,:), allocatable, public r_h
major radius (xout)
Definition: HELENA_vars.f90:33
vac_ops
Operations and variables pertaining to the vacuum response.
Definition: vac_ops.f90:23
pb3d_ops::reconstruct_pb3d_eq_2
integer function, public reconstruct_pb3d_eq_2(grid_eq, eq, data_name, rich_lvl, tot_rich, lim_pos)
Reconstructs the equilibrium variables from PB3D HDF5 output.
Definition: PB3D_ops.f90:695
grid_vars::min_par_x
real(dp), public min_par_x
min. of parallel coordinate [ ] in field-aligned grid
Definition: grid_vars.f90:24
num_vars::rich_restart_lvl
integer, public rich_restart_lvl
starting Richardson level (0: none [default])
Definition: num_vars.f90:173
helena_vars::z_h
real(dp), dimension(:,:), allocatable, public z_h
height (yout)
Definition: HELENA_vars.f90:34
eq_ops::print_output_eq
Print equilibrium quantities to an output file:
Definition: eq_ops.f90:90
html
The last line will be deleted in html
Definition: mainpage.dox:35
output_ops::draw_ex
subroutine, public draw_ex(var_names, draw_name, nplt, draw_dim, plot_on_screen, ex_plot_style, data_name, draw_ops, extra_ops, is_animated, ranges, delay, persistent)
Use external program to draw a plot.
Definition: output_ops.f90:1079
num_utilities::derivs
integer function, dimension(:,:), allocatable, public derivs(order, dims)
Returns derivatives of certain order.
Definition: num_utilities.f90:2246
grid_ops::magn_grid_plot
integer function, public magn_grid_plot(grid)
Plots the grid in real 3-D space.
Definition: grid_ops.f90:1115
output_ops::plot_hdf5
Prints variables vars with names var_names in an HDF5 file with name c file_name and accompanying XDM...
Definition: output_ops.f90:137
driver_eq
Driver of the equilibrium part of PB3D.
Definition: driver_eq.f90:4
num_vars::plot_b
logical, public plot_b
whether to plot the magnetic field in real coordinates
Definition: num_vars.f90:104
num_vars::eq_style
integer, public eq_style
either 1 (VMEC) or 2 (HELENA)
Definition: num_vars.f90:89
num_vars::plot_j
logical, public plot_j
whether to plot the current in real coordinates
Definition: num_vars.f90:105
num_vars::plot_kappa
logical, public plot_kappa
whether to plot curvature
Definition: num_vars.f90:107
mpi_utilities::wait_mpi
integer function, public wait_mpi()
Wait for all processes, wrapper to MPI barrier.
Definition: MPI_utilities.f90:744
num_utilities
Numerical utilities.
Definition: num_utilities.f90:4
num_vars::alpha_style
integer, public alpha_style
style for alpha (1: one field line, many turns, 2: many field lines, one turn)
Definition: num_vars.f90:100
messages::writo
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition: messages.f90:275
messages
Numerical utilities related to giving output.
Definition: messages.f90:4
helena_vars
Variables that have to do with HELENA quantities.
Definition: HELENA_vars.f90:4
pb3d_ops
Operations on PB3D output.
Definition: PB3D_ops.f90:8
num_vars::pi
real(dp), parameter, public pi
Definition: num_vars.f90:83
pb3d_ops::reconstruct_pb3d_eq_1
integer function, public reconstruct_pb3d_eq_1(grid_eq, eq, data_name, lim_pos)
Reconstructs the equilibrium variables from PB3D HDF5 output.
Definition: PB3D_ops.f90:597
eq_ops::kappa_plot
integer function, public kappa_plot(grid_eq, eq_1, eq_2, rich_lvl, XYZ)
Plots the curvature.
Definition: eq_ops.f90:5971
vac_vars::vac_type
vacuum type
Definition: vac_vars.f90:46
num_vars::jump_to_sol
logical, public jump_to_sol
jump to solution
Definition: num_vars.f90:141
grid_vars
Variables pertaining to the different grids used.
Definition: grid_vars.f90:4
grid_ops::calc_ang_grid_eq_b
integer function, public calc_ang_grid_eq_b(grid_eq, eq, only_half_grid)
Calculate equilibrium grid that follows magnetic field lines.
Definition: grid_ops.f90:798
pb3d_ops::reconstruct_pb3d_grid
integer function, public reconstruct_pb3d_grid(grid, data_name, rich_lvl, tot_rich, lim_pos, grid_limits)
Reconstructs grid variables from PB3D HDF5 output.
Definition: PB3D_ops.f90:442
grid_ops::setup_grid_eq
integer function, public setup_grid_eq(grid_eq, eq_limits)
Sets up the equilibrium grid.
Definition: grid_ops.f90:529
messages::lvl_ud
subroutine, public lvl_ud(inc)
Increases/decreases lvl of output.
Definition: messages.f90:254
input_utilities::get_int
integer function, public get_int(lim_lo, lim_hi, ind)
Queries for user input for an integer value, where allowable range can be provided as well.
Definition: input_utilities.f90:152
input_utilities::pause_prog
subroutine, public pause_prog(ind)
Pauses the running of the program.
Definition: input_utilities.f90:226
driver_eq::run_driver_eq
integer function, public run_driver_eq(grid_eq_out, grid_eq_B_out, eq_1_out, eq_2_out, vac)
Main driver of PB3D equilibrium part.
Definition: driver_eq.f90:49
num_vars::use_pol_flux_f
logical, public use_pol_flux_f
whether poloidal flux is used in F coords.
Definition: num_vars.f90:114
rich_vars::rich_lvl
integer, public rich_lvl
current level of Richardson extrapolation
Definition: rich_vars.f90:19
num_vars::eq_jobs_lims
integer, dimension(:,:), allocatable, public eq_jobs_lims
data about eq jobs: [ , ] for all jobs
Definition: num_vars.f90:77
grid_vars::n_alpha
integer, public n_alpha
nr. of field-lines
Definition: grid_vars.f90:23
output_ops
Operations concerning giving output, on the screen as well as in output files.
Definition: output_ops.f90:5
num_vars::plot_flux_q
logical, public plot_flux_q
whether to plot flux quantities in real coordinates
Definition: num_vars.f90:106
eq_ops::flux_q_plot
integer function, public flux_q_plot(grid_eq, eq)
Plots the flux quantities in the solution grid.
Definition: eq_ops.f90:3810
input_utilities
Numerical utilities related to input.
Definition: input_utilities.f90:4
grid_ops::redistribute_output_grid
integer function, public redistribute_output_grid(grid, grid_out, no_outer_trim)
Redistribute a grid to match the normal distribution of solution grid.
Definition: grid_ops.f90:995
eq_vars::eq_2_type
metric equilibrium type
Definition: eq_vars.f90:114
eq_ops
Operations on the equilibrium variables.
Definition: eq_ops.f90:4
grid_ops
Operations that have to do with the grids and different coordinate systems.
Definition: grid_ops.f90:4