CFD Mesh Functions

This group of functions is used to setup and run the CFD Mesh tool through the API.

GetComputationFileName(file_type)

Get the file name of a specified file type.

SetComputationFileName(file_type, file_name)

Set the file name a computation writes for one export type.

ComputeCFDMesh(set, degenset, file_export_types)

Create a CFD Mesh for the components in the set.

GetCFDMeshVal(type)

Set the value of a specific CFD Mesh option

SetCFDMeshVal(type, val)

Set one of the CFD Mesh settings.

GetCFDWakeFlag(geom_id)

Activate or deactivate the CFD Mesh wake for a particular Geom.

SetCFDWakeFlag(geom_id, flag)

Say whether a Geom sheds a wake in CFD Mesh.

SetCFDFarFieldGeomID(geom_id)

Set the Geom that stands in for the CFD Mesh far field box.

GetCFDFarFieldGeomID()

Get the Geom that stands in for the CFD Mesh far field box.

GetNumCFDSources(geom_id)

Delete all CFD Mesh sources for all Geoms

GetCFDSourceName(geom_id, source_index)

Get the name of a CFD Mesh source on the specified Geom

SetCFDSourceName(geom_id, source_index, name)

Get the type of a CFD Mesh source on the specified Geom

GetCFDSourceType(geom_id, source_index)

Get the type of one CFD Mesh source on a Geom.

DeleteCFDSource(geom_id, source_index)

Delete a single CFD Mesh source from the specified Geom

DeleteAllCFDSources()

Delete every CFD Mesh source on every Geom.

GetCFDSourceID(geom_id, source_index)

Get the ParmContainer ID of a CFD Mesh source, so its size and placement can be read and driven after the source has been created.

AdjustAllCFDSourceLen(mult)

Scale the edge length of every CFD Mesh source in the model by a common factor.

AdjustAllCFDSourceRad(mult)

Scale the radius of influence of every CFD Mesh source in the model by a common factor.

AddDefaultSources()

Add default CFD Mesh sources for all Geoms

AddCFDSource(type, geom_id, surf_index, l1, ...)

Add a CFD Mesh default source for the indicated Geom.

Details

openvsp.GetComputationFileName(file_type)[source]

Get the file name of a specified file type. Note, this function cannot be used to set FEA Mesh file names.

#==== 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: COMPUTATION_FILE_TYPE, SetFeaMeshFileName :param [in]: file_type int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) :param [in]: file_name string File name

Get the file name of a specified file type. Note, this function cannot be used to get FEA Mesh file names.

#==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" )

assert GetComputationFileName( DEGEN_GEOM_CSV_TYPE ) == "TestDegenScript.csv", "GetComputationFileName did not report the name that was set"

# Each file type carries its own name.
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh.stl" )

assert GetComputationFileName( CFD_STL_TYPE ) == "TestCFDMesh.stl", "setting one file name disturbed another"
assert GetComputationFileName( DEGEN_GEOM_CSV_TYPE ) == "TestDegenScript.csv", "setting one file name disturbed another"

See also: COMPUTATION_FILE_TYPE, SetComputationFileName, GetFeaMeshFileName :param [in]: file_type int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) :rtype: string :return: string File name

openvsp.SetComputationFileName(file_type, file_name)[source]

Set the file name a computation writes for one export type. The type is one of the computation file type enums, and each is remembered separately.

SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh.stl" )

SetComputationFileName( CFD_TRI_TYPE, "TestCFDMesh.tri" )

See also: COMPUTATION_FILE_TYPE, ComputeCFDMesh :param [in]: file_type int Computation file type enum (i.e. CFD_STL_TYPE) :param [in]: file_name string Name of the file to write

openvsp.ComputeCFDMesh(set, degenset, file_export_types)[source]

Create a CFD Mesh for the components in the set. This analysis cannot be run through the Analysis Manager.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

Update()

#==== Keep the mesh coarse so the example runs quickly ====//
SetCFDMeshVal( CFD_MAX_EDGE_LEN, 1.0 )
SetCFDMeshVal( CFD_MIN_EDGE_LEN, 0.1 )

#==== CFDMesh Method Facet Export =====//
SetComputationFileName( CFD_FACET_TYPE, "TestCFDMeshFacet_API.facet" )
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh_API.stl" )

print( "\tComputing CFDMesh..." )

ComputeCFDMesh( SET_ALL, SET_NONE, CFD_FACET_TYPE | CFD_STL_TYPE )

# CFD Mesh reports nothing through the Results Manager, so read the mesh it
# just wrote back in to prove it produced one.
mesh_id = ImportFile( "TestCFDMesh_API.stl", IMPORT_STL, "" )

assert len( mesh_id ) > 0, "ComputeCFDMesh did not write a readable mesh"
assert GetGeomTypeName( mesh_id ) == "Mesh", "ComputeCFDMesh did not write a readable mesh"

DeleteGeom( mesh_id )

See also: COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: degenset int DegenSet index (i.e. SET_NONE) :param [in]: file_export_types int CFD Mesh file type to export (supports XOR i.e CFD_SRF_TYPE & CFD_STL_TYPE)

openvsp.GetCFDMeshVal(type)[source]

Set the value of a specific CFD Mesh option

SetCFDMeshVal( CFD_MIN_EDGE_LEN, 1.0 )

# The control types are backed by Parms in the CFD grid density container,
# so the value that was set can be read back.
dens_id = FindContainer( "CFDGridDensity", 0 )

min_len_id = FindParm( dens_id, "MinLen", "CFDGridDensity" )

assert abs( GetParmVal( min_len_id ) - 1.0 ) < 1e-12, "SetCFDMeshVal did not set CFD_MIN_EDGE_LEN"

See also: CFD_CONTROL_TYPE :param [in]: type int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) :param [in]: val double Value to set

Get the value of a specific CFD Mesh option

SetCFDMeshVal( CFD_MIN_EDGE_LEN, 1.0 )

assert abs( GetCFDMeshVal( CFD_MIN_EDGE_LEN ) - 1.0 ) < 1e-12, "GetCFDMeshVal did not report the value that was set"

# Flags read back as zero or one.
SetCFDMeshVal( CFD_HALF_MESH_FLAG, 1.0 )

assert abs( GetCFDMeshVal( CFD_HALF_MESH_FLAG ) - 1.0 ) < 1e-12, "GetCFDMeshVal did not report the half mesh flag"

# A control type that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDMeshVal( -1 )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDMeshVal accepted an unknown control type"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_CONTROL_TYPE, SetCFDMeshVal :param [in]: type int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) :rtype: float :return: double Value of the option

openvsp.SetCFDMeshVal(type, val)[source]

Set one of the CFD Mesh settings. The type is one of the CFD mesh setting enums, and the value is read as a double whatever the setting means.

SetCFDMeshVal( CFD_MIN_EDGE_LEN, 0.2 )

SetCFDMeshVal( CFD_MAX_EDGE_LEN, 1.0 )

See also: CFD_CONTROL_TYPE, ComputeCFDMesh :param [in]: type int CFD mesh setting enum (i.e. CFD_MIN_EDGE_LEN) :param [in]: val double Value to set

openvsp.GetCFDWakeFlag(geom_id)[source]

Activate or deactivate the CFD Mesh wake for a particular Geom. Note, the wake flag is only applicable for wing-type surfaces. Also, this function is simply an alternative to setting the value of the Parm with the available Parm setting API functions.

#==== Add Wing Geom ====//
wid = AddGeom( "WING", "" )

SetCFDWakeFlag( wid, True )

assert abs( GetParmVal( wid, "Wake", "Shape" ) - 1.0 ) < 1e-12, "SetCFDWakeFlag did not activate the wake"

SetCFDWakeFlag( wid, False )

assert abs( GetParmVal( wid, "Wake", "Shape" ) ) < 1e-12, "SetCFDWakeFlag did not deactivate the wake"

# This is equivalent to SetParmValUpdate( wid, "Wake", "Shape", 1.0 )
# To change the scale: SetParmValUpdate( wid, "WakeScale", "WakeSettings", 10.0 )
# To change the angle: SetParmValUpdate( wid, "WakeAngle", "WakeSettings", -5.0 )

See also: SetParmVal, SetParmValUpdate :param [in]: geom_id string Geom ID :param [in]: flag bool True to activate, false to deactivate

Get the CFD Mesh wake flag for a particular Geom

#==== Add Wing Geom ====//
wid = AddGeom( "WING", "" )

# A new Geom starts with its wake off.
assert not GetCFDWakeFlag( wid ), "a new Geom starts with its wake on"

SetCFDWakeFlag( wid, True )

assert GetCFDWakeFlag( wid ), "GetCFDWakeFlag did not follow SetCFDWakeFlag"

# The flag is the Wake Parm, so the two have to agree.
assert abs( GetParmVal( wid, "Wake", "Shape" ) - 1.0 ) < 1e-12, "the wake flag disagrees with its Parm"

See also: SetCFDWakeFlag :param [in]: geom_id string Geom ID :rtype: boolean :return: bool True if the wake is active

openvsp.SetCFDWakeFlag(geom_id, flag)[source]

Say whether a Geom sheds a wake in CFD Mesh. This is the Wake check box on the CFD Mesh screen.

wid = AddGeom( "WING" )

Update()

SetCFDWakeFlag( wid, True )

assert GetParmVal( FindParm( wid, "Wake", "Shape" ) ) == 1.0, "SetCFDWakeFlag did not take"

See also: ComputeCFDMesh :param [in]: geom_id string Geom ID :param [in]: flag bool True to shed a wake from this Geom

openvsp.SetCFDFarFieldGeomID(geom_id)[source]

Set the Geom that stands in for the CFD Mesh far field box. Turning the far field on and choosing to use a component for it are separate settings; this one only names the component. Pass an empty string to clear it.

#==== Add Pod And A Sphere Around It ====//
pid = AddGeom( "POD" )
eid = AddGeom( "ELLIPSOID" )

SetParmVal( eid, "A_Radius", "Design", 12.0 )

SetCFDMeshVal( CFD_FAR_FIELD_FLAG, 1.0 )
SetParmVal( FindParm( FindContainer( "CFDMeshSettings", 0 ), "FarComp", "FarField" ), 1.0 )

SetCFDFarFieldGeomID( eid )

assert GetCFDFarFieldGeomID() == eid, "SetCFDFarFieldGeomID did not name the Geom"

# An empty string puts the setting back the way it reads before a choice is made.
SetCFDFarFieldGeomID( "" )

assert GetCFDFarFieldGeomID() == "", "SetCFDFarFieldGeomID did not clear the choice"

# A Geom that does not exist has to be rejected.  The error queue is reached through
# the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetCFDFarFieldGeomID( "NoSuchGeom" )

assert err_mgr.GetNumTotalErrors() > 0, "SetCFDFarFieldGeomID accepted a Geom that does not exist"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: GetCFDFarFieldGeomID, SetCFDMeshVal :param [in]: geom_id string Geom ID, or an empty string to clear

openvsp.GetCFDFarFieldGeomID()[source]

Get the Geom that stands in for the CFD Mesh far field box. Comes back empty when none has been named.

#==== Add Two Geoms To Choose Between ====//
pid = AddGeom( "POD" )
eid = AddGeom( "ELLIPSOID" )

SetCFDFarFieldGeomID( eid )

assert GetCFDFarFieldGeomID() == eid, "GetCFDFarFieldGeomID did not report the Geom that was set"

# It follows the setting, so naming another Geom changes what comes back.
SetCFDFarFieldGeomID( pid )

assert GetCFDFarFieldGeomID() == pid, "GetCFDFarFieldGeomID did not follow SetCFDFarFieldGeomID"

# With the choice cleared it comes back empty.
SetCFDFarFieldGeomID( "" )

assert GetCFDFarFieldGeomID() == "", "GetCFDFarFieldGeomID did not come back empty"

See also: SetCFDFarFieldGeomID :rtype: string :return: string Geom ID

openvsp.GetNumCFDSources(geom_id)[source]

Delete all CFD Mesh sources for all Geoms

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetNumCFDSources( pid ) == 1, "the source was not added"

DeleteAllCFDSources()

assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"

Get the number of CFD Mesh sources on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

assert GetNumCFDSources( pid ) == 0, "a new Geom starts with sources"

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetNumCFDSources( pid ) == 1, "GetNumCFDSources did not count the source that was added"

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

assert GetNumCFDSources( pid ) == 4, "GetNumCFDSources did not count the default sources"

DeleteAllCFDSources()

assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"

See also: AddCFDSource, AddDefaultSources, DeleteCFDSource, DeleteAllCFDSources :param [in]: geom_id string Geom ID :rtype: int :return: int Number of CFD Mesh sources on the Geom

openvsp.GetCFDSourceName(geom_id, source_index)[source]

Get the name of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

assert GetCFDSourceName( pid, 0 ) == "Def_Fwd_PS", "GetCFDSourceName did not name the first default source"

# Every source the Geom counts has to be nameable.
for i in range( GetNumCFDSources( pid ) ):
    assert len( GetCFDSourceName( pid, i ) ) > 0, "source " + str( i ) + " has no name"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDSourceName( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDSourceName 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()

See also: GetNumCFDSources, GetCFDSourceType :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :rtype: string :return: string Source name

openvsp.SetCFDSourceName(geom_id, source_index, name)[source]

Get the type of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "GetCFDSourceType did not report the type that was added"

# A source of a different type reports differently.
AddCFDSource( LINE_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5, 0.25, 2.0, 0.75, 0.75 )

assert GetCFDSourceType( pid, 1 ) == LINE_SOURCE, "GetCFDSourceType did not report the second source"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDSourceType( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDSourceType 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()

See also: CFD_MESH_SOURCE_TYPE, GetNumCFDSources, GetCFDSourceName :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :rtype: void :return: int CFD Mesh source type enum (i.e. POINT_SOURCE)

Set the name of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

SetCFDSourceName( pid, 0, "ExampleSource" )

assert GetCFDSourceName( pid, 0 ) == "ExampleSource", "SetCFDSourceName did not take"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetCFDSourceName( pid, GetNumCFDSources( pid ), "ExampleSource" )

assert err_mgr.GetNumTotalErrors() > 0, "SetCFDSourceName 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()

See also: GetCFDSourceName, GetNumCFDSources :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :param [in]: name string Source name

openvsp.GetCFDSourceType(geom_id, source_index)[source]

Get the type of one CFD Mesh source on a Geom.

pid = AddGeom( "POD" )

Update()

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 1.0, 0.25, 0.5 )

assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "GetCFDSourceType did not report the source type"

See also: CFD_MESH_SOURCE_TYPE, AddCFDSource :param [in]: geom_id string Geom ID :param [in]: source_index int Index of the source on that Geom :rtype: int :return: int CFD mesh source type enum (i.e. POINT_SOURCE)

openvsp.DeleteCFDSource(geom_id, source_index)[source]

Delete a single CFD Mesh source from the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

second_name = GetCFDSourceName( pid, 1 )

DeleteCFDSource( pid, 0 )

# Only the named source goes, and the rest slide down.
assert GetNumCFDSources( pid ) == 2, "DeleteCFDSource did not remove one source"
assert GetCFDSourceName( pid, 0 ) == second_name, "DeleteCFDSource removed the wrong source"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteCFDSource( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteCFDSource 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()

See also: AddCFDSource, AddDefaultSources, DeleteAllCFDSources, GetNumCFDSources :param [in]: geom_id string Geom ID :param [in]: source_index int Source index

openvsp.DeleteAllCFDSources()[source]

Delete every CFD Mesh source on every Geom.

pid = AddGeom( "POD" )

Update()

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 1.0, 0.25, 0.5 )

DeleteAllCFDSources()

assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"

See also: AddCFDSource, DeleteCFDSource

openvsp.GetCFDSourceID(geom_id, source_index)[source]

Get the ParmContainer ID of a CFD Mesh source, so its size and placement can be read and driven after the source has been created. A source’s Parms live in the “Source” group and are named SrcLen, SrcRad, U_Loc and W_Loc, with SrcLen2, SrcRad2 and the numbered locations on the source types that take two ends.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

assert len( src_id ) > 0, "GetCFDSourceID returned no id"

# The source was created with a length of 0.25, and is editable from here.
assert abs( GetParmVal( src_id, "SrcLen", "Source" ) - 0.25 ) < 1e-6, "GetCFDSourceID did not reach the source"

SetParmVal( src_id, "SrcLen", "Source", 0.5 )

See also: AddCFDSource, GetCFDSourceName, GetCFDSourceType :param [in]: geom_id string Geom ID :param [in]: source_index int CFD Mesh source index :rtype: string :return: string ParmContainer ID for the source

openvsp.AdjustAllCFDSourceLen(mult)[source]

Scale the edge length of every CFD Mesh source in the model by a common factor. This is what the four global source length buttons on the CFD Mesh screen do, at 1/1.5, 1/1.1, 1.1 and 1.5. Sources are usually sized relative to one another, so scaling them together is how a mesh is refined or coarsened as a whole.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

AdjustAllCFDSourceLen( 2.0 )

assert abs( GetParmVal( src_id, "SrcLen", "Source" ) - 0.5 ) < 1e-6, "AdjustAllCFDSourceLen did not scale the source"

See also: AdjustAllCFDSourceRad, GetCFDSourceID :param [in]: mult double Factor to scale every source length by

openvsp.AdjustAllCFDSourceRad(mult)[source]

Scale the radius of influence of every CFD Mesh source in the model by a common factor. This is what the four global source radius buttons on the CFD Mesh screen do, at 1/1.5, 1/1.1, 1.1 and 1.5.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

AdjustAllCFDSourceRad( 0.5 )

assert abs( GetParmVal( src_id, "SrcRad", "Source" ) - 1.0 ) < 1e-6, "AdjustAllCFDSourceRad did not scale the source"

See also: AdjustAllCFDSourceLen, GetCFDSourceID :param [in]: mult double Factor to scale every source radius by

openvsp.AddDefaultSources()[source]

Add default CFD Mesh sources for all Geoms

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

# The three default sources arrive under the names in the comment.
assert GetNumCFDSources( pid ) == 3, "AddDefaultSources did not add three sources"
assert GetCFDSourceName( pid, 0 ) == "Def_Fwd_PS", "AddDefaultSources did not add the expected sources"
assert GetCFDSourceName( pid, 1 ) == "Def_Aft_PS", "AddDefaultSources did not add the expected sources"
assert GetCFDSourceName( pid, 2 ) == "Def_Fwd_Aft_LS", "AddDefaultSources did not add the expected sources"

# The first two are point sources and the third joins them with a line.
assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "AddDefaultSources did not add the expected source types"
assert GetCFDSourceType( pid, 1 ) == POINT_SOURCE, "AddDefaultSources did not add the expected source types"
assert GetCFDSourceType( pid, 2 ) == LINE_SOURCE, "AddDefaultSources did not add the expected source types"
openvsp.AddCFDSource(type, geom_id, surf_index, l1, r1, u1, w1, l2=0, r2=0, u2=0, w2=0)[source]

Add a CFD Mesh default source for the indicated Geom. Note, certain input params may not be used depending on the source type

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

# The source lands on the Geom it was given, as the type it was given.
assert GetNumCFDSources( pid ) == 1, "AddCFDSource did not add a point source"
assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "AddCFDSource did not add a point source"

# A source attached to a Geom that does not exist has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

AddCFDSource( POINT_SOURCE, "NOSUCHGEOM", 0, 0.25, 2.0, 0.5, 0.5 )

assert err_mgr.GetNumTotalErrors() > 0, "AddCFDSource accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_MESH_SOURCE_TYPE :param [in]: type int CFD Mesh source type( i.e.BOX_SOURCE ) :param [in]: geom_id string Geom ID :param [in]: surf_index int Main surface index :param [in]: l1 double Source first edge length :param [in]: r1 double Source first radius :param [in]: u1 double Source first U location :param [in]: w1 double Source first W location :param [in]: l2 double Source second edge length :param [in]: r2 double Source second radius :param [in]: u2 double Source second U location :param [in]: w2 double Source second W location