3.4.6.3. GraphWriter
The GraphWriter I/O module writes column-based data per cycle and can
optionally plot the first two columns live to a PNG. It supports data from
globdat.outputNames, attributes on globdat (including arrays indexed
by node/dof), and solver status fields.
The output is stored in a multi-column file. By default, the file is stored
with the extension .out. The first two columns of the output can be shown
on the screen as a curve during the simulation. Please note that the live
plotting option only works when PyFEM is used in a Linux environment.
3.4.6.3.1. Overview
Module type: GraphWriter
Source: pyfem/io/GraphWriter.py
Output file:
<prefix>.outby default, or a customfilename.Live plot: when
onScreen = true, saves a PNG<prefix>.pngeach update.Columns: configured via a list of column names; each column may have sub-parameters.
3.4.6.3.2. Parameters
3.4.6.3.2.1. Mandatory Parameters
Parameter |
Description |
|---|---|
|
Must be set to |
|
Array of strings indicating the columns that will be stored. For each column, the type of data, and if needed, the node, degree of freedom and scaling factor needs to be specified. |
3.4.6.3.2.2. Per-Column Sub-Parameters
Parameter |
Description |
|---|---|
|
Type of data source. This can be either |
|
Node ID, list of node IDs, or node group name when indexing arrays |
|
Degree of freedom. This is most likely |
|
Scale factor applied to the data (default: |
3.4.6.3.2.3. Optional Parameters
Parameter |
Description |
|---|---|
|
Output file name (default: |
|
When set to |
3.4.6.3.3. Examples
3.4.6.3.3.1. Example 1: Load-Displacement Curve
The GraphWriter is used to plot the load-displacement curve in the example
examples/ch03/NewtonRaphson.pro. In this case, the external load, the
load factor lambda is plotted against the vertical displacement of node 21.
First the graph writer is called in the list of output modules:
outputModules = ["mesh", "graph"];
where mesh refers to the VTK output writer, and graph refers to this
GraphWriter. The following code block in the input file describes the
input parameters:
graph =
{
type = "GraphWriter";
onScreen = true;
columns = [ "disp", "load" ];
disp =
{
type = "state";
node = 21;
dof = "v";
};
load =
{
type = "lam";
};
};
In this example, the output file consists of two columns, labeled disp and
load. The first column contains the displacement of node 21 in the y-direction.
In the code, the displacement is stored as state, whereas the v
degree-of-freedom is the displacement in the vertical direction. In a similar
fashion, the temperature or a rotation of a specific node can be plotted by
using the degree-of-freedom names, temp, rx, ry or rz.
The argument onScreen = true; indicates that the results are plotted on
screen during the simulation. Please note that this only works in a Linux environment.
3.4.6.3.3.2. Example 2: Force-Displacement Curve
Configure two columns for a force-displacement curve:
outputModules = [ "GraphWriter" ];
GraphWriter =
{
type = "GraphWriter";
columns = [ "u", "R" ];
u = { type = "u"; node = 10; dof = "u"; } # displacement at node 10
R = { type = "R"; factor = 1.0; } # solver reaction or custom output
onScreen = true; # live plot
filename = "force_disp.out";
};
3.4.6.3.4. See Also
Related writers: ContourWriter, OutputWriter, MeshWriter