**process z7p#
Description#
This post-processing provides an interface for user defined post-processing operations using the z7p scripting language. The z7p should contain the following functions:
A function to define the names of input variables
ARRAY<STRING> input() { ... }
define the names of output variables
ARRAY<STRING> output() { ... }
compute output variables
void compute() { ... }
initialization (not mandatory)
void initialize() { ... }
Memory Deallocation or extra results dumping (not mandatory)
void destroy() { ... }
Syntax#
**process z7p script.z7p
Example#
The following example can be found at $Z7PATH/TESTS/Program_test/Post_test/INP/arm2_glob.inp
***global_post_processing
**output_number 1-3
**elset ALL_ELEMENT
**file integ
**process z7p arm2_glob.z7p
The script arm2_glob.z7p:
ARRAY<STRING> input()
{
ARRAY<STRING> i; // declare an array of strings to store input variables' names
i.resize(4); // resize the array
i[0]="sig11"; i[1]="sig22"; i[2]="sig33"; i[3]="sig12"; // give the names of variables to read from database
return(i);
}
ARRAY<STRING> output()
{
ARRAY<STRING> o; // declare an array of strings to store input variables' names
o.resize(1); // resize the array
o[0]="z7pmises"; // give the names of output variables
return(o);
}
void initialize()
{
global double max_mises,min_mises; // these variables should be defined global
// to be able to used them outside the scope of this function
max_mises=-MAX_DOUBLE; min_mises=MAX_DOUBLE;
}
void destroy()
{
// this function prints the minimum and maximum of stress over all maps
// done here because compute() is called for each map
Zfstream f;
endl.print();
("Max Mises ="+max_mises+endl).print();
("Min Mises ="+min_mises+endl).print();
cflush();
f.open("arm2_glob.post",18);
f<<max_mises<<" "<<min_mises<<endl; // append min and max to post file as well
f.close();
}
void compute()
{
int i,j;
TENSOR2 sigma;
double mises;
for(i=0;i<!ape;i=i+1) { // loop over POST_ELEMENT array
for(j=0;j<ape[i].nb_idata();j=j+1) { // loop over Gauss points
sigma.reassign(4,ape[i].idata(j).data,0); // TENSOR2 sigma points to the values of input
// stored in ape[i].idata(j).data
mises=sigma.mises(); // compute von Mises equivalent stress
ape[i].idata(j).out[0]=mises; // fill output value with the mises
if(mises<min_mises) min_mises=mises;
if(mises>max_mises) max_mises=mises;
}
}
}
Note
Some variables are already defined, in order to make the script easy to use. Here a list of these variables:
variables |
description |
|---|---|
|
array of POST_ELEMENT |
|
array of POST_NODE |
To access data of POST_ELEMENT:
ape[i].nb_idata(): The number of Gauss points for POST_ELEMENT i.ape[i].idata(j): an object handling j-th Gauss point data.ape[i].idata(j).out: a vector to store output results.