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, lphasecalc, 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]
lphasecalc [logical ,in]
l_probe_out [logical ,in]
dbdt (lm_maxmag,1 - nrstartmag + nrstopmag) [complex ,out]
djdt (lm_maxmag,1 - nrstartmag + nrstopmag) [complex ,out]
dvxbhlm (lm_maxmag,1 - nrstartmag + nrstopmag) [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
Quick access
- Types:
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/riter_t¶
Variables
- riteration/unknown_interface [private]¶
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
- Types:
- Variables:
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()
,l_dtrmagspec()
): 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)\).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….out_movie
(store_movie_frame()
): This module handles the storage of the relevant diagnostics in the public array frames(*) and then the writing of the corresponding movie filesoutrot
(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.nonlinear_bcs
(get_br_v_bcs()
,v_rigid_boundary()
,v_center_sphere()
)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()
,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 wayspecial
(ellip_fac_icb()
,l_radial_flow_bc()
): 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
Types
- type riter_mod/riter_single_t¶
- Type fields:
% gsa [grid_space_arrays_t ]
% nl_lm [nonlinear_lm_t ]
Variables
get_nl.f90
¶
Quick access
- Types:
Types
- type general_arrays_mod/general_arrays_t¶
Variables
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
- Types:
- Variables:
get_dbdt
,get_dpdt
,get_dsdt
,get_dwdt
,get_dwdt_double_curl
,get_dxidt
,get_dzdt
,lm_min
,set_zero
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()
,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/nonlinear_lm_t¶
- 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]
Variables
- nonlinear_lm_mod/finalize [private]¶
- nonlinear_lm_mod/get_dbdt [private]¶
- nonlinear_lm_mod/get_dpdt [private]¶
- nonlinear_lm_mod/get_dsdt [private]¶
- nonlinear_lm_mod/get_dwdt [private]¶
- nonlinear_lm_mod/get_dwdt_double_curl [private]¶
- nonlinear_lm_mod/get_dxidt [private]¶
- nonlinear_lm_mod/get_dzdt [private]¶
- nonlinear_lm_mod/initialize [private]¶
- nonlinear_lm_mod/lm_min [integer,private]¶
- nonlinear_lm_mod/set_zero [private]¶
nonlinear_bcs.f90
¶
Quick access
- Routines:
get_b_nl_bcs()
,get_br_v_bcs()
,v_center_sphere()
,v_rigid_boundary()
Needed modules
iso_fortran_env
(output_unit()
)precision_mod
: This module controls the precision used in MagICtruncation
(n_phi_max()
,l_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()
,phi()
,sintheta()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderconstants
(two()
,y10_norm()
,y11_norm()
,zero()
): 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 (*) [complex ,inout] :: br*vt/(sin(theta)**2*r**2)
br_vp_lm (*) [complex ,inout] :: br*(vp/(sin(theta)**2*r**2)-omega_ma)
- Call to:
- subroutine nonlinear_bcs/get_b_nl_bcs(bc, br_vt_lm, br_vp_lm, 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.
- Parameters:
bc [character(len=3),in] :: Distinguishes ‘CMB’ and ‘ICB’
br_vt_lm (*) [complex ,in] :: \(B_r u_\theta/(r^2\sin^2\theta)\)
br_vp_lm (*) [complex ,in] :: \(B_r u_\phi/(r^2\sin^2\theta)\)
b_nl_bc (*) [complex ,out] :: nonlinear bc for b
aj_nl_bc (*) [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]
- subroutine nonlinear_bcs/v_center_sphere(ddw, vrr, vtr, vpr)¶
This routine is only called for full sphere computations to construct a vector field at the center of the the sphere. At the center, we have wlm propto r^{l+1} and so vr = d2wlm/dr2 for l=1, 0 otherwise vtheta, vphi = sht(1/l*ddwlm, 0) for l=1, 0 otherwise
- Parameters:
ddw (*) [complex ,in]
vrr (*,*) [real ,out]
vtr (*,*) [real ,out]
vpr (*,*) [real ,out]