20 #include "sll_assert.h"
21 #include "sll_memory.h"
22 #include "sll_working_precision.h"
68 sll_real64,
intent(in) :: x
77 subroutine init_n0_r(r_peak, inv_Ln, deltarn, n0_rmin, &
79 sll_real64,
intent(in) :: r_peak
80 sll_real64,
intent(in) :: inv_ln
81 sll_real64,
intent(in) :: deltarn
82 sll_real64,
intent(in) :: n0_rmin
83 sll_real64,
dimension(:),
intent(in) :: r_grid
84 sll_real64,
dimension(:),
intent(inout) :: n0_1d
88 sll_real64 :: etai, etai_mid
90 sll_real64 :: n0norm_tmp
91 sll_real64 :: deltarn_norm
94 lr = r_grid(nr) - r_grid(1)
95 dr = r_grid(2) - r_grid(1)
97 deltarn_norm = deltarn*lr
105 etai = r_grid(ir - 1)
106 etai_mid = etai + dr*0.5_f64
108 sech((etai_mid - r_peak)/deltarn_norm)**2
110 n0_1d(ir) = (1._f64 + tmp)/(1._f64 - tmp)*n0_1d(ir - 1)
117 n0norm_tmp = n0norm_tmp + n0_1d(ir)*r_grid(ir)
119 n0norm_tmp = n0norm_tmp + 0.5_f64* &
120 (n0_1d(1)*r_grid(1) + n0_1d(nr)*r_grid(nr))
122 n0norm_tmp = n0norm_tmp*2._f64*dr/ &
123 (r_grid(nr)**2 - r_grid(1)**2)
125 n0_1d(1:nr) = n0_1d(1:nr)/n0norm_tmp
141 sll_real64,
intent(in) :: x
142 sll_real64,
intent(in) :: y
143 sll_real64,
dimension(:),
intent(in) ::params_profil
150 kappa = params_profil(1)
151 delta = params_profil(2)
152 rx = params_profil(3)
153 r = sqrt(x**2 + y**2)
171 sll_real64,
intent(in) :: r
172 sll_real64,
dimension(:),
intent(in) :: params_profil
179 kappa = params_profil(1)
180 delta = params_profil(2)
181 rx = params_profil(3)
190 deltarT, T_rmin, T_scal, r_grid, T_1d)
191 sll_real64,
intent(in) :: r_peak
192 sll_real64,
intent(in) :: inv_lt
193 sll_real64,
intent(in) :: deltart
194 sll_real64,
intent(in) :: t_rmin
195 sll_real64,
intent(in) :: t_scal
196 sll_real64,
dimension(:),
intent(in) :: r_grid
197 sll_real64,
dimension(:),
intent(inout) :: t_1d
201 sll_real64 :: etai, etai_mid
203 sll_real64 :: w0, w1, tnorm_tmp
204 sll_real64 :: deltart_norm
207 lr = r_grid(nr) - r_grid(1)
208 dr = r_grid(2) - r_grid(1)
209 deltart_norm = deltart*lr
217 etai = r_grid(ir - 1)
218 etai_mid = etai + dr*0.5_f64
220 sech((etai_mid - r_peak)/deltart_norm)**2
222 t_1d(ir) = (1._f64 + tmp)/(1._f64 - tmp)*t_1d(ir - 1)
226 ir = int((r_peak - r_grid(1))/dr)
227 w1 = (r_peak - r_grid(ir))/dr
229 tnorm_tmp = w0*t_1d(ir) + w1*t_1d(ir + 1)
230 t_1d(1:nr) = (t_1d(1:nr)/tnorm_tmp)/t_scal
237 sll_real64,
dimension(:),
intent(in) :: r_grid
238 sll_real64,
dimension(:),
intent(in) :: theta_grid
239 sll_real64,
dimension(:, :),
intent(inout) :: b_rtheta
241 sll_int32 :: ir, itheta
242 sll_int32 :: nr, ntheta
245 ntheta =
size(theta_grid, 1)
247 do itheta = 1, ntheta
249 b_rtheta(ir, itheta) = 1._f64
266 sll_real64,
intent(in) :: r
267 sll_real64,
intent(in) :: vpar
268 sll_real64,
intent(in) :: n0_r
269 sll_real64,
intent(in) :: ti_r
272 val = n0_r/sqrt(2._f64*
sll_p_pi*ti_r)* &
273 exp(-0.5_f64*vpar**2/ti_r)
283 r_grid, vpar_grid, n0_1d, Ti_1d, feq_2d)
284 sll_int32,
intent(in) :: nr
285 sll_int32,
intent(in) :: nvpar
286 sll_real64,
dimension(:),
intent(in) :: r_grid
287 sll_real64,
dimension(:),
intent(in) :: vpar_grid
288 sll_real64,
dimension(:),
intent(in) :: n0_1d
289 sll_real64,
dimension(:),
intent(in) :: ti_1d
290 sll_real64,
dimension(:, :),
intent(out) :: feq_2d
292 sll_int32 :: ir, ivpar
293 sll_real64 :: r, vpar, n0_r, ti_r
296 vpar = vpar_grid(ivpar)
310 xgrid_2d, ygrid_2d, func_xy)
311 sll_real64,
dimension(:),
intent(in) :: r_grid
312 sll_real64,
dimension(:),
intent(in) :: func_r
313 sll_real64,
dimension(:, :),
intent(in) :: xgrid_2d
314 sll_real64,
dimension(:, :),
intent(in) :: ygrid_2d
315 sll_real64,
dimension(:, :),
intent(out) :: func_xy
317 sll_int32 :: nr, npt1, npt2
319 sll_real64 :: r, x, y
324 npt1 =
size(xgrid_2d, 1)
325 npt2 =
size(xgrid_2d, 2)
328 r_grid(1), r_grid(nr), sll_p_hermite)
336 r = min(max(r, r_grid(1)), r_grid(nr))
347 func_rtheta, xgrid_2d, ygrid_2d, func_xy)
348 sll_real64,
dimension(:),
intent(in) :: r_grid
349 sll_real64,
dimension(:),
intent(in) :: theta_grid
350 sll_real64,
dimension(:, :),
intent(in) :: func_rtheta
351 sll_real64,
dimension(:, :),
intent(in) :: xgrid_2d
352 sll_real64,
dimension(:, :),
intent(in) :: ygrid_2d
353 sll_real64,
dimension(:, :),
intent(out) :: func_xy
355 sll_int32 :: nr, ntheta
356 sll_int32 :: npt1, npt2
358 sll_real64 :: r, theta, x, y
363 ntheta =
size(theta_grid, 1)
364 npt1 =
size(xgrid_2d, 1)
365 npt2 =
size(xgrid_2d, 2)
369 r_grid(1), r_grid(nr), &
370 theta_grid(1), theta_grid(ntheta), &
371 sll_p_hermite, sll_p_periodic)
379 r = min(max(r, r_grid(1)), r_grid(nr))
381 theta = modulo(theta, 2._f64*
sll_p_pi)
395 vpar_grid, n0_xy, Ti_xy, feq_xyvpar)
396 sll_real64,
dimension(:, :),
intent(in) :: xgrid_2d
397 sll_real64,
dimension(:, :),
intent(in) :: ygrid_2d
398 sll_real64,
dimension(:),
intent(in) :: vpar_grid
399 sll_real64,
dimension(:, :),
intent(in) :: n0_xy
400 sll_real64,
dimension(:, :),
intent(in) :: ti_xy
401 sll_real64,
dimension(:, :, :),
intent(out) :: feq_xyvpar
403 sll_int32 :: npt1, npt2, nvpar
404 sll_int32 :: ix, iy, ivpar
406 npt1 =
size(xgrid_2d, 1)
407 npt2 =
size(ygrid_2d, 2)
408 nvpar =
size(vpar_grid, 1)
413 feq_xyvpar(ix, iy, ivpar) = n0_xy(ix, iy)* &
414 exp(-0.5_f64*vpar_grid(ivpar)**2/ti_xy(ix, iy)) &
415 /sqrt(2._f64*
sll_p_pi*ti_xy(ix, iy))
Describe different boundary conditions.
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_pi
Provides capabilities for data and derivative interpolation with cubic B-splines and different bounda...
subroutine, public sll_s_cubic_spline_2d_compute_interpolant(data, spline)
Computes the spline coefficients for the given data. The coeffcients are first computed in the second...
subroutine, public sll_s_cubic_spline_1d_compute_interpolant(f, spline)
Computes the cubic spline coefficients corresponding to the 1D data array 'f'.
subroutine, public sll_s_cubic_spline_1d_init(self, num_points, xmin, xmax, bc_type, sl, sr, fast_algorithm)
Returns a pointer to a heap-allocated cubic spline object.
real(kind=f64) function, public sll_f_cubic_spline_1d_eval(x, spline)
returns the value of the interpolated image of the abscissa x, using the spline coefficients stored i...
real(kind=f64) function, public sll_f_cubic_spline_2d_eval(x1, x2, spline)
Returns the interpolated value of the image of the point (x1,x2) using the spline decomposition store...
subroutine, public sll_s_cubic_spline_1d_free(spline)
deallocate the sll_t_cubic_spline_1d object
subroutine, public sll_s_cubic_spline_2d_init(this, num_pts_x1, num_pts_x2, x1_min, x1_max, x2_min, x2_max, x1_bc_type, x2_bc_type, const_slope_x1_min, const_slope_x1_max, const_slope_x2_min, const_slope_x2_max, x1_min_slopes, x1_max_slopes, x2_min_slopes, x2_max_slopes)
subroutine, public sll_s_cubic_spline_2d_free(spline)
Initialisation of the distribution functioinit_fequilibrium_xyn for the drift-kinetic 4D simulation.
real(kind=f64) function compute_feq_val(r, vpar, n0_r, Ti_r)
real(kind=f64), dimension(1) whatever
subroutine, public sll_s_init_brtheta(r_grid, theta_grid, B_rtheta)
subroutine, public sll_s_init_fequilibrium(Nr, Nvpar, r_grid, vpar_grid, n0_1d, Ti_1d, feq_2d)
real(kind=f64) function sech(x)
real(kind=f64) function, public sll_f_profil_xy_exacte(x, y, params_profil)
subroutine, public sll_s_init_fequilibrium_xy(xgrid_2d, ygrid_2d, vpar_grid, n0_xy, Ti_xy, feq_xyvpar)
subroutine init_n0_r(r_peak, inv_Ln, deltarn, n0_rmin, r_grid, n0_1d)
real(kind=f64) function, public sll_f_init_exact_profile_r(r, params_profil)
subroutine function_xy_from_r(r_grid, func_r, xgrid_2d, ygrid_2d, func_xy)
subroutine init_t_r(r_peak, inv_LT, deltarT, T_rmin, T_scal, r_grid, T_1d)
subroutine, public sll_s_function_xy_from_rtheta(r_grid, theta_grid, func_rtheta, xgrid_2d, ygrid_2d, func_xy)
basic type for one-dimensional cubic spline data.
Basic type for one-dimensional cubic spline data.