PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
HELENA_vars.f90
Go to the documentation of this file.
1 !------------------------------------------------------------------------------!
3 !------------------------------------------------------------------------------!
4 module helena_vars
5 #include <PB3D_macros.h>
6  use num_vars, only: pi
7  use str_utilities
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
22  real(dp) :: bmtog_h
23  real(dp), allocatable :: chi_h(:)
24  real(dp), allocatable :: flux_p_h(:,:)
25  real(dp), allocatable :: flux_t_h(:,:)
26  real(dp), allocatable :: pres_h(:,:)
27  real(dp), allocatable :: q_saf_h(:,:)
28  real(dp), allocatable :: rot_t_h(:,:)
29  real(dp), allocatable :: rbphi_h(:,:)
30  real(dp), allocatable :: h_h_11(:,:)
31  real(dp), allocatable :: h_h_12(:,:)
32  real(dp), allocatable :: h_h_33(:,:)
33  real(dp), allocatable :: r_h(:,:)
34  real(dp), allocatable :: z_h(:,:)
35  integer :: nchi
36  integer :: ias
37 
38 contains
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
74 end module helena_vars
helena_vars::rbphi_h
real(dp), dimension(:,:), allocatable, public rbphi_h
Definition: HELENA_vars.f90:29
num_vars::dp
integer, parameter, public dp
double precision
Definition: num_vars.f90:46
num_vars
Numerical variables used by most other modules.
Definition: num_vars.f90:4
num_vars::max_str_ln
integer, parameter, public max_str_ln
maximum length of strings
Definition: num_vars.f90:50
helena_vars::rot_t_h
real(dp), dimension(:,:), allocatable, public rot_t_h
rotational transform
Definition: HELENA_vars.f90:28
str_utilities::i2str
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Definition: str_utilities.f90:18
helena_vars::q_saf_h
real(dp), dimension(:,:), allocatable, public q_saf_h
safety factor
Definition: HELENA_vars.f90:27
helena_vars::flux_p_h
real(dp), dimension(:,:), allocatable, public flux_p_h
poloidal flux
Definition: HELENA_vars.f90:24
messages::get_mem_usage
integer function, public get_mem_usage()
Returns the memory usage in kilobytes.
Definition: messages.f90:554
str_utilities
Operations on strings.
Definition: str_utilities.f90:4
grid_vars::grid_type
Type for grids.
Definition: grid_vars.f90:59
helena_vars::h_h_33
real(dp), dimension(:,:), allocatable, public h_h_33
upper metric factor (1 / gem12)
Definition: HELENA_vars.f90:32
helena_vars::r_h
real(dp), dimension(:,:), allocatable, public r_h
major radius (xout)
Definition: HELENA_vars.f90:33
helena_vars::flux_t_h
real(dp), dimension(:,:), allocatable, public flux_t_h
toroidal flux
Definition: HELENA_vars.f90:25
helena_vars::h_h_12
real(dp), dimension(:,:), allocatable, public h_h_12
upper metric factor (gem12)
Definition: HELENA_vars.f90:31
helena_vars::z_h
real(dp), dimension(:,:), allocatable, public z_h
height (yout)
Definition: HELENA_vars.f90:34
helena_vars::pres_h
real(dp), dimension(:,:), allocatable, public pres_h
pressure profile
Definition: HELENA_vars.f90:26
x_vars::x_2_type
tensorial perturbation type
Definition: X_vars.f90:81
num_vars::print_mem_usage
logical, public print_mem_usage
print memory usage is printed
Definition: num_vars.f90:149
helena_vars::dealloc_hel
subroutine, public dealloc_hel
Deallocates HELENA quantities that are not used any more.
Definition: HELENA_vars.f90:41
x_vars
Variables pertaining to the perturbation quantities.
Definition: X_vars.f90:4
helena_vars::h_h_11
real(dp), dimension(:,:), allocatable, public h_h_11
upper metric factor (gem11)
Definition: HELENA_vars.f90:30
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
num_vars::pi
real(dp), parameter, public pi
Definition: num_vars.f90:83
helena_vars::bmtog_h
real(dp), public bmtog_h
B_geo/B_mag.
Definition: HELENA_vars.f90:22
grid_vars
Variables pertaining to the different grids used.
Definition: grid_vars.f90:4
helena_vars::ias
integer, public ias
0 if top-bottom symmetric, 1 if not
Definition: HELENA_vars.f90:36
x_vars::x_1_type
vectorial perturbation type
Definition: X_vars.f90:51
helena_vars::chi_h
real(dp), dimension(:), allocatable, public chi_h
poloidal angle
Definition: HELENA_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::rank
integer, public rank
MPI rank.
Definition: num_vars.f90:68
helena_vars::nchi
integer, public nchi
nr. of poloidal points
Definition: HELENA_vars.f90:35
helena_vars::rmtog_h
real(dp), public rmtog_h
R_geo/R_mag.
Definition: HELENA_vars.f90:21