def main(): # Input epsilon = 0.025 tau = 30 alpha = 10 # Generate coordinates and cp distribution x, y, cp = van_de_vooren(tau, epsilon, alpha) # Plot the pressure distribution plot_cp(x, cp, x, y)
def main(): # This function runs the vortex panel method on a NACA 2412 # Generate airfoil coordinates airfoil_coordinates = NACA4('2412', 50) x_airfoil = airfoil_coordinates[:, 0] y_airfoil = airfoil_coordinates[:, 1] # Set the angle of attack alpha = 10 # Run the vortex panel method x, cp, cl, cm = vortex_panel_method(alpha, airfoil_coordinates) # Print the values of cl and cm in the terminal print('C_l = ', cl) print('C_m = ', cm) # Plot the pressure distribution plot_cp(x, cp, x_airfoil, y_airfoil) # Plot the lift coefficient and moment coefficient versus angle of attack plot_polar(airfoil_coordinates)
rtstruct = sb.build_structure_set() rtstruct.add_external_box() sph = rtstruct.add_sphere(radius=70, center=[-50, 0, -100], name='Sph-Organ', interpreted_type='CAVITY') sph2 = rtstruct.add_sphere(radius=25, center=[0, 0, 0], name='Sph-PTV', interpreted_type='PTV') rtplan = sb.build_static_plan() b1 = rtplan.build_beam(gantry_angle=180, collimator_angle=15, meterset=100) b1.conform_to_rectangle(1, 1, [0, 0]) rtplan.build(finalize_mlc=False) modules.conform_mlc_to_roi(b1.rtbeam, sph.roi_contour, sb.current_study) modules.conform_mlc_to_roi(b1.rtbeam, sph2.roi_contour, sb.current_study) b1.finalize_mlc() sb.write(tmpdir) print tmpdir import plotting as p p.plot_cp(rtplan.datasets[0].Beams[0], rtplan.datasets[0].Beams[0].CPs[0]) p.plot_roi_in_cp(rtplan.datasets[0].Beams[0], rtplan.datasets[0].Beams[0].CPs[0], sph.roi_contour, sb.current_study) pp.axis('image')
print ct.pixel_array.max(),ct.pixel_array.min() ct.add_sphere(radius = 25, center = [0,0,0], real_value = -1000, mode = 'set') print ct.pixel_array.max(),ct.pixel_array.min() ct.add_box(size = [25,50,25], center = [0,0,0], stored_value = 300, mode = 'add') print ct.pixel_array.max(),ct.pixel_array.min() assert sb.seriesbuilders['CT'] == [ct] rtstruct = sb.build_structure_set() rtstruct.add_external_box() sph = rtstruct.add_sphere(radius=70, center = [-50,0,-100], name='Sph-Organ', interpreted_type='CAVITY') sph2 = rtstruct.add_sphere(radius = 25, center = [0,0,0], name='Sph-PTV', interpreted_type='PTV') rtplan = sb.build_static_plan() b1 = rtplan.build_beam(gantry_angle = 180, collimator_angle = 15, meterset = 100) b1.conform_to_rectangle(1,1,[0,0]) rtplan.build(finalize_mlc = False) modules.conform_mlc_to_roi(b1.rtbeam, sph.roi_contour, sb.current_study) modules.conform_mlc_to_roi(b1.rtbeam, sph2.roi_contour, sb.current_study) b1.finalize_mlc() sb.write(tmpdir) print tmpdir import plotting as p p.plot_cp(rtplan.datasets[0].Beams[0], rtplan.datasets[0].Beams[0].CPs[0]) p.plot_roi_in_cp(rtplan.datasets[0].Beams[0], rtplan.datasets[0].Beams[0].CPs[0], sph.roi_contour, sb.current_study) pp.axis('image')