inductiva / wind-tunnel

Example of a virtual Wind Tunnel implementation with Inductiva API.
0 stars 2 forks source link

How to get used transformations #10

Closed rcvalerio closed 1 month ago

rcvalerio commented 2 months ago

Current:

Has no inverse transformation:

wind_tunnel = windtunnel.WindTunnel()
task = wind_tunnel.simulate(object_path="assets/f1_car.obj",
                            wind_speed_ms=10,
                            rotate_z_degrees=0,
                            num_iterations=50,
                            resolution=3,
                            display=True)

Add normalization parameter #9 :

Return is weird but simulate is intuitive:

wind_tunnel = windtunnel.WindTunnel()
task, displace_vector, scaling_factor = wind_tunnel.simulate(object_path="assets/f1_car.obj",
                            wind_speed_ms=10,
                            rotate_z_degrees=0,
                            num_iterations=50,
                            resolution=3,
                            normalize_mesh=True,
                            display=True)

Add normalization parameter and dict return :

Return is weird but simulate is intuitive:

wind_tunnel = windtunnel.WindTunnel()
output = wind_tunnel.simulate(object_path="assets/f1_car.obj",
                            wind_speed_ms=10,
                            rotate_z_degrees=0,
                            num_iterations=50,
                            resolution=3,
                            normalize_mesh=True,
                            display=True)
 task = output["task"]
 displace_vector = output["displace_vector"]
 scaling_factor = scaling_factor["scaling_factor"]

Add normalization before simulate:

Code becomes complex, mesh dependency, return is good:

wind_tunnel = windtunnel.WindTunnel()
mesh, displace_vector, scaling_factor = preprocessing.preprocess(
        object_path="assets/f1_car.obj", rotate_z_degrees=0, normalize_mesh=True, center_mesh=True)
task  = wind_tunnel.simulate(object_mesh=mesh,
                            wind_speed_ms=10,
                            num_iterations=50,
                            resolution=3,
                            display=True)
hpenedones commented 2 months ago

This is what we came up with together:


wind_tunnel = windtunnel.WindTunnel(dimensions = (20, 10, 8))  # (length, width, height)
# calling with empty arguments assumes the default dimensions
# wind_tunnel = windtunnel.WindTunnel()

for angle in range(360):
    transforms = wind_tunnel.set_object(
            object_path="assets/f1_car.obj",
            rotate_z_degrees=angle,
            normalize=True,
            center=True)

    # wind_tunnel.display()

    for wind_speed_ms in [10, 30, 50]:
        # Needs to verify that insert_object was called already    
        task  = wind_tunnel.simulate(wind_speed_ms,
                                     num_iterations=50,
                                     resolution=3,
                                     # inputs_base_dir="./inductiva_input",   # if user passes None, we don't save the inputs (it just stays in the temp dir)
)
rcvalerio commented 2 months ago

13

rcvalerio commented 1 month ago

Solved by #13