Code initialization¶
Namelists.f90¶
Description
Read and print the input namelist
Quick access
- Variables:
defaultnamelists,runhours,runminutes,runseconds,select_tscheme- Routines:
Needed modules
iso_fortran_env(output_unit())precision_mod: This module controls the precision used in MagICconstants: module containing constants and parameters used in the code.truncation: This module defines the grid points and the truncationradial_functions: This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters: Module containing the physical parametersnum_param: Module containing numerical and control parameterstorsional_oscillations: This module contains information for TO calculation and outputinit_fields: This module is used to construct the initial solution.logic: Module containing the logicals that control the runoutput_data: This module contains the parameters for output controlparallel_mod: This module contains the blocking informationspecial: This module contains all variables for the case of an imposed IC dipole, an imposed external magnetic field and a special boundary forcing to excite inertial modescharmanip(capitalize()): This module contains several useful routines to manipule character stringsprobe_mod: Module for artificial sensors to compare time series of physical data with experiments. Probes are located in a radially symmetrical wayuseful(abortrun()): This module contains several useful routines.dirk_schemes(type_dirk()): 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 usemultistep_schemes(type_multistep()): 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),time_schemes(type_tscheme()): This module defines an abstract class type_tscheme which is employed for the time advance of the code.
Variables
- namelists/defaultnamelists [private]¶
- namelists/runhours [integer,private]¶
- namelists/runminutes [integer,private]¶
- namelists/runseconds [integer,private]¶
- namelists/select_tscheme [private]¶
Subroutines and functions
- subroutine namelists/readnamelists(tscheme)¶
Purpose of this subroutine is to read the input namelists. This program also determins logical parameters that are stored in logic.f90.
- Parameters:
tscheme [real ]
- Called from:
- Call to:
startFiels.f90¶
Description
This module is used to set-up the initial starting fields. They can be obtained by reading a starting checkpoint file or by setting some starting conditions.
Quick access
Needed modules
truncation: This module defines the grid points and the truncationprecision_mod: This module controls the precision used in MagICparallel_mod: This module contains the blocking informationradial_data(n_r_cmb(),n_r_icb(),nrstart(),nrstop()): This module defines the MPI decomposition in the radial direction.communications(lo2r_one()): This module contains the different MPI communicators used in MagIC.radial_functions(rscheme_oc(),r(),or1(),alpha0(),dltemp0(),dlalpha0(),beta(),orho1(),temp0(),rho0(),r_cmb(),otemp1(),ogrun(),dentropy0(),dxicond(),r_icb()): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters(interior_model(),epss(),imps(),n_r_lcr(),ktopv(),kbotv(),lffac(),imagcon(),thexpnb(),vischeatfac(),impxi()): Module containing the physical parametersnum_param(dtmax(),alpha()): Module containing numerical and control parametersspecial(lgrenoble(),ampforce()): This module contains all variables for the case of an imposed IC dipole, an imposed external magnetic field and a special boundary forcing to excite inertial modesoutput_data(log_file(),n_log_file()): This module contains the parameters for output controlblocking(lo_map(),llm(),ulm(),ulmmag(),llmmag()): Module containing blocking informationlogic(l_conv(),l_mag(),l_cond_ic(),l_heat(),l_srma(),l_sric(),l_mag_kin(),l_mag_lf(),l_temperature_diff(),l_onset(),l_chemical_conv(),l_anelastic_liquid(),l_save_out(),l_parallel_solve(),l_mag_par_solve(),l_phase_field(),l_single_matrix(),l_non_adia()): Module containing the logicals that control the runinit_fields(l_start_file(),init_s1(),init_b1(),tops(),pt_cond(),initv(),inits(),initb(),initxi(),ps_cond(),start_file(),init_xi1(),topxi(),xi_cond(),omega_ic1(),omega_ma1(),initphi(),init_phi(),initf()): This module is used to construct the initial solution.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….timing(timer_type()): This module contains functions that are used to measure the time spent.constants(zero(),c_lorentz_ma(),c_lorentz_ic(),osq4pi(),one(),two(),sq4pi()): module containing constants and parameters used in the code.useful(cc2real(),logwrite()): This module contains several useful routines.radial_der(get_dr(),exch_ghosts(),bulk_to_ghost()): Radial derivatives functionsreadcheckpoints(readstartfields_mpi()): This module contains the functions that can help reading and mapping of the restart filestime_schemes(type_tscheme()): This module defines an abstract class type_tscheme which is employed for the time advance of the code.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 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.updates_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….updateb_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 linear
Variables
- start_fields/botcond [real,public]¶
Conducting heat flux at the inner boundary
- start_fields/botxicond [real,public]¶
Conducting mass flux at the inner boundary
- start_fields/deltacond [real,public]¶
Temperature or entropy difference between boundaries
- start_fields/deltaxicond [real,public]¶
Composition difference between boundaries
- start_fields/topcond [real,public]¶
Conducting heat flux at the outer boundary
- start_fields/topxicond [real,public]¶
Conducting mass flux at the outer boundary
Subroutines and functions
- subroutine start_fields/getstartfields(time, tscheme, n_time_step)¶
Purpose of this subroutine is to initialize the fields and other auxiliary parameters.
- Parameters:
time [real ,out] :: Time of the restart
tscheme [real ]
n_time_step [integer ,out] :: Number of past iterations
- Called from:
- Call to:
pt_cond(),xi_cond(),readstartfields_old(),readstartfields_mpi(),logwrite(),initb(),initv(),inits(),initxi(),initphi(),fill_ghosts_xi(),get_comp_rhs_imp_ghost(),get_comp_rhs_imp(),fill_ghosts_phi(),get_phase_rhs_imp_ghost(),get_phase_rhs_imp(),get_single_rhs_imp(),fill_ghosts_s(),get_entropy_rhs_imp_ghost(),get_entropy_rhs_imp(),fill_ghosts_w(),get_pol_rhs_imp_ghost(),get_pol_rhs_imp(),fill_ghosts_z(),get_tor_rhs_imp_ghost(),get_tor_rhs_imp(),fill_ghosts_b(),get_mag_rhs_imp_ghost(),get_mag_rhs_imp(),get_mag_ic_rhs_imp(),cc2real(),initf()
init_fields.f90¶
Description
This module is used to construct the initial solution.
Quick access
- Variables:
amp_b1,amp_s1,amp_s2,amp_v1,amp_xi1,amp_xi2,bots,botxi,bpeakbot,bpeaktop,inform,init_b1,init_phi,init_s1,init_s2,init_v1,init_xi1,init_xi2,j_cond,l_reset_t,l_start_file,n_s_bounds,n_xi_bounds,nrotic,nrotma,omega_ic1,omega_ic2,omega_ma1,omega_ma2,omegaosz_ic1,omegaosz_ic2,omegaosz_ma1,omegaosz_ma2,phi_bot,phi_top,ps_cond,s_bot,s_top,scale_b,scale_s,scale_v,scale_xi,start_file,tipdipole,tomega_ic1,tomega_ic2,tomega_ma1,tomega_ma2,tops,topxi,tshift_ic1,tshift_ic2,tshift_ma1,tshift_ma2,xi_bot,xi_top- Routines:
finalize_init_fields(),initb(),initf(),initialize_init_fields(),initphi(),inits(),initv(),initxi(),pt_cond(),xi_cond()
Needed modules
precision_mod: This module controls the precision used in MagICiso_fortran_env(output_unit())parallel_mod: This module contains the blocking informationfinite_differences(type_fd()): This module is used to calculate the radial grid when finite differences are requestedcommunications(lo2r_one(),r2lo_one(),transp_r2phi(),transp_phi2r()): This module contains the different MPI communicators used in MagIC.truncation(n_r_max(),n_r_maxmag(),n_r_ic_max(),m_min(),l_max(),n_phi_max(),n_theta_max(),n_r_tot(),m_max(),minc(),n_cheb_ic_max(),lm_max(),nlat_padded()): This module defines the grid points and the truncationmem_alloc(bytes_allocated()): This little module is used to estimate the global memory allocation used in MagICblocking(lo_map(),st_map(),llm(),ulm(),llmmag(),ulmmag()): Module containing blocking informationhorizontal_data(sintheta(),dlh(),dtheta1s(),dtheta1a(),phi(),costheta(),hdif_b()): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic(l_rot_ic(),l_rot_ma(),l_sric(),l_srma(),l_cond_ic(),l_temperature_diff(),l_chemical_conv(),l_onset(),l_anelastic_liquid(),l_non_adia(),l_finite_diff()): Module containing the logicals that control the runradial_functions(r_icb(),r(),r_cmb(),r_ic(),or1(),jvarcon(),lambda(),or2(),dllambda(),or3(),cheb_ic(),dcheb_ic(),d2cheb_ic(),cheb_norm_ic(),orho1(),chebt_ic(),temp0(),dltemp0(),kappa(),dlkappa(),beta(),dbeta(),epscprof(),ddltemp0(),ddlalpha0(),rgrav(),rho0(),dlalpha0(),alpha0(),otemp1(),ogrun(),rscheme_oc(),o_r_ic()): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)radial_data(n_r_icb(),n_r_cmb(),nrstart(),nrstop()): This module defines the MPI decomposition in the radial direction.constants(pi(),y10_norm(),c_z10_omega_ic(),c_z10_omega_ma(),osq4pi(),zero(),one(),two(),three(),four(),third(),half(),sq4pi()): module containing constants and parameters used in the code.useful(abortrun(),lagrange_interp()): This module contains several useful routines.physical_parameters(imps(),n_imps_max(),n_imps(),phis(),thetas(),peaks(),widths(),radratio(),imagcon(),opm(),sigma_ratio(),o_sr(),kbots(),ktops(),opr(),epsc(),vischeatfac(),thexpnb(),tmelt(),impxi(),n_impxi_max(),n_impxi(),phixi(),thetaxi(),peakxi(),widthxi(),osc(),epscxi(),kbotxi(),ktopxi(),buofac(),ktopp(),oek(),epsphase()): Module containing the physical parametersspecial(ampforce()): This module contains all variables for the case of an imposed IC dipole, an imposed external magnetic field and a special boundary forcing to excite inertial modescosine_transform_odd: This module contains the built-in type I discrete Cosine Transforms. This implementation is based on Numerical Recipes and FFTPACK. This only works forn_r_max-1 = 2**a 3**b 5**c, with a,b,c integers….
Variables
- init_fields/amp_b1 [real,public]¶
- init_fields/amp_s1 [real,public]¶
- init_fields/amp_s2 [real,public]¶
- init_fields/amp_v1 [real,public]¶
- init_fields/amp_xi1 [real,public]¶
- init_fields/amp_xi2 [real,public]¶
- init_fields/bots (*,*) [complex,allocatable/public]¶
- init_fields/botxi (*,*) [complex,allocatable/public]¶
- init_fields/bpeakbot [real,public]¶
Inner boundary
- init_fields/bpeaktop [real,public]¶
Outer boundary
- init_fields/inform [integer,public]¶
format of start_file
- init_fields/init_b1 [integer,public]¶
- init_fields/init_phi [integer,public]¶
An integer to specify phase field initial configuration
- init_fields/init_s1 [integer,public]¶
- init_fields/init_s2 [integer,public]¶
- init_fields/init_v1 [integer,public]¶
- init_fields/init_xi1 [integer,public]¶
- init_fields/init_xi2 [integer,public]¶
- init_fields/j_cond [private]¶
- init_fields/l_reset_t [logical,public]¶
reset time from startfile ?
- init_fields/l_start_file [logical,public]¶
taking fields from startfile ?
- init_fields/n_s_bounds [integer,parameter=20]¶
- init_fields/n_xi_bounds [integer,parameter=20]¶
- init_fields/nrotic [integer,public]¶
- init_fields/nrotma [integer,public]¶
- init_fields/omega_ic1 [real,public]¶
- init_fields/omega_ic2 [real,public]¶
- init_fields/omega_ma1 [real,public]¶
- init_fields/omega_ma2 [real,public]¶
- init_fields/omegaosz_ic1 [real,public]¶
- init_fields/omegaosz_ic2 [real,public]¶
- init_fields/omegaosz_ma1 [real,public]¶
- init_fields/omegaosz_ma2 [real,public]¶
- init_fields/phi_bot [real,public]¶
Phase field value at the inner boundary
- init_fields/phi_top [real,public]¶
Phase field value at the outer boundary
- init_fields/ps_cond [public]¶
‘)
- init_fields/s_bot (80) [real,public]¶
input variables for tops,bots
- init_fields/s_top (80) [real,public]¶
- init_fields/scale_b [real,public]¶
- init_fields/scale_s [real,public]¶
- init_fields/scale_v [real,public]¶
- init_fields/scale_xi [real,public]¶
- init_fields/start_file [character(len=72),public]¶
name of start_file
- init_fields/tipdipole [real,public]¶
adding to symetric field
- init_fields/tomega_ic1 [real,public]¶
- init_fields/tomega_ic2 [real,public]¶
- init_fields/tomega_ma1 [real,public]¶
- init_fields/tomega_ma2 [real,public]¶
- init_fields/tops (*,*) [complex,allocatable/public]¶
- init_fields/topxi (*,*) [complex,allocatable/public]¶
- init_fields/tshift_ic1 [real,public]¶
- init_fields/tshift_ic2 [real,public]¶
- init_fields/tshift_ma1 [real,public]¶
- init_fields/tshift_ma2 [real,public]¶
- init_fields/xi_bot (80) [real,public]¶
input variables for topxi,botxi
- init_fields/xi_top (80) [real,public]¶
Subroutines and functions
- subroutine init_fields/initv(w, z, omega_ic, omega_ma)¶
Purpose of this subroutine is to initialize the velocity field So far it is only rudimentary and will be expanded later. Because s is needed for dwdt init_s has to be called before.
- Parameters:
- Called from:
- Call to:
- subroutine init_fields/inits(s, p)¶
Purpose of this subroutine is to initialize the entropy field according to the input control parameters.
Input
value
init_s1 < 100:
random noise initialized the noise spectrum decays as l ^ (init_s1-1) with peak amplitude amp_s1 for l=1
init_s1 >=100:
a specific harmonic mode initialized with amplitude amp_s1. init_s1 is interpreted as number llmm where ll: harmonic degree, mm: harmonic order.
init_s2 >100 :
a second harmonic mode initialized with amplitude amp_s2. init_s2 is again interpreted as number llmm where ll: harmonic degree, mm: harmonic order.
- Parameters:
- Called from:
- Call to:
- subroutine init_fields/initxi(xi)¶
Purpose of this subroutine is to initialize the chemical composition according to the input control parameters.
Input
value
init_xi1 < 100:
random noise initialized the noise spectrum decays as l^ (init_xi1-1) with peak amplitude amp_xi1 for l=1
init_xi1 >=100:
a specific harmonic mode initialized with amplitude amp_xi1. init_xi1 is interpreted as number llmm where ll: harmonic degree, mm: harmonic order.
init_xi2 >100 :
a second harmonic mode initialized with amplitude amp_xi2. init_xi2 is again interpreted as number llmm where ll: harmonic degree, mm: harmonic order.
- Parameters:
- Called from:
- Call to:
- subroutine init_fields/initb(b, aj, b_ic, aj_ic)¶
Purpose of this subroutine is to initialize the magnetic field according to the control parameters imagcon and init_b1/2. In addition CMB and ICB peak values are calculated for magneto convection.
- Parameters:
b (1 - llmmag + ulmmag,n_r_maxmag) [complex ,inout]
aj (1 - llmmag + ulmmag,n_r_maxmag) [complex ,inout]
b_ic (1 - llmmag + ulmmag,n_r_ic_max) [complex ,inout]
aj_ic (1 - llmmag + ulmmag,n_r_ic_max) [complex ,inout]
- Called from:
- Call to:
- subroutine init_fields/initphi(s, phi)¶
This subroutine sets the initial phase field distribution. It follows a tanh function with a width of size epsPhase
- Parameters:
- Called from:
- Call to:
getblocks(),scal_to_spat(),transp_r2phi(),lagrange_interp(),transp_phi2r(),scal_to_sh()
- subroutine init_fields/initf(bodyforce)¶
This subroutine is used to initialize a toroidal body force of the form (-a s + b s^2) vec{e}_phi in lm space. This can easily be extended to other forms of body forces prescribed in physical space.
- Parameters:
- Called from:
- Call to:
- subroutine init_fields/xi_cond(xi0)¶
Purpose of this subroutine is to solve the chemical composition equation for an the conductive (l=0,m=0)-mode. Output is the radial dependence of the solution in s0.
- Parameters:
xi0 (*) [real ,out] :: spherically-symmetric part
- Called from:
- Call to:
- subroutine init_fields/pt_cond(t0, p0)¶
Purpose of this subroutine is to solve the entropy equation for an the conductive (l=0,m=0)-mode. Output is the radial dependence of the solution in t0 and p0.
- Parameters:
t0 (*) [real ,out] :: spherically-symmetric temperature
p0 (*) [real ,out] :: spherically-symmetric pressure
- Called from:
- Call to: