Advanced CAE Data Extraction with Altair Monarch
Some text files are easy to read but have data spread across multiple lines of output. Monarch can collect all your data with simple and configurable data traps.
A previous blog covered using Monarch to collect simple data from a correspondingly simple output file, such as the *out file created by an Altair OptiStruct structural optimization. In that case, the datum of interest was contained on a single line and could be identified via text matching. In many other cases, the relevant data is spread across multiple lines and more advanced pattern matching is required. But don’t fear; Monarch has all the software features need to collect structured data.
To illustrate, I’ll walk through the steps to collect data from another file output from the same OptiStruct optimization: the *kpi file that contains key performance indices from the optimization. In this example, the task is to collect information about the max stress at each property group in the structural model. The actual max von Mises stress needs to be collected, of course, and the id of the finite element at which the max value occurs is also to be collected. Lastly, these values need to be recorded for both each property group and iteration of the optimization. To begin, we will apply a similar process to that used previously: (1) add a “detail” to the trap definition; (2) chose the sample line; (3) identify the property group (PID), element id (EID), and stress (VON) in the sample record; and (4) add a numeric pattern match to the trap to ensure unwanted lines are skipped. The steps are notated in the image below.
Thus far, things look good, and the columns shown at the bottom of the interface indicate the trap is collecting meaningful data. However, upon closer inspection, the trap pattern is also matching the data records for the displacements also present in the file. It is simple to narrow the matches by (5) adding another numeric pattern match – this time to enforce that the line must have non-whitespace in that position.
With this fix, the next requirement is to collect the iteration number associated with each record. The steps are: (6) adding an “Append” to the template, (7) add the line with the iteration information to sample and select the field, and (8) add a literal string text pattern to the trap.
As evidenced by the newly added blue highlighted extracted data column at the bottom of the interface, the appropriate iteration data has been appended to each record and our task has been completed.
This example shows that the data collection functionality of Monarch is flexible enough to be applied to files of arbitrarily structured text data. The data collected in this example and previous blog could further be joined into a larger table, but that is a topic for another day ….