Useful additional libraries

mean_sd.f90

Description

This module contains a small type that simply handles two arrays (mean and SD) This type is used for time-averaged outputs (and their standard deviations).

Quick access

Types:

mean_sd_2d_type, mean_sd_type

Variables:

compute_1d_complex, compute_1d_real, compute_2d_1d_input, compute_2d_2d_input, finalize_1d, finalize_2d, finalize_sd_1d, finalize_sd_2d, initialize_1d, initialize_2d

Needed modules

Types

  • type  mean_sd/mean_sd_type
    Type fields:
    • % mean (*) [real ,allocatable]

    • % nstart [integer ]

    • % nstop [integer ]

    • % sd (*) [real ,allocatable]

  • type  mean_sd/mean_sd_2d_type
    Type fields:
    • % l_sd [logical ]

    • % mean (*,*) [real ,allocatable]

    • % n_start_col [integer ]

    • % n_start_row [integer ]

    • % n_stop_col [integer ]

    • % n_stop_row [integer ]

    • % sd (*,*) [real ,allocatable]

Variables

  • mean_sd/compute_1d_complex [private]
  • mean_sd/compute_1d_real [private]
  • mean_sd/compute_2d_1d_input [private]
  • mean_sd/compute_2d_2d_input [private]
  • mean_sd/finalize_1d [private]
  • mean_sd/finalize_2d [private]
  • mean_sd/finalize_sd_1d [private]
  • mean_sd/finalize_sd_2d [private]
  • mean_sd/initialize_1d [private]
  • mean_sd/initialize_2d [private]

useful.f90

Description

This module contains several useful routines.

Quick access

Variables:

polynomial_interpolation_real

Routines:

abortrun(), cc22real(), cc2real(), factorise(), l_correct_step(), logwrite(), polynomial_interpolation(), round_off()

Needed modules

Variables

  • useful/polynomial_interpolation_real [private]

Subroutines and functions

function  useful/l_correct_step(n, t, t_last, n_max, n_step, n_intervals, n_ts, times, n_eo)

Suppose we have a (loop) maximum of n_max steps! If n_intervals times in these steps a certain action should be carried out this can be invoked by l_correct_step=true if on input n_intervals>0 and n_step=0. Alternatively the action can be invoked every n_step steps if on input n_intervals=0 and n_step>0. In both cases l_correct_step=true for n=n_max.

The argument controls whether in addition n should be even (n_eo=2) or odd (n_eo=1)

Parameters:
  • n [integer ,in] :: current step

  • t [real ,in] :: time at current step

  • t_last [real ,in] :: last time at current step

  • n_max [integer ,in] :: max number of steps

  • n_step [integer ,in] ::

  • n_intervals [integer ,in] :: number of actions

  • n_ts [integer ,in] :: number of times t

  • times (*) [real ,in] :: times where l_correct_step == true

  • n_eo [integer ,in] :: even/odd controller

Return:

l_correct_step [logical ]

Called from:

step_time()

Call to:

abortrun()

subroutine  useful/factorise(n, n_facs, fac, n_factors, factor)

Purpose of this subroutine is factorize n into a number of given factors fac(i).

Parameters:
  • n [integer ,in] :: remaining

  • n_facs [integer ,in] :: number of facs to be tried !

  • fac (*) [integer ,in] :: list of fators to be tried !

  • n_factors [integer ,out] :: number of factors

  • factor (*) [integer ,out]

Called from:

init_fft()

Call to:

abortrun()

function  useful/cc2real(c, m)

This function computes the norm of complex number, depending on the azimuthal wavenumber.

Parameters:
  • c [complex ,in] :: A complex number

  • m [integer ,in] :: Azimuthal wavenumber

Return:

cc2real [real ]

Called from:

get_poltorrms(), hint2dpol(), hint2dpollm(), hintrms(), getdlm(), get_e_kin(), get_u_square(), get_e_mag(), get_power(), rbrspec(), rbpspec(), spectrum(), get_amplitude(), getstartfields(), get_mag_rhs_imp(), get_mag_rhs_imp_ghost(), get_pol_rhs_imp(), get_pol_rhs_imp_ghost(), assemble_pol(), assemble_single(), get_single_rhs_imp(), get_tor_rhs_imp(), get_tor_rhs_imp_ghost()

function  useful/cc22real(c1, c2, m)
Parameters:
  • c1 [complex ,in]

  • c2 [complex ,in]

  • m [integer ,in]

Return:

cc22real [real ]

Called from:

get_e_mag()

subroutine  useful/logwrite(message)

This subroutine writes a message in the log.TAG file and in the STDOUT If l_save_out is set to .true. the log.TAG file is opened and closed.

Parameters:

message [character(len=*),in] :: Message to be written

Called from:

dt_courant(), outto(), output(), precalc(), radial(), spectrum(), getstartfields(), step_time()

subroutine  useful/polynomial_interpolation(xold, yold, xnew, ynew)
Parameters:
  • xold (4) [real ,in]

  • yold (4) [complex ,in]

  • xnew [real ,in]

  • ynew [complex ,out]

subroutine  useful/abortrun(message)

This routine properly terminates a run

Parameters:

message [character(len=*),in] :: Message printing before termination

Called from:

readnamelists(), prepare_mat(), initialize_blocking(), init_fft(), getdlm(), inits(), initxi(), initb(), xi_cond(), pt_cond(), ps_cond(), get_e_kin(), movie_gather_frames_to_rank0(), get_b_nl_bcs(), write_movie_frame(), plm_theta(), precalc(), writeinfo(), transportproperties(), get_dr_rloc(), get_ddr_rloc(), get_ddr_ghost(), get_ddddr_ghost(), readstartfields_old(), readstartfields(), readstartfields_mpi(), checktruncation(), prepareb_fd(), fill_ghosts_b(), assemble_mag(), assemble_mag_rloc(), assemble_pol_rloc(), assemble_single(), assemble_tor(), assemble_tor_rloc(), l_correct_step(), factorise()

function  useful/round_off(param, ref[, cut])

This function rounds off tiny numbers. This is only used for some outputs.

Parameters:
  • param [real ,in] :: parameter to be checked

  • ref [real ,in] :: reference value

Options:

cut [real ,in,] :: cutoff factor compared to machine epsilon

Return:

round_off [real ]

Called from:

outhemi(), outheat(), outphase(), outpar(), outperppar(), get_power(), spectrum()

mem_alloc.f90

Description

This little module is used to estimate the global memory allocation used in MagIC

Quick access

Variables:

human_readable_size, memory_file, n_memory_file, n_ranks_print, ranks_selected

Routines:

finalize_memory_counter(), initialize_memory_counter(), memwrite()

Needed modules

Variables

  • mem_alloc/bytes_allocated [integer,public]
  • mem_alloc/human_readable_size [private]
  • mem_alloc/memory_file [character(len=72),private]
  • mem_alloc/n_memory_file [integer,private]
  • mem_alloc/n_ranks_print [integer,private]
  • mem_alloc/ranks_selected (*) [integer,private/allocatable]

Subroutines and functions

subroutine  mem_alloc/initialize_memory_counter()
Called from:

magic

subroutine  mem_alloc/memwrite(origin, bytes_alloc)
Parameters:
  • origin [character(len=*),in]

  • bytes_alloc [integer ,in]

Called from:

initialize_lmloop(), initialize_blocking(), initialize_communications(), initialize_radialloop(), magic

subroutine  mem_alloc/finalize_memory_counter()
Called from:

magic

char_manip.f90

Description

This module contains several useful routines to manipule character strings

Quick access

Routines:

capitalize(), dble2str(), delete_string(), write_long_string()

Needed modules

  • precision_mod: This module controls the precision used in MagIC

Subroutines and functions

subroutine  charmanip/capitalize(string_bn)

Convert lower-case letters into capital letters

Parameters:

string_bn [character(len=*),inout]

Called from:

readnamelists(), initialize_communications()

subroutine  charmanip/delete_string(string_bn, string_del, length)

Deletes string_del from string and returns new length of string.

Parameters:
  • string_bn [character(len=*),inout]

  • string_del [character(len=*),in]

  • length [integer ,out]

subroutine  charmanip/dble2str(num, str)

converts a 1 number num into a character str

Parameters:
  • num [real ,in]

  • str [character(len=*),out]

Called from:

store(), store_mpi()

subroutine  charmanip/write_long_string(prefix, long_string, out_unit)

This subroutine is used to split a long string (with len(str)>85) into a multi-lines string for a cleaner printout.

Parameters:
  • prefix [character(len=*),in]

  • long_string [character(len=*),in]

  • out_unit [integer ,in]

Called from:

magic