mindflow.cfd.cal_con_var

View Source On Gitee
mindflow.cfd.cal_con_var(pri_var, material)[source]

Calculate conservative variables from primitive variables and material.

Parameters
  • pri_var (Tensor) – The primitive variables.

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

Returns

Tensor, with the same shape as pri_var.

Supported Platforms:

GPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor
>>> from mindflow.utils import cal_con_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_con_var(x, m)
>>> x2.shape
(5, 32, 32, 1)