Extracting and Post-Processing CAE/TEST results in Altair Compose

Manoj Kandukuri_22400
Manoj Kandukuri_22400
Altair Employee
edited February 2021 in Altair HyperWorks

There are many functions under the CAE Reader Library in Altair Compose that can be used to extract data from CAE/Test result files. This Article gives insight about the CAE Reader functions in Altair Compose (Open Matric Language Format) and utilizes these to automate some tasks of post processing CAE results in a robust, fast and efficient workflow.

Pre-requisite: CAE Reader capability feature video - Altair Compose: Math, Scripting, Data Analysis & Visualization Software

Below are listed a few use cases where one can benefit from utilizing Compose CAE Readers for Post Processing:

1. Creating a PSD curve of Road Test data and automatically create a curve to parse it to Optistruct.

2. Extracting the stress results from solver output file and do plasticity correction based on Neuber analytical method.

3. Post Process Whiplash Assessment Criteria - “Data format and injury criteria calculation”

4. Post process Material Test data to solver recognizable format.

5. Calculate Cylinder Bore distortion from Solver output file.

Insight into the CAE Reader library

Compose CAE Reader library uses Altair’s CAE Readers to extract the data of simulation or test result files. Altair’s readers have 4 main categories or building blocks namely Subcase, Type, Request, Component:

 

Category

 Description

Subcase Title of the Simulation/Analysis type
Type Result file consisting of different data types like displacement, stress etc.
Request

Result file consisting of different nodes/elements on specific data types.

Component

Result file consisting of different results on specific nodes/elements like X,Y,Z,Mag etc.

 

These categories have each three OML functions to extract specific information from the results file:

SUBCASE
TYPE
REQUEST
COMPONENT

getsubcaselist

getsubcasename

getsubcaseindex

gettypelist

gettypename

gettypeindex

getreqlist

getreqname

getreqindex

getcomplist

getcompname

getcompindex

 

At any point, to extract a specific information from the results file, the order below is to be followed:

 image

 

Extracting the desired data from the results file

The 3-step process is described below:

i. Parsing the entire structure of the results file

To use the CAE reader library, knowing the structure of the results file is key.

The CAE Reader functions are reviewed and explained in this section using an example file ‘bezel.h3d’ (Optistruct solver output file) which contains simulation results for 4 subcases, structural static analysis with 5 different result data types on all nodes and elements of the bezel model across all the subcases.

First, the getsubcasename function can be used to read all the subcase names from the sample file ‘bezel.h3d’. Calling getsubcasename returns a string with the subcase name:

 >Sub_name2 = getsubcasename(‘bezel.h3d’,2)

>Sub_name2 = Subcase 2 (Step_Y)

When the results file consists of more than one subcase, getsubcaselist can be used to extract all the subcase names from the results file. The output of the function getsubcaselist is a list of names in a cell datatype.

>Sub = getsubcaselist(‘bezel.h3d’)

>Sub =

{

[1,1] Subcase 1 (Step_X)

[1,2] Subcase 2 (Step_Y)

[1,3] Subcase 3 (Step_Z)

[1,4] Subcase 4 (solver_LSP)

}

Once the cell data of subcase names is obtained, indexing is used to get the subcase name of interest.

>Sub{2}

>ans = Subcase 2 (Step_Y)

 

To get the index of a specific subcase name, for example the index of ‘Subcase 4 (solver_LSP)’ from the sample results file, use the function getsubcaseindex:

>Sub_index = getsubcaseindex('bezel.h3d','Subcase 4 (solver_LSP)')

>Sub_index = 4

 

Similarly, the same can be done using any other get**** CAE Reader functions (gettypelist, gettypename, .. etc.) to get Type, Request and Component information from the results file.

For example, to get the list of result TYPE’s in the fourth subcase and index of ‘Displacement (Global)’:

>types = gettypelist('bezel.h3d', Sub_index) % 1 represent 1st subcase

>types =

{

[1,1] Time

[1,2] Displacement (Global)

[1,3] SPCF Forces (Global)

[1,4] SPCF Moments (Global)

[1,5] Element Stresses (2D & 3D) (2D)

[1,6] Element Strains (2D & 3D) (2D)

[1,7] Index

}

>types_index = gettypeindex('bezel.h3d', Sub_index, 'Displacement (Global)')

>types_index = 2

ii. Extracting the data for the specified structure

In case of a large set of data in the results file, it might be beneficial to read the data to the Compose’s memory space. Then, the readmultvectors function is well-suited as it uses the CAE readers provided with Altair Compose and supports a large set of file formats.

readmultvectors function has 3 main forms:

1. Input is only the filename then all the data is read from the file if no subcase information is present, otherwise only the data from the first subcase is read.

2. Inputs are the filename and a variable of cell datatype which contains subcase, type, request, and components info.

3. Inputs are the filename, Subcase, Type, Request start, Request End, Component start, Component End, Time Range

Extensive customization can be done for the variable of cell datatype (information that is extracted from the file) and readmultvectors function can be used without compromising performance.

For example, the commands below show how to extract Displacement X, Y, Z results for all the nodes in the second subcase from a sample CAE results file.

The first step is to extract the required subcase, type, request and component information, to parse it as input arguments (as second form above) to readmultvectors:

 

result_file = 'bezel.h3d';

%Extract subcase list from result file

Sub = getsubcaselist('bezel.h3d');

%Extract name of 2nd subcase from result file

Sub_name2 = getsubcasename('bezel.h3d',2);

%Extract Type list from result file

% 1 represent 1st subcase

types = gettypelist('bezel.h3d', Sub_name2);

%Extract name of Displacement result type from result file

types_name = gettypeindex('bezel.h3d', Sub_name2, types{2});

%Extract Request (Node)list from result file

req = getreqlist('bezel.h3d', Sub_name2,types_name);

%Extract component list from result file

component = getcomplist('bezel.h3d', Sub_name2,types_name);

With the required information about subcase, type, request, component from the results file now available, a cell datatype variable is created with the required information as input to readmultvector.

totaldatacell = max(size(req))*3; % 3= X Y Z components

datacell=cell(totaldatacell,4); % initializing

j = 1;

for i = 1:max(size(req))

datacell{j,1} = Sub_name2;

datacell{j,2} = types_name;

datacell{j,3} = req{i} ;

datacell{j,4} = component{2};

%datacell(j,5) = '1';

j = j+1;

datacell{j,1} = Sub_name2;

datacell{j,2} = types_name;

datacell{j,3} = req{i} ;

datacell{j,4} = component{3};

%datacell(j,5) = '1';

j = j+1;

datacell{j,1} = Sub_name2;

datacell{j,2} = types_name;

datacell{j,3} = req{i};

datacell{j,4} = component{4};

%datacell(j,5) = '1';

j = j+1;

end

 

Finally, the required data can be extracted from the results file using readmultvectors:

output=readmultvectors(result_file,datacell);

 iii. Getting the data ready for post-processing

The output from the readmultvectors function will be a cell datatype as the input arguments are parsed as cell datatype “datacell” as shown below; and the fifth element in every row array in a cell datatype is the result corresponding to that row. For example, output{1,5}is the result output for X Displacement for Node id 1 in Subcase 2 and output{2,5}is the result output for Y Displacement for Node id 1 in Subcase 2.

>output

output =

{

[1,1] Subcase 2 (Step_Y)

[1,2] 2

[1,3] N1

[1,4] X

[1,5] 0

[2,1] Subcase 2 (Step_Y)

[2,2] 2

[2,3] N1

[2,4] Y

[2,5] 0

[3,1] Subcase 2 (Step_Y)

Re-arranging the output data to have a matrix as [nodeid, X_displacement, Y_displacement, Z_displacement]

for i = 1:totaldatacell

ttt(i,1) = output{i,5};

temp = strsplit(output{i,3},'N');

nodeid(i,1) = str2num(temp{2});

end

% Displacement data for a given node set

Data_temp = (reshape(ttt,3,[]))';

nodeid = (reshape(nodeid,3,[]))';

Data = [nodeid(:,1),Data_temp];

 

Variable ‘Data’ is a matrix datatype of size of 236 X 4, where the first column are the node ids, the second column is x displacement, the third column is y displacement, the fourth column is z displacement.

 

Post-processing: Calculate the Magnitude of the displacement extracted

Once the required displacement components on all the nodes are extracted from the CAE results file, the data can be further post processed by using the supported built-in functions of OML.

Magnitude of Displacement is given by:

Magnitude = √(????_????????????????????????????????????????????????)2+(????_????????????????????????????????????????????????)2+(????_????????????????????????????????????????????????)2

Where the X, Y, Z components of displacements are stored in variable “Data_temp”

The magnitude of displacement for all the nodes in SUBCASE 2 is calculated as shown below:

mag = sqrt(Data_temp(:,1).^2 + Data_temp(:,2).^2 +Data_temp(:,3).^2);

 

Conclusion

With CAE Reader library in Compose OML, one can extract the required data from CAE result files with ease and perform a robust and efficient post processing and this article shows one such way..!

Tagged: