Code initialization

Namelists.f90

Description

Read and print the input namelist

Quick access

Variables:

runhours, runminutes, runseconds

Routines:

defaultnamelists(), readnamelists(), select_tscheme(), writenamelists()

Needed modules

  • iso_fortran_env (output_unit())

  • precision_mod: This module controls the precision used in MagIC

  • constants: module containing constants and parameters used in the code.

  • truncation: This module defines the grid points and the truncation

  • radial_functions: This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)

  • physical_parameters: Module containing the physical parameters

  • num_param: Module containing numerical and control parameters

  • torsional_oscillations: This module contains information for TO calculation and output

  • init_fields: This module is used to construct the initial solution.

  • logic: Module containing the logicals that control the run

  • output_data: This module contains the parameters for output control

  • parallel_mod: This module contains the blocking information

  • special: 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 modes

  • movie_data (movie(), n_movies(), n_movies_max())

  • charmanip (capitalize()): This module contains several useful routines to manipule character strings

  • probe_mod: Module for artificial sensors to compare time series of physical data with experiments. Probes are located in a radially symmetrical way

  • useful (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 use

  • multistep_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/runhours [integer,private]
  • namelists/runminutes [integer,private]
  • namelists/runseconds [integer,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:

magic

Call to:

defaultnamelists(), abortrun(), capitalize(), select_tscheme(), initialize_truncation()

subroutine  namelists/writenamelists(n_out)

Purpose of this subroutine is to write the namelist to file unit n_out. This file has to be open before calling this routine.

Parameters:

n_out [integer ,in]

Called from:

magic

subroutine  namelists/defaultnamelists()

Purpose of this subroutine is to set default parameters for the namelists.

Called from:

readnamelists()

subroutine  namelists/select_tscheme(scheme_name, tscheme)

This routine determines which family of time stepper should be initiated depending on the name found in the input namelist.

Parameters:
  • scheme_name [character(len=72),inout] :: Name of the time scheme

  • tscheme [real ]

Called from:

readnamelists()

Call to:

capitalize()

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

Variables:

botcond, botxicond, deltacond, deltaxicond, topcond, topxicond

Routines:

getstartfields()

Needed modules

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:

magic

Call to:

pt_cond(), ps_cond(), xi_cond(), readstartfields_old(), readstartfields_mpi(), logwrite(), initb(), initv(), inits(), initxi(), initphi(), bulk_to_ghost(), exch_ghosts(), 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, 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, 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(), j_cond(), ps_cond(), pt_cond(), xi_cond()

Needed modules

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]
  • init_fields/bpeaktop [real,public]
  • 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/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/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/initialize_init_fields()

Memory allocation

Called from:

magic

subroutine  init_fields/finalize_init_fields()

Memory deallocation

Called from:

magic

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:

getstartfields()

Call to:

scal_to_sh()

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:

getstartfields()

Call to:

pt_cond(), ps_cond(), abortrun(), scal_to_sh(), prepare_mat()

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:

xi (1 - llm + ulm,n_r_max) [complex ,inout]

Called from:

getstartfields()

Call to:

xi_cond(), abortrun(), scal_to_sh(), prepare_mat()

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:
Called from:

getstartfields()

Call to:

j_cond(), abortrun()

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:

getstartfields()

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:

bodyforce (1 - llm + ulm,n_r_max) [complex ,inout]

Called from:

getstartfields()

Call to:

scal_to_sh()

subroutine  init_fields/j_cond(lm0, aj0, aj0_ic)

Purpose of this subroutine is to solve the diffusion equation for an initial toroidal magnetic field.

Parameters:
  • lm0 [integer ,in]

  • aj0 (*) [complex ,out] :: aj(l=0,m=0) in the outer core

  • aj0_ic (*) [complex ,out] :: aj(l=0,m=0) in the inner core

Called from:

initb()

Call to:

prepare_mat(), abortrun()

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:

initxi(), getstartfields()

Call to:

abortrun()

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:

inits(), getstartfields()

Call to:

prepare_mat(), abortrun()

subroutine  init_fields/ps_cond(s0, 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 s0 and p0.

Parameters:
  • s0 (*) [real ,out] :: spherically-symmetric part

  • p0 (*) [real ,out] :: spherically-symmetric part

Called from:

inits(), getstartfields()

Call to:

prepare_mat(), abortrun()