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 MagIC

  • parallel_mod: This module contains the blocking information

  • constants (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 parameters

  • mem_alloc (memwrite(), bytes_allocated()): This little module is used to estimate the global memory allocation used in MagIC

  • truncation (l_max(), lm_max(), n_r_max(), n_r_maxmag(), n_r_ic_max(), lm_maxmag()): This module defines the grid points and the truncation

  • radial_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 information

  • logic (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 run

  • 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.

  • 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 linear

  • updateb_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 linear

  • updatexi_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

magic

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

magic

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

magic

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

step_time()

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

step_time()

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]

  • w (ulm-(llm)+1,n_r_max) [complex ,in]

  • b_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]

  • aj_ic (ulmmag-(llmmag)+1,n_r_ic_max) [complex ,in]

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

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

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

  • 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

step_time()

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

step_time()

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

step_time()

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

step_time()

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

lmloop_rdist()

Call to

get_openmp_blocks(), abortrun()

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

lmloop_rdist(), time_lm_loop()

Call to

get_openmp_blocks(), abortrun()

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

initialize_lmloop(), time_lm_loop()

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

logwrite(), set_block_number(), time_lm_loop()

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

set_block_number(), parallel_solve()

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

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

initialize_lmloop()

subroutine updatewps_mod/finalize_updatewps()
Called from

finalize_lmloop()

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

lmloop()

Call to

get_ps0mat(), get_wpsmat(), get_single_rhs_imp()

subroutine updatewps_mod/finish_exp_smat(dvsrlm, ds_exp_last)
Parameters
Called from

finish_explicit_assembly()

Call to

get_openmp_blocks()

subroutine updatewps_mod/finish_exp_smat_rdist(dvsrlm, ds_exp_last)
Parameters
Called from

finish_explicit_assembly_rdist()

Call to

get_dr_rloc(), get_openmp_blocks()

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

assemble_stage()

Call to

abortrun(), get_openmp_blocks(), get_ddr(), cc2real()

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
Options

l_in_cheb_space [logical ,in,]

Called from

readstartfields_old(), readstartfields(), readstartfields_mpi(), getstartfields(), start_from_another_scheme(), updatewps()

Call to

get_openmp_blocks(), get_ddr(), get_dddr(), cc2real()

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
  • tscheme [real ]

  • l [integer ,in]

  • hdif_vel [real ,in]

  • hdif_s [real ,in]

  • wpsmat (3*n_r_max,3*n_r_max) [real ,out] :: ‘)

  • wpspivot (3*n_r_max) [integer ,out]

  • wpsmat_fac (3*n_r_max,2) [real ,out]

Called from

updatewps()

Call to

prepare_mat(), abortrun()

subroutine updatewps_mod/get_ps0mat(tscheme, psmat, pspivot, psmat_fac)
Parameters
  • tscheme [real ]

  • psmat (2*n_r_max,2*n_r_max) [real ,out] :: entropy diffusion

  • pspivot (2*n_r_max) [integer ,out]

  • psmat_fac (2*n_r_max,2) [real ,out]

Called from

updatewps()

Call to

prepare_mat(), abortrun()

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

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

initialize_lmloop()

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

finalize_lmloop()

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

lmloop()

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

test_lmloop(), lmloop_rdist()

Call to

get_wmat_rdist(), get_p0mat_rdist(), get_openmp_blocks()

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

get_openmp_blocks()

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]

  • p (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Pressure

  • 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

lmloop_rdist()

Call to

get_pol_rhs_imp_ghost(), get_openmp_blocks()

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

assemble_pol()

Call to

get_elliptic_mat()

subroutine updatewp_mod/finish_exp_pol(dvxvhlm, dw_exp_last)
Parameters
Called from

finish_explicit_assembly()

Call to

get_openmp_blocks()

subroutine updatewp_mod/finish_exp_pol_rdist(dvxvhlm, dw_exp_last)
Parameters
Called from

finish_explicit_assembly_rdist()

Call to

get_dr_rloc(), get_openmp_blocks()

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
Options

l_in_cheb_space [logical ,in,]

Called from

readstartfields_old(), readstartfields(), readstartfields_mpi(), getstartfields(), start_from_another_scheme(), updatewp()

Call to

get_openmp_blocks(), get_ddr(), get_dddr(), cc2real()

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

assemble_stage()

Call to

get_pol(), get_openmp_blocks(), get_ddr(), cc2real()

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

assemble_stage_rdist()

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

updatewp()

Call to

abortrun()

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

get_pol()

Call to

abortrun()

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

updatewp()

Call to

abortrun()

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

assemble_pol_rloc()

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

preparew_fd()

subroutine updatewp_mod/get_p0mat(pmat)

This subroutine solves the linear problem of the spherically-symmetric pressure

Parameters

pmat [real ] :: matrix

Called from

updatewp()

Call to

abortrun()

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

preparew_fd()

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

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

initialize_lmloop()

subroutine updatez_mod/finalize_updatez()

Memory deallocation of arrays associated with time advance of Z

Called from

finalize_lmloop()

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

lmloop()

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

test_lmloop(), lmloop_rdist()

Call to

get_zmat_rdist(), get_z10mat_rdist(), get_openmp_blocks()

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

zg (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

Called from

lmloop_rdist(), getstartfields(), start_from_another_scheme(), assemble_tor_rloc()

Call to

get_openmp_blocks()

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

lmloop_rdist()

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]

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

  • dz (ulm-(llm)+1,n_r_max) [complex ,out]

  • 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]

  • zg (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

  • dz (lm_max,nrstop-(nrstart)+1) [complex ,out]

  • 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]

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

  • dz (ulm-(llm)+1,n_r_max) [complex ,out]

  • 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

assemble_stage()

Call to

abortrun(), update_rot_rates(), get_tor_rhs_imp()

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]

  • z (lm_max,nrstop-(nrstart)+1) [complex ,inout]

  • dz (lm_max,nrstop-(nrstart)+1) [complex ,out]

  • 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

assemble_stage_rdist()

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
  • z (ulm-(llm)+1,n_r_max) [complex ,in]

  • 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

updatez(), assemble_tor()

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
  • z (lm_max,nrstop+1-(nrstart-1)+1) [complex ,in]

  • 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

updatez_fd(), assemble_tor_rloc()

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 (either kbotv=1 and/or ktopv=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

updatez()

Call to

abortrun()

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

updatez()

Call to

abortrun()

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

preparez_fd()

Call to

abortrun()

subroutine updatez_mod/get_zmat_rdist(tscheme, hdif, zmat)

This subroutine is used to construct the z matrices when the parallel F.D. solver is employed.

Parameters
  • tscheme [real ] :: time step

  • hdif (l_max)+1) [real ,in] :: Hyperdiffusivity

  • zmat [type_tri_par ,inout]

Called from

preparez_fd()

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

lsmat, s_ghost, smat_fac, smat_fd

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

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

initialize_lmloop()

subroutine updates_mod/finalize_updates()

Memory deallocation of updateS module

Called from

finalize_lmloop()

subroutine updates_mod/updates(s, ds, dsdt, phi, tscheme)

Updates the entropy field s and its radial derivative.

Parameters
  • s (ulm-(llm)+1,n_r_max) [complex ,inout] :: Entropy

  • ds (ulm-(llm)+1,n_r_max) [complex ,out] :: Radial derivative of entropy

  • dsdt [type_tarray ,inout]

  • phi (ulm-(llm)+1,n_r_max) [complex ,in] :: Phase field

  • tscheme [real ]

Called from

lmloop()

Call to

get_smat(), get_entropy_rhs_imp()

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

test_lmloop(), lmloop_rdist()

Call to

get_smat_rdist(), get_openmp_blocks()

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

sg (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

Called from

lmloop_rdist(), getstartfields(), start_from_another_scheme(), assemble_entropy_rloc()

Call to

get_openmp_blocks()

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

lmloop_rdist()

Call to

get_entropy_rhs_imp_ghost(), get_openmp_blocks()

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).

Parameters
Called from

finish_explicit_assembly()

Call to

get_openmp_blocks()

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

finish_explicit_assembly_rdist()

Call to

get_dr_rloc(), get_openmp_blocks()

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

get_openmp_blocks(), get_ddr()

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

get_openmp_blocks(), get_ddr_ghost()

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

assemble_stage_rdist()

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.

Parameters
Called from

assemble_stage()

Call to

get_entropy_rhs_imp()

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

updates()

Call to

abortrun()

subroutine updates_mod/get_smat_rdist(tscheme, hdif, smat)

This subroutine is used to construct the matrices when the parallel solver for F.D. is employed.

Parameters
  • tscheme [real ] :: time step

  • hdif (l_max)+1) [real ,in]

  • smat [type_tri_par ,inout]

Called from

prepares_fd()

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

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

initialize_lmloop()

subroutine updatexi_mod/finalize_updatexi()

This subroutine deallocates the matrices involved in the time-advance of xi.

Called from

finalize_lmloop()

subroutine updatexi_mod/updatexi(xi, dxi, dxidt, tscheme)

Updates the chemical composition field s and its radial derivative.

Parameters
  • xi (ulm-(llm)+1,n_r_max) [complex ,inout] :: Chemical composition

  • dxi (ulm-(llm)+1,n_r_max) [complex ,out] :: Radial derivative of xi

  • dxidt [type_tarray ,inout]

  • tscheme [real ]

Called from

lmloop()

Call to

get_ximat(), get_comp_rhs_imp()

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

test_lmloop(), lmloop_rdist()

Call to

get_ximat_rdist(), get_openmp_blocks()

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

xig (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

Called from

lmloop_rdist(), getstartfields(), start_from_another_scheme(), assemble_comp_rloc()

Call to

get_openmp_blocks()

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
  • xi (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Composition

  • dxidt [type_tarray ,inout]

  • tscheme [real ]

Called from

lmloop_rdist()

Call to

get_comp_rhs_imp_ghost(), get_openmp_blocks()

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.

Parameters
Called from

finish_explicit_assembly()

Call to

get_openmp_blocks()

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

finish_explicit_assembly_rdist()

Call to

get_dr_rloc(), get_openmp_blocks()

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
  • xi (ulm-(llm)+1,n_r_max) [complex ,inout]

  • dxi (ulm-(llm)+1,n_r_max) [complex ,out]

  • dxidt [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(), updatexi(), assemble_comp()

Call to

get_openmp_blocks(), get_ddr()

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
  • xig (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

  • dxidt [type_tarray ,inout]

  • istage [integer ,in]

  • l_calc_lin [logical ,in]

Called from

getstartfields(), start_from_another_scheme(), updatexi_fd(), assemble_comp_rloc()

Call to

get_openmp_blocks(), get_ddr_ghost()

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

assemble_stage()

Call to

get_comp_rhs_imp()

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

assemble_stage_rdist()

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

updatexi()

Call to

abortrun()

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

preparexi_fd()

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

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

initialize_lmloop()

subroutine updateb_mod/finalize_updateb()

This subroutine deallocates the matrices involved in the time advance of the magnetic field.

Called from

finalize_lmloop()

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

lmloop(), lmloop_rdist()

Call to

get_bmat(), get_mag_rhs_imp(), get_mag_ic_rhs_imp()

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

test_lmloop(), lmloop_rdist()

Call to

abortrun(), get_bmat_rdist(), get_openmp_blocks()

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

lmloop_rdist(), getstartfields(), start_from_another_scheme(), assemble_mag_rloc()

Call to

get_openmp_blocks(), abortrun()

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

lmloop_rdist()

Call to

get_mag_rhs_imp_ghost(), get_openmp_blocks()

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

finish_explicit_assembly()

Call to

get_openmp_blocks()

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

finish_explicit_assembly_rdist()

Call to

get_dr_rloc(), get_openmp_blocks()

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
Options

l_in_cheb_space [logical ,in,]

Called from

readstartfields_old(), readstartfields(), readstartfields_mpi(), getstartfields(), start_from_another_scheme(), updateb(), assemble_mag()

Call to

get_openmp_blocks(), get_ddr_even()

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

assemble_stage(), assemble_stage_rdist()

Call to

abortrun(), get_mag_rhs_imp(), get_mag_ic_rhs_imp()

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

assemble_stage_rdist()

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
Options

l_in_cheb_space [logical ,in,]

Called from

readstartfields_old(), readstartfields(), readstartfields_mpi(), getstartfields(), start_from_another_scheme(), updateb(), assemble_mag()

Call to

get_openmp_blocks(), get_ddr(), cc2real()

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

getstartfields(), start_from_another_scheme(), updateb_fd(), assemble_mag_rloc()

Call to

get_openmp_blocks(), get_ddr_ghost(), cc2real()

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) and ajmat 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

updateb()

Call to

abortrun()

subroutine updateb_mod/get_bmat_rdist(tscheme, hdif, bmat, jmat)

Purpose of this subroutine is to contruct the time step matrices bmat(i,j) and ajmat 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

prepareb_fd()

Call to

abortrun()

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

lphimat, phi_ghost, phimat_fac, phimat_fd

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

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

initialize_lmloop()

subroutine updatephi_mod/finalize_updatephi()

This subroutine deallocates the matrices involved in the time-advance of phi.

Called from

finalize_lmloop()

subroutine updatephi_mod/updatephi(phi, dphidt, tscheme)

Updates the phase field

Parameters
  • phi (ulm-(llm)+1,n_r_max) [complex ,inout] :: Chemical composition

  • dphidt [type_tarray ,inout]

  • tscheme [real ]

Called from

lmloop()

Call to

get_phimat(), get_phase_rhs_imp()

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

lmloop_rdist()

Call to

get_phimat_rdist(), get_openmp_blocks()

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

phig (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

Called from

lmloop_rdist(), getstartfields(), start_from_another_scheme(), assemble_phase_rloc()

Call to

get_openmp_blocks()

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
  • phi (lm_max,nrstop-(nrstart)+1) [complex ,inout] :: Phase field

  • dphidt [type_tarray ,inout]

  • tscheme [real ]

Called from

lmloop_rdist()

Call to

get_phase_rhs_imp_ghost(), get_openmp_blocks()

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
  • phi (ulm-(llm)+1,n_r_max) [complex ,inout]

  • dphidt [type_tarray ,inout]

  • istage [integer ,in]

  • l_calc_lin [logical ,in]

Options

l_in_cheb_space [logical ,in,]

Called from

getstartfields(), start_from_another_scheme(), updatephi(), assemble_phase()

Call to

get_openmp_blocks(), get_ddr()

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
  • phig (lm_max,nrstop+1-(nrstart-1)+1) [complex ,inout]

  • dphidt [type_tarray ,inout]

  • istage [integer ,in]

  • l_calc_lin [logical ,in]

Called from

getstartfields(), start_from_another_scheme(), updatephase_fd(), assemble_phase_rloc()

Call to

get_openmp_blocks(), get_ddr_ghost()

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
  • phi (ulm-(llm)+1,n_r_max) [complex ,inout]

  • dphidt [type_tarray ,inout]

  • tscheme [real ]

Called from

assemble_stage()

Call to

get_phase_rhs_imp()

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

assemble_stage_rdist()

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

updatephi()

Call to

abortrun()

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

preparephase_fd()