Linear calculation part of the time stepping (LMLoop)¶
LMLoop.f90
¶
Quick access
- Variables
array_of_requests
,block_sze
,n_penta
,n_requests
,n_tri
,nblocks
- Routines
assemble_stage()
,assemble_stage_rdist()
,finalize_lmloop()
,finish_explicit_assembly()
,finish_explicit_assembly_rdist()
,initialize_lmloop()
,lmloop()
,lmloop_rdist()
,parallel_solve()
,parallel_solve_phase()
,set_block_number()
,test_lmloop()
,time_lm_loop()
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….precision_mod
: This module controls the precision used in MagICparallel_mod
: This module contains the blocking informationconstants
(one()
): module containing constants and parameters used in the code.useful
(abortrun()
,logwrite()
): This module contains several useful routines.num_param
(solve_counter()
): Module containing numerical and control parametersmem_alloc
(memwrite()
,bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICtruncation
(l_max()
,lm_max()
,n_r_max()
,n_r_maxmag()
,n_r_ic_max()
,lm_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.blocking
(lo_map()
,llm()
,ulm()
,llmmag()
,ulmmag()
,st_map()
): Module containing blocking informationlogic
(l_mag()
,l_conv()
,l_heat()
,l_single_matrix()
,l_double_curl()
,l_chemical_conv()
,l_cond_ic()
,l_update_s()
,l_z10mat()
,l_parallel_solve()
,l_mag_par_solve()
,l_phase_field()
,l_onset()
): Module containing the logicals that control the runtime_array
(type_tarray()
,type_tscalar()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.timing
(timer_type()
): This module contains functions that are used to measure the time spent.updates_mod
: This module handles the time advance of the entropy s. It contains the computation of the implicit terms and the linear solves….updatez_mod
: This module handles the time advance of the toroidal potential z It contains the computation of the implicit terms and the linear solves….updatewp_mod
: 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
: 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 linearupdateb_mod
: 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 linearupdatexi_mod
: 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
: This module handles the time advance of the phase field phi. It contains the computation of the implicit terms and the linear solves….
Variables
-
lmloop_mod/
array_of_requests
(*) [integer,private/allocatable]¶
-
-
lmloop_mod/
block_sze
[integer,private]¶
-
-
lmloop_mod/
n_penta
[integer,private]¶ Number of tridiagonal and pentadiagonal solvers
-
-
lmloop_mod/
n_requests
[integer,private]¶
-
-
lmloop_mod/
n_tri
[integer,private]¶
-
-
lmloop_mod/
nblocks
[integer,private]¶
-
Subroutines and functions
-
subroutine
lmloop_mod/
initialize_lmloop
(tscheme)¶ This subroutine handles the memory allocation of the matrices needed in the time advance of MagIC
- Parameters
tscheme [real ] :: time scheme
- Called from
- Call to
initialize_updatewps()
,initialize_updates()
,initialize_updatewp()
,initialize_updatexi()
,initialize_updatephi()
,initialize_updatez()
,initialize_updateb()
,memwrite()
,set_block_number()
-
subroutine
lmloop_mod/
test_lmloop
(tscheme)¶ This subroutine is used to solve dummy linear problem to estimate the best blocking size. This is done once at the initialisation stage of MagIC.
- Parameters
tscheme [real ] :: time scheme
- Called from
- Call to
prepares_fd()
,preparexi_fd()
,preparez_fd()
,preparew_fd()
,prepareb_fd()
,find_faster_block()
-
subroutine
lmloop_mod/
finalize_lmloop
(tscheme)¶ This subroutine deallocates the matrices involved in the time advance of MagIC.
- Parameters
tscheme [real ] :: time scheme
- Called from
- Call to
finalize_updatewps()
,finalize_updates()
,finalize_updatewp()
,finalize_updatez()
,finalize_updatexi()
,finalize_updatephi()
,finalize_updateb()
-
subroutine
lmloop_mod/
lmloop
(time, timenext, tscheme, lmat, lrmsnext, lpressnext, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dbdt_ic, djdt_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, b_nl_cmb, aj_nl_cmb, aj_nl_icb)¶ This subroutine performs the actual time-stepping. It calls succesively the update routines of the various fields.
- Parameters
time [real ,in]
timenext [real ,in]
tscheme [real ]
lmat [logical ,in]
lrmsnext [logical ,in]
lpressnext [logical ,in]
dsdt [type_tarray ,inout]
dwdt [type_tarray ,inout]
dzdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
dxidt [type_tarray ,inout]
dphidt [type_tarray ,inout]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
b_nl_cmb (lm_max) [complex ,in] :: nonlinear bc for b at CMB
aj_nl_cmb (lm_max) [complex ,in] :: nonlinear bc for aj at CMB
aj_nl_icb (lm_max) [complex ,in] :: nonlinear bc for dr aj at ICB
- Called from
- Call to
updatephi()
,updates()
,updatexi()
,updatez()
,updatewps()
,updatewp()
,updateb()
-
subroutine
lmloop_mod/
lmloop_rdist
(time, timenext, tscheme, lmat, lrmsnext, lpressnext, lp00next, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dbdt_ic, djdt_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, b_nl_cmb, aj_nl_cmb, aj_nl_icb)¶ This subroutine performs the actual time-stepping. It calls succesively the update routines of the various fields. This is used with the parallel finite difference solver.
- Parameters
time [real ,in]
timenext [real ,in]
tscheme [real ]
lmat [logical ,in]
lrmsnext [logical ,in]
lpressnext [logical ,in]
lp00next [logical ,in] :: Do wee need p00 pressure on next log
dsdt [type_tarray ,inout]
dwdt [type_tarray ,inout]
dzdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
dxidt [type_tarray ,inout]
dphidt [type_tarray ,inout]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
b_nl_cmb (lm_max) [complex ,in] :: nonlinear bc for b at CMB
aj_nl_cmb (lm_max) [complex ,in] :: nonlinear bc for aj at CMB
aj_nl_icb (lm_max) [complex ,in] :: nonlinear bc for dr aj at ICB
- Called from
- Call to
preparephase_fd()
,parallel_solve_phase()
,fill_ghosts_phi()
,updatephase_fd()
,prepares_fd()
,preparexi_fd()
,preparez_fd()
,preparew_fd()
,prepareb_fd()
,parallel_solve()
,fill_ghosts_s()
,fill_ghosts_xi()
,fill_ghosts_z()
,fill_ghosts_w()
,fill_ghosts_b()
,updates_fd()
,updatexi_fd()
,updatez_fd()
,updatew_fd()
,updateb_fd()
,updateb()
-
subroutine
lmloop_mod/
finish_explicit_assembly
(omega_ic, w, b_ic, aj_ic, dvsr_lmloc, dvxir_lmloc, dvxvh_lmloc, dvxbh_lmloc, lorentz_torque_ma, lorentz_torque_ic, dsdt, dxidt, dwdt, djdt, dbdt_ic, djdt_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, tscheme)¶ This subroutine is used to finish the computation of the explicit terms. This is only possible in a LM-distributed space since it mainly involves computation of radial derivatives.
- Parameters
omega_ic [real ,in]
b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
dvxbh_lmloc (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
lorentz_torque_ma [real ,in]
lorentz_torque_ic [real ,in]
dsdt [type_tarray ,inout]
dxidt [type_tarray ,inout]
dwdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
tscheme [real ]
- Called from
- Call to
finish_exp_comp()
,finish_exp_smat()
,finish_exp_entropy()
,finish_exp_pol()
,finish_exp_tor()
,finish_exp_mag()
,finish_exp_mag_ic()
-
subroutine
lmloop_mod/
finish_explicit_assembly_rdist
(omega_ic, w, b_ic, aj_ic, dvsr_rloc, dvxir_rloc, dvxvh_rloc, dvxbh_rloc, lorentz_torque_ma, lorentz_torque_ic, dsdt_rloc, dxidt_rloc, dwdt_rloc, djdt_rloc, dbdt_ic, djdt_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, tscheme)¶ This subroutine is used to finish the computation of the explicit terms. This is the version that handles R-distributed arrays used when FD are employed.
- Parameters
omega_ic [real ,in]
b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
dvxbh_rloc (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,inout]
lorentz_torque_ma [real ,in]
lorentz_torque_ic [real ,in]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
tscheme [real ]
- Called from
- Call to
finish_exp_comp_rdist()
,finish_exp_smat_rdist()
,finish_exp_entropy_rdist()
,finish_exp_pol_rdist()
,finish_exp_tor()
,finish_exp_mag_rdist()
,finish_exp_mag_ic()
-
subroutine
lmloop_mod/
assemble_stage
(time, omega_ic, omega_ic1, omega_ma, omega_ma1, dwdt, dzdt, dpdt, dsdt, dxidt, dphidt, dbdt, djdt, dbdt_ic, djdt_ic, domega_ic_dt, domega_ma_dt, lorentz_torque_ic_dt, lorentz_torque_ma_dt, lpressnext, lrmsnext, tscheme)¶ This routine is used to call the different assembly stage of the different equations. This is only used for a special subset of IMEX-RK schemes that have
tscheme%l_assembly=.true.
- Parameters
time [real ,in]
omega_ic [real ,inout]
omega_ic1 [real ,inout]
omega_ma [real ,inout]
omega_ma1 [real ,inout]
dwdt [type_tarray ,inout]
dzdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
dsdt [type_tarray ,inout]
dxidt [type_tarray ,inout]
dphidt [type_tarray ,inout]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ic_dt [type_tscalar ,inout]
domega_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lpressnext [logical ,in]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
assemble_comp()
,assemble_phase()
,assemble_single()
,assemble_entropy()
,assemble_pol()
,assemble_tor()
,assemble_mag()
-
subroutine
lmloop_mod/
assemble_stage_rdist
(time, omega_ic, omega_ic1, omega_ma, omega_ma1, dwdt, dzdt, dpdt, dsdt, dxidt, dphidt, dbdt, djdt, dbdt_ic, djdt_ic, domega_ic_dt, domega_ma_dt, lorentz_torque_ic_dt, lorentz_torque_ma_dt, lpressnext, lrmsnext, tscheme)¶ This routine is used to call the different assembly stage of the different equations. This is only used for a special subset of IMEX-RK schemes that have
tscheme%l_assembly=.true.
- Parameters
time [real ,in]
omega_ic [real ,inout]
omega_ic1 [real ,inout]
omega_ma [real ,inout]
omega_ma1 [real ,inout]
dwdt [type_tarray ,inout]
dzdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
dsdt [type_tarray ,inout]
dxidt [type_tarray ,inout]
dphidt [type_tarray ,inout]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
domega_ic_dt [type_tscalar ,inout]
domega_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lpressnext [logical ,in]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
assemble_phase_rloc()
,assemble_comp_rloc()
,assemble_entropy_rloc()
,assemble_pol_rloc()
,assemble_tor_rloc()
,assemble_mag_rloc()
,assemble_mag()
-
subroutine
lmloop_mod/
parallel_solve_phase
(block_sze)¶ This subroutine handles the parallel solve of the phase field matrices. This needs to be updated before the temperature.
- Parameters
block_sze [integer ,in] :: Size ot the LM blocks
- Called from
- Call to
-
subroutine
lmloop_mod/
parallel_solve
(block_sze)¶ This subroutine handles the parallel solve of the time-advance matrices. This works with R-distributed arrays (finite differences).
- Parameters
block_sze [integer ,in] :: Size ot the LM blocks
- Called from
- Call to
-
function
lmloop_mod/
set_block_number
(nb)¶ This routine returns the number of lm-blocks for solving the LM loop. This is adapted from xshells.
- Parameters
nb [integer ,inout] :: No more than 2048 blocks
- Return
nbo [integer ]
- Called from
-
subroutine
lmloop_mod/
find_faster_block
()¶ This routine is used to find the best lm-block size for MPI communication. This is adapted from xshells.
- Call to
-
function
lmloop_mod/
time_lm_loop
(nblk, nloops)¶ This function is defined to measure the time of a call to the parallel solvers when a a number of block nblk is used. This takes the average over nloop calls.
- Parameters
nblk [integer ,inout] :: Number of lm blocks
nloops [integer ,in] :: Number of calls
- Return
time [real ]
- Call to
updateWPS.f90
¶
Description
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 linear solves.
Quick access
- Variables
cor00_fac
,lwpsmat
,ps0mat
,ps0mat_fac
,ps0pivot
,workb
,workc
,wpsmat
,wpsmat_fac
,wpspivot
- Routines
assemble_single()
,finalize_updatewps()
,finish_exp_smat()
,finish_exp_smat_rdist()
,get_ps0mat()
,get_single_rhs_imp()
,get_wpsmat()
,initialize_updatewps()
,updatewps()
Needed modules
omp_lib
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()
,n_r_max()
,l_max()
,m_min()
): This module defines the grid points and the truncationradial_data
(n_r_cmb()
,n_r_icb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(or1()
,or2()
,rho0()
,rgrav()
,r()
,visc()
,dlvisc()
,rscheme_oc()
,beta()
,dbeta()
,dlkappa()
,dltemp0()
,ddltemp0()
,alpha0()
,dlalpha0()
,ddlalpha0()
,ogrun()
,kappa()
,orho1()
,dentropy0()
,temp0()
,l_r()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(kbotv()
,ktopv()
,ktops()
,kbots()
,ra()
,opr()
,vischeatfac()
,thexpnb()
,buofac()
,corfac()
,ktopp()
): Module containing the physical parametersnum_param
(dct_counter()
,solve_counter()
): Module containing numerical and control parametersinit_fields
(tops()
,bots()
): This module is used to construct the initial solution.blocking
(lo_sub_map()
,lo_map()
,st_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationhorizontal_data
(hdif_v()
,hdif_s()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_update_v()
,l_temperature_diff()
,l_rms()
,l_full_sphere()
): Module containing the logicals that control the runrms
(difpol2hint()
,difpollmr()
): This module contains the calculation of the RMS force balance and induction terms.communications
(get_global_sum()
): This module contains the different MPI communicators used in MagIC.parallel_mod
(chunksize()
,rank()
,n_procs()
,get_openmp_blocks()
): This module contains the blocking informationradial_der
(get_dddr()
,get_ddr()
,get_dr()
,get_dr_rloc()
): Radial derivatives functionsconstants
(zero()
,one()
,two()
,three()
,four()
,third()
,half()
,pi()
,osq4pi()
): module containing constants and parameters used in the code.fields
(work_lmloc()
): 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….useful
(abortrun()
,cc2real()
): This module contains several useful routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.
Variables
-
updatewps_mod/
cor00_fac
[real,private]¶
-
-
updatewps_mod/
lwpsmat
(*) [logical,allocatable/public]¶
-
-
updatewps_mod/
maxthreads
[integer,private]¶
-
-
updatewps_mod/
ps0mat
(*,*) [real,private/allocatable]¶
-
-
updatewps_mod/
ps0mat_fac
(*,*) [real,private/allocatable]¶
-
-
updatewps_mod/
ps0pivot
(*) [integer,private/allocatable]¶
-
-
updatewps_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
-
updatewps_mod/
workb
(*,*) [complex,private/allocatable]¶
-
-
updatewps_mod/
workc
(*,*) [complex,private/allocatable]¶
-
-
updatewps_mod/
wpsmat
(*,*,*) [real,private/allocatable]¶
-
-
updatewps_mod/
wpsmat_fac
(*,*,*) [real,private/allocatable]¶
-
-
updatewps_mod/
wpspivot
(*,*) [integer,private/allocatable]¶
-
Subroutines and functions
-
subroutine
updatewps_mod/
initialize_updatewps
()¶ - Called from
-
subroutine
updatewps_mod/
finalize_updatewps
()¶ - Called from
-
subroutine
updatewps_mod/
updatewps
(w, dw, ddw, z10, dwdt, p, dp, dpdt, s, ds, dsdt, tscheme, lrmsnext)¶ updates the poloidal velocity potential w, the pressure p, the entropy and their radial derivatives.
- Parameters
z10 (n_r_max) [real ,in]
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
dsdt [type_tarray ,inout]
tscheme [real ]
lrmsnext [logical ,in]
- Called from
- Call to
-
subroutine
updatewps_mod/
finish_exp_smat
(dvsrlm, ds_exp_last)¶ - Parameters
- Called from
- Call to
-
subroutine
updatewps_mod/
finish_exp_smat_rdist
(dvsrlm, ds_exp_last)¶ - Parameters
- Called from
- Call to
-
subroutine
updatewps_mod/
assemble_single
(s, ds, w, dw, ddw, dsdt, dwdt, dpdt, tscheme, lrmsnext)¶ This routine is used to assemble the solution in case IMEX RK with an assembly stage are used
- Parameters
dsdt [type_tarray ,inout]
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
tscheme [real ]
lrmsnext [logical ,in]
- Called from
- Call to
-
subroutine
updatewps_mod/
get_single_rhs_imp
(s, ds, w, dw, ddw, p, dp, dsdt, dwdt, dpdt, tscheme, istage, l_calc_lin, lrmsnext[, l_in_cheb_space])¶ – Input variables
- Parameters
dsdt [type_tarray ,inout]
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lrmsnext [logical ,in]
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updatewps()
- Call to
-
subroutine
updatewps_mod/
get_wpsmat
(tscheme, l, hdif_vel, hdif_s, wpsmat, wpspivot, wpsmat_fac)¶ Purpose of this subroutine is to contruct the time step matrix wpmat for the NS equation.
- Parameters
- Called from
- Call to
-
subroutine
updatewps_mod/
get_ps0mat
(tscheme, psmat, pspivot, psmat_fac)¶ - Parameters
- Called from
- Call to
updateWP.f90
¶
Description
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.
Quick access
- Variables
ddddw
,dwold
,ellmat_fd
,l_ellmat
,lwpmat
,p0_ghost
,p0mat_fd
,rhs0
,size_rhs1
,w_ghost
,wmat_fd
,work
,wpmat_fac
- Routines
assemble_pol()
,assemble_pol_rloc()
,fill_ghosts_w()
,finalize_updatewp()
,finish_exp_pol()
,finish_exp_pol_rdist()
,get_elliptic_mat()
,get_elliptic_mat_rdist()
,get_p0mat()
,get_p0mat_rdist()
,get_pol()
,get_pol_rhs_imp()
,get_pol_rhs_imp_ghost()
,get_wmat()
,get_wmat_rdist()
,get_wpmat()
,initialize_updatewp()
,preparew_fd()
,updatew_fd()
,updatewp()
Needed modules
omp_lib
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()
,n_r_max()
,l_max()
,m_min()
): This module defines the grid points and the truncationradial_data
(n_r_cmb()
,n_r_icb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(or1()
,or2()
,rho0()
,rgrav()
,visc()
,dlvisc()
,r()
,alpha0()
,temp0()
,beta()
,dbeta()
,ogrun()
,l_r()
,rscheme_oc()
,ddlvisc()
,ddbeta()
,orho1()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(kbotv()
,ktopv()
,ra()
,buofac()
,chemfac()
,vischeatfac()
,thexpnb()
,ktopp()
): Module containing the physical parametersnum_param
(dct_counter()
,solve_counter()
): Module containing numerical and control parametersblocking
(lo_sub_map()
,lo_map()
,st_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationhorizontal_data
(hdif_v()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_update_v()
,l_chemical_conv()
,l_rms()
,l_double_curl()
,l_fluxprofs()
,l_finite_diff()
,l_full_sphere()
,l_heat()
,l_parallel_solve()
): Module containing the logicals that control the runrms
(difpol2hint()
,difpollmr()
): This module contains the calculation of the RMS force balance and induction terms.communications
(get_global_sum()
): This module contains the different MPI communicators used in MagIC.parallel_mod
: This module contains the blocking informationradial_der
(get_dddr()
,get_ddr()
,get_dr()
,get_dr_rloc()
,get_ddddr_ghost()
,bulk_to_ghost()
,exch_ghosts()
): Radial derivatives functionsintegration
(rint_r()
): Radial integration functionsfields
(work_lmloc()
,s_rloc()
,xi_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….constants
(zero()
,one()
,two()
,three()
,four()
,third()
,half()
): module containing constants and parameters used in the code.useful
(abortrun()
,cc2real()
): This module contains several useful routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.parallel_solvers
: This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updatewp_mod/
ddddw
(*,*) [complex,private/allocatable]¶
-
-
updatewp_mod/
dwold
(*,*) [complex,private/allocatable]¶
-
-
updatewp_mod/
ellmat_fd
[type_tri_par,public]¶
-
-
updatewp_mod/
l_ellmat
(*) [logical,private/allocatable]¶
-
-
updatewp_mod/
lwpmat
(*) [logical,allocatable/public]¶
-
-
updatewp_mod/
maxthreads
[integer,private]¶
-
-
updatewp_mod/
p0_ghost
(*) [complex,allocatable/public]¶
-
-
updatewp_mod/
p0mat_fd
[type_tri_par,public]¶
-
-
updatewp_mod/
rhs
(*) [real,private/allocatable]¶
-
-
updatewp_mod/
rhs0
(*,*,*) [real,private/allocatable]¶
-
-
updatewp_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
-
updatewp_mod/
size_rhs1
[integer,private]¶
-
-
updatewp_mod/
w_ghost
(*,*) [complex,allocatable/public]¶
-
-
updatewp_mod/
wmat_fd
[type_penta_par,public]¶
-
-
updatewp_mod/
work
(*) [real,private/allocatable]¶
-
-
updatewp_mod/
wpmat_fac
(*,*,*) [real,private/allocatable]¶
-
Subroutines and functions
-
subroutine
updatewp_mod/
initialize_updatewp
(tscheme)¶ Purpose of this subroutine is to allocate the matrices needed to time advance the poloidal/pressure equations. Depending on the radial scheme, it can be either full or band matrices.
- Parameters
tscheme [real ] :: time scheme
- Called from
-
subroutine
updatewp_mod/
finalize_updatewp
(tscheme)¶ Deallocation of the matrices used to time-advance the poloidal/pressure equations.
- Parameters
tscheme [real ] :: time scheme
- Called from
-
subroutine
updatewp_mod/
updatewp
(s, xi, w, dw, ddw, dwdt, p, dp, dpdt, tscheme, lrmsnext, lpressnext)¶ updates the poloidal velocity potential w, the pressure p, and their radial derivatives.
- Parameters
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
tscheme [real ]
lrmsnext [logical ,in]
lpressnext [logical ,in]
- Called from
- Call to
get_p0mat()
,get_wmat()
,get_wpmat()
,rint_r()
,get_pol_rhs_imp()
-
subroutine
updatewp_mod/
preparew_fd
(tscheme, dwdt, lpressnext)¶ - Parameters
tscheme [real ]
dwdt [type_tarray ,inout]
lpressnext [logical ,in]
- Called from
- Call to
-
subroutine
updatewp_mod/
fill_ghosts_w
(wg, p0g, lpressnext)¶ This subroutine is used to fill the ghost zones.
- Parameters
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_pol_rloc()
- Call to
-
subroutine
updatewp_mod/
updatew_fd
(w, dw, ddw, dwdt, p, dp, dpdt, tscheme, lrmsnext, lpressnext, lp00next)¶ – Input of variables:
- Parameters
w (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Poloidal potential
dw (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Radial derivative of w
ddw (lm_max,nrstop-(nrstart)+1) [complex ,out] :: Radial derivative of dw
dwdt [type_tarray ,inout]
dp (lm_max,nrstop-(nrstart)+1) [complex ,out] :: Radial derivative of p
dpdt [type_tarray ,in]
tscheme [real ]
lrmsnext [logical ,in]
lpressnext [logical ,in]
lp00next [logical ,in]
- Called from
- Call to
-
subroutine
updatewp_mod/
get_pol
(w, work)¶ Get the poloidal potential from the solve of an elliptic equation. Careful: the output is in Chebyshev space!
- Parameters
- Called from
- Call to
-
subroutine
updatewp_mod/
finish_exp_pol
(dvxvhlm, dw_exp_last)¶ - Parameters
- Called from
- Call to
-
subroutine
updatewp_mod/
finish_exp_pol_rdist
(dvxvhlm, dw_exp_last)¶ - Parameters
- Called from
- Call to
-
subroutine
updatewp_mod/
get_pol_rhs_imp
(s, xi, w, dw, ddw, p, dp, dwdt, dpdt, tscheme, istage, l_calc_lin, lpressnext, lrmsnext, dp_expl[, l_in_cheb_space])¶ This subroutine computes the derivatives of w and p and assemble the implicit stage if needed.
- Parameters
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lpressnext [logical ,in]
lrmsnext [logical ,in]
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updatewp()
- Call to
-
subroutine
updatewp_mod/
get_pol_rhs_imp_ghost
(wg, dw, ddw, p, dp, dwdt, tscheme, istage, l_calc_lin, lpressnext, lrmsnext, dp_expl)¶ This subroutine computes the derivatives of w and p and assemble the implicit stage if needed.
- Parameters
dwdt [type_tarray ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lpressnext [logical ,in]
lrmsnext [logical ,in]
- Called from
getstartfields()
,start_from_another_scheme()
,updatew_fd()
,assemble_pol_rloc()
- Call to
get_openmp_blocks()
,get_ddddr_ghost()
,get_dr_rloc()
,cc2real()
-
subroutine
updatewp_mod/
assemble_pol
(s, xi, w, dw, ddw, p, dp, dwdt, dpdt, dp_expl, tscheme, lpressnext, lrmsnext)¶ This subroutine is used to assemble w and dw/dr when IMEX RK time schemes which necessitate an assembly stage are employed. Robin-type boundary conditions are enforced using Canuto (1986) approach.
- Parameters
dwdt [type_tarray ,inout]
dpdt [type_tarray ,inout]
tscheme [real ]
lpressnext [logical ,in]
lrmsnext [logical ,in]
- Called from
- Call to
-
subroutine
updatewp_mod/
assemble_pol_rloc
(block_sze, nblocks, w, dw, ddw, p, dp, dwdt, dp_expl, tscheme, lpressnext, lrmsnext)¶ This subroutine is used to assemble w and dw/dr when IMEX RK time schemes which necessitate an assembly stage are employed. Robin-type boundary conditions are enforced using Canuto (1986) approach.
- Parameters
block_sze [integer ,in]
nblocks [integer ,in]
dwdt [type_tarray ,inout]
tscheme [real ]
lpressnext [logical ,in]
lrmsnext [logical ,in]
- Called from
- Call to
get_elliptic_mat_rdist()
,get_openmp_blocks()
,bulk_to_ghost()
,abortrun()
,exch_ghosts()
,fill_ghosts_w()
,get_pol_rhs_imp_ghost()
-
subroutine
updatewp_mod/
get_wpmat
(tscheme, l, hdif, wpmat, wpmat_fac)¶ Purpose of this subroutine is to contruct the time step matrix
wpMat
for the Navier-Stokes equation.- Parameters
tscheme [real ] :: time scheme
l [integer ,in] :: degree \(\ell\)
hdif [real ,in] :: hyperdiffusion
wpmat [real ] :: ‘)
wpmat_fac (2*n_r_max,2) [real ,out]
- Called from
- Call to
-
subroutine
updatewp_mod/
get_elliptic_mat
(l, ellmat)¶ Purpose of this subroutine is to contruct the matrix needed for the derivation of w for the time advance of the poloidal equation if the double curl form is used.
- Parameters
l [integer ,in] :: degree \(\ell\)
ellmat [real ] :: ‘)
- Called from
- Call to
-
subroutine
updatewp_mod/
get_wmat
(tscheme, l, hdif, wmat, wmat_fac)¶ Purpose of this subroutine is to contruct the time step matrix wpmat for the NS equation. This matrix corresponds here to the radial component of the double-curl of the Navier-Stokes equation.
- Parameters
tscheme [real ] :: time scheme
l [integer ,in] :: degree \(\ell\)
hdif [real ,in] :: hyperdiffusion
wmat [real ] :: ‘)
wmat_fac (n_r_max,2) [real ,out]
- Called from
- Call to
-
subroutine
updatewp_mod/
get_elliptic_mat_rdist
(ellmat)¶ Purpose of this subroutine is to contruct the matrix needed for the derivation of w for the time advance of the poloidal equation if the double curl form is used. This is the R-dist version.
- Parameters
ellmat [type_tri_par ,inout]
- Called from
-
subroutine
updatewp_mod/
get_wmat_rdist
(tscheme, hdif, wmat)¶ Purpose of this subroutine is to contruct the time step matrix wMat_FD for the NS equation. This matrix corresponds here to the radial component of the double-curl of the Navier-Stokes equation. This routine is used when parallel F.D. solvers are employed.
- Parameters
tscheme [real ] :: time scheme
hdif (l_max)+1) [real ,in] :: hyperdiffusion
wmat [type_penta_par ,inout]
- Called from
-
subroutine
updatewp_mod/
get_p0mat
(pmat)¶ This subroutine solves the linear problem of the spherically-symmetric pressure
- Parameters
pmat [real ] :: matrix
- Called from
- Call to
-
subroutine
updatewp_mod/
get_p0mat_rdist
(pmat)¶ This subroutine solves the linear problem of the spherically-symmetric pressure. This is the R-distributed variant of the function used when parallel F.D. solvers are employed
- Parameters
pmat [type_tri_par ,inout] :: matrix
- Called from
updateZ.f90
¶
Description
This module handles the time advance of the toroidal potential z It contains the computation of the implicit terms and the linear solves.
Quick access
- Variables
lz10mat
,lzmat
,maxthreads
,rhs
,rhs1
,z10_ghost
,z10mat_fac
,z10mat_fd
,z_ghost
,zmat_fac
,zmat_fd
- Routines
assemble_tor()
,assemble_tor_rloc()
,fill_ghosts_z()
,finalize_updatez()
,finish_exp_tor()
,get_tor_rhs_imp()
,get_tor_rhs_imp_ghost()
,get_z10mat()
,get_z10mat_rdist()
,get_zmat()
,get_zmat_rdist()
,initialize_updatez()
,preparez_fd()
,update_rot_rates()
,update_rot_rates_rloc()
,updatez()
,updatez_fd()
Needed modules
init_fields
: This module is used to construct the initial solution.omp_lib
precision_mod
: This module controls the precision used in MagICcommunications
(allgather_from_rloc()
): This module contains the different MPI communicators used in MagIC.mem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICtruncation
(n_r_max()
,lm_max()
,l_max()
,m_min()
): This module defines the grid points and the truncationradial_data
(n_r_cmb()
,n_r_icb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(visc()
,or1()
,or2()
,rscheme_oc()
,dlvisc()
,beta()
,rho0()
,r_icb()
,r_cmb()
,r()
,dbeta()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(kbotv()
,ktopv()
,prec_angle()
,po()
,oek()
): Module containing the physical parametersnum_param
(amstart()
,dct_counter()
,solve_counter()
): Module containing numerical and control parameterstorsional_oscillations
(ddzasl()
): This module contains information for TO calculation and outputblocking
(lo_sub_map()
,lo_map()
,st_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationhorizontal_data
(hdif_v()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_rot_ma()
,l_rot_ic()
,l_srma()
,l_sric()
,l_z10mat()
,l_precession()
,l_correct_ame()
,l_correct_amz()
,l_update_v()
,l_to()
,l_finite_diff()
,l_full_sphere()
,l_parallel_solve()
): Module containing the logicals that control the runconstants
(c_lorentz_ma()
,c_lorentz_ic()
,c_dt_z10_ma()
,c_dt_z10_ic()
,c_moi_ma()
,c_moi_ic()
,c_z10_omega_ma()
,c_z10_omega_ic()
,c_moi_oc()
,y10_norm()
,y11_norm()
,zero()
,one()
,two()
,four()
,pi()
,third()
): module containing constants and parameters used in the code.parallel_mod
: This module contains the blocking informationoutrot
(get_angular_moment()
,get_angular_moment_rloc()
): 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….rms
(diftor2hint()
): This module contains the calculation of the RMS force balance and induction terms.radial_der
(get_ddr()
,get_ddr_ghost()
,bulk_to_ghost()
,exch_ghosts()
): Radial derivatives functionsfields
(work_lmloc()
): 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….useful
(abortrun()
,cc2real()
): This module contains several useful routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
,type_tscalar()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.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 modesparallel_solvers
: This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updatez_mod/
lz10mat
[logical,public]¶
-
-
updatez_mod/
lzmat
(*) [logical,allocatable/public]¶
-
-
updatez_mod/
maxthreads
[integer,private]¶
-
-
updatez_mod/
rhs
(*) [complex,private/allocatable]¶ rhs for l=1, m=0
-
-
updatez_mod/
rhs1
(*,*,*) [real,private/allocatable]¶ RHS for other modes
-
-
updatez_mod/
z10_ghost
(*) [complex,allocatable/public]¶
-
-
updatez_mod/
z10mat_fac
(*) [real,private/allocatable]¶
-
-
updatez_mod/
z10mat_fd
[type_tri_par,public]¶
-
-
updatez_mod/
z_ghost
(*,*) [complex,allocatable/public]¶
-
-
updatez_mod/
zmat_fac
(*,*) [real,private/allocatable]¶
-
-
updatez_mod/
zmat_fd
[type_tri_par,public]¶
-
Subroutines and functions
-
subroutine
updatez_mod/
initialize_updatez
()¶ This subroutine handles the memory allocation of the arrays involved in the time advance of the toroidal potential.
- Called from
-
subroutine
updatez_mod/
finalize_updatez
()¶ Memory deallocation of arrays associated with time advance of Z
- Called from
-
subroutine
updatez_mod/
updatez
(time, timenext, z, dz, dzdt, omega_ma, omega_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, tscheme, lrmsnext)¶ Updates the toroidal potential z and its radial derivative dz
- Parameters
time [real ,in] :: Current stage time
timenext [real ,in] :: Next time
z (ulm-(llm)+1,n_r_max) [complex ,inout] :: Toroidal velocity potential z
dz (ulm-(llm)+1,n_r_max) [complex ,out] :: Radial derivative of z
dzdt [type_tarray ,inout]
omega_ma [real ,out] :: Calculated OC rotation
omega_ic [real ,out] :: Calculated IC rotation
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
tscheme [real ]
lrmsnext [logical ,in] :: Logical for storing update if (l_RMS.and.l_logNext)
- Called from
- Call to
get_zmat()
,get_z10mat()
,update_rot_rates()
,get_tor_rhs_imp()
-
subroutine
updatez_mod/
preparez_fd
(time, tscheme, dzdt, omega_ma, omega_ic, domega_ma_dt, domega_ic_dt)¶ – Input of variables:
- Parameters
time [real ,in]
tscheme [real ]
dzdt [type_tarray ,inout]
omega_ma [real ,inout] :: Calculated OC rotation
omega_ic [real ,inout] :: Calculated IC rotation
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
- Called from
- Call to
-
subroutine
updatez_mod/
fill_ghosts_z
(zg)¶ This subroutine is used to fill the ghosts zones that are located at nR=n_r_cmb-1 and nR=n_r_icb+1. This is used to properly set the Neuman boundary conditions. In case Dirichlet BCs are used, a simple first order extrapolation is employed. This is anyway only used for outputs (like Nusselt numbers).
- Parameters
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_tor_rloc()
- Call to
-
subroutine
updatez_mod/
updatez_fd
(time, timenext, z, dz, dzdt, omega_ma, omega_ic, domega_ma_dt, domega_ic_dt, lorentz_torque_ma_dt, lorentz_torque_ic_dt, tscheme, lrmsnext)¶ – Input of variables:
- Parameters
time [real ,in] :: Current stage time
timenext [real ,in] :: Next time
z (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Toroidal potential
dz (lm_max,nrstop-(nrstart)+1) [complex ,out] :: Radial derivative of z
dzdt [type_tarray ,inout]
omega_ma [real ,inout] :: Calculated OC rotation
omega_ic [real ,inout] :: Calculated IC rotation
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
tscheme [real ]
lrmsnext [logical ,in] :: Logical for storing update if (l_RMS.and.l_logNext)
- Called from
- Call to
update_rot_rates_rloc()
,get_tor_rhs_imp_ghost()
,get_openmp_blocks()
-
subroutine
updatez_mod/
get_tor_rhs_imp
(time, z, dz, dzdt, domega_ma_dt, domega_ic_dt, omega_ic, omega_ma, omega_ic1, omega_ma1, tscheme, istage, l_calc_lin, lrmsnext[, l_in_cheb_space])¶ – Input variables
- Parameters
time [real ,in]
dzdt [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
omega_ic [real ,inout]
omega_ma [real ,inout]
omega_ic1 [real ,inout]
omega_ma1 [real ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lrmsnext [logical ,in]
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updatez()
,assemble_tor()
- Call to
get_openmp_blocks()
,get_ddr()
,get_angular_moment()
,cc2real()
-
subroutine
updatez_mod/
get_tor_rhs_imp_ghost
(time, zg, dz, dzdt, domega_ma_dt, domega_ic_dt, omega_ic, omega_ma, omega_ic1, omega_ma1, tscheme, istage, l_calc_lin, lrmsnext)¶ – Input variables
- Parameters
time [real ,in]
dzdt [type_tarray ,inout]
domega_ma_dt [type_tscalar ,inout]
domega_ic_dt [type_tscalar ,inout]
omega_ic [real ,inout]
omega_ma [real ,inout]
omega_ic1 [real ,inout]
omega_ma1 [real ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lrmsnext [logical ,in]
- Called from
getstartfields()
,start_from_another_scheme()
,updatez_fd()
,assemble_tor_rloc()
- Call to
get_openmp_blocks()
,get_ddr_ghost()
,get_angular_moment_rloc()
,cc2real()
-
subroutine
updatez_mod/
assemble_tor
(time, z, dz, dzdt, domega_ic_dt, domega_ma_dt, lorentz_torque_ic_dt, lorentz_torque_ma_dt, omega_ic, omega_ma, omega_ic1, omega_ma1, lrmsnext, tscheme)¶ This subroutine is used to assemble the toroidal flow potential when an IMEX RK time scheme with an assembly stage is employed (LM-distributed version).
- Parameters
time [real ,in]
dzdt [type_tarray ,inout]
domega_ic_dt [type_tscalar ,inout]
domega_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
omega_ic [real ,inout]
omega_ma [real ,inout]
omega_ic1 [real ,inout]
omega_ma1 [real ,inout]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
-
subroutine
updatez_mod/
assemble_tor_rloc
(time, z, dz, dzdt, domega_ic_dt, domega_ma_dt, lorentz_torque_ic_dt, lorentz_torque_ma_dt, omega_ic, omega_ma, omega_ic1, omega_ma1, lrmsnext, tscheme)¶ This subroutine is used when a IMEX Runge-Kutta scheme with an assembly stage is employed (R-distributed version)
- Parameters
time [real ,in]
dzdt [type_tarray ,inout]
domega_ic_dt [type_tscalar ,inout]
domega_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
lorentz_torque_ma_dt [type_tscalar ,inout]
omega_ic [real ,inout]
omega_ma [real ,inout]
omega_ic1 [real ,inout]
omega_ma1 [real ,inout]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
abortrun()
,get_openmp_blocks()
,bulk_to_ghost()
,exch_ghosts()
,fill_ghosts_z()
,update_rot_rates_rloc()
,get_tor_rhs_imp_ghost()
-
subroutine
updatez_mod/
update_rot_rates
(z, lo_ma, lo_ic, lorentz_torque_ma_dt, lorentz_torque_ic_dt, omega_ma, omega_ma1, omega_ic, omega_ic1, istage[, l_in_cheb_space])¶ This subroutine updates the rotation rate of inner core and mantle.
- Parameters
lo_ma [real ,in]
lo_ic [real ,in] :: RHS when stress-free BCs are used
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
omega_ma [real ,out]
omega_ma1 [real ,out]
omega_ic [real ,out]
omega_ic1 [real ,out]
istage [integer ,in]
- Options
l_in_cheb_space [logical ,in,] :: Is z in Cheb space or not?
- Called from
-
subroutine
updatez_mod/
update_rot_rates_rloc
(z, lo_ma, lo_ic, lorentz_torque_ma_dt, lorentz_torque_ic_dt, omega_ma, omega_ma1, omega_ic, omega_ic1, istage)¶ – Input variables
- Parameters
lo_ma [real ,in]
lo_ic [real ,in] :: RHS when stress-free BCs are used
lorentz_torque_ma_dt [type_tscalar ,inout]
lorentz_torque_ic_dt [type_tscalar ,inout]
omega_ma [real ,out]
omega_ma1 [real ,out]
omega_ic [real ,out]
omega_ic1 [real ,out]
istage [integer ,in]
- Called from
-
subroutine
updatez_mod/
finish_exp_tor
(lorentz_torque_ma, lorentz_torque_ic, domega_ma_dt_exp, domega_ic_dt_exp, lorentz_ma_exp, lorentz_ic_exp)¶ – Input variables
- Parameters
lorentz_torque_ma [real ,in] :: Lorentz torque (for OC rotation)
lorentz_torque_ic [real ,in] :: Lorentz torque (for IC rotation)
domega_ma_dt_exp [real ,out]
domega_ic_dt_exp [real ,out]
lorentz_ma_exp [real ,out]
lorentz_ic_exp [real ,out]
- Called from
finish_explicit_assembly()
,finish_explicit_assembly_rdist()
-
subroutine
updatez_mod/
get_z10mat
(tscheme, l, hdif, zmat, zmat_fac)¶ Purpose of this subroutine is to construct and LU-decompose the inversion matrix
z10mat
for the implicit time step of the toroidal velocity potential z of degree \(\ell=1\) and order \(m=0\). This differs from the the normal zmat only if either the ICB or CMB have no-slip boundary condition and inner core or mantle are chosen to rotate freely (eitherkbotv=1
and/orktopv=1
).- Parameters
tscheme [real ] :: Time step internal
l [integer ,in] :: Variable to loop over degrees
hdif [real ,in] :: Value of hyperdiffusivity in zMat terms
zmat [real ]
zmat_fac (n_r_max) [real ,out] :: Inverse of max(zMat) for inversion
- Called from
- Call to
-
subroutine
updatez_mod/
get_zmat
(tscheme, l, hdif, zmat, zmat_fac)¶ Purpose of this subroutine is to contruct the time step matrices
zmat(i,j)
for the Navier-Stokes equation.- Parameters
tscheme [real ] :: time step
l [integer ,in] :: Variable to loop over degrees
hdif [real ,in] :: Hyperdiffusivity
zmat [real ]
zmat_fac (n_r_max) [real ,out] :: Inverse of max(zMat) for the inversion
- Called from
- Call to
-
subroutine
updatez_mod/
get_z10mat_rdist
(tscheme, hdif, zmat)¶ This subroutine is employed to construct the matrix for the z(l=1,m=0) mode when the parallel F.D. solver is used.
- Parameters
tscheme [real ] :: Time step internal
hdif (l_max)+1) [real ,in] :: Value of hyperdiffusivity in zMat terms
zmat [type_tri_par ,inout] :: Tridiag matrix
- Called from
- Call to
updateS.f90
¶
Description
This module handles the time advance of the entropy s. It contains the computation of the implicit terms and the linear solves.
Quick access
- Variables
- Routines
assemble_entropy()
,assemble_entropy_rloc()
,fill_ghosts_s()
,finalize_updates()
,finish_exp_entropy()
,finish_exp_entropy_rdist()
,get_entropy_rhs_imp()
,get_entropy_rhs_imp_ghost()
,get_smat()
,get_smat_rdist()
,initialize_updates()
,prepares_fd()
,updates()
,updates_fd()
Needed modules
omp_lib
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
(n_r_max()
,lm_max()
,l_max()
): This module defines the grid points and the truncationradial_data
(n_r_cmb()
,n_r_icb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(orho1()
,or1()
,or2()
,beta()
,dentropy0()
,rscheme_oc()
,kappa()
,dlkappa()
,dltemp0()
,temp0()
,r()
,l_r()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(opr()
,kbots()
,ktops()
,stef()
): Module containing the physical parametersnum_param
(dct_counter()
,solve_counter()
): Module containing numerical and control parametersinit_fields
(tops()
,bots()
): This module is used to construct the initial solution.blocking
(lo_map()
,lo_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationhorizontal_data
(hdif_s()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_update_s()
,l_anelastic_liquid()
,l_finite_diff()
,l_full_sphere()
,l_parallel_solve()
,l_phase_field()
): Module containing the logicals that control the runparallel_mod
: This module contains the blocking informationradial_der
(get_ddr()
,get_dr()
,get_dr_rloc()
,get_ddr_ghost()
,exch_ghosts()
,bulk_to_ghost()
): Radial derivatives functionsfields
(work_lmloc()
): 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….constants
(zero()
,one()
,two()
): module containing constants and parameters used in the code.useful
(abortrun()
): This module contains several useful routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.parallel_solvers
(type_tri_par()
): This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updates_mod/
fd_fac_bot
(*) [real,private/allocatable]¶
-
-
updates_mod/
fd_fac_top
(*) [real,private/allocatable]¶
-
-
updates_mod/
lsmat
(*) [logical,allocatable/public]¶
-
-
updates_mod/
maxthreads
[integer,private]¶
-
-
updates_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
-
updates_mod/
s_ghost
(*,*) [complex,public/allocatable]¶
-
-
updates_mod/
smat_fac
(*,*) [real,private/allocatable]¶
-
-
updates_mod/
smat_fd
[type_tri_par,public]¶
-
Subroutines and functions
-
subroutine
updates_mod/
initialize_updates
()¶ This subroutine allocates the arrays involved in the time-advance of the entropy/temperature equation.
- Called from
-
subroutine
updates_mod/
finalize_updates
()¶ Memory deallocation of updateS module
- Called from
-
subroutine
updates_mod/
updates
(s, ds, dsdt, phi, tscheme)¶ Updates the entropy field s and its radial derivative.
-
subroutine
updates_mod/
prepares_fd
(tscheme, dsdt, phi)¶ This subroutine is used to assemble the r.h.s. of the entropy equation when parallel F.D solvers are used. Boundary values are set here.
- Parameters
- Called from
- Call to
-
subroutine
updates_mod/
fill_ghosts_s
(sg)¶ This subroutine is used to fill the ghosts zones that are located at nR=n_r_cmb-1 and nR=n_r_icb+1. This is used to properly set the Neuman boundary conditions. In case Dirichlet BCs are used, a simple first order extrapolation is employed. This is anyway only used for outputs (like Nusselt numbers).
- Parameters
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_entropy_rloc()
- Call to
-
subroutine
updates_mod/
updates_fd
(s, ds, dsdt, phi, tscheme)¶ This subroutine is called after the linear solves have been completed. This is then assembling the linear terms that will be used in the r.h.s. for the next iteration.
- Parameters
- Called from
- Call to
-
subroutine
updates_mod/
finish_exp_entropy
(w, dvsrlm, ds_exp_last)¶ This subroutine completes the computation of the advection term by computing the radial derivative (LM-distributed variant).
-
subroutine
updates_mod/
finish_exp_entropy_rdist
(w, dvsrlm, ds_exp_last)¶ This subroutine completes the computation of the advection term by computing the radial derivative (R-distributed variant).
- Parameters
- Called from
- Call to
-
subroutine
updates_mod/
get_entropy_rhs_imp
(s, ds, dsdt, phi, istage, l_calc_lin[, l_in_cheb_space])¶ This subroutine computes the linear terms that enters the r.h.s.. This is used with LM-distributed
- Parameters
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updates()
,assemble_entropy()
- Call to
-
subroutine
updates_mod/
get_entropy_rhs_imp_ghost
(sg, ds, dsdt, phi, istage, l_calc_lin)¶ This subroutine computes the linear terms that enters the r.h.s.. This is used with R-distributed
- Parameters
- Called from
getstartfields()
,start_from_another_scheme()
,updates_fd()
,assemble_entropy_rloc()
- Call to
-
subroutine
updates_mod/
assemble_entropy_rloc
(s, ds, dsdt, phi, tscheme)¶ This subroutine is used when an IMEX Runge-Kutta time scheme with an assembly stage is used. This is used when R is distributed.
- Parameters
- Called from
- Call to
get_openmp_blocks()
,bulk_to_ghost()
,exch_ghosts()
,fill_ghosts_s()
,get_entropy_rhs_imp_ghost()
-
subroutine
updates_mod/
assemble_entropy
(s, ds, dsdt, phi, tscheme)¶ This subroutine is used to assemble the entropy/temperature at assembly stages of IMEX-RK time schemes. This is used when LM is distributed.
-
subroutine
updates_mod/
get_smat
(tscheme, l, hdif, smat, smat_fac)¶ Purpose of this subroutine is to contruct the time step matrices sMat(i,j) and s0mat for the entropy equation.
- Parameters
tscheme [real ] :: time step
l [integer ,in]
hdif [real ,in]
smat [real ] :: ‘)
smat_fac (n_r_max) [real ,out]
- Called from
- Call to
updateXI.f90
¶
Description
This module handles the time advance of the chemical composition xi. It contains the computation of the implicit terms and the linear solves.
Quick access
- Variables
fd_fac_bot
,fd_fac_top
,lximat
,xi_ghost
,ximat_fac
,ximat_fd
- Routines
assemble_comp()
,assemble_comp_rloc()
,fill_ghosts_xi()
,finalize_updatexi()
,finish_exp_comp()
,finish_exp_comp_rdist()
,get_comp_rhs_imp()
,get_comp_rhs_imp_ghost()
,get_ximat()
,get_ximat_rdist()
,initialize_updatexi()
,preparexi_fd()
,updatexi()
,updatexi_fd()
Needed modules
omp_lib
precision_mod
: This module controls the precision used in MagICtruncation
(n_r_max()
,lm_max()
,l_max()
): This module defines the grid points and the truncationradial_data
(n_r_icb()
,n_r_cmb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(orho1()
,or1()
,or2()
,beta()
,rscheme_oc()
,r()
,dxicond()
,l_r()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)physical_parameters
(osc()
,kbotxi()
,ktopxi()
): Module containing the physical parametersnum_param
(dct_counter()
,solve_counter()
): Module containing numerical and control parametersinit_fields
(topxi()
,botxi()
): This module is used to construct the initial solution.blocking
(lo_map()
,lo_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationhorizontal_data
(hdif_xi()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_update_xi()
,l_finite_diff()
,l_full_sphere()
,l_parallel_solve()
,l_onset()
): Module containing the logicals that control the runparallel_mod
(rank()
,chunksize()
,n_procs()
,get_openmp_blocks()
): This module contains the blocking informationradial_der
(get_ddr()
,get_dr()
,get_dr_rloc()
,get_ddr_ghost()
,exch_ghosts()
,bulk_to_ghost()
): Radial derivatives functionsconstants
(zero()
,one()
,two()
): module containing constants and parameters used in the code.fields
(work_lmloc()
): 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….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.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.parallel_solvers
(type_tri_par()
): This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updatexi_mod/
fd_fac_bot
(*) [complex,private/allocatable]¶
-
-
updatexi_mod/
fd_fac_top
(*) [complex,private/allocatable]¶
-
-
updatexi_mod/
lximat
(*) [logical,allocatable/public]¶
-
-
updatexi_mod/
maxthreads
[integer,private]¶
-
-
updatexi_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
-
updatexi_mod/
xi_ghost
(*,*) [complex,allocatable/public]¶
-
-
updatexi_mod/
ximat_fac
(*,*) [real,private/allocatable]¶
-
-
updatexi_mod/
ximat_fd
[type_tri_par,public]¶
-
Subroutines and functions
-
subroutine
updatexi_mod/
initialize_updatexi
()¶ - Called from
-
subroutine
updatexi_mod/
finalize_updatexi
()¶ This subroutine deallocates the matrices involved in the time-advance of xi.
- Called from
-
subroutine
updatexi_mod/
updatexi
(xi, dxi, dxidt, tscheme)¶ Updates the chemical composition field s and its radial derivative.
- Parameters
- Called from
- Call to
-
subroutine
updatexi_mod/
preparexi_fd
(tscheme, dxidt)¶ This subroutine is used to assemble the r.h.s. of the composition equation when parallel F.D solvers are used. Boundary values are set here.
- Parameters
tscheme [real ]
dxidt [type_tarray ,inout]
- Called from
- Call to
-
subroutine
updatexi_mod/
fill_ghosts_xi
(xig)¶ This subroutine is used to fill the ghosts zones that are located at nR=n_r_cmb-1 and nR=n_r_icb+1. This is used to properly set the Neuman boundary conditions. In case Dirichlet BCs are used, a simple first order extrapolation is employed. This is anyway only used for outputs (like Sherwood numbers).
- Parameters
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_comp_rloc()
- Call to
-
subroutine
updatexi_mod/
updatexi_fd
(xi, dxidt, tscheme)¶ This subroutine is called after the linear solves have been completed. This is then assembling the linear terms that will be used in the r.h.s. for the next iteration.
- Parameters
- Called from
- Call to
-
subroutine
updatexi_mod/
finish_exp_comp
(w, dvxirlm, dxi_exp_last)¶ This subroutine completes the computation of the advection term which enters the composition equation by taking the radial derivative. This is the LM-distributed version.
-
subroutine
updatexi_mod/
finish_exp_comp_rdist
(w, dvxirlm, dxi_exp_last)¶ This subroutine completes the computation of the advection term which enters the composition equation by taking the radial derivative. This is the R-distributed version.
- Parameters
- Called from
- Call to
-
subroutine
updatexi_mod/
get_comp_rhs_imp
(xi, dxi, dxidt, istage, l_calc_lin[, l_in_cheb_space])¶ This subroutine computes the linear terms which enter the r.h.s. of the equation for composition. This is the LM-distributed version.
- Parameters
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updatexi()
,assemble_comp()
- Call to
-
subroutine
updatexi_mod/
get_comp_rhs_imp_ghost
(xig, dxidt, istage, l_calc_lin)¶ This subroutine computes the linear terms which enter the r.h.s. of the equation for composition. This is the R-distributed version.
- Parameters
- Called from
getstartfields()
,start_from_another_scheme()
,updatexi_fd()
,assemble_comp_rloc()
- Call to
-
subroutine
updatexi_mod/
assemble_comp
(xi, dxi, dxidt, tscheme)¶ This subroutine is used to assemble the chemical composition when an IMEX-RK with an assembly stage is employed. Non-Dirichlet boundary conditions are handled using Canuto (1986) approach. This is the LM distributed version.
- Parameters
- Called from
- Call to
-
subroutine
updatexi_mod/
assemble_comp_rloc
(xi, dxidt, tscheme)¶ This subroutine is used when an IMEX Runge-Kutta time scheme with an assembly stage is used. This is used when R is distributed.
- Parameters
- Called from
- Call to
get_openmp_blocks()
,bulk_to_ghost()
,exch_ghosts()
,fill_ghosts_xi()
,get_comp_rhs_imp_ghost()
-
subroutine
updatexi_mod/
get_ximat
(tscheme, l, hdif, ximat, ximat_fac)¶ Purpose of this subroutine is to contruct the time step matrices xiMat(i,j) for the equation for the chemical composition.
- Parameters
tscheme [real ] :: time step
l [integer ,in]
hdif [real ,in]
ximat [real ] :: ‘)
ximat_fac (n_r_max) [real ,out]
- Called from
- Call to
-
subroutine
updatexi_mod/
get_ximat_rdist
(tscheme, hdif, ximat)¶ Purpose of this subroutine is to contruct the time step matrices xiMat(i,j) for the equation for the chemical composition. This is used when parallel F.D. solvers are employed.
- Parameters
tscheme [real ] :: time step
hdif (l_max)+1) [real ,in]
ximat [type_tri_par ,inout]
- Called from
updateB.f90
¶
Description
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 solves.
Quick access
- Variables
aj_ghost
,b_ghost
,bmat_fac
,bmat_fd
,jmat_fac
,jmat_fd
,lbmat
,rhs2
,work_ic_lmloc
,worka
- Routines
assemble_mag()
,assemble_mag_rloc()
,fill_ghosts_b()
,finalize_updateb()
,finish_exp_mag()
,finish_exp_mag_ic()
,finish_exp_mag_rdist()
,get_bmat()
,get_bmat_rdist()
,get_mag_ic_rhs_imp()
,get_mag_rhs_imp()
,get_mag_rhs_imp_ghost()
,initialize_updateb()
,prepareb_fd()
,updateb()
,updateb_fd()
Needed modules
omp_lib
precision_mod
: This module controls the precision used in MagICparallel_mod
: This module contains the blocking informationmem_alloc
(bytes_allocated()
): This little module is used to estimate the global memory allocation used in MagICtruncation
(n_r_max()
,n_r_tot()
,n_r_ic_max()
,n_cheb_ic_max()
,n_r_ic_maxmag()
,n_r_maxmag()
,n_r_totmag()
,lm_max()
,l_maxmag()
,lm_maxmag()
): This module defines the grid points and the truncationradial_functions
(chebt_ic()
,or2()
,r_cmb()
,chebt_ic_even()
,d2cheb_ic()
,l_r()
,cheb_norm_ic()
,dr_fac_ic()
,lambda()
,dllambda()
,o_r_ic()
,r()
,or1()
,cheb_ic()
,dcheb_ic()
,rscheme_oc()
,dr_top_ic()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)radial_data
(n_r_cmb()
,n_r_icb()
,nrstartmag()
,nrstopmag()
): This module defines the MPI decomposition in the radial direction.physical_parameters
(n_r_lcr()
,opm()
,o_sr()
,kbotb()
,imagcon()
,tmagcon()
,sigma_ratio()
,conductance_ma()
,ktopb()
): Module containing the physical parametersinit_fields
(bpeaktop()
,bpeakbot()
): This module is used to construct the initial solution.num_param
(solve_counter()
,dct_counter()
): Module containing numerical and control parametersblocking
(st_map()
,lo_map()
,st_sub_map()
,lo_sub_map()
,llmmag()
,ulmmag()
): Module containing blocking informationhorizontal_data
(hdif_b()
): Module containing functions depending on longitude and latitude plus help arrays depending on degree and orderlogic
(l_cond_ic()
,l_lcr()
,l_rot_ic()
,l_mag_nl()
,l_b_nl_icb()
,l_b_nl_cmb()
,l_update_b()
,l_rms()
,l_finite_diff()
,l_full_sphere()
,l_mag_par_solve()
): Module containing the logicals that control the runrms
(dtbpollmr()
,dtbpol2hint()
,dtbtor2hint()
): This module contains the calculation of the RMS force balance and induction terms.constants
(pi()
,zero()
,one()
,two()
,three()
,half()
): module containing constants and parameters used in the code.special
(n_imp()
,l_imp()
,amp_imp()
,expo_imp()
,bmax_imp()
,rrmp()
,l_curr()
,amp_curr()
,fac_loop()
): 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 modesfields
(work_lmloc()
): 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….radial_der
(get_dr()
,get_ddr()
,get_dr_rloc()
,get_ddr_ghost()
,exch_ghosts()
,bulk_to_ghost()
): Radial derivatives functionsuseful
(abortrun()
,cc2real()
): This module contains several useful routines.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.bordered_matrices
parallel_solvers
(type_tri_par()
): This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updateb_mod/
aj_ghost
(*,*) [complex,public/allocatable]¶
-
-
updateb_mod/
b_ghost
(*,*) [complex,public/allocatable]¶
-
-
updateb_mod/
bmat_fac
(*,*) [real,private/allocatable]¶
-
-
updateb_mod/
bmat_fd
[type_tri_par,public]¶
-
-
updateb_mod/
jmat_fac
(*,*) [real,private/allocatable]¶
-
-
updateb_mod/
jmat_fd
[type_tri_par,public]¶
-
-
updateb_mod/
lbmat
(*) [logical,allocatable/public]¶
-
-
updateb_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
-
updateb_mod/
rhs2
(*,*,*) [real,private/allocatable]¶
-
-
updateb_mod/
work_ic_lmloc
(*,*) [complex,private/allocatable]¶
-
-
updateb_mod/
worka
(*,*) [complex,private/allocatable]¶
-
-
updateb_mod/
workb
(*,*) [complex,private/allocatable]¶
-
Subroutines and functions
-
subroutine
updateb_mod/
initialize_updateb
()¶ Purpose of this subroutine is to allocate the matrices needed to time advance the magnetic field. Depending on the radial scheme and the inner core conductivity, it can be full, bordered or band matrices.
- Called from
-
subroutine
updateb_mod/
finalize_updateb
()¶ This subroutine deallocates the matrices involved in the time advance of the magnetic field.
- Called from
-
subroutine
updateb_mod/
updateb
(b, db, ddb, aj, dj, ddj, dbdt, djdt, b_ic, db_ic, ddb_ic, aj_ic, dj_ic, ddj_ic, dbdt_ic, djdt_ic, b_nl_cmb, aj_nl_cmb, aj_nl_icb, time, tscheme, lrmsnext)¶ Calculates update of magnetic field potentials.
- Parameters
b (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
db (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
ddb (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
aj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
dj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
ddj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
b_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,inout]
db_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,out]
ddb_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,out]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,inout]
dj_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,out]
ddj_ic (ulmmag-(llmmag)+1,n_r_ic_maxmag) [complex ,out]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
b_nl_cmb (*) [complex ,in] :: nonlinear BC for b at CMB
aj_nl_cmb (*) [complex ,in] :: nonlinear BC for aj at CMB
aj_nl_icb (*) [complex ,in] :: nonlinear BC for dr aj at ICB
time [real ,in]
tscheme [real ]
lrmsnext [logical ,in]
- Called from
- Call to
-
subroutine
updateb_mod/
prepareb_fd
(time, tscheme, dbdt, djdt)¶ This subroutine assembles the r.h.s. when finite difference parallel solver is employed
- Parameters
time [real ,in]
tscheme [real ]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
- Called from
- Call to
-
subroutine
updateb_mod/
fill_ghosts_b
(bg, ajg)¶ This subroutine is used to fill the ghosts zones that are located at nR=n_r_cmb-1 and nR=n_r_icb+1. This is used to properly set the Neuman boundary conditions. In case Dirichlet BCs are used, a simple first order extrapolation is employed. This is anyway only used for outputs.
- Parameters
bg (lm_max,nrstopmag+1-(nrstartmag-1)+1) [complex ,inout]
ajg (lm_max,nrstopmag+1-(nrstartmag-1)+1) [complex ,inout]
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_mag_rloc()
- Call to
-
subroutine
updateb_mod/
updateb_fd
(b, db, ddb, aj, dj, ddj, dbdt, djdt, tscheme, lrmsnext)¶ This subroutine handles the IMEX postprocs once the solve has been completed
- Parameters
b (lm_max,nrstopmag-(nrstartmag)+1) [complex ,inout]
db (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
ddb (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
aj (lm_max,nrstopmag-(nrstartmag)+1) [complex ,inout]
dj (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
ddj (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
tscheme [real ]
lrmsnext [logical ,in]
- Called from
- Call to
-
subroutine
updateb_mod/
finish_exp_mag_ic
(b_ic, aj_ic, omega_ic, db_exp_last, dj_exp_last)¶ This subroutine computes the nonlinear term at the inner core boundary when there is a conducting inner core and stress-free boundary conditions.
- Parameters
b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]
omega_ic [real ,in]
db_exp_last (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
dj_exp_last (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
- Called from
finish_explicit_assembly()
,finish_explicit_assembly_rdist()
-
subroutine
updateb_mod/
finish_exp_mag
(dvxbhlm, dj_exp_last)¶ This subroutine finishes the computation of the nonlinear induction term by taking the missing radial derivative (LM-distributed version).
- Parameters
dvxbhlm (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
dj_exp_last (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
- Called from
- Call to
-
subroutine
updateb_mod/
finish_exp_mag_rdist
(dvxbhlm, dj_exp_last)¶ This subroutine finishes the computation of the nonlinear induction term by taking the missing radial derivative (R-distributed version).
- Parameters
dvxbhlm (lm_max,nrstopmag-(nrstartmag)+1) [complex ,inout]
dj_exp_last (lm_max,nrstopmag-(nrstartmag)+1) [complex ,inout]
- Called from
- Call to
-
subroutine
updateb_mod/
get_mag_ic_rhs_imp
(b_ic, db_ic, ddb_ic, aj_ic, dj_ic, ddj_ic, dbdt_ic, djdt_ic, istage, l_calc_lin[, l_in_cheb_space])¶ This subroutine computes the linear terms that enter the r.h.s. of the inner core equations.
- Parameters
b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
db_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
ddb_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
dj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
ddj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
istage [integer ,in]
l_calc_lin [logical ,in]
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updateb()
,assemble_mag()
- Call to
-
subroutine
updateb_mod/
assemble_mag
(b, db, ddb, aj, dj, ddj, b_ic, db_ic, ddb_ic, aj_ic, dj_ic, ddj_ic, dbdt, djdt, dbdt_ic, djdt_ic, lrmsnext, tscheme)¶ This subroutine is used when an IMEX Runge Kutta with an assembly stage is employed. This is the LM-distributed version
- Parameters
b (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
db (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
ddb (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
aj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,inout]
dj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
ddj (ulmmag-(llmmag)+1,n_r_maxmag) [complex ,out]
b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
db_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
ddb_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,inout]
dj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
ddj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,out]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
dbdt_ic [type_tarray ,inout]
djdt_ic [type_tarray ,inout]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
-
subroutine
updateb_mod/
assemble_mag_rloc
(b, db, ddb, aj, dj, ddj, dbdt, djdt, lrmsnext, tscheme)¶ This subroutine is used when an IMEX Runge Kutta with an assembly stage is employed. This is the R-distributed version.
- Parameters
b (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,inout]
db (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
ddb (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
aj (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,inout]
dj (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
ddj (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
lrmsnext [logical ,in]
tscheme [real ]
- Called from
- Call to
abortrun()
,get_openmp_blocks()
,bulk_to_ghost()
,exch_ghosts()
,fill_ghosts_b()
,get_mag_rhs_imp_ghost()
-
subroutine
updateb_mod/
get_mag_rhs_imp
(b, db, ddb, aj, dj, ddj, dbdt, djdt, tscheme, istage, l_calc_lin, lrmsnext[, l_in_cheb_space])¶ This subroutine handles the computation of the linear terms which enter the r.h.s. of the induction equation (LM-distributed version).
- Parameters
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lrmsnext [logical ,in]
- Options
l_in_cheb_space [logical ,in,]
- Called from
readstartfields_old()
,readstartfields()
,readstartfields_mpi()
,getstartfields()
,start_from_another_scheme()
,updateb()
,assemble_mag()
- Call to
-
subroutine
updateb_mod/
get_mag_rhs_imp_ghost
(bg, db, ddb, ajg, dj, ddj, dbdt, djdt, tscheme, istage, l_calc_lin, lrmsnext)¶ This subroutine handles the computation of the linear terms which enter the r.h.s. of the induction equation (R-distributed version).
- Parameters
bg (lm_max,nrstopmag+1-(nrstartmag-1)+1) [complex ,inout]
db (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
ddb (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
ajg (lm_max,nrstopmag+1-(nrstartmag-1)+1) [complex ,inout]
dj (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
ddj (lm_max,nrstopmag-(nrstartmag)+1) [complex ,out]
dbdt [type_tarray ,inout]
djdt [type_tarray ,inout]
tscheme [real ]
istage [integer ,in]
l_calc_lin [logical ,in]
lrmsnext [logical ,in]
- Called from
getstartfields()
,start_from_another_scheme()
,updateb_fd()
,assemble_mag_rloc()
- Call to
-
subroutine
updateb_mod/
get_bmat
(tscheme, l, hdif, bmat, bmat_fac, jmat, jmat_fac)¶ Purpose of this subroutine is to contruct the time step matrices
bmat(i,j)
andajmat
for the dynamo equations.- Parameters
tscheme [real ] :: time step
l [integer ,in]
hdif [real ,in]
bmat [real ]
bmat_fac (n_r_totmag) [real ,out]
jmat [integer ] :: ‘)
jmat_fac (n_r_totmag) [real ,out]
- Called from
- Call to
-
subroutine
updateb_mod/
get_bmat_rdist
(tscheme, hdif, bmat, jmat)¶ Purpose of this subroutine is to contruct the time step matrices
bmat(i,j)
andajmat
for the dynamo equations when the parallel F.D. solver is used- Parameters
tscheme [real ] :: time step
hdif (l_maxmag)+1) [real ,in]
bmat [type_tri_par ,inout]
jmat [type_tri_par ,inout]
- Called from
- Call to
updatePHI.f90
¶
Description
This module handles the time advance of the phase field phi. It contains the computation of the implicit terms and the linear solves.
Quick access
- Variables
- Routines
assemble_phase()
,assemble_phase_rloc()
,fill_ghosts_phi()
,finalize_updatephi()
,get_phase_rhs_imp()
,get_phase_rhs_imp_ghost()
,get_phimat()
,get_phimat_rdist()
,initialize_updatephi()
,preparephase_fd()
,updatephase_fd()
,updatephi()
Needed modules
omp_lib
precision_mod
: This module controls the precision used in MagICtruncation
(n_r_max()
,lm_max()
,l_max()
): This module defines the grid points and the truncationradial_data
(n_r_icb()
,n_r_cmb()
,nrstart()
,nrstop()
): This module defines the MPI decomposition in the radial direction.radial_functions
(or2()
,rscheme_oc()
,r()
,or1()
): This module initiates all the radial functions (transport properties, density, temperature, cheb transforms, etc.)num_param
(dct_counter()
,solve_counter()
): Module containing numerical and control parametersphysical_parameters
(pr()
,phasedifffac()
,stef()
,ktopphi()
,kbotphi()
): Module containing the physical parametersinit_fields
(phi_top()
,phi_bot()
): This module is used to construct the initial solution.blocking
(lo_map()
,lo_sub_map()
,llm()
,ulm()
,st_map()
): Module containing blocking informationlogic
(l_finite_diff()
,l_full_sphere()
,l_parallel_solve()
): Module containing the logicals that control the runparallel_mod
(rank()
,chunksize()
,n_procs()
,get_openmp_blocks()
): This module contains the blocking informationradial_der
(get_ddr()
,get_ddr_ghost()
,exch_ghosts()
,bulk_to_ghost()
): Radial derivatives functionsconstants
(zero()
,one()
,two()
): module containing constants and parameters used in the code.fields
(work_lmloc()
): 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….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.time_schemes
(type_tscheme()
): This module defines an abstract class type_tscheme which is employed for the time advance of the code.time_array
(type_tarray()
): This module defines two types that are defined to store the implicit/explicit terms at the different sub-stage/step.parallel_solvers
(type_tri_par()
): This module contains the routines that are used to solve linear banded problems with R-distributed arrays.
Variables
-
updatephi_mod/
lphimat
(*) [logical,allocatable/public]¶
-
-
updatephi_mod/
maxthreads
[integer,private]¶
-
-
updatephi_mod/
phi_ghost
(*,*) [complex,allocatable/public]¶
-
-
updatephi_mod/
phimat_fac
(*,*) [real,private/allocatable]¶
-
-
updatephi_mod/
phimat_fd
[type_tri_par,public]¶
-
-
updatephi_mod/
rhs1
(*,*,*) [real,private/allocatable]¶
-
Subroutines and functions
-
subroutine
updatephi_mod/
initialize_updatephi
()¶ - Called from
-
subroutine
updatephi_mod/
finalize_updatephi
()¶ This subroutine deallocates the matrices involved in the time-advance of phi.
- Called from
-
subroutine
updatephi_mod/
updatephi
(phi, dphidt, tscheme)¶ Updates the phase field
- Parameters
- Called from
- Call to
-
subroutine
updatephi_mod/
preparephase_fd
(tscheme, dphidt)¶ This subroutine is used to assemble the r.h.s. of the phase field equation when parallel F.D solvers are used. Boundary values are set here.
- Parameters
tscheme [real ]
dphidt [type_tarray ,inout]
- Called from
- Call to
-
subroutine
updatephi_mod/
fill_ghosts_phi
(phig)¶ This subroutine is used to fill the ghosts zones that are located at nR=n_r_cmb-1 and nR=n_r_icb+1. This is used to properly set the Neuman boundary conditions. In case Dirichlet BCs are used, a simple first order extrapolation is employed. This is anyway only used for outputs (like Sherwood numbers).
- Parameters
- Called from
lmloop_rdist()
,getstartfields()
,start_from_another_scheme()
,assemble_phase_rloc()
- Call to
-
subroutine
updatephi_mod/
updatephase_fd
(phi, dphidt, tscheme)¶ This subroutine is called after the linear solves have been completed. This is then assembling the linear terms that will be used in the r.h.s. for the next iteration.
- Parameters
- Called from
- Call to
-
subroutine
updatephi_mod/
get_phase_rhs_imp
(phi, dphidt, istage, l_calc_lin[, l_in_cheb_space])¶ This subroutine computes the linear terms which enter the r.h.s. of the equation for phase field. This is the LM-distributed version.
- Parameters
- Options
l_in_cheb_space [logical ,in,]
- Called from
getstartfields()
,start_from_another_scheme()
,updatephi()
,assemble_phase()
- Call to
-
subroutine
updatephi_mod/
get_phase_rhs_imp_ghost
(phig, dphidt, istage, l_calc_lin)¶ This subroutine computes the linear terms which enter the r.h.s. of the equation for phase field. This is the R-distributed version.
- Parameters
- Called from
getstartfields()
,start_from_another_scheme()
,updatephase_fd()
,assemble_phase_rloc()
- Call to
-
subroutine
updatephi_mod/
assemble_phase
(phi, dphidt, tscheme)¶ This subroutine is used to assemble the phase field when an IMEX-RK with an assembly stage is employed.
- Parameters
- Called from
- Call to
-
subroutine
updatephi_mod/
assemble_phase_rloc
(phi, dphidt, tscheme)¶ This subroutine is used when an IMEX Runge-Kutta time scheme with an assembly stage is used. This is used when R is distributed.
- Parameters
- Called from
- Call to
get_openmp_blocks()
,bulk_to_ghost()
,exch_ghosts()
,fill_ghosts_phi()
,get_phase_rhs_imp_ghost()
-
subroutine
updatephi_mod/
get_phimat
(tscheme, l, phimat, phimat_fac)¶ Purpose of this subroutine is to contruct the time step matrices phiMat(i,j) for the equation for phase field.
- Parameters
tscheme [real ] :: time step
l [integer ,in]
phimat [real ] :: ‘)
phimat_fac (n_r_max) [real ,out]
- Called from
- Call to
-
subroutine
updatephi_mod/
get_phimat_rdist
(tscheme, phimat)¶ Purpose of this subroutine is to contruct the time step matrices phiMat(i,j) for the equation for the phase field. This is used when parallel F.D. solvers are employed.
- Parameters
tscheme [real ] :: time step
phimat [type_tri_par ,inout]
- Called from