Post Processing#
It is very easy to write a local post processing criterion using
zLanguage. Just write your script assuming that two global variables of
type VECTOR already exists (named in
and out
). For instance to
compute mises norm, one can use :
ARRAY<STRING> input()
{
ARRAY<STRING> i;
i.resize(4); i[0]="sig11"; i[1]="sig22"; i[2]="sig33"; i[3]="sig12";
return(i);
}
ARRAY<STRING> output()
{
ARRAY<STRING> o;
o.resize(1); o[0]="z7pmises";
return(o);
}
void compute()
{
TENSOR2 sigma;
global double max_mises,min_mises;
double mises;
sigma.reassign(4,in,0);
sigma.add_sqrt2();
mises=sigma.mises();
out.resize(1);
out[0]=mises;
if(out[0]<min_mises) min_mises=out[0];
if(out[0]>max_mises) max_mises=out[0];
}
Then write a “classical” post-processing input file :
****post_processing
***local_post_processing
**elset ALL_ELEMENT
**output_number 1-2
**file integ
**process z7p
*program post.z7p
****return
Input components are automatically extracted using the script function
called input
; output components are taken from function output
.
It is also possible to supply two additional function in your script
file : void initialize()
and void destroy()
which are called
just before and just after executing the post computation. It allows for
instance global variables initialization (before computation) and
printing (after).
Global post processing#
It is also possible to write global post processing scripts. You only
have to assume that two global variables are defined : ape
and
apn
which are arrays of POST_ELEMENT and of POST_NODE. The input
file is exactly the same (except for the global options) :
****post_processing
***global_post_processing
**elset ALL_ELEMENT
**output_number 1-2
**file integ
**process z7p
*program post.z7p
****return
The script file could be, for instance (it computes and prints the maximum and minimum values of mises stress over the mesh) :
ARRAY<STRING> input()
{
ARRAY<STRING> i;
i.resize(4); i[0]="sig11"; i[1]="sig22"; i[2]="sig33"; i[3]="sig12";
return(i);
}
ARRAY<STRING> output()
{
ARRAY<STRING> o;
o.resize(1); o[0]="z7pmises";
return(o);
}
void initialize()
{
global double max_mises,min_mises;
max_mises=-MAX_DOUBLE; min_mises=MAX_DOUBLE;
}
void destroy()
{
global double max_mises,min_mises;
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;
f.close();
}
void compute()
{
int i,j;
TENSOR2 sigma;
global double max_mises,min_mises;
double mises;
for(i=0;i<!ape;i=i+1) {
for(j=0;j<ape[i].nb_idata();j=j+1) {
sigma.reassign(4,ape[i].idata(j).data,0);
mises=sigma.mises();
ape[i].idata(j).out[0]=mises;
if(mises<min_mises) min_mises=mises;
if(mises>max_mises) max_mises=mises;
}
}
}
Post processing end user objects#
INTEG_DATA
: represents datas coming from .integ or .ctnod file (ie finite element results at integration points)Operators : none
Methods : none
Members :
VECTOR out
: the result vector. Its size should be equal to the number of components declared in functionoutput
VECTOR data
: the input vector. Its size should be equal to the number of components declared in functioninput
NODE_DATA
: represents datas coming from .node file (ie finite element results at nodes)Operators : none
Methods : none
Members :
VECTOR out
: the result vector. Its size should be equal to the number of components declared in functionoutput
VECTOR data
: the input vector. Its size should be equal to the number of components declared in functioninput
POST_NODE
: an entity to store nodal datasOperators :
int operator!()
: return the number of attachedNODE_DATA
Methods :
POST_NODE data(int n)
: return the nthNODE_DATA
object
Members : none
POST_ELEMENT
: an entity to store element datasOperators : none
Methods :
int nb_idata()
: return the number of integ datas (should be equal to the number of integration points)int nb_ndata()
: return the number of ctnod datas (should be equal to the number of nodes)ELEM_DATA idata(int n)
: return the nth integ dataELEM_DATA ndata(int n)
: return the nth ctnod datavoid start(MATRIX elem_coord)
: starts an element loopvoid next(MATRIX elem_coord)
: next integration point in the element loopint ok()
: return 0 if the number of integration points has been excedeed, 1 otherwiseVECTOR shape()
: return shape vector for the current integration pointVECTOR shape_inv()
: return ”inverse“ shape vector for the current integration pointvoid get_elem_coord(MATRIX &m)
: return int matrix m the elements coordinatesvoid get_position_of_integration_point(VECTOR &v)
: return in vector v the coordinate of the current integration pointvoid integrate(T &v, T &tot)
: incrementtot
with the integral contribution associated with the current integration point.T
may bedouble
,VECTOR
orMATRIX
.
Members : none