Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_nml_mesh_cart

Initialize of cartesian mesh from namelist

We propose a uniform way of initializing cartesian meshes from namelists

FIRST EXAMPLE
in namelist test.nml
&mesh_1d_unif_cart
num_cells = 32
eta_min = 0.
eta_max = 2.
/

!ADD_EXECUTABLE(my_prog my_prog.f90)
!TARGET_LINK_LIBRARIES(my_prog sll_nml_mesh_cart)
program my_prog
sll_s_nml_mesh_1d_unif_cart
implicit none
type(sll_t_cartesian_mesh_1d), pointer :: mesh
call sll_s_nml_mesh_1d_unif_cart( "test", mesh )
print *,'#mesh%num_cells=',mesh%num_cells
end program
Cartesian mesh basic types.
initialization of 1d uniform cartesian mesh from namelist

Information from mesh_1d_unif_cart in namelist file test.nml is stored in mesh

SECOND EXAMPLE
in namelist test.nml, we can also have another cartesian mesh corresponding for example to the second dimension
&mesh_1d_unif_cart_2
num_cells_2 = 32
eta_min_2 = 0.
eta_max_2 = 2.
/

!ADD_EXECUTABLE(my_prog my_prog.f90)
!TARGET_LINK_LIBRARIES(my_prog sll_nml_mesh_cart)
program my_prog
sll_s_nml_mesh_1d_unif_cart
implicit none
type(sll_t_cartesian_mesh_1d), pointer :: mesh
call sll_s_nml_mesh_1d_unif_cart( "test", mesh, clone="_2" )
print *,'#mesh%num_cells=',mesh%num_cells
end program

Information from mesh_1d_unif_cart_2 in namelist file test.nml is stored in mesh

THIRD EXAMPLE
We can also choose the mesh we want to initialize when we want to initialize an array (not a sll_t_cartesian_mesh_1d which is uniform)
Suppose that we have the following namelist file test.nml

&mesh_1d_cart_1
choice_1 = "landau"
/
&mesh_1d_landau_cart_1
num_cells_1 = 32
eta_min_1 = 0.
nbox_1 = 1
kmode_1 = 0.5
/
&mesh_1d_cart_2
choice_2 = "unif"
/
&mesh_1d_unif_cart_2
num_cells_2 = 32
eta_min_2 = -6.
eta_max_2 = 6.
/


and the following code

!ADD_EXECUTABLE(my_prog my_prog.f90)
!TARGET_LINK_LIBRARIES(my_prog sll_nml_mesh_cart)
program my_prog
sll_s_nml_mesh_1d_cart
implicit none
real(kind=f64), pointer :: x(:)
real(kind=f64), pointer :: v(:)
call sll_s_nml_mesh_1d_cart( "test", x, clone="_1" )
call sll_s_nml_mesh_1d_cart( "test", v, clone="_2" )
print *,'#num_cells=',size(x)-1,size(v)-1
end program
initialization of 1d cartesian mesh from namelist

Information from namelist file test.nml is stored in x and v .

Author
Michel Mehrenberger
Todo:
add initialization in 2D,3D,4D if needed
    Report Typos and Errors