This group of functions is used to setup and run the CFD Mesh tool through the API. Click here to return to the main page.
More...
|
| std::string | vsp::GetComputationFileName (int file_type) |
| void | vsp::ComputeCFDMesh (int set, int degenset, int file_export_types) |
| double | vsp::GetCFDMeshVal (int type) |
| bool | vsp::GetCFDWakeFlag (const std::string &geom_id) |
| int | vsp::GetNumCFDSources (const std::string &geom_id) |
| std::string | vsp::GetCFDSourceName (const std::string &geom_id, int source_index) |
| void | vsp::SetCFDSourceName (const std::string &geom_id, int source_index, const std::string &name) |
| void | vsp::DeleteCFDSource (const std::string &geom_id, int source_index) |
| std::string | vsp::GetCFDSourceID (const std::string &geom_id, int source_index) |
| void | vsp::AdjustAllCFDSourceLen (double mult) |
| void | vsp::AdjustAllCFDSourceRad (double mult) |
| void | vsp::AddDefaultSources () |
| void | vsp::AddCFDSource (int type, const std::string &geom_id, int surf_index, double l1, double r1, double u1, double w1, double l2=0, double r2=0, double u2=0, double w2=0) |
◆ AddCFDSource()
| void vsp::AddCFDSource |
( |
int | type, |
|
|
const std::string & | geom_id, |
|
|
int | surf_index, |
|
|
double | l1, |
|
|
double | r1, |
|
|
double | u1, |
|
|
double | w1, |
|
|
double | l2 = 0, |
|
|
double | r2 = 0, |
|
|
double | u2 = 0, |
|
|
double | w2 = 0 ) |
|
extern |
Add a CFD Mesh default source for the indicated Geom. Note, certain input params may not be used depending on the source type
{
Print( "ERROR: AddCFDSource did not add a point source" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: AddCFDSource accepted a bad Geom ID" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
void AddCFDSource(int type, const std::string &geom_id, int surf_index, double l1, double r1, double u1, double w1, double l2=0, double r2=0, double u2=0, double w2=0)
int GetNumCFDSources(const std::string &geom_id)
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
- See also
- CFD_MESH_SOURCE_TYPE
- Parameters
-
| [in] | type | int CFD Mesh source type( i.e.BOX_SOURCE ) |
| [in] | geom_id | string Geom ID |
| [in] | surf_index | int Main surface index |
| [in] | l1 | double Source first edge length |
| [in] | r1 | double Source first radius |
| [in] | u1 | double Source first U location |
| [in] | w1 | double Source first W location |
| [in] | l2 | double Source second edge length |
| [in] | r2 | double Source second radius |
| [in] | u2 | double Source second U location |
| [in] | w2 | double Source second W location |
◆ AddDefaultSources()
| void vsp::AddDefaultSources |
( |
| ) |
|
|
extern |
Add default CFD Mesh sources for all Geoms
{
Print( "ERROR: AddDefaultSources did not add three sources" );
__failure++;
}
else
{
{
Print( "ERROR: AddDefaultSources did not add the expected sources" );
__failure++;
}
{
Print( "ERROR: AddDefaultSources did not add the expected source types" );
__failure++;
}
}
std::string GetCFDSourceName(const std::string &geom_id, int source_index)
◆ AdjustAllCFDSourceLen()
| void vsp::AdjustAllCFDSourceLen |
( |
double | mult | ) |
|
|
extern |
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.
if ( abs(
GetParmVal( src_id,
"SrcLen",
"Source" ) - 0.5 ) > 1e-6 )
{
Print( "ERROR: AdjustAllCFDSourceLen did not scale the source" );
__failure++;
}
std::string GetCFDSourceID(const std::string &geom_id, int source_index)
void AdjustAllCFDSourceLen(double mult)
double GetParmVal(const std::string &parm_id)
- See also
- AdjustAllCFDSourceRad, GetCFDSourceID
- Parameters
-
| [in] | mult | double Factor to scale every source length by |
◆ AdjustAllCFDSourceRad()
| void vsp::AdjustAllCFDSourceRad |
( |
double | mult | ) |
|
|
extern |
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.
if ( abs(
GetParmVal( src_id,
"SrcRad",
"Source" ) - 1.0 ) > 1e-6 )
{
Print( "ERROR: AdjustAllCFDSourceRad did not scale the source" );
__failure++;
}
void AdjustAllCFDSourceRad(double mult)
- See also
- AdjustAllCFDSourceLen, GetCFDSourceID
- Parameters
-
| [in] | mult | double Factor to scale every source radius by |
◆ ComputeCFDMesh()
| void vsp::ComputeCFDMesh |
( |
int | set, |
|
|
int | degenset, |
|
|
int | file_export_types ) |
|
extern |
Create a CFD Mesh for the components in the set. This analysis cannot be run through the Analysis Manager.
SetComputationFileName( CFD_FACET_TYPE, "TestCFDMeshFacet_API.facet" );
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh_API.stl" );
Print( "\tComputing CFDMesh..." );
{
Print( "ERROR: ComputeCFDMesh did not write a readable mesh" );
__failure++;
}
else
{
}
void ComputeCFDMesh(int set, int degenset, int file_export_types)
std::string ImportFile(const std::string &file_name, int file_type, const std::string &parent)
void DeleteGeom(const std::string &geom_id)
std::string GetGeomTypeName(const std::string &geom_id)
void Update(bool update_managers=true)
- See also
- COMPUTATION_FILE_TYPE
- Parameters
-
| [in] | set | int Set index (i.e. SET_ALL) |
| [in] | degenset | int DegenSet index (i.e. SET_NONE) |
| [in] | file_export_types | int CFD Mesh file type to export (supports XOR i.e CFD_SRF_TYPE & CFD_STL_TYPE) |
◆ DeleteCFDSource()
| void vsp::DeleteCFDSource |
( |
const std::string & | geom_id, |
|
|
int | source_index ) |
|
extern |
Delete a single CFD Mesh source from the specified Geom
{
Print( "ERROR: DeleteCFDSource did not remove one source" );
__failure++;
}
{
Print( "ERROR: DeleteCFDSource removed the wrong source" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteCFDSource accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
void DeleteCFDSource(const std::string &geom_id, int source_index)
- See also
- AddCFDSource, AddDefaultSources, DeleteAllCFDSources, GetNumCFDSources
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | source_index | int Source index |
◆ GetCFDMeshVal()
| double vsp::GetCFDMeshVal |
( |
int | type | ) |
|
|
extern |
Set the value of a specific CFD Mesh option
string min_len_id =
FindParm( dens_id,
"MinLen",
"CFDGridDensity" );
if ( !closeTo(
GetParmVal( min_len_id ), 1.0, 1e-12 ) )
{
Print( "ERROR: SetCFDMeshVal did not set CFD_MIN_EDGE_LEN" );
__failure++;
}
std::string FindContainer(const std::string &name, int index)
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
- See also
- CFD_CONTROL_TYPE
- Parameters
-
| [in] | type | int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) |
| [in] | val | double Value to set |
Get the value of a specific CFD Mesh option
{
Print( "ERROR: GetCFDMeshVal did not report the value that was set" );
__failure++;
}
{
Print( "ERROR: GetCFDMeshVal did not report the half mesh flag" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetCFDMeshVal accepted an unknown control type" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
double GetCFDMeshVal(int type)
- See also
- CFD_CONTROL_TYPE, SetCFDMeshVal
- Parameters
-
| [in] | type | int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) |
- Returns
- double Value of the option
◆ GetCFDSourceID()
| std::string vsp::GetCFDSourceID |
( |
const std::string & | geom_id, |
|
|
int | source_index ) |
|
extern |
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.
if ( src_id.length() == 0 )
{
Print( "ERROR: GetCFDSourceID returned no id" );
__failure++;
}
if ( abs(
GetParmVal( src_id,
"SrcLen",
"Source" ) - 0.25 ) > 1e-6 )
{
Print( "ERROR: GetCFDSourceID did not reach the source" );
__failure++;
}
double SetParmVal(const std::string &parm_id, double val)
- See also
- AddCFDSource, GetCFDSourceName, GetCFDSourceType
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | source_index | int CFD Mesh source index |
- Returns
- string ParmContainer ID for the source
◆ GetCFDSourceName()
| std::string vsp::GetCFDSourceName |
( |
const std::string & | geom_id, |
|
|
int | source_index ) |
|
extern |
Get the name of a CFD Mesh source on the specified Geom
{
Print( "ERROR: GetCFDSourceName did not name the first default source" );
__failure++;
}
{
{
Print( "ERROR: source " + i + " has no name" );
__failure++;
}
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetCFDSourceName accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
- See also
- GetNumCFDSources, GetCFDSourceType
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | source_index | int Source index |
- Returns
- string Source name
◆ GetCFDWakeFlag()
| bool vsp::GetCFDWakeFlag |
( |
const std::string & | geom_id | ) |
|
|
extern |
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.
string wid =
AddGeom(
"WING",
"" );
SetCFDWakeFlag( wid, true );
if ( !closeTo(
GetParmVal( wid,
"Wake",
"Shape" ), 1.0, 1e-12 ) )
{
Print( "ERROR: SetCFDWakeFlag did not activate the wake" );
__failure++;
}
SetCFDWakeFlag( wid, false );
if ( !closeTo(
GetParmVal( wid,
"Wake",
"Shape" ), 0.0, 1e-12 ) )
{
Print( "ERROR: SetCFDWakeFlag did not deactivate the wake" );
__failure++;
}
- See also
- SetParmVal, SetParmValUpdate
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | flag | bool True to activate, false to deactivate |
Get the CFD Mesh wake flag for a particular Geom
string wid =
AddGeom(
"WING",
"" );
{
Print( "ERROR: a new Geom starts with its wake on" );
__failure++;
}
SetCFDWakeFlag( wid, true );
{
Print( "ERROR: GetCFDWakeFlag did not follow SetCFDWakeFlag" );
__failure++;
}
if ( !closeTo(
GetParmVal( wid,
"Wake",
"Shape" ), 1.0, 1e-12 ) )
{
Print( "ERROR: the wake flag disagrees with its Parm" );
__failure++;
}
bool GetCFDWakeFlag(const std::string &geom_id)
- See also
- SetCFDWakeFlag
- Parameters
-
| [in] | geom_id | string Geom ID |
- Returns
- bool True if the wake is active
◆ GetComputationFileName()
| std::string vsp::GetComputationFileName |
( |
int | file_type | ) |
|
|
extern |
Get the file name of a specified file type. Note, this function cannot be used to set FEA Mesh file names.
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" );
{
Print( "ERROR: ComputeDegenGeom produced no DegenGeom result" );
__failure++;
}
{
Print( "ERROR: ComputeDegenGeom did not produce the component results" );
__failure++;
}
void ComputeDegenGeom(int set, int file_export_types)
int GetNumResults(const std::string &name)
- See also
- COMPUTATION_FILE_TYPE, SetFeaMeshFileName
- Parameters
-
| [in] | file_type | int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) |
| [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.
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" );
{
Print( "ERROR: GetComputationFileName did not report the name that was set" );
__failure++;
}
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh.stl" );
{
Print( "ERROR: setting one file name disturbed another" );
__failure++;
}
std::string GetComputationFileName(int file_type)
- See also
- COMPUTATION_FILE_TYPE, SetComputationFileName, GetFeaMeshFileName
- Parameters
-
| [in] | file_type | int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) |
- Returns
- string File name
◆ GetNumCFDSources()
| int vsp::GetNumCFDSources |
( |
const std::string & | geom_id | ) |
|
|
extern |
Delete all CFD Mesh sources for all Geoms
{
Print( "ERROR: the source was not added" );
__failure++;
}
DeleteAllCFDSources();
{
Print( "ERROR: DeleteAllCFDSources left sources behind" );
__failure++;
}
Get the number of CFD Mesh sources on the specified Geom
{
Print( "ERROR: a new Geom starts with sources" );
__failure++;
}
{
Print( "ERROR: GetNumCFDSources did not count the source that was added" );
__failure++;
}
{
Print( "ERROR: GetNumCFDSources did not count the default sources" );
__failure++;
}
DeleteAllCFDSources();
{
Print( "ERROR: DeleteAllCFDSources left sources behind" );
__failure++;
}
- See also
- AddCFDSource, AddDefaultSources, DeleteCFDSource, DeleteAllCFDSources
- Parameters
-
| [in] | geom_id | string Geom ID |
- Returns
- int Number of CFD Mesh sources on the Geom
◆ SetCFDSourceName()
| void vsp::SetCFDSourceName |
( |
const std::string & | geom_id, |
|
|
int | source_index, |
|
|
const std::string & | name ) |
|
extern |
Get the type of a CFD Mesh source on the specified Geom
{
Print( "ERROR: GetCFDSourceType did not report the type that was added" );
__failure++;
}
AddCFDSource(
LINE_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5, 0.25, 2.0, 0.75, 0.75 );
{
Print( "ERROR: GetCFDSourceType did not report the second source" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetCFDSourceType accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
- See also
- CFD_MESH_SOURCE_TYPE, GetNumCFDSources, GetCFDSourceName
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | source_index | int Source index |
- Returns
- int CFD Mesh source type enum (i.e. POINT_SOURCE)
Set the name of a CFD Mesh source on the specified Geom
{
Print( "ERROR: SetCFDSourceName did not take" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: SetCFDSourceName accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
void SetCFDSourceName(const std::string &geom_id, int source_index, const std::string &name)
- See also
- GetCFDSourceName, GetNumCFDSources
- Parameters
-
| [in] | geom_id | string Geom ID |
| [in] | source_index | int Source index |
| [in] | name | string Source name |