mindflow.cfd.cal_pri_var

View Source On Gitee
mindflow.cfd.cal_pri_var(con_var, material)[source]

Calculate primitive variables from conservative variables and material.

Parameters
  • con_var (Tensor) – The conservative variables.

  • material (mindflow.cfd.Material) – Material of the fluid.

Returns

Tensor, with the same shape as con_var.

Supported Platforms:

GPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor
>>> from mindflow.utils import cal_pri_var
>>> from mindflow import material
>>> config =  {'type': 'IdealGas', 'heat_ratio': 1.4, 'specific_heat_ratio': 1.4, 'specific_gas_constant': 1.0}
>>> m = material.select_material(config)
>>> x1 = Tensor(np.random.randn(5, 32, 32, 1))
>>> x2 = cal_pri_var(x, m)
>>> x2.shape
(5, 32, 32, 1)