Post-Processing and Visualizing Simulation Results (-S, -V)#

Note

This tutorial presents the Simulation Module (-S) and the simulation-related options of the Visualization Module (-V). Read first: Meshing a Tessellation (-T, -M) and Visualizing a Mesh (-V).

To reproduce exactly the images below, add the following line to your $HOME/.neperrc file (or to a local configuration file to be loaded with --rcfile):

neper -V -imagesize 800:400

In the following, the results of a small FEPX simulation are used (the Simulation Directory (.sim) n20.sim of Plotting Orientation Trajectories (-S, -V)), which corresponds to the deformation to 10% (engineering) tensile strain along z of a 20-grain polycrystal. The simulation directory includes the node positions (coo) and the element orientations (ori) at steps 0 to 10.

Note

The Simulation Module (-S) writes the new results in the simulation directory; you may want to work on a copy of it.

Computing Results#

New results can be computed for the nodes, elements, element sets (cells) and the whole mesh, using options -resnode, -reselt, -reselset and -resmesh, respectively, and the keys described in Simulation Results. For example, to compute the nodal displacements and the element volumes:

$ neper -S n20.sim -resnode disp -reselt vol

This writes the results in n20.sim/results/nodes/disp and n20.sim/results/elts/vol, as one file per step (disp.step0, etc.).

The results of element sets and of the mesh are computed from the element results, by averaging or other statistical treatments. For example, to compute the volumes and grain orientation spreads of the element sets, and the volume of the mesh:

$ neper -S n20.sim -reselset vol,gos -resmesh vol

The volume of the mesh is 1 at step 0 and 1.000849678065 at step 10.

Defining Results from Expressions#

A result can be defined from an expression based on other results, using the syntax <name>:<expression>. A component of a vector or tensor result is obtained by appending the component to its name, as in disp3. For example, to compute the norm of the displacement:

$ neper -S n20.sim -resnode "dispnorm:sqrt(disp1^2+disp2^2+disp3^2)"

This writes the results in n20.sim/results/nodes/dispnorm.

Note

Defining a name is mandatory for expressions containing divisions, as the / character cannot be used in file names.

An existing result can be removed by prefixing its name with , and so a result can be overridden. For example, to redefine dispnorm as the norm of the displacement in the (x,y) plane:

$ neper -S n20.sim -resnode '!dispnorm,dispnorm:sqrt(disp1^2+disp2^2)'

Note

Single quotes are used so that is not interpreted by the shell.

Defining New Entities#

New entities, made of element sets, can be defined using option -entity, from an expression based on the element set variables, and results can be computed for them using -res<entity>. For example, to define the top half of the sample, tophalf, and compute the z coordinate of its centroid:

$ neper -S n20.sim -entity "tophalf:z>0.5" -restophalf z

This writes the results in n20.sim/results/tophalf/z. The z coordinate is 0.747181733339 at step 0 and 0.811590106749 at step 10.

An entity can also comprise several members, each defined by an expression, which can be loaded from a file. For example, to define the bottom and top halves of the sample, consider a file, foo, containing:

z<=0.5
z>0.5

The entity, halves, can be defined and the z coordinates of the centroids of its members computed as follows:

$ neper -S n20.sim -entity "halves:file(foo)" -reshalves z

The values at step 10 are 0.268767546062 and 0.811590106749.

Note

Simulation directories can also be merged, as in neper -S cycle1.sim,cycle2.sim -o cycle1-2.

Visualizing Results#

A simulation directory can be passed to the Visualization Module (-V), and the step to visualize can be specified using -step. For example, to visualize the deformed mesh, by setting the node positions from the coo result, with the elements colored by their orientations, at step 10:

$ neper -V n20.sim -step 10 -datanodecoo coo -dataeltcol ori -print img1
../../_images/img114.png

To generate an image at several steps, a loop can be used (see -loop). For example, for steps 0, 5 and 10:

$ neper -V n20.sim -loop STEP 0 5 10 -step STEP -datanodecoo coo -dataeltcol ori -print imgSTEP -endloop

This produces PNG files named img0.png, img5.png and img10.png, which can be assembled using ImageMagick’s convert:

$ convert img0.png img5.png img10.png -trim +repage -resize x300 -extent x300 -bordercolor white -border 10x0 +append -resize 780x -background white -gravity center -extent 800x img2.png
../../_images/img212.png

The results computed above can also be used. For example, to color the element sets by their grain orientation spreads at step 10:

$ neper -V n20.sim -step 10 -datanodecoo coo -dataelsetcol "real:gos" -dataelsetscale 0:1:2:3:4 -dataelsetscaletitle "GOS (deg)" -print img3
$ convert img3.png img3-scale3d.png -gravity East -composite img3.png
../../_images/img312.png