27 #include "sll_errors.h"
28 #include "sll_memory.h"
29 #include "sll_working_precision.h"
78 character(len=*),
intent(in) :: mesh_case
80 character(len=256) :: err_msg
82 select case (mesh_case)
83 case (
"SLL_POLAR_MESH")
85 case (
"SLL_POLAR_SHEAR_MESH")
87 case (
"SLL_D_SHAPED_MESH")
90 err_msg =
'bad mesh_case: '//trim(mesh_case)
91 sll_error(
'compute_num_params_mesh', trim(err_msg))
108 character(len=*),
intent(in) :: mesh_case
109 sll_real64,
intent(in) :: eta1_min
110 sll_real64,
intent(in) :: eta1_max
111 sll_real64,
intent(in) :: eta2_min
112 sll_real64,
intent(in) :: eta2_max
113 sll_real64,
intent(in) :: mesh_alpha(:)
114 sll_real64,
intent(out) :: params_mesh(:)
115 sll_int32,
intent(in) :: num_params_mesh
117 character(len=256) :: err_msg
119 if (
size(params_mesh) < num_params_mesh)
then
120 err_msg =
'bad size for params_mesh: '
121 sll_error(
'compute_params_mesh', trim(err_msg))
124 params_mesh(1:num_params_mesh) = 0._f64
126 select case (mesh_case)
127 case (
"SLL_POLAR_MESH")
128 case (
"SLL_POLAR_SHEAR_MESH")
129 params_mesh(1) = mesh_alpha(1)
130 params_mesh(2) = mesh_alpha(2)
131 case (
"SLL_D_SHAPED_MESH")
132 params_mesh(1:5) = mesh_alpha(1:5)
133 params_mesh(6) = eta1_min
134 params_mesh(7) = eta1_max
135 params_mesh(8) = eta2_min
136 params_mesh(9) = eta2_max
138 err_msg =
'bad mesh_case: '//trim(mesh_case)
139 sll_error(
'compute_params_mesh', trim(err_msg))
153 character(len=*),
intent(in) :: mesh_case
155 sll_real64,
intent(out) :: params_mesh(:)
156 sll_int32,
intent(in) :: num_params_mesh
159 character(len=256) :: err_msg
161 if (
size(params_mesh) < num_params_mesh)
then
162 err_msg =
'bad size for params_mesh: '
163 sll_error(
'select_transformation', trim(err_msg))
166 select case (mesh_case)
167 case (
"SLL_POLAR_MESH")
169 "analytic_polar_transformation", &
178 case (
"SLL_POLAR_SHEAR_MESH")
180 "analytic_polar_shear_transformation", &
189 case (
"SLL_D_SHAPED_MESH")
191 "analytic_D_SHAPED_transformation", &
201 err_msg =
'bad mesh_case: '//trim(mesh_case)
202 sll_error(
'select_transformation', trim(err_msg))
216 character(len=*),
intent(in) :: filename
221 sll_int32,
intent(in) :: proc_id
224 character(len=256) :: mesh_case
225 sll_int32 :: num_cells_eta1
226 sll_int32 :: num_cells_eta2
227 sll_real64 :: eta1_min
228 sll_real64 :: eta1_max
229 sll_real64 :: eta2_min
230 sll_real64 :: eta2_max
231 sll_real64 :: mesh_alpha1
232 sll_real64 :: mesh_alpha2
233 sll_real64 :: mesh_alpha3
234 sll_real64 :: mesh_alpha4
235 sll_real64 :: mesh_alpha5
236 sll_real64 :: mesh_alpha6
237 sll_int32 :: num_cells_x3
238 sll_int32 :: num_cells_x4
245 sll_int32 :: namelist_id
248 character(len=256) :: err_msg
249 sll_real64,
allocatable :: params_mesh(:)
250 sll_int32 :: num_params_mesh
251 sll_real64 :: mesh_alpha(6)
276 mesh_case =
"SLL_POLAR_MESH"
282 eta2_max = 6.283185307179586477_f64
292 z_max = 1506.759067_f64
297 open (unit=namelist_id, file=trim(filename)//
'.nml', iostat=io_stat)
298 if (io_stat /= 0)
then
299 err_msg =
'failed to open file '//trim(filename)//
'.nml'
300 sll_error(
'sll_s_init_dk_curv_mesh', trim(err_msg))
302 read (namelist_id, mesh)
304 if (proc_id == 0)
then
306 print *,
'#mesh_case=', trim(mesh_case)
307 print *,
'#num_cells_eta1=', num_cells_eta1
308 print *,
'#num_cells_eta2=', num_cells_eta2
309 print *,
'#eta1_min=', eta1_min
310 print *,
'#eta1_max=', eta1_max
311 print *,
'#eta2_min=', eta2_min
312 print *,
'#eta2_max=', eta2_max
313 print *,
'#mesh_alpha1=', mesh_alpha1
314 print *,
'#mesh_alpha2=', mesh_alpha2
315 print *,
'#mesh_alpha3=', mesh_alpha3
316 print *,
'#mesh_alpha4=', mesh_alpha4
317 print *,
'#mesh_alpha5=', mesh_alpha5
318 print *,
'#mesh_alpha6=', mesh_alpha6
319 print *,
'#num_cells_x3=', num_cells_x3
320 print *,
'#num_cells_x4=', num_cells_x4
321 print *,
'#z_min=', z_min
322 print *,
'#z_max=', z_max
323 print *,
'#v_min=', v_min
324 print *,
'#v_max=', v_max
338 sll_allocate(params_mesh(num_params_mesh), ierr)
339 mesh_alpha(1:3) = (/mesh_alpha1, mesh_alpha2, mesh_alpha3/)
340 mesh_alpha(4:6) = (/mesh_alpha4, mesh_alpha5, mesh_alpha6/)
Cartesian mesh basic types.
type(sll_t_cartesian_mesh_2d) function, pointer, public sll_f_new_cartesian_mesh_2d(num_cells1, num_cells2, eta1_min, eta1_max, eta2_min, eta2_max)
allocates the memory space for a new 2D cartesian mesh on the heap, initializes it with the given arg...
type(sll_t_cartesian_mesh_1d) function, pointer, public sll_f_new_cartesian_mesh_1d(num_cells, eta_min, eta_max)
allocates the memory space for a new 1D cartesian mesh on the heap, initializes it with the given arg...
initialization from dk_curv_mesh namelist this module is then used in sl_dk_3d1v_curv_field_aligned w...
subroutine, public sll_s_init_dk_curv_mesh(filename, m_x1x2, m_x3, m_x4, transformation, proc_id)
Initialize simulation from input file.
subroutine select_transformation(mesh_case, mesh_2d, params_mesh, num_params_mesh, transformation)
select transformation
subroutine compute_params_mesh(mesh_case, eta1_min, eta1_max, eta2_min, eta2_max, mesh_alpha, params_mesh, num_params_mesh)
compute params_mesh
integer(kind=i32) function compute_num_params_mesh(mesh_case)
compute num_params_mesh
Some common numerical utilities.
subroutine, public sll_s_new_file_id(file_id, error)
Get a file unit number free before creating a file.