# Hybrid tangent linear model¶

OOPS’s hybrid tangent linear model (H-TLM) implementation, named `HybridLinearModel`

in the code, can be used for any `MODEL`

which has implemented a `LinearModel`

in its interface.

The `LinearModel`

is instantiated via a factory. To make this a `HybridLinearModel`

, the `name`

option in the `linear model`

subconfiguration must be set to `HTLM`

.

Coefficients can be generated either “on the fly” in a Variational run, or precalculated using GenHybridLinearModelCoeffs.

Assuming the coefficients have been precalculated, the `HybridLinearModel`

can be configured using the following options within the `linear model`

subconfiguration:

`name`

: must be “HTLM” in order to instantiate a`HybridLinearModel`

via the`LinearModel`

factory`simple linear model`

: subconfiguration for the`SimpleLinearModel`

wrapper:`linear model`

: subconfiguration for the underlying`MODEL`

-specific`LinearModel`

`geometry`

(optional): subconfiguration for the`MODEL`

-specific`Geometry`

of the`MODEL`

-specific`LinearModel`

when using`SimpleLinearModelMultiresolution`

or`SimpleLinearModelResidualForm`

`residual form`

(optional, default`false`

): boolean determining whether`SimpleLinearModelResidualForm`

is used over`SimpleLinearModelMultiresolution`

`update tstep`

: timestep of the`HybridLinearModel`

, as used by`CostFct4DVar`

/`CostFctWeak`

(i.e. the time between`HybridLinearModel`

updates using the coefficients); a duration in ISO 8601 format`variables`

: list of variables, as used by`CostFct4DVar`

/`CostFctWeak`

(i.e. the analysis variables); must be a superset of`coefficients.update variables`

`coefficients`

: subconfiguration for the`HybridLinearModelCoeffs`

class:`input`

: subconfiguration for the reading of coefficients from file, consisting of`base filepath`

(string) and`one file per task`

(boolean; currently, this must be set to`true`

)`update variables`

: list of variables which are updated by the coefficients (having previously been trained on them)`influence region size`

: number of vertical levels in column of influence (must be an odd number to allow centering on the level of interest)`time window`

: subconfiguration for the`TimeWindow`

over which coefficients are applied (i.e. the assimilation window)

Note that the configuration must match that used to precalculate the coefficients (with the exception of `input`

, which would be set to `output`

for the precalculation).

Here is an example configuration as would be used to run 4D-Var using the `Variational`

application when coefficients have been precalculated:

```
# rest of Variational configuration
linear model:
name: HTLM
simple linear model:
linear model:
# MODEL-specific subconfiguration
update tstep: PT1H
variables: [x, y, z]
coefficients:
input:
base filepath: path/to/coeffs
one file per task: true
update variables: [x, y]
influence region size: 5
time window:
begin: 2024-01-16T06:00:00Z
length: PT6H
# rest of Variational configuration
```

To instead generate coefficients “on the fly” (during the execution of `Variational`

), more options are needed in the configuration. These options are the same as would be required to generate the coefficients using GenHybridLinearModelCoeffs, and are detailed on that page.