General Computation Functions¶
The following group of API functions are available for general computations. In general, it is best practice to perform computations through the the Analysis group instead of calling these functions directly.
|
Compute mass properties for the components in the set. |
|
Mesh, intersect, and trim components in the set. |
|
Slice and mesh the components in the set. |
|
Compute the degenerate geometry representation for the components in the set. |
|
Integrate the analytic potential flow solution over an ellipsoid. |
Details¶
- openvsp.ComputeMassProps(set, num_slices, idir)[source]¶
Compute mass properties for the components in the set. Alternatively can be run through the Analysis Manager with ‘MassProp’.
#==== Test Mass Props ====// pid = AddGeom( "POD", "" ) mesh_id = ComputeMassProps( SET_ALL, 20, X_DIR ) mass_res_id = FindLatestResultsID( "Mass_Properties" ) double_arr = GetDoubleResults( mass_res_id, "Total_Mass" ) if len(double_arr) != 1 : print( "---> Error: API ComputeMassProps" ) assert False, "---> Error: API ComputeMassProps"
See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis :param [in]: set int Set index (i.e. SET_ALL) :param [in]: num_slices int Number of slices :param [in]: idir int Direction of slicing for integration :rtype: string :return: string MeshGeom ID
- openvsp.ComputeCompGeom(set, half_mesh, file_export_types)[source]¶
Mesh, intersect, and trim components in the set. Alternatively can be run through the Analysis Manager with ‘CompGeom’.
#==== Add Pod Geom ====// pid = AddGeom( "POD", "" ) #==== Run CompGeom And Get Results ====// mesh_id = ComputeCompGeom( SET_ALL, False, 0 ) # Half Mesh false and no file export assert len( mesh_id ) > 0, "ComputeCompGeom returned no id" comp_res_id = FindLatestResultsID( "Comp_Geom" ) # Find Results ID double_arr = GetDoubleResults( comp_res_id, "Wet_Area" ) # Extract Results
See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: half_mesh bool Flag to ignore surfaces on the negative side of the XZ plane (e.g. symmetry) :param [in]: file_export_types int CompGeom file type to export (supports XOR i.e. COMP_GEOM_CSV_TYPE & COMP_GEOM_TXT_TYPE ) :rtype: string :return: string MeshGeom ID
- openvsp.ComputePlaneSlice(set, num_slices, norm, auto_bnd, start_bnd=0, end_bnd=0, measureduct=False)[source]¶
Slice and mesh the components in the set. Alternatively can be run through the Analysis Manager with ‘PlanarSlice’.
#==== Add Pod Geom ====// pid = AddGeom( "POD", "" ) #==== Test Plane Slice ====// slice_mesh_id = ComputePlaneSlice( 0, 6, vec3d( 0.0, 0.0, 1.0 ), True ) pslice_results = FindLatestResultsID( "Slice" ) double_arr = GetDoubleResults( pslice_results, "Slice_Area" ) if len(double_arr) != 6 : print( "---> Error: API ComputePlaneSlice" ) assert False, "---> Error: API ComputePlaneSlice"
See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis :param [in]: set int Set index (i.e. SET_ALL) :param [in]: num_slices int Number of slices :param [in]: norm vec3d Normal axis for all slices :param [in]: auto_bnd bool Flag to automatically set the start and end bound locations :param [in]: start_bnd double Location of the first slice along the normal axis (default: 0.0) :param [in]: end_bnd double Location of the last slice along the normal axis (default: 0.0) :param [in]: measureduct bool Flag to measure negative area inside positive area (default: false) :rtype: string :return: string MeshGeom ID
- openvsp.ComputeDegenGeom(set, file_export_types)[source]¶
Compute the degenerate geometry representation for the components in the set. Alternatively can be run through the Analysis Manager with ‘DegenGeom’ or ‘VSPAERODegenGeom’.
#==== Add Pod Geometry ====// pid = AddGeom( "POD" ) #==== Set File Name ====// SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" ) #==== Run Degen Geom ====// ComputeDegenGeom( SET_ALL, DEGEN_GEOM_CSV_TYPE ) # The degenerate representation is reported through the Results Manager as # well as written to file. A Pod yields a surface, a plate and a stick. assert GetNumResults( "DegenGeom" ) == 1, "ComputeDegenGeom produced no DegenGeom result" assert GetNumResults( "Degen_surf" ) >= 1, "ComputeDegenGeom produced no Degen_surf result" assert GetNumResults( "Degen_plate" ) >= 1, "ComputeDegenGeom produced no Degen_plate result" assert GetNumResults( "Degen_stick" ) >= 1, "ComputeDegenGeom produced no Degen_stick result"
See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: file_export_types int DegenGeom file type to export (supports XOR i.e DEGEN_GEOM_M_TYPE & DEGEN_GEOM_CSV_TYPE)
- openvsp.IntegrateEllipsoidFlow(abc_rad, abc_index)[source]¶
Integrate the analytic potential flow solution over an ellipsoid. Used to check a panel or surface solution against a case with a known answer.
val = IntegrateEllipsoidFlow( vec3d( 1.0, 2.0, 3.0 ), 0 ) assert val != 0.0, "IntegrateEllipsoidFlow returned zero"
See also: GetEllipsoidSurfPnts :param [in]: abc_rad vec3d Semi-axis lengths of the ellipsoid :param [in]: abc_index int Index of the axis the flow is along, 0, 1 or 2 :rtype: float :return: double Integrated value