PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
Loading...
Searching...
No Matches
HELENA_vars.f90
Go to the documentation of this file.
1!------------------------------------------------------------------------------!
2!> Variables that have to do with HELENA quantities.
3!------------------------------------------------------------------------------!
5#include <PB3D_macros.h>
6 use num_vars, only: pi
8 use output_ops
9 use messages
10 use num_vars, only: dp, max_str_ln
11 use grid_vars, only: grid_type
12 use x_vars, only: x_1_type, x_2_type
13
14 implicit none
15 private
16 public dealloc_hel, &
19
20 ! global variables
21 real(dp) :: rmtog_h !< R_geo/R_mag
22 real(dp) :: bmtog_h !< B_geo/B_mag
23 real(dp), allocatable :: chi_h(:) !< poloidal angle
24 real(dp), allocatable :: flux_p_h(:,:) !< poloidal flux
25 real(dp), allocatable :: flux_t_h(:,:) !< toroidal flux
26 real(dp), allocatable :: pres_h(:,:) !< pressure profile
27 real(dp), allocatable :: q_saf_h(:,:) !< safety factor
28 real(dp), allocatable :: rot_t_h(:,:) !< rotational transform
29 real(dp), allocatable :: rbphi_h(:,:) !< \f$R B_\phi (= F) \f$
30 real(dp), allocatable :: h_h_11(:,:) !< upper metric factor \f$h_{11}\f$ (\c gem11)
31 real(dp), allocatable :: h_h_12(:,:) !< upper metric factor \f$h_{12}\f$ (\c gem12)
32 real(dp), allocatable :: h_h_33(:,:) !< upper metric factor \f$h_{32}\f$ (1 / \c gem12)
33 real(dp), allocatable :: r_h(:,:) !< major radius \f$R\f$ (xout)
34 real(dp), allocatable :: z_h(:,:) !< height \f$Z\f$ (yout)
35 integer :: nchi !< nr. of poloidal points
36 integer :: ias !< 0 if top-bottom symmetric, 1 if not
37
38contains
39 !> Deallocates HELENA quantities that are not used any more.
40 subroutine dealloc_hel
41#if ldebug
42 use num_vars, only: rank, print_mem_usage
43
44 ! local variables
45 integer :: mem_diff ! difference in memory
46
47 ! memory usage before deallocation
48 if (print_mem_usage) mem_diff = get_mem_usage()
49#endif
50
51 ! deallocate
52 deallocate(chi_h)
53 deallocate(flux_p_h)
54 deallocate(flux_t_h)
55 deallocate(pres_h)
56 deallocate(q_saf_h)
57 deallocate(rot_t_h)
58 deallocate(rbphi_h)
59 deallocate(r_h)
60 deallocate(z_h)
61 deallocate(h_h_11)
62 deallocate(h_h_12)
63 deallocate(h_h_33)
64
65#if ldebug
66 ! memory usage difference after deallocation
67 if (print_mem_usage) then
68 mem_diff = mem_diff - get_mem_usage()
69 call writo('Rank '//trim(i2str(rank))//' liberated '//&
70 &trim(i2str(mem_diff))//'kB deallocating HELENA')
71 end if
72#endif
73 end subroutine dealloc_hel
74end module helena_vars
Variables pertaining to the different grids used.
Definition grid_vars.f90:4
Variables that have to do with HELENA quantities.
integer, public ias
0 if top-bottom symmetric, 1 if not
integer, public nchi
nr. of poloidal points
real(dp), dimension(:,:), allocatable, public r_h
major radius (xout)
real(dp), dimension(:,:), allocatable, public h_h_33
upper metric factor (1 / gem12)
real(dp), dimension(:,:), allocatable, public rbphi_h
real(dp), dimension(:,:), allocatable, public pres_h
pressure profile
real(dp), dimension(:,:), allocatable, public z_h
height (yout)
real(dp), dimension(:,:), allocatable, public q_saf_h
safety factor
real(dp), dimension(:), allocatable, public chi_h
poloidal angle
real(dp), public bmtog_h
B_geo/B_mag.
real(dp), dimension(:,:), allocatable, public h_h_12
upper metric factor (gem12)
real(dp), dimension(:,:), allocatable, public flux_p_h
poloidal flux
real(dp), dimension(:,:), allocatable, public h_h_11
upper metric factor (gem11)
subroutine, public dealloc_hel
Deallocates HELENA quantities that are not used any more.
real(dp), dimension(:,:), allocatable, public rot_t_h
rotational transform
real(dp), public rmtog_h
R_geo/R_mag.
real(dp), dimension(:,:), allocatable, public flux_t_h
toroidal flux
Numerical utilities related to giving output.
Definition messages.f90:4
integer function, public get_mem_usage()
Returns the memory usage in kilobytes.
Definition messages.f90:554
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition messages.f90:275
Numerical variables used by most other modules.
Definition num_vars.f90:4
integer, parameter, public dp
double precision
Definition num_vars.f90:46
real(dp), parameter, public pi
Definition num_vars.f90:83
logical, public print_mem_usage
print memory usage is printed
Definition num_vars.f90:149
integer, parameter, public max_str_ln
maximum length of strings
Definition num_vars.f90:50
integer, public rank
MPI rank.
Definition num_vars.f90:68
Operations concerning giving output, on the screen as well as in output files.
Definition output_ops.f90:5
Operations on strings.
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Variables pertaining to the perturbation quantities.
Definition X_vars.f90:4
Type for grids.
Definition grid_vars.f90:59
vectorial perturbation type
Definition X_vars.f90:51
tensorial perturbation type
Definition X_vars.f90:81