Parasite Drag Functions¶
This group of API functions is supplemental to performing a Paraste Drag analysis through the Analysis Manager. They include functions to write out Parasite Drag Tool equations, calculate atmospheric properties, and control excrescences.
|
Add an Excresence to the Parasite Drag Tool |
Delete an Excresence from the Parasite Drag Tool |
|
Delete all Excresences from the Parasite Drag Tool |
|
|
Delete one excrescence from the Parasite Drag tool, by index. |
Update any reference geometry, atmospheric properties, excressences, etc. |
|
|
Write the Parasite Drag Tool buildup table out to a CSV file, the way the Export CSV button on the tool does. |
|
Set the Parasite Drag reference wing, kept with the model, and use it for the reference quantities, as SetVSPAERORefWingID does. |
Get the Parasite Drag reference wing the analysis uses, kept with the model. |
|
|
Set the Parasite Drag mode the analysis uses when its use-mode flag is on, kept with the model. |
Get the Parasite Drag mode the analysis uses, kept with the model. |
|
|
Calculate the atmospheric properties determined by a specified model for a preset array of altitudes ranging from 0 to 90000 m and write the results to a CSV output file |
|
Calculate the atmospheric properties determined by a specified model at input altitude and temperature deviation. |
|
Calculate the form factor from each body FF equation (i.e. Hoerner Streamlined Body) and write the results to a CSV output file. |
|
Calculate the form factor from each wing FF equation (i.e. Schemensky 4 Series Airfoil) and write the results to a CSV output file. |
|
Calculate the coefficient of friction from each Cf equation (i.e. Power Law Blasius) and write the results to a CSV output file. |
|
Calculate the partial coefficient of friction and write the results to a CSV output file |
Details¶
- openvsp.AddExcrescence(excresName, excresType, excresVal)[source]¶
Add an Excresence to the Parasite Drag Tool
AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 ) AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 ) # Each excrescence gets its own row, so deleting them one at a time has to # empty the table and then start being rejected. The error queue is reached # through the error manager singleton in Python. err_mgr = ErrorMgrSingleton.getInstance() DeleteExcrescence( 1 ) DeleteExcrescence( 0 ) assert err_mgr.GetNumTotalErrors() == 0, "the two excrescences were not both added" DeleteExcrescence( 0 ) assert err_mgr.GetNumTotalErrors() > 0, "more excrescences were added than asked for" # That error was raised deliberately, so take it back off the queue. while err_mgr.GetNumTotalErrors() > 0 : err = err_mgr.PopLastError()
See also: EXCRES_TYPE :param [in]: excresName string Name of the Excressence :param [in]: excresType int Excressence type enum (i.e. EXCRESCENCE_PERCENT_GEOM) :param [in]: excresVal double Excressence value
- openvsp.GetNumExcrescences()[source]¶
Delete an Excresence from the Parasite Drag Tool
AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 ) AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 ) AddExcrescence( "Percentage Example", EXCRESCENCE_PERCENT_GEOM, 5 ) DeleteExcrescence( 2 ) # Last Index # Three were added and one was deleted, so index 2 no longer exists and # asking for it again has to be rejected. The error queue is reached through # the error manager singleton in Python. err_mgr = ErrorMgrSingleton.getInstance() DeleteExcrescence( 2 ) assert err_mgr.GetNumTotalErrors() > 0, "DeleteExcrescence accepted an index past the end" # That error was raised deliberately, so take it back off the queue. while err_mgr.GetNumTotalErrors() > 0 : err = err_mgr.PopLastError()
- Parameters:
[in] – index int Index of the Excressence to delete
Get the number of Excresences in the Parasite Drag Tool
assert GetNumExcrescences() == 0, "a new model starts with excrescences" AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 ) AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 ) assert GetNumExcrescences() == 2, "GetNumExcrescences did not count what was added" DeleteExcrescence( 1 ) assert GetNumExcrescences() == 1, "GetNumExcrescences did not follow DeleteExcrescence"
See also: AddExcrescence, DeleteExcrescence, DeleteAllExcrescences :rtype: int :return: int Number of excrescences
- openvsp.DeleteAllExcrescences()[source]¶
Delete all Excresences from the Parasite Drag Tool
AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 ) AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 ) AddExcrescence( "Percentage Example", EXCRESCENCE_PERCENT_GEOM, 5 ) DeleteAllExcrescences() assert GetNumExcrescences() == 0, "DeleteAllExcrescences left excrescences behind" # Clearing an empty table is not an error. err_mgr = ErrorMgrSingleton.getInstance() DeleteAllExcrescences() assert err_mgr.GetNumTotalErrors() == 0, "DeleteAllExcrescences complained about an empty table"
See also: AddExcrescence, DeleteExcrescence, GetNumExcrescences
- openvsp.DeleteExcrescence(index)[source]¶
Delete one excrescence from the Parasite Drag tool, by index.
AddExcrescence( "TestExcrescence", EXCRESCENCE_COUNT, 2.0 ) DeleteExcrescence( 0 ) assert GetNumExcrescences() == 0, "DeleteExcrescence did not delete the excrescence"
See also: AddExcrescence, GetNumExcrescences :param [in]: index int Index of the excrescence to delete
- openvsp.UpdateParasiteDrag()[source]¶
Update any reference geometry, atmospheric properties, excressences, etc. in the Parasite Drag Tool
pid = AddGeom( "POD" ) Update() UpdateParasiteDrag()
- openvsp.ExportParasiteDragToCSV(file_name)[source]¶
Write the Parasite Drag Tool buildup table out to a CSV file, the way the Export CSV button on the tool does. The same table is also placed in the Results Manager under the name “Parasite_Drag”, so the returned ID gives access to it without going through the file.
pod_id = AddGeom( "POD", "" ) Update() # The table is filled in by running the buildup, so do that first. ExecAnalysis( "ParasiteDrag" ) res_id = ExportParasiteDragToCSV( "ParasiteDragExample.csv" ) assert len( res_id ) > 0, "ExportParasiteDragToCSV returned no results" # The buildup carries one row per Geom, so the Pod has to be in there. labels = GetStringResults( res_id, "Comp_Label" ) assert len( labels ) > 0, "the buildup table is empty"
See also: UpdateParasiteDrag :param [in]: file_name string Name of the CSV file to write :rtype: string :return: string Results ID for the buildup table
- openvsp.SetParasiteDragRefWingID(geom_id)[source]¶
Set the Parasite Drag reference wing, kept with the model, and use it for the reference quantities, as SetVSPAERORefWingID does. An empty string goes back to manual reference quantities. The WingID analysis input overrides the wing for one run.
wid = AddGeom( "WING" ) SetParasiteDragRefWingID( wid ) assert GetParasiteDragRefWingID() == wid, "SetParasiteDragRefWingID did not set the reference wing"
See also: GetParasiteDragRefWingID :param [in]: geom_id string Wing Geom ID, or an empty string
- openvsp.GetParasiteDragRefWingID()[source]¶
Get the Parasite Drag reference wing the analysis uses, kept with the model.
wid = AddGeom( "WING" ) SetParasiteDragRefWingID( wid ) assert GetParasiteDragRefWingID() == wid, "GetParasiteDragRefWingID did not return the reference wing set"
See also: SetParasiteDragRefWingID :rtype: string :return: string Geom ID, or an empty string for none
- openvsp.SetParasiteDragModeID(mode_id)[source]¶
Set the Parasite Drag mode the analysis uses when its use-mode flag is on, kept with the model. The ModeID analysis input overrides it for one run. The flag is the “UseModeMassFlag” Parm, group “ParasiteDrag”, of the “ParasiteDragSettings” container.
AddGeom( "POD" ) mid = CreateAndAddMode( "Clean", SET_ALL, SET_NONE ) SetParasiteDragModeID( mid ) assert GetParasiteDragModeID() == mid, "SetParasiteDragModeID did not set the mode"
See also: GetParasiteDragModeID :param [in]: mode_id string Mode ID, or an empty string
- openvsp.GetParasiteDragModeID()[source]¶
Get the Parasite Drag mode the analysis uses, kept with the model.
AddGeom( "POD" ) mid = CreateAndAddMode( "Clean", SET_ALL, SET_NONE ) SetParasiteDragModeID( mid ) assert GetParasiteDragModeID() == mid, "GetParasiteDragModeID did not return the mode set"
See also: SetParasiteDragModeID :rtype: string :return: string Mode ID, or an empty string for none
- openvsp.WriteAtmosphereCSVFile(file_name, atmos_type)[source]¶
Calculate the atmospheric properties determined by a specified model for a preset array of altitudes ranging from 0 to 90000 m and write the results to a CSV output file
print( "Starting USAF Atmosphere 1966 Table Creation. \n" ) WriteAtmosphereCSVFile( "USAFAtmosphere1966Data.csv", ATMOS_TYPE_HERRINGTON_1966 ) # The call above should have produced a file with content in it. import os assert os.path.getsize( "USAFAtmosphere1966Data.csv" ) > 0, "WriteAtmosphereCSVFile wrote no file"
See also: ATMOS_TYPE :param [in]: file_name string Output CSV file :param [in]: atmos_type int Atmospheric model enum (i.e. ATMOS_TYPE_HERRINGTON_1966)
- openvsp.CalcAtmosphere(alt, delta_temp, atmos_type)[source]¶
Calculate the atmospheric properties determined by a specified model at input altitude and temperature deviation. This function may not be used for any manual atmospheric model types (i.e. ATMOS_TYPE_MANUAL_P_T). This function assumes freestream units are metric, temperature units are Kelvin, and pressure units are kPA.
alt = 4000 delta_temp = 0 temp, pres, pres_ratio, rho_ratio = CalcAtmosphere( alt, delta_temp, ATMOS_TYPE_US_STANDARD_1976) # The ratios are against sea level standard day, so asking at sea level with # no temperature offset has to return the sea level standard itself. sl_temp, sl_pres, sl_pres_ratio, sl_rho_ratio = CalcAtmosphere( 0.0, 0.0, ATMOS_TYPE_US_STANDARD_1976 ) assert abs( sl_temp - 288.15 ) < 1e-2, "sea level is not the standard day temperature" # The density ratio carries a little rounding from the model constants. assert abs( sl_pres_ratio - 1.0 ) < 1e-9, "the sea level ratios are not one" assert abs( sl_rho_ratio - 1.0 ) < 1e-4, "the sea level ratios are not one" # The atmosphere thins with altitude. assert temp < sl_temp, "the atmosphere did not thin with altitude" assert pres < sl_pres, "the atmosphere did not thin with altitude" assert pres_ratio < 1.0, "the atmosphere did not thin with altitude" assert rho_ratio < 1.0, "the atmosphere did not thin with altitude" # The pressure ratio is the pressure against sea level. assert abs( pres_ratio - pres / sl_pres ) < 1e-6, "the pressure ratio does not match the pressure"
See also: ATMOS_TYPE :param [in]: alt double Altitude :param [in]: delta_temp double Deviation in temperature from the value specified in the atmospheric model :param [in]: atmos_type int Atmospheric model enum (i.e. ATMOS_TYPE_HERRINGTON_1966) :param [out]: temp double output Temperature :param [out]: pres double output Pressure :param [out]: pres_ratio double Output pressure ratio :param [out]: rho_ratio double Output density ratio
- openvsp.WriteBodyFFCSVFile(file_name)[source]¶
Calculate the form factor from each body FF equation (i.e. Hoerner Streamlined Body) and write the results to a CSV output file
print( "Starting Body Form Factor Data Creation. \n" ) WriteBodyFFCSVFile( "BodyFormFactorData.csv" ) # The call above should have produced a file with content in it. import os assert os.path.getsize( "BodyFormFactorData.csv" ) > 0, "WriteBodyFFCSVFile wrote no file"
- Parameters:
[in] – file_name string Output CSV file
- openvsp.WriteWingFFCSVFile(file_name)[source]¶
Calculate the form factor from each wing FF equation (i.e. Schemensky 4 Series Airfoil) and write the results to a CSV output file
print( "Starting Wing Form Factor Data Creation. \n" ) WriteWingFFCSVFile( "WingFormFactorData.csv" ) # The call above should have produced a file with content in it. import os assert os.path.getsize( "WingFormFactorData.csv" ) > 0, "WriteWingFFCSVFile wrote no file"
- Parameters:
[in] – file_name string Output CSV file
- openvsp.WriteCfEqnCSVFile(file_name)[source]¶
Calculate the coefficient of friction from each Cf equation (i.e. Power Law Blasius) and write the results to a CSV output file
print( "Starting Turbulent Friciton Coefficient Data Creation. \n" ) WriteCfEqnCSVFile( "FrictionCoefficientData.csv" ) # The call above should have produced a file with content in it. import os assert os.path.getsize( "FrictionCoefficientData.csv" ) > 0, "WriteCfEqnCSVFile wrote no file"
- Parameters:
[in] – file_name string Output CSV file
Write a CSV file of the skin friction coefficient equations over a range of Reynolds numbers.
WriteCfEqnCSVFile( "TestCfEqn.csv" )
See also: WritePartialCfMethodCSVFile :param [in]: file_name string Name of the CSV file to write
- openvsp.WritePartialCfMethodCSVFile(file_name)[source]¶
Calculate the partial coefficient of friction and write the results to a CSV output file
print( "Starting Partial Friction Method Data Creation. \n" ) WritePartialCfMethodCSVFile( "PartialFrictionMethodData.csv" ) # The call above should have produced a file with content in it. import os assert os.path.getsize( "PartialFrictionMethodData.csv" ) > 0, "WritePartialCfMethodCSVFile wrote no file"
- Parameters:
[in] – file_name string Output CSV file
Write a CSV file of the partial turbulence skin friction methods.
WritePartialCfMethodCSVFile( "TestPartialCf.csv" )
See also: WriteCfEqnCSVFile :param [in]: file_name string Name of the CSV file to write