Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
Derived types and interfaces | Functions/Subroutines | Variables
sll_m_utilities Module Reference

Description

Some common numerical utilities.

Derived types and interfaces

interface  sll_o_display
 Functions to display on screen matrix or vector. More...
 
interface  sll_o_factorial
 Return factorial. More...
 

Functions/Subroutines

logical function, public sll_f_is_power_of_two (n)
 Check if an integer is equal to. More...
 
logical function, public sll_f_is_even (n)
 Check if an integer is even. More...
 
integer(kind=i64) function factorial_int32 (n)
 It would have been nice to declare the next functions as 'pure' functions, but it is safer to be able to indicate when their arguments have fallen out of range as this number is so limited anyway. More...
 
integer(kind=i64) function factorial_int64 (n)
 It would have been nice to declare the next functions as 'pure' functions, but it is safer to be able to indicate when their arguments have fallen out of range as this number is so limited anyway. More...
 
subroutine, public sll_s_int2string (istep, cstep)
 Convert an integer < 9999 to a 4 characters string. More...
 
subroutine, public sll_s_new_file_id (file_id, error)
 Get a file unit number free before creating a file. More...
 
subroutine display_vector_real (array, real_format)
 Display a vector to screen. More...
 
subroutine display_vector_integer (array, integer_format)
 Display a vector to screen. More...
 
subroutine display_matrix_2d_real (array, real_format)
 Display matrix to screen. More...
 
subroutine, public sll_s_display_matrix_2d_integer (array, integer_format)
 Display matrix to screen. More...
 
subroutine initialize_file (data_file_id, thf_file_id)
 Subroutine to open data file for slv2d and create the thf.dat file to write results. More...
 
subroutine time_history (file_id, desc, fformat, array)
 Routine from slv2d to write diagnostics. More...
 
subroutine, public sll_s_mpe_decomp1d (n, numprocs, myid, s, e)
 From the MPE library. More...
 
subroutine, public sll_s_pfenvelope (S, t, tflat, tL, tR, twL, twR, t0, turn_drive_off)
 S: the wave form at a given point in time. This wave form is not scaled (its maximum value is 1). t: the time at which the envelope is being evaluated tflat, tL, tR, twL, twR, tstart, t0: the parameters defining the envelope, defined in the main portion of this program. turn_drive_off: 1 if the drive should be turned off after a time tflat, and 0 otherwise. More...
 
subroutine, public sll_s_compute_bloc (bloc_coord, bloc_index, N)
 
subroutine, public sll_s_compute_mesh_from_bloc (bloc_coord, bloc_index, node_positions)
 
logical function, public sll_f_query_environment (env_variable, default_value)
 Query an environment variable for the values on,off,1,0,true,false and return the result as a logical. More...
 
pure subroutine, public sll_s_new_array_linspace (array, vmin, vmax, endpoint, step)
 Equivalent to numpy.linspace @contact Yaman Güçlü, IPP Garching. More...
 

Variables

integer, parameter, public sll_p_byte_size = selected_int_kind(0)
 kind of integers More...
 
logical flag = .true.
 

Function/Subroutine Documentation

◆ display_matrix_2d_real()

subroutine sll_m_utilities::display_matrix_2d_real ( real(kind=f64), dimension(:, :), intent(in)  array,
character(len=*), intent(in)  real_format 
)
private

Display matrix to screen.

Definition at line 253 of file sll_m_utilities.F90.

◆ display_vector_integer()

subroutine sll_m_utilities::display_vector_integer ( integer(kind=i32), dimension(:), intent(in)  array,
character(len=*), intent(in)  integer_format 
)
private

Display a vector to screen.

Definition at line 235 of file sll_m_utilities.F90.

◆ display_vector_real()

subroutine sll_m_utilities::display_vector_real ( real(kind=f64), dimension(:), intent(in)  array,
character(len=*), intent(in)  real_format 
)
private

Display a vector to screen.

Definition at line 217 of file sll_m_utilities.F90.

◆ factorial_int32()

integer(kind=i64) function sll_m_utilities::factorial_int32 ( integer(kind=i32), intent(in)  n)
private

It would have been nice to declare the next functions as 'pure' functions, but it is safer to be able to indicate when their arguments have fallen out of range as this number is so limited anyway.

Definition at line 121 of file sll_m_utilities.F90.

◆ factorial_int64()

integer(kind=i64) function sll_m_utilities::factorial_int64 ( integer(kind=i64), intent(in)  n)
private

It would have been nice to declare the next functions as 'pure' functions, but it is safer to be able to indicate when their arguments have fallen out of range as this number is so limited anyway.

Definition at line 146 of file sll_m_utilities.F90.

◆ initialize_file()

subroutine sll_m_utilities::initialize_file ( integer(kind=i32), intent(out)  data_file_id,
integer(kind=i32), intent(out)  thf_file_id 
)
private

Subroutine to open data file for slv2d and create the thf.dat file to write results.

Parameters
[out]data_file_idnamelist file for slv2d
[out]thf_file_idthf file for energy plot

Definition at line 296 of file sll_m_utilities.F90.

Here is the call graph for this function:

◆ sll_f_is_even()

logical function, public sll_m_utilities::sll_f_is_even ( integer(kind=i32), intent(in)  n)

Check if an integer is even.

Definition at line 105 of file sll_m_utilities.F90.

◆ sll_f_is_power_of_two()

logical function, public sll_m_utilities::sll_f_is_power_of_two ( integer(kind=i64), intent(in)  n)

Check if an integer is equal to.

\[2^n\]

Definition at line 91 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_f_query_environment()

logical function, public sll_m_utilities::sll_f_query_environment ( character(len=*), intent(in)  env_variable,
logical, intent(in)  default_value 
)

Query an environment variable for the values on,off,1,0,true,false and return the result as a logical.

Parameters
[in]env_variableenvironment variable to be checked
[in]default_valuedefault value to be checked agains

Definition at line 537 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_compute_bloc()

subroutine, public sll_m_utilities::sll_s_compute_bloc ( real(kind=f64), dimension(2), intent(inout)  bloc_coord,
integer(kind=i32), dimension(3), intent(inout)  bloc_index,
integer(kind=i32), intent(in)  N 
)
  • Input:
    • a=bloc_coord(1) b=bloc_coord(2)
    • (a,b) subset (0,1) is the refine zone
    • bloc_index(1) = density of points in (0,a)
    • bloc_index(2) = density of points in (a,b)
    • bloc_index(3) = density of points in (b,1)

Output:

  • 0<=i1<i1+N_fine<=N and x(i1)=a, x(i1+N_fine)=b (approx), x(0)=0, x(N)=1
  • bloc_coord(1) = x(i1)
  • bloc_coord(2) = x(i1+N_fine)
  • bloc_index(1) = i1
  • bloc_index(2) = N_fine
  • bloc_index(3) = N-i1-N_fine

Definition at line 435 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_compute_mesh_from_bloc()

subroutine, public sll_m_utilities::sll_s_compute_mesh_from_bloc ( real(kind=f64), dimension(2), intent(in)  bloc_coord,
integer(kind=i32), dimension(3), intent(in)  bloc_index,
real(kind=f64), dimension(:), intent(out)  node_positions 
)
  • Input:

    • x1=bloc_coord(1),x2=bloc_coord(2)
    • with 0<i1<i2<N i1=bloc_index(1), i2=i1+bloc_index(2)
    • N=bloc_index(1)+bloc_index(2)+bloc_index(3)

    Output:

    • node_positions(1:N+1)
    • with constraints node_positions(i1+1)=x1,node_positions(i2+1)=x2
    • node_positions(1)=0, node_positions(N+1)=1

Definition at line 496 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_display_matrix_2d_integer()

subroutine, public sll_m_utilities::sll_s_display_matrix_2d_integer ( integer(kind=i32), dimension(:, :), intent(in)  array,
character(len=*), intent(in)  integer_format 
)

Display matrix to screen.

Definition at line 274 of file sll_m_utilities.F90.

◆ sll_s_int2string()

subroutine, public sll_m_utilities::sll_s_int2string ( integer, intent(in)  istep,
character(len=*), intent(out)  cstep 
)

Convert an integer < 9999 to a 4 characters string.

Parameters
[in]istepinput integer
[out]cstepoutput string

Definition at line 169 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_mpe_decomp1d()

subroutine, public sll_m_utilities::sll_s_mpe_decomp1d ( integer(kind=i32), intent(in)  n,
integer(kind=i32), intent(in)  numprocs,
integer(kind=i32), intent(in)  myid,
integer(kind=i32), intent(out)  s,
integer(kind=i32), intent(out)  e 
)

From the MPE library.

This file contains a routine for producing a decomposition of a 1-d array when given a number of processors. It may be used in "direct" product decomposition. The values returned assume a "global" domain in [1:n]

Definition at line 350 of file sll_m_utilities.F90.

◆ sll_s_new_array_linspace()

pure subroutine, public sll_m_utilities::sll_s_new_array_linspace ( real(wp), dimension(:), intent(out)  array,
real(wp), intent(in)  vmin,
real(wp), intent(in)  vmax,
logical, intent(in), optional  endpoint,
real(wp), intent(out), optional  step 
)

Equivalent to numpy.linspace @contact Yaman Güçlü, IPP Garching.

Parameters
[in]vminMin value of interval
[in]vmaxMax value of interval
[in]endpointFlag: include endpoint in array? (default=true)
[out]arrayArray to be created, with linearly increasing values
[out]stepStep size (

Definition at line 568 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_new_file_id()

subroutine, public sll_m_utilities::sll_s_new_file_id ( integer(kind=i32), intent(out)  file_id,
integer(kind=i32), intent(out)  error 
)

Get a file unit number free before creating a file.

Parameters
[out]file_idfile unit number
[out]errorerror code

Definition at line 190 of file sll_m_utilities.F90.

Here is the caller graph for this function:

◆ sll_s_pfenvelope()

subroutine, public sll_m_utilities::sll_s_pfenvelope ( real(kind=f64), intent(out)  S,
real(kind=f64), intent(in)  t,
real(kind=f64), intent(in)  tflat,
real(kind=f64), intent(in)  tL,
real(kind=f64), intent(in)  tR,
real(kind=f64), intent(in)  twL,
real(kind=f64), intent(in)  twR,
real(kind=f64), intent(in)  t0,
logical, intent(in)  turn_drive_off 
)

S: the wave form at a given point in time. This wave form is not scaled (its maximum value is 1). t: the time at which the envelope is being evaluated tflat, tL, tR, twL, twR, tstart, t0: the parameters defining the envelope, defined in the main portion of this program. turn_drive_off: 1 if the drive should be turned off after a time tflat, and 0 otherwise.

Definition at line 379 of file sll_m_utilities.F90.

◆ time_history()

subroutine sll_m_utilities::time_history ( integer(kind=i32), intent(in)  file_id,
character(3), intent(in)  desc,
character(14), intent(in)  fformat,
real(kind=f64), dimension(:), intent(in)  array 
)
private

Routine from slv2d to write diagnostics.

Parameters
[in]file_idfile unit number
[in]descname of the diagnostics
[in]fformatfortran output format
[in]arraydata array

Definition at line 321 of file sll_m_utilities.F90.

Variable Documentation

◆ flag

logical flag = .true.
private
Parameters
logicalvariable used to print time history

Definition at line 81 of file sll_m_utilities.F90.

◆ sll_p_byte_size

integer, parameter, public sll_p_byte_size = selected_int_kind(0)

kind of integers

Definition at line 70 of file sll_m_utilities.F90.

    Report Typos and Errors