mindflow.cfd.RunTime

View Source On Gitee
class mindflow.cfd.RunTime(config, mesh_info, material)[source]

Simulation run time controller.

Parameters
  • config (dict) – The dict of parameters.

  • mesh_info (MeshInfo) – The information of the compute mesh.

  • material (Material) – The fluid material model.

Supported Platforms:

GPU

Examples

>>> from mindflow import cfd
>>> config = {'mesh': {'dim': 1, 'nx': 100, 'gamma': 1.4, 'x_range': [0, 1], 'pad_size': 3},
...           'material': {'type': 'IdealGas', 'heat_ratio': 1.4, 'specific_heat_ratio': 1.4,
...           'specific_gas_constant': 1.0}, 'runtime': {'CFL': 0.9, 'current_time': 0.0, 'end_time': 0.2},
...           'integrator': {'type': 'RungeKutta3'}, 'space_solver': {'is_convective_flux': True,
...           'convective_flux': {'reconstructor': 'WENO5', 'riemann_computer': 'Rusanov'},
...           'is_viscous_flux': False}, 'boundary_conditions': {'x_min': {'type': 'Neumann'},
...           'x_max': {'type': 'Neumann'}}}
>>> s = cfd.Simulator(config)
>>> r = cfd.RunTime(c, s.mesh_info, s.material)
advance()[source]

Simulation advance according to the timestep.

Raises

NotImplementedError – If timestep is invalid.

compute_timestep(pri_var)[source]

Computes the physical time step size.

Parameters

pri_var (Tensor) – The primitive variables.

time_loop(pri_var)[source]

Weather to continue the simulation. When current time reaches end time or NAN value detected, return False.

Parameters

pri_var (Tensor) – The primitive variables.

Returns

Bool. Weather to continue the simulation.

Raises

ValueError – If pri_var has NAN values.