コード例 #1
0
    FM = scene.solve_forces(non_dimensional=False,
                            verbose=True)["plane"]["total"]
    print(json.dumps(FM, indent=4))

    # Export vtk
    vtk_file = "dev/meshes/swept_wing_vtk.vtk"
    scene.export_vtk(filename=vtk_file, section_resolution=71)

    # Run PyPan with vtk mesh
    print()
    print("VTK Mesh")
    mesh = pp.Mesh(mesh_file=vtk_file,
                   mesh_file_type="VTK",
                   kutta_angle=90.0,
                   verbose=True)
    solver = pp.VortexRingSolver(mesh=mesh, verbose=True)
    solver.set_condition(V_inf=[-100.0, 0.0, -10.0], rho=0.0023769)
    F, M = solver.solve(lifting=True, verbose=True)
    print()
    print("Force Vector: {0}".format(F))
    print("Moment Vector: {0}".format(M))
    print("Max Pressure Coef: {0}".format(np.max(solver._C_P)))
    print("Min Pressure Coef: {0}".format(np.min(solver._C_P)))
    solver.export_vtk(vtk_file.replace("meshes", "results"))

    # Run PyPan with stl mesh
    print()
    print("STL Mesh")
    mesh = pp.Mesh(mesh_file=stl_file,
                   mesh_file_type="STL",
                   kutta_angle=90.0,
コード例 #2
0
import pypan as pp

if __name__ == "__main__":

    # Load mesh
    my_mesh = pp.Mesh(name="demo_wing",
                      mesh_file="dev/meshes/swept_wing_low_grid.vtk",
                      verbose=True)

    # Set wake
    my_mesh.set_wake(type="full_streamline", N_segments=40, segment_length=0.5)

    # Initialize solver
    my_solver = pp.VortexRingSolver(mesh=my_mesh)

    # Solve
    my_solver.set_condition(V_inf=[-100.0, 0.0, -10.0],
                            rho=0.0023769,
                            angular_rate=[1.0, 0.0, 0.0])
    F, M = my_solver.solve(verbose=True,
                           wake_iterations=4,
                           export_wake_series=True,
                           wake_series_title='demo')

    print()
    print("Force vector: {0}".format(F))
    print("Moment vector: {0}".format(M))

    # Export VTK
    my_solver.export_vtk("results.vtk")