Non-linear part of the time stepping (radial loop)¶
radialLoop.f90
¶
Quick access
Needed modules
precision_mod
: This module controls the precision used in MagICmem_alloc
(memwrite()
,bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICtruncation
(lm_max()
,lm_maxmag()
,l_max()
,l_maxmag()
): This module defines the grid points and the truncationradial_data
(nrstart()
,nrstop()
,nrstartmag()
,nrstopmag()
): This module defines the MPI decomposition in the radial direction.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.riteration
(riter_t()
): This module is used to define an abstract class for the radial loopriter_mod
(riter_single_t()
): This module actually handles the loop over the radial levels. It contains the spherical harmonic transforms and the operations on the arrays in physical space….
Variables
Subroutines and functions
-
subroutine
radialloop/
initialize_radialloop
()¶ - Called from
- Call to
-
subroutine
radialloop/
radialloopg
(l_graph, l_frame, time, timestage, tscheme, dtlast, ltocalc, ltonext, ltonext2, lhelcalc, lpowercalc, lrmscalc, lpresscalc, lpressnext, lviscbccalc, lfluxprofcalc, lperpparcalc, lgeoscalc, lhemicalc, l_probe_out, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dvxvhlm, dvxbhlm, dvsrlm, dvxirlm, lorentz_torque_ic, lorentz_torque_ma, br_vt_lm_cmb, br_vp_lm_cmb, br_vt_lm_icb, br_vp_lm_icb, dtrkc, dthkc)¶ This subroutine performs the actual time-stepping.
- Parameters
l_graph [logical ,in]
l_frame [logical ,in]
time [real ,in]
timestage [real ,in]
tscheme [real ]
dtlast [real ,in]
ltocalc [logical ,in]
ltonext [logical ,in]
ltonext2 [logical ,in]
lhelcalc [logical ,in]
lpowercalc [logical ,in]
lrmscalc [logical ,in]
lpresscalc [logical ,in]
lpressnext [logical ,in]
lviscbccalc [logical ,in]
lfluxprofcalc [logical ,in]
lperpparcalc [logical ,in]
lgeoscalc [logical ,in]
lhemicalc [logical ,in]
l_probe_out [logical ,in]
dbdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
djdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
dvxbhlm (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
lorentz_torque_ic [real ,out]
lorentz_torque_ma [real ,out]
br_vt_lm_cmb (lm_max) [complex ,out] :: product br*vt at CMB
br_vp_lm_cmb (lm_max) [complex ,out] :: product br*vp at CMB
br_vt_lm_icb (lm_max) [complex ,out] :: product br*vt at ICB
br_vp_lm_icb (lm_max) [complex ,out] :: product br*vp at ICB
- Called from
rIteration.f90
¶
Description
This module is used to define an abstract class for the radial loop
Needed modules
precision_mod
: This module controls the precision used in MagICradial_data
(nrstart()
,nrstop()
,nrstartmag()
,nrstopmag()
): This module defines the MPI decomposition in the radial direction.truncation
(lm_max()
,lm_maxmag()
): This module defines the grid points and the truncationtime_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.
Types
-
type
riteration/
unknown_type
¶
-
type
rIter.f90
¶
Description
This module actually handles the loop over the radial levels. It contains the spherical harmonic transforms and the operations on the arrays in physical space.
Quick access
Needed modules
precision_mod
: This module controls the precision used in MagICnum_param
(phy2lm_counter()
,lm2phy_counter()
,nl_counter()
,td_counter()
): Module containing numerical and control parametersparallel_mod
: This module contains the blocking informationtruncation
(n_phi_max()
,lm_max()
,lm_maxmag()
): This module defines the grid points and the truncationlogic
(l_mag()
,l_conv()
,l_mag_kin()
,l_heat()
,l_ht()
,l_anel()
,l_mag_lf()
,l_conv_nl()
,l_mag_nl()
,l_b_nl_cmb()
,l_b_nl_icb()
,l_rot_ic()
,l_cond_ic()
,l_rot_ma()
,l_cond_ma()
,l_dtb()
,l_store_frame()
,l_movie_oc()
,l_to()
,l_chemical_conv()
,l_probe()
,l_full_sphere()
,l_precession()
,l_centrifuge()
,l_adv_curl()
,l_double_curl()
,l_parallel_solve()
,l_single_matrix()
,l_temperature_diff()
,l_rms()
,l_phase_field()
,l_onset()
): Module containing the logicals that control the runradial_data
(n_r_cmb()
,n_r_icb()
,nrstart()
,nrstop()
,nrstartmag()
,nrstopmag()
): This module defines the MPI decomposition in the radial direction.radial_functions
(or2()
,orho1()
,l_r()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)constants
(zero()
): module containing constants and parameters used in the code.nonlinear_lm_mod
(nonlinear_lm_t()
): This module is used to finish the assembly of the nonlinear terms in \((\ell,m)\) space. Derivatives along \(\theta\) and \(\phi\) are handled using recurrence relations….grid_space_arrays_mod
(grid_space_arrays_t()
): This module is used to compute the nonlinear products in physical space \((\theta,\phi)\).to_arrays_mod
(to_arrays_t()
)dtb_arrays_mod
(dtb_arrays_t()
)torsional_oscillations
(prep_to_axi()
,getto()
,gettonext()
,gettofinish()
): This module contains information for TO calculation and outputgraphout_mod
(graphout_mpi()
,graphout_mpi_header()
): This module contains the subroutines that store the 3-D graphic files.dtb_mod
(get_dtblm()
,get_dh_dtblm()
): This module contains magnetic field stretching and advection terms plus a separate omega-effect. It is used for movie output….outrot
(get_lorentz_torque()
): This module handles the writing of several diagnostic files related to the rotation: angular momentum (AM.TAG), drift (drift.TAG), inner core and mantle rotations….courant_mod
(courant()
): This module handles the computation of Courant factors on grid space. It then checks whether the timestep size needs to be modified.power
(get_visc_heat()
): This module handles the writing of the power budgetoutmisc_mod
(get_ekin_solid_liquid()
,get_hemi()
,get_helicity()
): This module contains several subroutines that can compute and store various informations: helicity (helicity.TAG), heat transfer (heat.TAG), phase field (phase.TAG) and North/South hemisphericity of energies (hemi.TAG)outpar_mod
(get_fluxes()
,get_nlblayers()
,get_perppar()
): This module is used to compute several time-averaged radial profiles: fluxes, boundary layers, etc.geos
(calcgeos()
): This module is used to compute z-integrated diagnostics such as the degree of geostrophy or the separation of energies between inside and outside the tangent cylinder. This makes use of a local Simpson’s method. This alsofields
(s_rloc()
,ds_rloc()
,z_rloc()
,dz_rloc()
,p_rloc()
,b_rloc()
,db_rloc()
,ddb_rloc()
,aj_rloc()
,dj_rloc()
,w_rloc()
,dw_rloc()
,ddw_rloc()
,xi_rloc()
,omega_ic()
,omega_ma()
,dp_rloc()
,phi_rloc()
): 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….time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.physical_parameters
(ktops()
,kbots()
,n_r_lcr()
,ktopv()
,kbotv()
): Module containing the physical parametersriteration
(riter_t()
): This module is used to define an abstract class for the radial looprms
(get_nl_rms()
,transform_to_lm_rms()
,compute_lm_forces()
,transform_to_grid_rms()
): This module contains the calculation of the RMS force balance and induction terms.probe_mod
: Module for artificial sensors to compare time series of physical data with experiments. Probes are located in a radially symmetrical way
Types
-
type
riter_mod/
unknown_type
¶ - Type fields
%
dtb_arrays
[dtb_arrays_t ]%
gsa
[grid_space_arrays_t ]%
nl_lm
[nonlinear_lm_t ]%
to_arrays
[to_arrays_t ]
-
type
Subroutines and functions
-
subroutine
riter_mod/
initialize
(this)¶ - Parameters
this [real ]
-
subroutine
riter_mod/
finalize
(this)¶ - Parameters
this [real ]
-
subroutine
riter_mod/
radialloop
(this, l_graph, l_frame, time, timestage, tscheme, dtlast, ltocalc, ltonext, ltonext2, lhelcalc, lpowercalc, lrmscalc, lpresscalc, lpressnext, lviscbccalc, lfluxprofcalc, lperpparcalc, lgeoscalc, lhemicalc, l_probe_out, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dvxvhlm, dvxbhlm, dvsrlm, dvxirlm, lorentz_torque_ic, lorentz_torque_ma, br_vt_lm_cmb, br_vp_lm_cmb, br_vt_lm_icb, br_vp_lm_icb, dtrkc, dthkc)¶ This subroutine handles the main loop over the radial levels. It calls the SH transforms, computes the nonlinear terms on the grid and bring back the quantities in spectral space. This is the most time consuming part of MagIC.
- Parameters
this [real ]
l_graph [logical ,in]
l_frame [logical ,in]
time [real ,in]
timestage [real ,in]
tscheme [real ]
dtlast [real ,in]
ltocalc [logical ,in]
ltonext [logical ,in]
ltonext2 [logical ,in]
lhelcalc [logical ,in]
lpowercalc [logical ,in]
lrmscalc [logical ,in]
lpresscalc [logical ,in]
lpressnext [logical ,in]
lviscbccalc [logical ,in]
lfluxprofcalc [logical ,in]
lperpparcalc [logical ,in]
lgeoscalc [logical ,in]
lhemicalc [logical ,in]
l_probe_out [logical ,in]
dbdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
djdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
dvxbhlm (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
lorentz_torque_ic [real ,out]
lorentz_torque_ma [real ,out]
br_vt_lm_cmb (*) [complex ,out] :: product br*vt at CMB
br_vp_lm_cmb (*) [complex ,out] :: product br*vp at CMB
br_vt_lm_icb (*) [complex ,out] :: product br*vt at ICB
br_vp_lm_icb (*) [complex ,out] :: product br*vp at ICB
- Call to
graphout_mpi_header()
,prep_to_axi()
,get_nl_rms()
,get_br_v_bcs()
,get_lorentz_torque()
,courant()
,graphout_mpi()
,probe_out()
,get_helicity()
,get_hemi()
,get_visc_heat()
,get_nlblayers()
,get_fluxes()
,get_ekin_solid_liquid()
,get_perppar()
,calcgeos()
,store_movie_frame()
,get_dtblm()
,gettonext()
,getto()
,compute_lm_forces()
,gettofinish()
,get_dh_dtblm()
-
subroutine
riter_mod/
transform_to_grid_space
(this, nr, nbc, lviscbccalc, lrmscalc, lpresscalc, ltocalc, lpowercalc, lfluxprofcalc, lperpparcalc, lhelcalc, lgeoscalc, lhemicalc, l_frame, lderiv)¶ This subroutine actually handles the spherical harmonic transforms from (ell,m) space to (theta,phi) space.
- Parameters
this [real ]
nr [integer ,in]
nbc [integer ,in]
lviscbccalc [logical ,in]
lrmscalc [logical ,in]
lpresscalc [logical ,in]
ltocalc [logical ,in]
lpowercalc [logical ,in]
lfluxprofcalc [logical ,in]
lperpparcalc [logical ,in]
lhelcalc [logical ,in]
lgeoscalc [logical ,in]
lhemicalc [logical ,in]
l_frame [logical ,in]
lderiv [logical ,in]
- Call to
scal_to_spat()
,scal_to_grad_spat()
,transform_to_grid_rms()
,torpol_to_spat()
,torpol_to_curl_spat()
,pol_to_grad_spat()
,torpol_to_dphspat()
,pol_to_curlr_spat()
,v_rigid_boundary()
-
subroutine
riter_mod/
transform_to_lm_space
(this, nr, lrmscalc, dvsrlm, dvxirlm, dphidt)¶ This subroutine actually handles the spherical harmonic transforms from (theta,phi) space to (ell,m) space.
- Parameters
- Call to
get_openmp_blocks()
,spat_to_qst()
,scal_to_sh()
,spat_to_sphertor()
,transform_to_lm_rms()
get_td.f90
¶
Description
This module is used to finish the assembly of the nonlinear terms in \((\ell,m)\) space. Derivatives along \(\theta\) and \(\phi\) are handled using recurrence relations.
Quick access
- Variables
- Routines
Needed modules
precision_mod
: This module controls the precision used in MagICmem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICtruncation
(lm_max()
,lm_maxmag()
,m_min()
): This module defines the grid points and the truncationlogic
(l_anel()
,l_conv_nl()
,l_corr()
,l_heat()
,l_anelastic_liquid()
,l_mag_nl()
,l_mag_kin()
,l_mag_lf()
,l_conv()
,l_mag()
,l_chemical_conv()
,l_single_matrix()
,l_double_curl()
): Module containing the logicals that control the runradial_functions
(r()
,or2()
,or1()
,beta()
,epscprof()
,or4()
,temp0()
,orho1()
,l_r()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(corfac()
,epsc()
,n_r_lcr()
,epscxi()
): Module containing the physical parametersblocking
(lm2l()
,lm2m()
,lm2lma()
,lm2lms()
): Module containing blocking informationhorizontal_data
(dlh()
,dphi()
,dtheta2a()
,dtheta3a()
,dtheta4a()
,dtheta2s()
,dtheta3s()
,dtheta4s()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderconstants
(zero()
,two()
): module containing constants and parameters used in the code.fields
(w_rloc()
,dw_rloc()
,ddw_rloc()
,z_rloc()
,dz_rloc()
): 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….
Types
-
type
nonlinear_lm_mod/
unknown_type
¶ - Type fields
%
advplm
(*) [complex ,allocatable]%
advrlm
(*) [complex ,allocatable]%
advtlm
(*) [complex ,allocatable]%
heattermslm
(*) [complex ,allocatable]%
vsplm
(*) [complex ,allocatable]%
vstlm
(*) [complex ,allocatable]%
vxbplm
(*) [complex ,allocatable]%
vxbrlm
(*) [complex ,allocatable]%
vxbtlm
(*) [complex ,allocatable]%
vxiplm
(*) [complex ,allocatable]%
vxitlm
(*) [complex ,allocatable]
-
type
Variables
-
nonlinear_lm_mod/
lm_min
[integer,private]¶
-
Subroutines and functions
-
subroutine
nonlinear_lm_mod/
initialize
(this, lmp_max)¶ Memory allocation of
get_td
arrays- Parameters
this [real ]
lmp_max [integer ,in]
-
subroutine
nonlinear_lm_mod/
finalize
(this)¶ Memory deallocation
- Parameters
this [real ]
-
subroutine
nonlinear_lm_mod/
set_zero
(this)¶ Set all the arrays to zero
- Parameters
this [real ]
-
subroutine
nonlinear_lm_mod/
get_td
(this, nr, nbc, lpressnext, dvxvhlm, dvxbhlm, dwdt, dzdt, dpdt, dsdt, dxidt, dbdt, djdt)¶ Purpose of this to calculate time derivatives
dwdt
,``dzdt``,``dpdt``,``dsdt``,``dxidt``,``dbdt``,``djdt`` and auxiliary arraysdVxBhLM
,dVxVhLM
from non-linear terms in spectral form- Parameters
this [real ]
nr [integer ,in] :: Radial level
nbc [integer ,in] :: signifies boundary conditions
lpressnext [logical ,in]
dvxvhlm (*) [complex ,out]
dvxbhlm (*) [complex ,out]
dwdt (*) [complex ,out] :: +CorPol_loc
dzdt (*) [complex ,out]
dpdt (*) [complex ,out]
dsdt (*) [complex ,out]
dxidt (*) [complex ,out]
dbdt (*) [complex ,out]
djdt (*) [complex ,out]
nonlinear_bcs.f90
¶
Quick access
- Routines
Needed modules
iso_fortran_env
(output_unit()
)precision_mod
: This module controls the precision used in MagICtruncation
(n_phi_max()
,l_max()
,n_theta_max()
,nlat_padded()
,lm_max()
): This module defines the grid points and the truncationradial_data
(n_r_cmb()
,n_r_icb()
): This module defines the MPI decomposition in the radial direction.radial_functions
(r_cmb()
,r_icb()
,rho0()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(sigma_ratio()
,conductance_ma()
,prmag()
,oek()
): Module containing the physical parametershorizontal_data
(costheta()
,sintheta_e2()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderconstants
(two()
): module containing constants and parameters used in the code.useful
(abortrun()
): This module contains several useful routines.
Variables
Subroutines and functions
-
subroutine
nonlinear_bcs/
get_br_v_bcs
(br, vt, vp, omega, o_r_e_2, o_rho, br_vt_lm, br_vp_lm)¶ Purpose of this subroutine is to calculate the nonlinear term of the magnetic boundary condition for a conducting mantle or inner core in space (r,lm). Calculation is performed for the theta block:
n_theta_min<=n_theta<=n_theta_min+n_theta_block-1
On input
br
,vt
andvp
are given on all phi points and thetas in the specific block. On output the contribution of these grid points to all degree and orders is stored inbr_vt_lm
andbr_vp_lm
. Output is[r/sin(theta)*Br*U]=[(0,br_vt_lm,br_vp_lm)]
- Parameters
br (*,*) [real ,in] :: \(r^2 B_r\)
vt (*,*) [real ,in] :: \(r \sin\theta u_\theta\)
vp (*,*) [real ,in] :: \(r \sin\theta u_\phi\)
omega [real ,in] :: rotation rate of mantle or IC
o_r_e_2 [real ,in] :: \(1/r^2\)
o_rho [real ,in] :: \(1/\tilde{\rho}\) (anelastic)
br_vt_lm (lm_max) [complex ,inout]
br_vp_lm (lm_max) [complex ,inout]
- Called from
- Call to
-
subroutine
nonlinear_bcs/
get_b_nl_bcs
(bc, br_vt_lm, br_vp_lm, lm_min_b, lm_max_b, b_nl_bc, aj_nl_bc)¶ Purpose of this subroutine is to calculate the nonlinear term of the magnetic boundary condition for a conducting mantle in physical space (theta,phi), assuming that the conductance of the mantle is much smaller than that of the core. Calculation is performed for the theta block:
n_theta_min<=n_theta<=n_theta_min+n_theta_block-1
- Parameters
bc [character(len=3),in] :: Distinguishes ‘CMB’ and ‘ICB’
br_vt_lm (lm_max) [complex ,in] :: \(B_r u_\theta/(r^2\sin^2\theta)\)
br_vp_lm (lm_max) [complex ,in] :: \(B_r u_\phi/(r^2\sin^2\theta)\)
lm_min_b [integer ,in]
lm_max_b [integer ,in] :: limits of lm-block
b_nl_bc (lm_max_b-lm_min_b+1) [complex ,out] :: nonlinear bc for b
aj_nl_bc (lm_max_b-lm_min_b+1) [complex ,out] :: nonlinear bc for aj
- Called from
- Call to
-
subroutine
nonlinear_bcs/
v_rigid_boundary
(nr, omega, lderiv, vrr, vtr, vpr, cvrr, dvrdtr, dvrdpr, dvtdpr, dvpdpr)¶ Purpose of this subroutine is to set the velocities and their derivatives at a fixed boundary. While
vt
is zero, since we only allow for rotation about the \(z\)-axis,vp= r \sin(theta) v_phi = r**2 sin(theta)**2 omega
andcvr= r**2 * radial component of (\curl v) = r**2 2 cos(theta) omega
- Parameters
nr [integer ,in] :: no of radial grid point
omega [real ,in] :: boundary rotation rate
lderiv [logical ,in] :: derivatives required ?
vrr (*,*) [real ,out]
vtr (*,*) [real ,out]
vpr (*,*) [real ,out]
cvrr (*,*) [real ,out]
dvrdtr (*,*) [real ,out]
dvrdpr (*,*) [real ,out]
dvtdpr (*,*) [real ,out]
dvpdpr (*,*) [real ,out]
- Called from