|
In CFD-GEOM V2007.2, scripting and journaling are now available. Several improvements have been made to scripting, such as fewer modules that are arranged in a more logical manner, more robust functionality, etc. As in previous versions of CFD-GEOM, the Python scripting language is still used to create the CFD-GEOM scripting functions. If you are interested in scripting and journaling in CFD-GEOM, please read on.
Scripting
CFD-GEOM functions are divided
into a set of modules. Each module provides functionality for solving a
particular task. CFD-GEOM V2007.2 introduces a new set of scripting
modules/Application Programming Interface (API) functions which are much smaller
and more logically organized.
Below is a list of the Python modules available in CFD-GEOM V2007.2:
- GGeometry:
defines all geometry creation/manipulation API and transformations such as
translation, scaling, etc. that can be applied to every entity type.
- GMesh:
defines all meshing API for structured, semi-structured, unstructured, and
poly meshing
- GFileIO:
defines all API for geometry/mesh file I/O
- GBCVC:
defines all API for performing simple boundary and volume condition
assignment
- GUtils:
defines API for miscellaneous tasks such as creating/modifying levels and
user variables, deleting entities, undo/redo, etc.
- GViz:
defines API for setting entity colors. This module currently provides very
limited functionality, but new capabilities for controlling CFD-GEOM
visualization will be introduced in a later release.
- CFDForm:
defines all API for constructing custom graphical user interfaces (replaces the GWindow module)
CFD-GEOM
scripts can be run from virtually any other application that has an
embedded Python interpreter (including a stand alone Python interpreter). Similar
to running scripts in SimManager, running CFD-GEOM scripts from other
applications is akin to running CFD-GEOM in batch mode (i.e., no CFD-GEOM
window appears). We call this a ‘headless’ CFD-GEOM.
To run a CFD-GEOM script outside the
CFD-GEOM graphical user interface, you must initialize CFD-GEOM in the script
using the command GUtils.StartGeom() and the GUtils.StopGeom() command, which
releases the CFD-GEOM license and frees all memory consumed by CFD-GEOM.
However, these two commands are not needed when you run the scripts through
CFD-GEOM GUI as they have no effect.
Journaling Capability
Journaling can now be activated only when you create a new
model or when you’ve just read a script file (to which you wish to continue
journaling). You can disable journaling at any time (via the “Deactivate
Journaling” button on the toolbar). However, once deactivated for a model,
journaling can not be reactivated during the current session. Moreover, within
a CFD-GEOM session, it is not possible to journal to the same file from more
than one open model. These restrictions were introduced to help eliminate the
corruption of script files by the journaling system. Note that it is still
possible to journal to a single file from 2 or more instances of CFD-GEOM. This
practice is guaranteed to produce corrupt scripts and should be avoided.
You may specify to always use journaling for new files or after running a script by checking the options under Edit --> Preferences --> Tools. These options are shown in Figure 1.
Figure 1. Journaling options under Edit --> Preferences
By activating the journaling option for new files, the Journaling check box will always be checked when creating new files, as shown in Figure 2.
Figure 2. Journaling activation on the new model dialog
All tools in the CFD-GEOM V2007.2 geometry and meshing
toolboxes journal symbolic expressions if specified for any numerical
parameters. This feature was not available for all tools in previous versions of CFD-GEOM since most expressions were evaluated to a numerical value.
If you have not explored the new Scripting and Journaling features in CFD-GEOM V2007.2, try using them the next time you use CFD-GEOM.
Regards,
Shivakumar G.T.
ESI CFD Support Team
|