- subroutine diffuseb
- Description
- Numerical Equations
- Subroutine Arguments
- Local variables
- Logical units
- Order of Things
- Calls
- Called By
- Known Issues

- subroutine diffuseu
- Description
- Numerical Equations
- Subroutine Arguments
- Local variables
- Logical units
- Order of Things
- Calls
- Called By
- Known Issues

- subroutine diffuseb_n
- Description
- Numerical Equations
- Subroutine Arguments
- Local variables
- Logical units
- Order of Things
- Calls
- Called By
- Known Issues

- subroutine tridag
- Description
- Numerical Equations
- Subroutine Arguments
- Local variables
- Logical units
- Calls
- Called By
- Known Issues

- subroutine tridag_n

diffuse.F

subroutine diffuseb

,

where is the diffusion coefficient.

**If and are constant (this example is given for simplicity: in
practice they are not and there is a straightforward modification), the fully
implicit
scheme is
This leads to a tridiagonal system of equations, when supplemented by boundary
conditions (for example zero diffusion) at the surface and sea bed.
**

**ba**value of scalar variable, returns new diffused value

**i,j,k,**grid indices**hsq**square of depth**acr,bcr,ccr,rcr,ucr**matrix coefficients

- Set tridiagonal matrix coefficients for no diffusion at surface and bed
- Set `old' values of scalar at external points
- Set matrix coefficients in interior
- Call tridag to solve equations
- Return diffused value of scalar

- tridag

- baroc

subroutine diffuseu

,

where is the eddy viscosity.

**If and are constant (this example is given for simplicity: in
practice they are not and there is a straightforward modification), the fully
implicit
scheme is
This leads to a tridiagonal system of equations, when supplemented by boundary
conditions, for example wind stress at the surface and friction at the sea bed.
For stability, there is a semi-implicit form of quadratic bottom friction,
proportional to the `new' value of velocity multiplied by the `old' total
speed.
**

**ua**value of velocity variable, returns new diffused value**fsa**surface stress

**i,j,k,**grid indices**hsq**square of depth**acr,bcr,ccr,rcr,ucr**matrix coefficients

- Set tridiagonal matrix coefficients for boundary conditions at surface and bed
- Set `old' values of velocity at external points
- Set matrix coefficients in interior
- Call
**tridag**to solve equations - Return diffused value of velocity

- tridag

- baroc

subroutine diffuseb_n

,

where is the diffusion coefficient.

This leads to a tridiagonal system of equations, when supplemented by boundary
conditions (for example zero diffusion) at the surface and sea bed.

**ba**value of scalar variable, returns new diffused value**nv**number of scalars to be diffused

**i,j,k,**grid indices**iv**counter for scalars**hsq**square of depth**acr,bcr,ccr,rcr,ucr**matrix coefficients

- Set tridiagonal matrix coefficients for no diffusion at surface and bed
- Set `old' values of scalars at external points
- Set matrix coefficients in interior
- Call
**tridag_n**to solve equations - Return diffused value of scalars

- tridag_n

subroutine tridag

**They point out that as there is no pivoting tridag
can fail, though this rarely happens. Failure lines have been commented out.
**

**a,b,c**coefficients along the diagonal**r**values of right hand side**u**vector to be solved for**nt**number of equations

**j**counter**bet,gam**workspace

- diffuseb, diffuseu

subroutine tridag_n

**See the description of tridag for more information.
**

**a,b,c**coefficients along the diagonal**r**values of right hand side**u**vector to be solved for**nt**number of equations**nrhs**number of right hand sides

**irhs,j**counters**bet,gam**workspace

- htmlrefdiffuseb_ndiffuseb_n