124 #include "sll_errors.h"
125 #include "sll_memory.h"
126 #include "sll_working_precision.h"
147 sll_int32 :: num_cells
148 sll_real64 :: eta_min
151 character(len=256) :: label
153 procedure, pass(self) :: init => init_nml_mesh_1d_landau_cart
154 procedure, pass(self) :: init_1 => init_nml_mesh_1d_landau_cart_1
155 procedure, pass(self) :: init_2 => init_nml_mesh_1d_landau_cart_2
156 procedure, pass(self) :: init_3 => init_nml_mesh_1d_landau_cart_3
157 procedure, pass(self) :: init_4 => init_nml_mesh_1d_landau_cart_4
158 procedure, pass(self) :: init_clone => init_clone_nml_mesh_1d_landau_cart
189 character(len=*),
intent(in) :: filename
190 sll_real64,
pointer,
intent(out) :: array(:)
191 character(len=*),
intent(in),
optional :: clone
192 sll_int32,
intent(in),
optional :: proc_id
197 sll_int32 :: num_cells
198 sll_real64 :: eta_min
199 sll_real64 :: eta_max
200 sll_real64 :: delta_eta
202 if (
present(clone))
then
203 call self%init_clone(clone, filename, proc_id)
205 call self%init(filename, proc_id)
208 num_cells = self%num_cells
209 eta_min = self%eta_min
210 eta_max = eta_min + real(self%nbox, f64)*2._f64*
sll_p_pi/real(self%kmode, f64)
211 delta_eta = (eta_max - eta_min)/real(num_cells, f64)
213 sll_allocate(array(num_cells + 1), ierr)
214 do i = 1, num_cells + 1
215 array(i) = eta_min + real(i - 1, f64)*delta_eta
227 character(len=*),
intent(in) :: filename
229 character(len=*),
intent(in),
optional :: clone
230 sll_int32,
intent(in),
optional :: proc_id
234 sll_int32 :: num_cells
235 sll_real64 :: eta_min
236 sll_real64 :: eta_max
238 if (
present(clone))
then
239 call self%init_clone(clone, filename, proc_id)
241 call self%init(filename, proc_id)
244 num_cells = self%num_cells
245 eta_min = self%eta_min
246 eta_max = eta_min + real(self%nbox, f64)*2._f64*
sll_p_pi/real(self%kmode, f64)
265 character(len=*),
intent(in) :: filename
266 character(len=*),
intent(in),
optional :: clone
267 sll_int32,
intent(in),
optional :: proc_id
270 sll_int32 :: proc_id_loc
272 if (
present(clone))
then
273 call self%init_clone(clone, filename, proc_id)
275 call self%init(filename, proc_id)
278 if (
present(proc_id))
then
279 proc_id_loc = proc_id
284 if (proc_id_loc == 0)
then
285 print *,
'#nml_mesh_1d_landau_cart:'
287 print *,
'#label=', trim(self%label)
288 print *,
'#num_cells=', self%num_cells
289 print *,
'#eta_min=', self%eta_min
290 print *,
'#nbox=', self%nbox
291 print *,
'#kmode=', self%kmode
296 #ifndef DOXYGEN_SHOULD_SKIP_THIS
298 subroutine init_clone_nml_mesh_1d_landau_cart( &
304 character(len=*),
intent(in) :: clone
305 character(len=*),
intent(in) :: filename
306 sll_int32,
intent(in),
optional :: proc_id
308 character(len=256) :: err_msg
309 character(len=256) :: caller
311 caller =
'init_clone_nml_mesh_1d_landau_cart'
314 call self%init_1(filename, proc_id)
316 call self%init_2(filename, proc_id)
318 call self%init_3(filename, proc_id)
320 call self%init_4(filename, proc_id)
322 err_msg =
'bad value for clone'
323 sll_error(trim(caller), trim(err_msg))
326 end subroutine init_clone_nml_mesh_1d_landau_cart
328 subroutine init_nml_mesh_1d_landau_cart( &
333 character(len=*),
intent(in) :: filename
334 sll_int32,
intent(in),
optional :: proc_id
336 sll_int32 :: namelist_id
339 character(len=256) :: err_msg
340 character(len=256) :: caller
341 sll_int32 :: num_cells
342 sll_real64 :: eta_min
345 sll_int32 :: proc_id_loc
347 namelist /mesh_1d_landau_cart/ &
352 caller =
'init_nml_mesh_1d_landau_cart'
353 if (
present(proc_id))
then
354 proc_id_loc = proc_id
359 call set_default_values( &
368 file=trim(filename)//
'.nml', &
370 if (io_stat /= 0)
then
372 'failed to open first file '//trim(filename)//
'.nml'
373 sll_error(trim(caller), trim(err_msg))
376 read (namelist_id, mesh_1d_landau_cart)
377 self%label =
"no_label"
378 self%num_cells = num_cells
379 self%eta_min = eta_min
384 end subroutine init_nml_mesh_1d_landau_cart
386 subroutine init_nml_mesh_1d_landau_cart_1( &
391 character(len=*),
intent(in) :: filename
392 sll_int32,
intent(in),
optional :: proc_id
394 sll_int32 :: namelist_id
397 character(len=256) :: err_msg
398 character(len=256) :: caller
399 sll_int32 :: num_cells_1
400 sll_real64 :: eta_min_1
402 sll_real64 :: kmode_1
403 sll_int32 :: proc_id_loc
405 namelist /mesh_1d_landau_cart_1/ &
411 caller =
'init_nml_mesh_1d_landau_cart_1'
412 if (
present(proc_id))
then
413 proc_id_loc = proc_id
418 call set_default_values( &
427 file=trim(filename)//
'.nml', &
429 if (io_stat /= 0)
then
431 'failed to open first file '//trim(filename)//
'.nml'
432 sll_error(trim(caller), trim(err_msg))
435 read (namelist_id, mesh_1d_landau_cart_1)
437 self%num_cells = num_cells_1
438 self%eta_min = eta_min_1
443 end subroutine init_nml_mesh_1d_landau_cart_1
445 subroutine init_nml_mesh_1d_landau_cart_2( &
450 character(len=*),
intent(in) :: filename
451 sll_int32,
intent(in),
optional :: proc_id
453 sll_int32 :: namelist_id
456 character(len=256) :: err_msg
457 character(len=256) :: caller
458 sll_int32 :: num_cells_2
459 sll_real64 :: eta_min_2
461 sll_real64 :: kmode_2
462 sll_int32 :: proc_id_loc
464 namelist /mesh_1d_landau_cart_2/ &
470 caller =
'init_nml_mesh_1d_landau_cart_2'
471 if (
present(proc_id))
then
472 proc_id_loc = proc_id
477 call set_default_values( &
486 file=trim(filename)//
'.nml', &
488 if (io_stat /= 0)
then
490 'failed to open first file '//trim(filename)//
'.nml'
491 sll_error(trim(caller), trim(err_msg))
494 read (namelist_id, mesh_1d_landau_cart_2)
496 self%num_cells = num_cells_2
497 self%eta_min = eta_min_2
502 end subroutine init_nml_mesh_1d_landau_cart_2
504 subroutine init_nml_mesh_1d_landau_cart_3( &
509 character(len=*),
intent(in) :: filename
510 sll_int32,
intent(in),
optional :: proc_id
512 sll_int32 :: namelist_id
515 character(len=256) :: err_msg
516 character(len=256) :: caller
517 sll_int32 :: num_cells_3
518 sll_real64 :: eta_min_3
520 sll_real64 :: kmode_3
521 sll_int32 :: proc_id_loc
523 namelist /mesh_1d_landau_cart_3/ &
529 caller =
'init_nml_mesh_1d_landau_cart_3'
530 if (
present(proc_id))
then
531 proc_id_loc = proc_id
536 call set_default_values( &
545 file=trim(filename)//
'.nml', &
547 if (io_stat /= 0)
then
549 'failed to open first file '//trim(filename)//
'.nml'
550 sll_error(trim(caller), trim(err_msg))
553 read (namelist_id, mesh_1d_landau_cart_3)
555 self%num_cells = num_cells_3
556 self%eta_min = eta_min_3
561 end subroutine init_nml_mesh_1d_landau_cart_3
563 subroutine init_nml_mesh_1d_landau_cart_4( &
568 character(len=*),
intent(in) :: filename
569 sll_int32,
intent(in),
optional :: proc_id
571 sll_int32 :: namelist_id
574 character(len=256) :: err_msg
575 character(len=256) :: caller
576 sll_int32 :: num_cells_4
577 sll_real64 :: eta_min_4
579 sll_real64 :: kmode_4
580 sll_int32 :: proc_id_loc
582 namelist /mesh_1d_landau_cart_4/ &
588 caller =
'init_nml_mesh_1d_landau_cart_4'
589 if (
present(proc_id))
then
590 proc_id_loc = proc_id
595 call set_default_values( &
604 file=trim(filename)//
'.nml', &
606 if (io_stat /= 0)
then
608 'failed to open first file '//trim(filename)//
'.nml'
609 sll_error(trim(caller), trim(err_msg))
612 read (namelist_id, mesh_1d_landau_cart_4)
614 self%num_cells = num_cells_4
615 self%eta_min = eta_min_4
620 end subroutine init_nml_mesh_1d_landau_cart_4
622 subroutine set_default_values( &
627 sll_int32,
intent(inout) :: num_cells
628 sll_real64,
intent(inout) :: eta_min
629 sll_int32,
intent(inout) :: nbox
630 sll_real64,
intent(inout) :: kmode
637 end subroutine set_default_values
639 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
Cartesian mesh basic types.
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...
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_pi
initialization of 1d landau cartesian mesh from namelist
subroutine s_nml_mesh_1d_landau_cart_mesh(filename, mesh, clone, proc_id)
create 1d (uniform) cartesian mesh from namelist
subroutine s_nml_mesh_1d_landau_cart_print(filename, clone, proc_id)
print namelist info
subroutine s_nml_mesh_1d_landau_cart_array(filename, array, clone, proc_id)
create 1d array from namelist
Some common numerical utilities.
subroutine, public sll_s_new_file_id(file_id, error)
Get a file unit number free before creating a file.