generate_vtk_output Namespace Reference

Kynema API: generate_vtk_output Namespace Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
generate_vtk_output Namespace Reference

Classes

class  VTKOutput
 

Functions

np.ndarray quaternion_to_rotation_matrix (List[float] quaternion)
 
 create_vector_array (str name, int num_components=3)
 
 main ()
 

Function Documentation

◆ create_vector_array()

generate_vtk_output.create_vector_array ( str  name,
int   num_components = 3 
)
Creates a VTK double array with the given name and number of components.

Args:
    name (str): Name of the array
    num_components (int): Number of components in the array

Returns:
    vtk.vtkDoubleArray: A VTK double array with the given name and number of components

◆ main()

generate_vtk_output.main ( )
Main function to parse arguments and generate VTK files.

Example usage (run from the build directory):
    python ../src/viz/generate_vtk_output.py \
        tests/regression_tests/TurbineInterfaceTest.IEA15/turbine_interface.nc \
        tests/regression_tests/TurbineInterfaceTest.IEA15/mesh_connectivity.yaml \
        --output_dir tests/regression_tests/TurbineInterfaceTest.IEA15/vtk_output \
        --start-timestep 0 \
        --end-timestep 5

NOTE: Files are overwritten in the output directory if they already exist.

◆ quaternion_to_rotation_matrix()

np.ndarray generate_vtk_output.quaternion_to_rotation_matrix ( List[float]  quaternion)
Converts a 4x1 quaternion [w, i, j, k] to a 3x3 rotation matrix.

The rotation matrix is computed using the following formula (used in Kynema):
R = | 1 - 2(j^2 + k^2)  2(i*j - w*k)  2(i*k + w*j) |
    | 2(i*j + w*k)  1 - 2(i^2 + k^2)  2(j*k - w*i) |
    | 2(i*k - w*j)  2(j*k + w*i)  1 - 2(i^2 + j^2) |

Args:
    quaternion (list[float]): A list of 4 floats representing the quaternion

Returns:
    np.ndarray: A 3x3 rotation matrix