Tensors module

Module holding the model’s tendencies tensor encoding each of their additive terms.

qgs tensor module

This module computes and holds the tensor representing the tendencies of the model’s equations.

class qgs.tensors.qgtensor.QgsTensor(params=None, atmospheric_inner_products=None, oceanic_inner_products=None, ground_inner_products=None)[source]

Bases: object

qgs tendencies tensor class.

Parameters
• params (None or QgParams, optional) – The models parameters to configure the tensor. None to initialize an empty tensor. Default to None.

• atmospheric_inner_products (None or AtmosphericInnerProducts, optional) – The inner products of the atmospheric basis functions on which the model’s PDE atmospheric equations are projected. If None, disable the atmospheric tendencies. Default to None.

• oceanic_inner_products (None or OceanicInnerProducts, optional) – The inner products of the oceanic basis functions on which the model’s PDE oceanic equations are projected. If None, disable the oceanic tendencies. Default to None.

• ground_inner_products (None or GroundInnerProducts, optional) – The inner products of the ground basis functions on which the model’s PDE ground equations are projected. If None, disable the ground tendencies. Default to None.

params

The models parameters used to configure the tensor. None for an empty tensor.

Type
atmospheric_inner_products

The inner products of the atmospheric basis functions on which the model’s PDE atmospheric equations are projected. If None, disable the atmospheric tendencies. Default to None.

Type
oceanic_inner_products

The inner products of the oceanic basis functions on which the model’s PDE oceanic equations are projected. If None, disable the oceanic tendencies. Default to None.

Type
ground_inner_products

The inner products of the ground basis functions on which the model’s PDE ground equations are projected. If None, disable the ground tendencies. Default to None.

Type
tensor

The tensor $$\mathcal{T}_{i,j,k}$$ $$i$$-th components.

Type
jacobian_tensor

The jacobian tensor $$\mathcal{T}_{i,j,k} + \mathcal{T}_{i,k,j}$$ $$i$$-th components.

Type
compute_tensor()[source]

Routine to compute the tensor.

Function to load previously a saved tensor object with the method save_to_file().

Parameters
• filename (str) – The file name where the tensor object was saved.

• kwargs (dict) – Keyword arguments to pass to the pickle module method.

save_to_file(filename, **kwargs)[source]

Function to save the tensor object to a file with the pickle module.

Parameters
• filename (str) – The file name where to save the tensor object.

• kwargs (dict) – Keyword arguments to pass to the pickle module method.

static simplify_matrix(matrix)[source]

Routine that simplifies the component of the 3D tensors $$\mathcal{T}$$. For each index $$i$$, it upper-triangularizes the matrix $$\mathcal{T}_{i,j,k} \quad 0 \leq j,k \leq \mathrm{ndim}$$.

Parameters

matrix (ndarray) – $$i$$-th matrix component of the tensor $$\mathcal{T}_{i,j,k}$$ to simplify.

Returns

The upper-triangularized matrix.

Return type

ndarray