windtunnel.windtunnel module
Physical scenario of a configurable wind tunnel simulation.
A wind tunnel is a tool used in aerodynamic research to study the effects of air moving past solid objects. Here, the tunnel consists of a box object in 3D space (x, y, z) space, where air flows in the positive x-direction with a certain velocity.
An arbitrary object is placed within the tunnel, sucht that air flows around it, as illustrated in the schematic below:
|--------------------------------| |-> _____ | |-> _/ | | |->_______|_o___O_|______________|
This scenario solves steady-state continuity and momentum equations (time-independent) with incompressible flow. The simulation solves the time-independent equations for several time steps, based on the state of the previous one. The end goal is to determine the steady-state of the system, i.e., where the flow does not change in time anymore.
- Currently, the following variables are fixed:
The fluid being inject is air.
Air only flows in the positive x-direction.
The flow is incompressible (this seems to be a reasonable approximation
until about Mach 0.3 which is 102.9 m/s, or 370.44 km/h). See https://www.quora.com/Is-air-an-incompressible-fluid
- class windtunnel.windtunnel.WindTunnel(dimensions: tuple[int, int, int] = (20, 10, 8))[source]
Bases:
objectWindTunnel scenario.
- set_object(object_path: str, rotate_z_degrees: float = 0, normalize: bool = True, center: bool = True)[source]
Load an object into the windtunnel scenario. Optionally rotates, normalizes, and centers it.
- Parameters:
object_path (str) – Mesh file path.
rotate_z_degrees (float) – Rotation around Z-axis in degrees.
normalize (bool) – Scales object to unit size if True.
center (bool) – Centers object in simulation space if True.
- simulate(wind_speed_ms: float, num_iterations: int, resolution: int, machine_group_name: str | None = None, inputs_base_dir: str | None = './inductiva_input')[source]
Runs wind tunnel simulation with specified parameters.
- Parameters:
wind_speed_ms (float) – Air flow speed in m/s.
num_iterations (int) – Simulation iteration count.
resolution (int) – Grid resolution.
machine_group_name (Optional[str]) – Machine group for simulation.
inputs_base_dir (Optional[str]) – Local directory where the OpenFOAM inputs files that are constructed by the WindTunnel class will be stored. This can be useful for later reference, and for inspecting exactly what the Inductiva API passed to OpenFOAM. If set to None, nothing will be stored on the local disk.