tridia.f
45 lines · 1 definitions · on GitHub (7be4133)
Python version: tridia.py, 69 lines, on the right (switch to Python above the code).
Purpose
TRIDIA solves the tridiagonal system of the implicit angular-momentum diffusion step (the Thomas algorithm), and returns the change of angular momentum at each point.
How it fits
- Inputs:
TRIDI_MOD, filled by DCOEFT just before the call: the three diagonalsA,B,C, the right-hand sideD(byDCOEFT's comment, the angular velocities at the start of the time step, the outermost one already reduced by the wind), andGAMA(N), the wind term at the surface.GAMAis also the elimination's work array (loop 1 setsGAMA(2..N), line 29↗), so TRIDIA reads the wind term first (line 22↗). The argumentEIholds the points' moments of inertia (bySECULR's use, probably). - Who calls it: only SECULR.
- Outputs:
UinTRIDI_MOD, the angular velocities at the end of the step;DJ, the change of angular momentum at each point; andSUMDJ, their sum.SECULRpassesDJto EQ2MOD to return to the model's grid. - Modules:
TRIDI_MOD(formerlyCOMMON/TRIDI/), shared withDCOEFT, CCOEFT, CTRIDI, GETQUA and MIXCOM.
The method
Forward elimination and back substitution for $a_j u_{j-1} + b_j u_j + c_j u_{j+1} = d_j$; then $$\Delta J_j = (\Omega_j^\mathrm{new} - \Omega_j^\mathrm{old})\,I_j,$$ with, at the surface, the wind term added: $\Delta J_N = \gamma_N + (\Omega_N^\mathrm{new} - \Omega_N^\mathrm{old})\,I_N$. A zero pivot stops the run ("#TRIDIA:SINGULAR MATRIX").
Definitions
subroutineTRIDIA
Thomas algorithm for the implicit angular-momentum diffusion, returning each point's change of angular momentum and their sum.
Uses modules DIMENSIONS_MOD, TRIDI_MOD
Called by SECULR
Compiler warnings (1)
gfortran -Wall -Wextra, compiling only; nothing was run.
- line 31: Equality comparison for REAL(8) [-Wcompare-reals]
Change log
The changes since rp_1
Changed since rp_1. Declarations only: COMMON/TRIDI/ to TRIDI_MOD, JSON from DIMENSIONS_MOD, IMPLICIT NONE.