Pointwise’s Plugin SDK now includes an API with which you can write structured and unstructured grid importers. In addition, the existing functionality for structured and unstructured export to CAE formats has been improved. These updates are introduced in Part 1 of this 4-part series.
Yes, you read that correctly. You can now create Pointwise grid import plugins!
Using the Grid Import Plugin API, you can easily add support for a new grid import format to Pointwise without waiting for Pointwise to add it for you. The Grid Import Plugin API provides a mechanism by which structured and unstructured grid data can be read from an external source and then converted into a representation that is understood by Pointwise.
The sections below will give a brief explanation of the changes made to the Pointwise Plugin SDK.
What is a Pointwise Plugin?
Before we dive into the SDK changes, I thought I should answer the question “What is a plugin?”
In computer science jargon, a plugin is an independently compiled, binary library that can be loaded selectively and used by an application to extend its functionality.
As implemented by the Pointwise Plugin SDK, a Pointwise plugin gives you the ability to add a support for exporting a new CAE solver format or importing a new grid format. This added functionality integrates seamlessly into to both the Pointwise graphical user interface (GUI) and Glyph scripting language. And best of all, you can add this new functionality without any involvement from the Pointwise staff (unless you want it).
Deploying a Pointwise plugin is as simple as dropping a finished plugin library file into the /plugins/ folder of your Pointwise installation. The next time Pointwise starts, the new functionality will be available in the Pointwise GUI and at the command line using the Pointwise Glyph Tcl shell.
Changes to the Pointwise Grid Model API
Prior to this update, the Pointwise Grid Model API only supported read-only access to the grid data as needed by the CAE exporter plugins. To support grid import, the Pointwise Grid Model API was extended to also support the creation of both structured and unstructured grid entities. At this time, the Pointwise Grid Model API is limited to the creation of raw grid data only. This means that the import of boundary conditions and volume conditions is not yet supported.
There is a difference between the process used to create structured grid entities versus the process used to create unstructured grid entities. This difference is motivated by the inverted relationship between a structured and unstructured grid entity and its vertices as shown in the following diagram.In addition to supporting the creation of structured grid entities, the Pointwise Grid Model API also supports the import of unstructured cell-based and unstructured face-based formats. An unstructured cell-based format defines a grid as a collection of cell elements. An unstructured face-based format defines a grid as a collection of faces tagged with the id of the cells on either side of the face.
Many grid creation functions are now available in the Pointwise Grid Model API. For example the
PwModCreateUnsVertexList() function is used to create an unstructured vertex list. For unstructured, cell-based grids, the
PwVlstCreateUnsDomain() functions are used to create blocks, and domains. For unstructured, face-based grids, the
PwAsmPushElementFace() functions are use to create blocks, and domains. For structured grids, the
PwModCreateCon() functions are used to create blocks, domains, and connectors.
Changes to the Pointwise CAE Export API
Most of the changes made to the CAE Export API were internal, structural changes. For example, the following data types, now used by both the grid import and CAE export plugins, were renamed and moved to the apiPWP.h header file.
- CAEP_ENUM_FILEDEST is now PWP_ENUM_FILEDEST
- CAEP_ENUM_DIMENSION is now PWP_ENUM_DIMENSION
- CAEP_ENUM_ENCODING is now PWP_ENUM_ENCODING
- CAEP_ENUM_PRECISION is now PWP_ENUM_PRECISION
- CAEP_API_EXPORT is now PWP_API_CAE_EXPORT
- PWU_ENDIANNESS is now PWP_ENDIANNESS
- PWU_ENDIAN_ERROR is now PWP_ENDIAN_ERROR
- PWU_ENDIAN_LITTLE is now PWP_ENDIAN_LITTLE
- PWU_ENDIAN_BIG is now PWP_ENDIAN_BIG
- PWU_ENDIAN_NATIVE is now PWP_ENDIAN_NATIVE
- PWU_ENDIAN_FOREIGN is now PWP_ENDIAN_FOREIGN
Appropriate aliasing macros were added that provide backward compatibility with existing CAE exporter plugin code. However, the old type names are deprecated and the aliasing macros may be removed in a future SDK release.
Another recent addition to CAE export API is support for shadow (non-inflated) BC types. If an internal baffle patch or block-to-block connection patch is tagged with a shadow BC type, it will not be inflated into a zero volume thin wall during export. Non-inflated BC types are often used by solvers to approximate physical phenomena such as a pressure drop across a propeller or energy exchange across a fluid/solid barrier.
In the image below, the top domain represents the set of exported elements if they are not inflated. The bottom domain shows the topology of the “thin wall” inflated domain. The circled pairs of points in the inflated domain are actually at the same XYZ location. They are drawn apart on the image to make the exported topology more obvious. The new (inflated) yellow points are used to create distinct elements with an opposing orientation on the “other” side of the domain.
Shadow BCs are specified in a plugin by calling the
caeuAssignInfoValue() in the plugin’s
runtimeCreate() C function or
PluginName::create() C++ method. The code below shows how the ANSYS Fluent CAE plugin defines its shadow BC types.
const char * ShadowTypes = "Porous Jump|Fan|Radiator|Interior"; caeuAssignInfoValue("ShadowBcTypes", ShadowTypes, true);
Using the mkplugin Script
The mkplugin script is distributed as part of the Pointwise Plugin SDK distribution. The script has been updated to support the creation of grid import plugin projects. Also, the CAE exporter plugin options have been renamed.
The script usage is as follows:
usage: mkplugin.tcl [-h] -caes|-caeu|-grdp -c|-cpp PluginName where, -caes Creates a CAE exporter project that supports structured grids. Name prefix is 'CaeStr'. -caeu Creates a CAE exporter project that supports unstructured grids. Name prefix is 'CaeUns'. -grdp Creates a grid importer project. Name prefix is 'Grdp'. -c Use procedural C api in the plugin. This is the only option supported by -grdp at this time. -cpp Use object oriented C++ api in the plugin. This option cannot be used with -grdp (yet). PluginName Specifies the plugin's base name. PluginName will be prefixed with CaeUns, CaeStr, or Grdp accordingly.
Execute the script using mkplugin -h to see the full usage.
Github Sample Plugins
To help with your plugin development efforts, you can now find the production source code for the following five plugins on the Pointwise github page.
- GrdpOpenFOAM grid import plugin
- GrdpSU2 grid import plugin
- CaeUnsOpenFOAM CAE export plugin
- CaeUnsUMCPSEG CAE export plugin
- CaeUnsSU2 CAE export plugin
These fully functional plugins will make a good starting point for your CAE export or grid import plugin.
Hungry for More?
This post only provides a brief overview of the changes made to the Pointwise Plugin SDK supported by Pointwise V18.1. If you’re ready to start writing plugins now, visit the Pointwise Plugin SDK section of our website.
In part 2 of this 4-part series, you will learn how to write an importer for unstructured grids.
Pingback: The Plugin SDK, Part 2: Unstructured Grid Import – New in Pointwise V18.1 | Another Fine Mesh
Pingback: The Plugin SDK, Part 3: Structured Grid Import – New in Pointwise V18.1 | Another Fine Mesh