Non-linear part of the time stepping (radial loop)

radialLoop.f90

Quick access

Routines

finalize_radialloop(), initialize_radialloop(), radialloopg()

Needed modules

Variables

Subroutines and functions

subroutine radialloop/initialize_radialloop()
Called from

magic

Call to

memwrite()

subroutine radialloop/finalize_radialloop()
Called from

magic

subroutine radialloop/radialloopg(l_graph, l_frame, time, timestage, tscheme, dtlast, ltocalc, ltonext, ltonext2, lhelcalc, lpowercalc, lrmscalc, lpresscalc, lpressnext, lviscbccalc, lfluxprofcalc, lperpparcalc, lgeoscalc, lhemicalc, l_probe_out, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dvxvhlm, dvxbhlm, dvsrlm, dvxirlm, lorentz_torque_ic, lorentz_torque_ma, br_vt_lm_cmb, br_vp_lm_cmb, br_vt_lm_icb, br_vp_lm_icb, dtrkc, dthkc)

This subroutine performs the actual time-stepping.

Parameters
Called from

step_time()

rIteration.f90

Description

This module is used to define an abstract class for the radial loop

Needed modules

Types

  • type riteration/unknown_type

rIter.f90

Description

This module actually handles the loop over the radial levels. It contains the spherical harmonic transforms and the operations on the arrays in physical space.

Quick access

Routines

radialloop(), transform_to_grid_space(), transform_to_lm_space()

Needed modules

Types

  • type riter_mod/unknown_type
    Type fields
    • % dtb_arrays [dtb_arrays_t ]

    • % gsa [grid_space_arrays_t ]

    • % nl_lm [nonlinear_lm_t ]

    • % to_arrays [to_arrays_t ]

Subroutines and functions

subroutine riter_mod/initialize(this)
Parameters

this [real ]

subroutine riter_mod/finalize(this)
Parameters

this [real ]

subroutine riter_mod/radialloop(this, l_graph, l_frame, time, timestage, tscheme, dtlast, ltocalc, ltonext, ltonext2, lhelcalc, lpowercalc, lrmscalc, lpresscalc, lpressnext, lviscbccalc, lfluxprofcalc, lperpparcalc, lgeoscalc, lhemicalc, l_probe_out, dsdt, dwdt, dzdt, dpdt, dxidt, dphidt, dbdt, djdt, dvxvhlm, dvxbhlm, dvsrlm, dvxirlm, lorentz_torque_ic, lorentz_torque_ma, br_vt_lm_cmb, br_vp_lm_cmb, br_vt_lm_icb, br_vp_lm_icb, dtrkc, dthkc)

This subroutine handles the main loop over the radial levels. It calls the SH transforms, computes the nonlinear terms on the grid and bring back the quantities in spectral space. This is the most time consuming part of MagIC.

Parameters
  • this [real ]

  • l_graph [logical ,in]

  • l_frame [logical ,in]

  • time [real ,in]

  • timestage [real ,in]

  • tscheme [real ]

  • dtlast [real ,in]

  • ltocalc [logical ,in]

  • ltonext [logical ,in]

  • ltonext2 [logical ,in]

  • lhelcalc [logical ,in]

  • lpowercalc [logical ,in]

  • lrmscalc [logical ,in]

  • lpresscalc [logical ,in]

  • lpressnext [logical ,in]

  • lviscbccalc [logical ,in]

  • lfluxprofcalc [logical ,in]

  • lperpparcalc [logical ,in]

  • lgeoscalc [logical ,in]

  • lhemicalc [logical ,in]

  • l_probe_out [logical ,in]

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

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

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

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

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

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

  • dbdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]

  • djdt (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]

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

  • dvxbhlm (lm_maxmag,nrstopmag-(nrstartmag)+1) [complex ,out]

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

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

  • lorentz_torque_ic [real ,out]

  • lorentz_torque_ma [real ,out]

  • br_vt_lm_cmb (*) [complex ,out] :: product br*vt at CMB

  • br_vp_lm_cmb (*) [complex ,out] :: product br*vp at CMB

  • br_vt_lm_icb (*) [complex ,out] :: product br*vt at ICB

  • br_vp_lm_icb (*) [complex ,out] :: product br*vp at ICB

  • dtrkc (nrstop-(nrstart)+1) [real ,out]

  • dthkc (nrstop-(nrstart)+1) [real ,out]

Call to

graphout_mpi_header(), prep_to_axi(), get_nl_rms(), get_br_v_bcs(), get_lorentz_torque(), courant(), graphout_mpi(), probe_out(), get_helicity(), get_hemi(), get_visc_heat(), get_nlblayers(), get_fluxes(), get_ekin_solid_liquid(), get_perppar(), calcgeos(), store_movie_frame(), get_dtblm(), gettonext(), getto(), compute_lm_forces(), gettofinish(), get_dh_dtblm()

subroutine riter_mod/transform_to_grid_space(this, nr, nbc, lviscbccalc, lrmscalc, lpresscalc, ltocalc, lpowercalc, lfluxprofcalc, lperpparcalc, lhelcalc, lgeoscalc, lhemicalc, l_frame, lderiv)

This subroutine actually handles the spherical harmonic transforms from (ell,m) space to (theta,phi) space.

Parameters
  • this [real ]

  • nr [integer ,in]

  • nbc [integer ,in]

  • lviscbccalc [logical ,in]

  • lrmscalc [logical ,in]

  • lpresscalc [logical ,in]

  • ltocalc [logical ,in]

  • lpowercalc [logical ,in]

  • lfluxprofcalc [logical ,in]

  • lperpparcalc [logical ,in]

  • lhelcalc [logical ,in]

  • lgeoscalc [logical ,in]

  • lhemicalc [logical ,in]

  • l_frame [logical ,in]

  • lderiv [logical ,in]

Call to

scal_to_spat(), scal_to_grad_spat(), transform_to_grid_rms(), torpol_to_spat(), torpol_to_curl_spat(), pol_to_grad_spat(), torpol_to_dphspat(), pol_to_curlr_spat(), v_rigid_boundary()

subroutine riter_mod/transform_to_lm_space(this, nr, lrmscalc, dvsrlm, dvxirlm, dphidt)

This subroutine actually handles the spherical harmonic transforms from (theta,phi) space to (ell,m) space.

Parameters
  • this [real ]

  • nr [integer ,in]

  • lrmscalc [logical ,in]

  • dvsrlm (lm_max) [complex ,out]

  • dvxirlm (lm_max) [complex ,out]

  • dphidt (lm_max) [complex ,out]

Call to

get_openmp_blocks(), spat_to_qst(), scal_to_sh(), spat_to_sphertor(), transform_to_lm_rms()

get_nl.f90

Types

  • type general_arrays_mod/unknown_type

get_td.f90

Description

This module is used to finish the assembly of the nonlinear terms in \((\ell,m)\) space. Derivatives along \(\theta\) and \(\phi\) are handled using recurrence relations.

Quick access

Variables

lm_min

Routines

get_td(), set_zero()

Needed modules

Types

  • type nonlinear_lm_mod/unknown_type
    Type fields
    • % advplm (*) [complex ,allocatable]

    • % advrlm (*) [complex ,allocatable]

    • % advtlm (*) [complex ,allocatable]

    • % heattermslm (*) [complex ,allocatable]

    • % vsplm (*) [complex ,allocatable]

    • % vstlm (*) [complex ,allocatable]

    • % vxbplm (*) [complex ,allocatable]

    • % vxbrlm (*) [complex ,allocatable]

    • % vxbtlm (*) [complex ,allocatable]

    • % vxiplm (*) [complex ,allocatable]

    • % vxitlm (*) [complex ,allocatable]

Variables

  • nonlinear_lm_mod/lm_min [integer,private]

Subroutines and functions

subroutine nonlinear_lm_mod/initialize(this, lmp_max)

Memory allocation of get_td arrays

Parameters
  • this [real ]

  • lmp_max [integer ,in]

subroutine nonlinear_lm_mod/finalize(this)

Memory deallocation

Parameters

this [real ]

subroutine nonlinear_lm_mod/set_zero(this)

Set all the arrays to zero

Parameters

this [real ]

subroutine nonlinear_lm_mod/get_td(this, nr, nbc, lpressnext, dvxvhlm, dvxbhlm, dwdt, dzdt, dpdt, dsdt, dxidt, dbdt, djdt)

Purpose of this to calculate time derivatives dwdt,``dzdt``,``dpdt``,``dsdt``,``dxidt``,``dbdt``,``djdt`` and auxiliary arrays dVxBhLM, dVxVhLM from non-linear terms in spectral form

Parameters
  • this [real ]

  • nr [integer ,in] :: Radial level

  • nbc [integer ,in] :: signifies boundary conditions

  • lpressnext [logical ,in]

  • dvxvhlm (*) [complex ,out]

  • dvxbhlm (*) [complex ,out]

  • dwdt (*) [complex ,out] :: +CorPol_loc

  • dzdt (*) [complex ,out]

  • dpdt (*) [complex ,out]

  • dsdt (*) [complex ,out]

  • dxidt (*) [complex ,out]

  • dbdt (*) [complex ,out]

  • djdt (*) [complex ,out]

nonlinear_bcs.f90

Quick access

Routines

get_b_nl_bcs(), get_br_v_bcs(), v_rigid_boundary()

Needed modules

Variables

Subroutines and functions

subroutine nonlinear_bcs/get_br_v_bcs(br, vt, vp, omega, o_r_e_2, o_rho, br_vt_lm, br_vp_lm)

Purpose of this subroutine is to calculate the nonlinear term of the magnetic boundary condition for a conducting mantle or inner core in space (r,lm). Calculation is performed for the theta block:

n_theta_min<=n_theta<=n_theta_min+n_theta_block-1

On input br, vt and vp are given on all phi points and thetas in the specific block. On output the contribution of these grid points to all degree and orders is stored in br_vt_lm and br_vp_lm. Output is [r/sin(theta)*Br*U]=[(0,br_vt_lm,br_vp_lm)]

Parameters
  • br (*,*) [real ,in] :: \(r^2 B_r\)

  • vt (*,*) [real ,in] :: \(r \sin\theta u_\theta\)

  • vp (*,*) [real ,in] :: \(r \sin\theta u_\phi\)

  • omega [real ,in] :: rotation rate of mantle or IC

  • o_r_e_2 [real ,in] :: \(1/r^2\)

  • o_rho [real ,in] :: \(1/\tilde{\rho}\) (anelastic)

  • br_vt_lm (lm_max) [complex ,inout]

  • br_vp_lm (lm_max) [complex ,inout]

Called from

radialloop()

Call to

spat_to_sphertor()

subroutine nonlinear_bcs/get_b_nl_bcs(bc, br_vt_lm, br_vp_lm, lm_min_b, lm_max_b, b_nl_bc, aj_nl_bc)

Purpose of this subroutine is to calculate the nonlinear term of the magnetic boundary condition for a conducting mantle in physical space (theta,phi), assuming that the conductance of the mantle is much smaller than that of the core. Calculation is performed for the theta block:

n_theta_min<=n_theta<=n_theta_min+n_theta_block-1
Parameters
  • bc [character(len=3),in] :: Distinguishes ‘CMB’ and ‘ICB’

  • br_vt_lm (lm_max) [complex ,in] :: \(B_r u_\theta/(r^2\sin^2\theta)\)

  • br_vp_lm (lm_max) [complex ,in] :: \(B_r u_\phi/(r^2\sin^2\theta)\)

  • lm_min_b [integer ,in]

  • lm_max_b [integer ,in] :: limits of lm-block

  • b_nl_bc (lm_max_b-lm_min_b+1) [complex ,out] :: nonlinear bc for b

  • aj_nl_bc (lm_max_b-lm_min_b+1) [complex ,out] :: nonlinear bc for aj

Called from

step_time()

Call to

abortrun()

subroutine nonlinear_bcs/v_rigid_boundary(nr, omega, lderiv, vrr, vtr, vpr, cvrr, dvrdtr, dvrdpr, dvtdpr, dvpdpr)

Purpose of this subroutine is to set the velocities and their derivatives at a fixed boundary. While vt is zero, since we only allow for rotation about the \(z\)-axis, vp= r \sin(theta) v_phi = r**2 sin(theta)**2 omega and cvr= r**2 * radial component of (\curl v) = r**2  2 cos(theta) omega

Parameters
  • nr [integer ,in] :: no of radial grid point

  • omega [real ,in] :: boundary rotation rate

  • lderiv [logical ,in] :: derivatives required ?

  • vrr (*,*) [real ,out]

  • vtr (*,*) [real ,out]

  • vpr (*,*) [real ,out]

  • cvrr (*,*) [real ,out]

  • dvrdtr (*,*) [real ,out]

  • dvrdpr (*,*) [real ,out]

  • dvtdpr (*,*) [real ,out]

  • dvpdpr (*,*) [real ,out]

Called from

transform_to_grid_space()