Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_gyroaverage_2d_polar_computation.F90
Go to the documentation of this file.
1 !**************************************************************
2 ! Copyright INRIA
3 ! Authors :
4 ! CALVI project team
5 !
6 ! This code SeLaLib (for Semi-Lagrangian-Library)
7 ! is a parallel library for simulating the plasma turbulence
8 ! in a tokamak.
9 !
10 ! This software is governed by the CeCILL-B license
11 ! under French law and abiding by the rules of distribution
12 ! of free software. You can use, modify and redistribute
13 ! the software under the terms of the CeCILL-B license as
14 ! circulated by CEA, CNRS and INRIA at the following URL
15 ! "http://www.cecill.info".
16 !**************************************************************
17 
19 #include "sll_working_precision.h"
20 #include "sll_memory.h"
21 #include "sll_assert.h"
24  implicit none
25 
26  sll_int32, parameter :: sll_gyroaverage_pade = 0
27 
28  sll_int32, parameter :: sll_gyroaverage_hermite = 10
29  sll_int32, parameter :: sll_gyroaverage_hermite_c1 = 11
30  sll_int32, parameter :: sll_gyroaverage_hermite_c1_precompute = 12
31  sll_int32, parameter :: sll_gyroaverage_hermite_c1_with_invariance = 13
32 
33  sll_int32, parameter :: sll_gyroaverage_splines = 20
34  sll_int32, parameter :: sll_gyroaverage_splines_precompute = 21
35  sll_int32, parameter :: sll_gyroaverage_splines_with_invariance = 22
36  sll_int32, parameter :: sll_gyroaverage_splines_precompute_with_fft = 23
37 
39 
40  type(sll_plan_gyroaverage_polar), pointer :: gyro
41  sll_int32 :: gyroaverage_case
42  sll_real64 :: eta_min(2)
43  sll_real64 :: eta_max(2)
44  sll_int32 :: nc(2)
45  sll_int32 :: n_points
46  sll_int32 :: interp_degree(2)
47 
48  contains
49  procedure, pass(gyroaverage) :: initialize => &
51  procedure, pass(gyroaverage) :: compute_gyroaverage => &
53 
55 
56 contains
58  eta_min, &
59  eta_max, &
60  Nc, &
61  N_points, &
62  interp_degree, &
63  gyroaverage_case) &
64  result(gyroaverage)
65 
66  type(gyroaverage_2d_polar_computation), pointer :: gyroaverage
67  sll_real64, intent(in) :: eta_min(2)
68  sll_real64, intent(in) :: eta_max(2)
69  sll_int32, intent(in) :: nc(2)
70  sll_int32, optional :: n_points
71  sll_int32, optional :: interp_degree(2)
72  sll_int32, optional :: gyroaverage_case
73  sll_int32 :: ierr
74 
75  sll_allocate(gyroaverage, ierr)
77  gyroaverage, &
78  eta_min, &
79  eta_max, &
80  nc, &
81  n_points, &
82  interp_degree, &
83  gyroaverage_case)
84 
86 
88  gyroaverage, &
89  eta_min, &
90  eta_max, &
91  Nc, &
92  N_points, &
93  interp_degree, &
94  gyroaverage_case)
95  class(gyroaverage_2d_polar_computation) :: gyroaverage
96  sll_real64, intent(in) :: eta_min(2)
97  sll_real64, intent(in) :: eta_max(2)
98  sll_int32, intent(in) :: nc(2)
99  sll_int32, optional :: n_points
100  sll_int32, optional :: interp_degree(2)
101  sll_int32, optional :: gyroaverage_case
102  sll_int32 :: ierr
103 
104  gyroaverage%eta_min = eta_min
105  gyroaverage%eta_max = eta_max
106  gyroaverage%Nc = nc
107 
108  if (.not. (present(n_points))) then
109  gyroaverage%N_points = 4
110  else
111  gyroaverage%N_points = n_points
112  end if
113 
114  if (.not. (present(interp_degree))) then
115  gyroaverage%interp_degree(1) = 3
116  gyroaverage%interp_degree(2) = 3
117  else
118  gyroaverage%interp_degree = interp_degree
119  end if
120 
121  if (.not. (present(gyroaverage_case))) then
122  gyroaverage%gyroaverage_case = sll_gyroaverage_hermite
123  else
124  select case (gyroaverage_case)
125  case (sll_gyroaverage_pade)
134  case default
135  print *, '#bad value of gyroaverage_case=', gyroaverage%gyroaverage_case
136  print *, '#not implemented'
137  print *, '#in initialize_gyroaverage_2d_polar_computation'
138  stop
139  end select
140  gyroaverage%gyroaverage_case = gyroaverage_case
141  end if
142 
144 
145  subroutine compute_gyroaverage_2d_polar(gyroaverage, larmor_rad, f, Jf)
146  class(gyroaverage_2d_polar_computation), target :: gyroaverage
147  sll_real64, intent(in) :: larmor_rad
148  sll_real64, dimension(:, :), intent(in) :: f
149  sll_real64, dimension(:, :), intent(out) :: jf
150 
151  select case (gyroaverage%gyroaverage_case)
152 ! case (SLL_GYROAVERAGE_PADE)
153 ! call compute_gyroaverage_pade_polar(gyroaverage%gyro,f,larmor_rad)
154 ! case (SLL_GYROAVERAGE_HERMITE)
155 ! call compute_gyroaverage_points_polar_hermite(gyroaverage%gyro,f,larmor_rad)
156 ! case (SLL_GYROAVERAGE_HERMITE_C1)
157 ! call compute_gyroaverage_points_polar_hermite_c1(gyroaverage%gyro,f,larmor_rad)
158 ! case (SLL_GYROAVERAGE_HERMITE_C1_PRECOMPUTE)
159 ! call pre_compute_gyroaverage_polar_hermite_c1(gyroaverage%gyro,larmor_rad)
160 ! call compute_gyroaverage_pre_compute_polar_hermite_c1(gyroaverage%gyro,f)
161 ! case (SLL_GYROAVERAGE_HERMITE_C1_WITH_INVARIANCE)
162 ! call compute_gyroaverage_points_polar_with_invar_hermite_c1(gyroaverage%gyro,f,larmor_rad)
163 ! case (SLL_GYROAVERAGE_SPLINES)
164 ! call compute_gyroaverage_points_polar_spl(gyroaverage%gyro,f,larmor_rad)
165 ! case (SLL_GYROAVERAGE_SPLINES_PRECOMPUTE)
166 ! call pre_compute_gyroaverage_polar_spl(gyroaverage%gyro,larmor_rad)
167 ! call compute_gyroaverage_pre_compute_polar_spl(gyroaverage%gyro,f)
168 ! case (SLL_GYROAVERAGE_SPLINES_WITH_INVARIANCE)
169 ! call compute_gyroaverage_points_polar_with_invar_spl(gyroaverage%gyro,f,larmor_rad)
170 ! case (SLL_GYROAVERAGE_SPLINES_PRECOMPUTE_WITH_FFT)
171 ! call pre_compute_gyroaverage_polar_spl_FFT(gyroaverage%gyro,larmor_rad)
172 ! call compute_gyroaverage_pre_compute_polar_spl_FFT(gyroaverage%gyro,f)
173  case default
174  print *, '#bad value of gyroaverage_case=', gyroaverage%gyroaverage_case
175  print *, '#not implemented'
176  print *, 'in compute_gyroaverage_2d_polar'
177  stop
178  end select
179 
180  jf = f
181 
182  end subroutine compute_gyroaverage_2d_polar
183 
subroutine initialize_gyroaverage_2d_polar_computation(gyroaverage, eta_min, eta_max, Nc, N_points, interp_degree, gyroaverage_case)
type(gyroaverage_2d_polar_computation) function, pointer new_gyroaverage_2d_polar_computation(eta_min, eta_max, Nc, N_points, interp_degree, gyroaverage_case)
subroutine compute_gyroaverage_2d_polar(gyroaverage, larmor_rad, f, Jf)
    Report Typos and Errors