Time stepping¶
step_time.f90
¶
Quick access
- Variables:
start_from_another_scheme
,transp_lmloc_to_rloc
,transp_rloc_to_lmloc
,transp_rloc_to_lmloc_io
- Routines:
Needed modules
iso_fortran_env
(output_unit()
)fields
: This module contains all the fields used in MagIC in the hybrid (LM,r) space as well as their radial derivatives. It defines both the LM-distributed arrays and the R-distributed arrays….fieldslast
: This module contains all the work arrays of the previous time-steps needed to time advance the code. They are needed in the time-stepping scheme….parallel_mod
: This module contains the blocking informationprecision_mod
: This module controls the precision used in MagICconstants
(zero()
,one()
,half()
): module containing constants and parameters used in the code.truncation
(n_r_max()
,l_max()
,l_maxmag()
,lm_max()
,fd_order()
,fd_order_bound()
): This module defines the grid points and the truncationnum_param
(n_time_steps()
,run_time_limit()
,tend()
,dtmax()
,dtmin()
,tscale()
,dct_counter()
,nl_counter()
,solve_counter()
,lm2phy_counter()
,td_counter()
,phy2lm_counter()
,f_exp_counter()
): Module containing numerical and control parametersradial_data
(nrstart()
,nrstop()
,nrstartmag()
,nrstopmag()
,n_r_icb()
,n_r_cmb()
): This module defines the MPI decomposition in the radial direction.radial_der
(get_dr_rloc()
,get_ddr_rloc()
,exch_ghosts()
,bulk_to_ghost()
): Radial derivatives functionsradial_functions
(rscheme_oc()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)logic
(l_mag()
,l_mag_lf()
,l_dtb()
,l_rms()
,l_hel()
,l_to()
,l_tomovie()
,l_r_field()
,l_cmb_field()
,l_htmovie()
,l_dtrmagspec()
,lverbose()
,l_b_nl_icb()
,l_par()
,l_b_nl_cmb()
,l_fluxprofs()
,l_viscbccalc()
,l_perppar()
,l_ht()
,l_dtbmovie()
,l_heat()
,l_conv()
,l_movie()
,l_runtimelimit()
,l_save_out()
,l_bridge_step()
,l_dt_cmb_field()
,l_chemical_conv()
,l_mag_kin()
,l_hemi()
,l_power()
,l_double_curl()
,l_pressgraph()
,l_probe()
,l_ab1()
,l_finite_diff()
,l_cond_ic()
,l_single_matrix()
,l_packed_transp()
,l_rot_ic()
,l_rot_ma()
,l_cond_ma()
,l_parallel_solve()
,l_mag_par_solve()
,l_phase_field()
,l_onset()
,l_geosmovie()
,l_phasemovie()
,l_dtphasemovie()
): Module containing the logicals that control the runinit_fields
(omega_ic1()
,omega_ma1()
): This module is used to construct the initial solution.lmloop_mod
(lmloop()
,finish_explicit_assembly()
,assemble_stage()
,finish_explicit_assembly_rdist()
,lmloop_rdist()
,assemble_stage_rdist()
)signals_mod
(initialize_signals()
,check_signals()
): This module handles the reading/writing of the signal.TAG file which allows to communicate with MagIC during its executiongraphout_mod
(open_graph_file()
,close_graph_file()
): This module contains the subroutines that store the 3-D graphic files.output_data
(tag()
,n_graph_step()
,n_graphs()
,dt_graph()
,t_graph()
,n_spec_step()
,n_specs()
,dt_spec()
,t_spec()
,n_movie_step()
,n_movie_frames()
,dt_movie()
,t_movie()
,n_tomovie_step()
,n_tomovie_frames()
,dt_tomovie()
,t_tomovie()
,n_pot_step()
,n_pots()
,dt_pot()
,t_pot()
,n_rst_step()
,n_rsts()
,dt_rst()
,t_rst()
,n_stores()
,n_log_step()
,n_logs()
,dt_log()
,t_log()
,n_cmb_step()
,n_cmbs()
,dt_cmb()
,t_cmb()
,n_r_field_step()
,n_r_fields()
,dt_r_field()
,t_r_field()
,n_to_step()
,n_tos()
,dt_to()
,t_to()
,n_probe_step()
,n_probe_out()
,dt_probe()
,t_probe()
,log_file()
,n_log_file()
,n_time_hits()
): This module contains the parameters for output controlupdateb_mod
(get_mag_rhs_imp()
,get_mag_ic_rhs_imp()
,b_ghost()
,aj_ghost()
,get_mag_rhs_imp_ghost()
,fill_ghosts_b()
): This module handles the time advance of the magnetic field potentials b and aj as well as the inner core counterparts b_ic and aj_ic. It contains the computation of the implicit terms and the linearupdatewp_mod
(get_pol_rhs_imp()
,get_pol_rhs_imp_ghost()
,w_ghost()
,fill_ghosts_w()
,p0_ghost()
): This module handles the time advance of the poloidal potential w and the pressure p. It contains the computation of the implicit terms and the linear solves.updatewps_mod
(get_single_rhs_imp()
): This module handles the time advance of the poloidal potential w, the pressure p and the entropy s in one single matrix per degree. It contains the computation of the implicit terms and the linearupdates_mod
(get_entropy_rhs_imp()
,get_entropy_rhs_imp_ghost()
,s_ghost()
,fill_ghosts_s()
): This module handles the time advance of the entropy s. It contains the computation of the implicit terms and the linear solves….updatexi_mod
(get_comp_rhs_imp()
,get_comp_rhs_imp_ghost()
,xi_ghost()
,fill_ghosts_xi()
): This module handles the time advance of the chemical composition xi. It contains the computation of the implicit terms and the linear solves….updatephi_mod
(get_phase_rhs_imp()
,get_phase_rhs_imp_ghost()
,phi_ghost()
,fill_ghosts_phi()
): This module handles the time advance of the phase field phi. It contains the computation of the implicit terms and the linear solves….updatez_mod
(get_tor_rhs_imp()
,get_tor_rhs_imp_ghost()
,z_ghost()
,fill_ghosts_z()
): This module handles the time advance of the toroidal potential z It contains the computation of the implicit terms and the linear solves….output_mod
(output()
): This module handles the calls to the different output routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.useful
(l_correct_step()
,logwrite()
): This module contains several useful routines.communications
(lo2r_field()
,lo2r_flow()
,scatter_from_rank0_to_lo()
,lo2r_xi()
,r2lo_flow()
,r2lo_s()
,r2lo_xi()
,r2lo_field()
,lo2r_s()
,lo2r_press()
,lo2r_one()
,r2lo_one()
): This module contains the different MPI communicators used in MagIC.courant_mod
(dt_courant()
): This module handles the computation of Courant factors on grid space. It then checks whether the timestep size needs to be modified.timing
: This module contains functions that are used to measure the time spent.probe_mod
: Module for artificial sensors to compare time series of physical data with experiments. Probes are located in a radially symmetrical way
Variables
- step_time_mod/start_from_another_scheme [private]¶
- step_time_mod/transp_lmloc_to_rloc [private]¶
- step_time_mod/transp_rloc_to_lmloc [private]¶
- step_time_mod/transp_rloc_to_lmloc_io [private]¶
Subroutines and functions
- subroutine step_time_mod/step_time(time, tscheme, n_time_step, run_time_start)¶
This subroutine performs the actual time-stepping.
- Parameters:
time [real ,inout]
tscheme [real ]
n_time_step [integer ,inout]
run_time_start [timer_type ,in]
- Called from:
- Call to:
check_signals()
,logwrite()
,l_correct_step()
,open_graph_file()
,radialloopg()
,finish_explicit_assembly_rdist()
,get_b_nl_bcs()
,finish_explicit_assembly()
,scatter_from_rank0_to_lo()
,output()
,close_graph_file()
,dt_courant()
,lmloop_rdist()
,lmloop()
,assemble_stage_rdist()
,assemble_stage()
,formattime()
courant.f90
¶
Description
This module handles the computation of Courant factors on grid space. It then checks whether the timestep size needs to be modified.
Quick access
- Variables:
- Routines:
courant()
,dt_courant()
,finalize_courant()
,initialize_courant()
Needed modules
parallel_mod
: This module contains the blocking informationprecision_mod
: This module controls the precision used in MagICtruncation
(n_phi_max()
,n_theta_max()
): This module defines the grid points and the truncationradial_data
(nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(orho1()
,orho2()
,or4()
,or2()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(lffac()
,opm()
): Module containing the physical parametersnum_param
(delxr2()
,delxh2()
): Module containing numerical and control parametershorizontal_data
(o_sin_theta_e2()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_mag()
,l_mag_lf()
,l_mag_kin()
,l_cour_alf_damp()
): Module containing the logicals that control the runuseful
(logwrite()
): This module contains several useful routines.constants
(half()
,one()
,two()
): module containing constants and parameters used in the code.
Variables
- courant_mod/file_handle [integer,private]¶
Subroutines and functions
- subroutine courant_mod/initialize_courant(time, dt, tag)¶
This subroutine opens the timestep.TAG file which stores the time step changes of MagIC.
- Parameters:
time [real ,in] :: time
dt [real ,in] :: time step
tag [character(len=*),in] :: trailing of the fime
- Called from:
- subroutine courant_mod/courant(n_r, dtrkc, dthkc, vr, vt, vp, br, bt, bp, courfac, alffac)¶
courant condition check: calculates Courant advection lengths in radial direction dtrkc and in horizontal direction dthkc on the local radial level n_r
for the effective velocity, the abs. sum of fluid velocity and Alfven velocity is taken
instead of the full Alfven velocity a modified Alfven velocity is employed that takes viscous and Joule damping into account. Different Courant factors are used for the fluid velocity and the such modified Alfven velocity
- Parameters:
n_r [integer ,in] :: radial level
dtrkc [real ,inout] :: Courant step (based on radial advection)
dthkc [real ,inout] :: Courant step based on horizontal advection
vr (*,*) [real ,in] :: radial velocity
vt (*,*) [real ,in] :: longitudinal velocity
vp (*,*) [real ,in] :: azimuthal velocity
br (*,*) [real ,in] :: radial magnetic field
bt (*,*) [real ,in] :: longitudinal magnetic field
bp (*,*) [real ,in] :: azimuthal magnetic field
courfac [real ,in]
alffac [real ,in]
- subroutine courant_mod/dt_courant(l_new_dt, dt, dt_new, dtmax, dtrkc, dthkc, time)¶
This subroutine checks if the Courant criterion based on combined fluid and Alfven velocity is satisfied. It returns a new value for the time step size.
- Parameters:
l_new_dt [logical ,out] :: flag indicating that time step is changed (=1) or not (=0)
dt [real ,in] :: old time step size
dt_new [real ,out] :: new time step size
dtmax [real ,in] ::
”
dtrkc (1 - nrstart + nrstop) [real ,in] :: radial Courant time step as function of radial level
dthkc (1 - nrstart + nrstop) [real ,in] :: horizontal Courant time step as function of radial level
time [real ,in] :: Current time
- Called from:
- Call to:
timing.f90
¶
Description
This module contains functions that are used to measure the time spent.
Quick access
- Types:
- Variables:
- Routines:
Needed modules
iso_fortran_env
(output_unit()
)mpimod
precision_mod
: This module controls the precision used in MagICparallel_mod
: This module contains the blocking information
Types
- type timing/timer_type¶
- Type fields:
% n_counts [integer ]
% tstart [real ]
% ttot [real ]
Variables
- timing/finalize [private]¶
- timing/initialize [private]¶
- timing/start_count [private]¶
- timing/stop_count [private]¶
Subroutines and functions
- subroutine timing/formattime(n_out, message, time_in_sec)¶
- Parameters:
n_out [integer ,in]
message [character(len=*),in]
time_in_sec [real ,in]
- Called from:
Time schemes¶
time_schemes.f90
¶
Description
This module defines an abstract class type_tscheme which is employed for the time advance of the code.
Quick access
- Types:
- Variables:
Needed modules
iso_fortran_env
(output_unit()
)time_array
: This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.logic
(l_save_out()
): Module containing the logicals that control the runoutput_data
(log_file()
): This module contains the parameters for output controlprecision_mod
: This module controls the precision used in MagIC
Types
- type time_schemes/type_tscheme¶
- Type fields:
% alffac [real ]
% courfac [real ]
% dt (*) [real ,allocatable]
% family [character(len=10)]
% intfac [real ]
% istage [integer ]
% l_assembly [logical ]
% l_exp_calc (*) [logical ,allocatable]
% l_imp_calc_rhs (*) [logical ,allocatable]
% nexp [integer ]
% nimp [integer ]
% nold [integer ]
% nstages [integer ]
% time_scheme [character(len=8)]
% wimp_lin (*) [real ,allocatable]
Variables
multistep_schemes.f90
¶
Description
This module defines the type_multistep which inherits from the abstract type_tscheme. It actually implements all the routine required to time-advance an IMEX multistep scheme such as CN/AB2, SBDF(2,3,4), CNLF, …
Quick access
- Types:
- Variables:
assemble_imex
,assemble_imex_scalar
,bridge_with_cnab2
,get_time_stage
,rotate_imex
,rotate_imex_scalar
,set_dt_array
,set_imex_rhs
,set_imex_rhs_ghost
,set_imex_rhs_scalar
,set_weights
,start_with_ab1
Needed modules
precision_mod
: This module controls the precision used in MagICiso_fortran_env
(output_unit()
)parallel_mod
: This module contains the blocking informationnum_param
(alpha()
): Module containing numerical and control parametersconstants
(one()
,half()
,two()
,zero()
): module containing constants and parameters used in the code.mem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICuseful
(abortrun()
): This module contains several useful routines.output_data
(log_file()
): This module contains the parameters for output controllogic
(l_save_out()
): Module containing the logicals that control the runtime_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
: This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.
Types
- type multistep_schemes/type_multistep¶
- Type fields:
% wexp (*) [real ,allocatable]
% wimp (*) [real ,allocatable]
Variables
- multistep_schemes/assemble_imex [private]¶
- multistep_schemes/assemble_imex_scalar [private]¶
- multistep_schemes/bridge_with_cnab2 [private]¶
- multistep_schemes/finalize [private]¶
- multistep_schemes/get_time_stage [private]¶
- multistep_schemes/initialize [private]¶
- multistep_schemes/rotate_imex [private]¶
- multistep_schemes/rotate_imex_scalar [private]¶
- multistep_schemes/set_dt_array [private]¶
- multistep_schemes/set_imex_rhs [private]¶
- multistep_schemes/set_imex_rhs_ghost [private]¶
- multistep_schemes/set_imex_rhs_scalar [private]¶
- multistep_schemes/set_weights [private]¶
- multistep_schemes/start_with_ab1 [private]¶
dirk_schemes.f90
¶
Description
This module defines the type_dirk which inherits from the abstract type_tscheme. It actually implements all the routine required to time-advance an diagonally implicit Runge-Kutta scheme. It makes use of Butcher tables to construct the right-hand-sides.
Quick access
- Types:
Needed modules
iso_fortran_env
(output_unit()
)precision_mod
: This module controls the precision used in MagICparallel_mod
: This module contains the blocking informationnum_param
(alpha()
): Module containing numerical and control parametersconstants
(one()
,half()
,two()
,zero()
): module containing constants and parameters used in the code.mem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICuseful
(abortrun()
): This module contains several useful routines.logic
(l_save_out()
): Module containing the logicals that control the runoutput_data
(log_file()
): This module contains the parameters for output controltime_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
: This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.
Types
- type dirk_schemes/type_dirk¶
- Type fields:
% butcher_ass_exp (*) [real ,allocatable]
% butcher_ass_imp (*) [real ,allocatable]
% butcher_c (*) [real ,allocatable]
% butcher_exp (*,*) [real ,allocatable]
% butcher_imp (*,*) [real ,allocatable]
Variables
- dirk_schemes/assemble_imex [private]¶
- dirk_schemes/assemble_imex_scalar [private]¶
- dirk_schemes/bridge_with_cnab2 [private]¶
- dirk_schemes/finalize [private]¶
- dirk_schemes/get_time_stage [private]¶
- dirk_schemes/initialize [private]¶
- dirk_schemes/rotate_imex [private]¶
- dirk_schemes/rotate_imex_scalar [private]¶
- dirk_schemes/set_dt_array [private]¶
- dirk_schemes/set_imex_rhs [private]¶
- dirk_schemes/set_imex_rhs_ghost [private]¶
- dirk_schemes/set_imex_rhs_scalar [private]¶
- dirk_schemes/set_weights [private]¶
- dirk_schemes/start_with_ab1 [private]¶
time_array.f90
¶
Description
This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.
Quick access
- Types:
- Variables:
Needed modules
precision_mod
: This module controls the precision used in MagICconstants
(zero()
): module containing constants and parameters used in the code.mem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagIC
Types
- type time_array/type_tarray¶
- Type fields:
% expl (*,*,*) [complex ,pointer]
% impl (*,*,*) [complex ,allocatable]
% l_exp [logical ]
% llm [integer ]
% nrstart [integer ]
% nrstop [integer ]
% old (*,*,*) [complex ,allocatable]
% ulm [integer ]
- type time_array/type_tscalar¶
- Type fields:
% expl (*) [real ,allocatable]
% impl (*) [real ,allocatable]
% old (*) [real ,allocatable]
Variables