PyREC scaffolding (from YREC development, 7be4133)/ ctridi.fGlossary

ctridi.f

32 lines · 1 definitions · on GitHub (7be4133)

Python version: ctridi.py, 38 lines, on the right (switch to Python above the code).

Variables on this page (6)

a, b, c, d, gama, u

Purpose

Solves a tridiagonal linear system by the Thomas algorithm (Numerical Recipes' TRIDAG, per its comment), for the new abundance of a species after rotational mixing.

How it fits

  • Inputs: N, and the coefficients A, B, C and right-hand side D in TRIDI_MOD, set by CCOEFT.
  • Who calls it: MIXCOM.
  • Output: the solution U in TRIDI_MOD (GAMA is a work array there). The same module serves the angular-momentum problem: DCOEFT fills it for TRIDIA, and GETQUA also uses it.

The method

For $a_j u_{j-1} + b_j u_j + c_j u_{j+1} = d_j$: forward elimination with $\beta_1 = b_1$, $\gamma_j = c_{j-1}/\beta_{j-1}$, $\beta_j = b_j - a_j\gamma_j$, $u_j = (d_j - a_j u_{j-1})/\beta_j$; then back substitution $u_j \leftarrow u_j - \gamma_{j+1}u_{j+1}$. No pivoting; a zero $\beta$ stops the run (with the message "TRIDIA: singular matrix").

Design

TRIDIA is the same solver with extra bookkeeping of the change in angular momentum; this copy is for composition.

Definitions

subroutineCTRIDI

lines 2–32 · GitHub

Thomas algorithm for the tridiagonal system in TRIDI_MOD; the solution goes to U.

Uses modules TRIDI_MOD

Called by MIXCOM

Compiler warnings (1)

gfortran -Wall -Wextra, compiling only; nothing was run.

  • line 24: Equality comparison for REAL(8) [-Wcompare-reals]

Change log

The changes since rp_1

Changed since rp_1. Declarations only: /TRIDI/ to TRIDI_MOD, IMPLICIT NONE.