Simple Simulation#

Note

Read also: Simple RVE-Type Simulation.

A polycrystal of 20 grains, generated and meshed by Neper, is used:

../../_images/mesh4.png

Fig. 2 The mesh (10-node tetrahedra), colored by grain.#

The domain is the unit cube. Length units are mm, so that stresses (and the material parameters) are in MPa. An fcc material with anisotropic elasticity and the crystal-plasticity model with isotropic saturation hardening (Crystal Behavior (simulation.cfg)) is considered, with the parameters:

Table 9 Single-crystal elastic constants and plasticity parameters (saturation_isotropic hardening).#

\(c_{11}\) [MPa]

\(c_{12}\) [MPa]

\(c_{44}\) [MPa]

\(m\) [-]

\(\dot{\gamma}_0\) [1/s]

\(\tau_0\) [MPa]

\(h_0\) [MPa]

\(\tau_s\) [MPa]

\(n\) [-]

\(245.0 \times 10^3\)

\(155.0 \times 10^3\)

\(62.5 \times 10^3\)

0.05

1.0

210.0

200.0

330.0

1.0

The polycrystal is pulled along \(z\) at a rate of 0.001 /s, by velocity conditions given node set by node set (boundary_conditions general, see Boundary Conditions): \(v_z = 0\) on face z0, \(v_z = 0.001\) mm/s on face z1, and two corners fixed against rigid-body motion. The loading has two steps, which end at the times 5 s and 10 s (0.5 % and 1 % strain), with increments of 1 s. The nodal coordinates and the elemental orientations, stresses and strains are written at the end of each step, and the face forces at every increment.

Input Files#

## FEPX tutorial "Simple simulation": a 20-grain fcc polycrystal in the unit cube pulled
## along z at 0.001 mm/s, the conditions given node set by node set, two steps of 5 s.

## Material
number_of_phases 1
phase 1
  crystal_type FCC
  model crystal_plasticity
  c11 245.0e3
  c12 155.0e3
  c44 62.5e3
  m 0.05
  gammadot_0 1.0
  tau_0 210.0
  hardening saturation_isotropic
  h_0 200.0
  tau_s 330.0
  n 1.0

## Loading
boundary_conditions general
set_bc vel z0 z 0
set_bc vel z1 z 0.001
set_bc vel x0y0z0 x 0 y 0
set_bc vel x1y0z0 y 0
number_of_steps 2
target_time 5.0 10.0
dtime       1.0  1.0

## Output
print coo
print ori
print stress
print strain
print forces

Execution#

In the directory holding the two files:

$ mpirun -np 4 fepx
========================    F   E   P   X    ===========================
Info   : A finite element software package for polycrystal plasticity.
Info   : Version 3.0.0-dev (git 755da754, 11-06-2026)
Info   : Built with: GCC 15.2.0|Open MPI 5.0.10|HDF5 1.14.6
Info   : Running on 4 ranks.
Info   : <https://fepx.info>
Info   : Copyright (C) 1996-2026, and MIT licensed, by the FEPX authors.
Info   : ---------------------------------------------------------------
Info   : Loading simulation...
Info   :   [i] Parsing file `simulation.cfg'...
Info   :   [i] Parsed file `simulation.cfg'.
Info   :   [i] Parsing file `simulation.msh'...
Info   :   [i] Parsed file `simulation.msh'.
Info   :   - Material parameters:
Info   :     > Number of phases: 1
Info   :     > Phase 1: fcc, crystal_plasticity
Info   :       . c11:                       2.4500E+05 MPa
Info   :       . c12:                       1.5500E+05 MPa
Info   :       . c44:                       6.2500E+04 MPa
Info   :       . m:                         5.0000E-02
Info   :       . gammadot_0:                1.0000E+00 1/s
Info   :       . hardening:                 saturation_isotropic
Info   :       . tau_0:                     2.1000E+02 MPa
Info   :       . h_0:                       2.0000E+02 MPa
Info   :       . tau_s:                     3.3000E+02 MPa
Info   :       . n:                         1.0000E+00
Info   :       . saturation_evolution:      off (def.)
Info   :       . cyclic_hardening:          off (def.)
Info   :       . precipitate_strengthening: off (def.)
Info   :   - Loading: boundary_conditions general, 2 steps
Info   :     > Step 1: t = 0.0000E+00 -> 5.0000E+00 s, 5 increments
Info   :     > Step 2: t = 5.0000E+00 -> 1.0000E+01 s, 5 increments
Info   :   - Options other than the defaults: (none)
Info   :   - Output: coo ori stress strain forces (format ascii)
Info   :   - Mesh parameters:
Info   :     > Node number: 4008
Info   :     > Elt  number: 2453 (10-node tetrahedra)
Info   :     > Elsets: 20; partitions: 4
Info   :   - Partitioning: 4 ranks
Info   :     > Elements per rank: 613 to 614
Info   :     > Ghost nodes per rank: 146 to 167 (626 in total)
Info   :     > Neighbors per rank: 3 to 3
Info   :   [o] Writing results to `simulation.sim'...
Info   : Initializing simulation...
Info   :   - Elastic step of 1.1351E-02 s (step 1)
Info   :     > Iteration 1 (SA): R = 2.5329E+00 (543 CG iterations)
Info   :     > Iteration 2 (SA): R = 1.5030E-05 (539 CG iterations)
Info   :     > Converged in 2 iterations (0.648 s)
Info   : Running step 1...
Info   :   - Increment 1: t = 1.0000E+00 s, dt = 9.8865E-01 s
Info   :     > Iteration 1 (SA): R = 7.1922E-04 (552 CG iterations)
Info   :     > Iteration 2 (NR): R = 6.3443E-07 (562 CG iterations)
Info   :     > Converged in 2 iterations (0.776 s)
  [...]
Info   : Final step terminated. Simulation completed successfully.
Info   :   [o] Wrote results to `simulation.sim'.
Info   :   - Increments: 10
Info   :   - Global iterations: 47 (22 NR)
Info   :   - CG iterations: 32537
Info   :   - Warnings issued: 0
Info   :   - Wall time per phase:
Info   :     > Input and setup:                      0.054 s
Info   :     > Initialization:                       0.655 s
Info   :     > Increments:                          21.166 s
Info   :       . Element and material work:         13.250 s
Info   :       . CG:                                 7.833 s
Info   :       . Other:                              0.083 s
Info   :     > Output:                               0.330 s
Info   : Elapsed time:                              22.205 s
========================================================================

The mesh was partitioned by Neper into 4 parts, one per process (see Running a Simulation). The content of the resulting simulation directory (Simulation Directory (simulation.sim)) is:

simulation.sim
|-- inputs
|   |-- simulation.cfg
|   `-- simulation.msh
`-- results
    |-- elts
    |   |-- ori
    |   |   |-- ori.step0
    |   |   |-- ori.step1
    |   |   `-- ori.step2
    |   |-- strain
    |   |   |-- strain.step0
    |   |   |-- strain.step1
    |   |   `-- strain.step2
    |   `-- stress
    |       |-- stress.step0
    |       |-- stress.step1
    |       `-- stress.step2
    |-- forces
    |   |-- x0
    |   |-- x1
    |   |-- y0
    |   |-- y1
    |   |-- z0
    |   `-- z1
    |-- mesh
    |   |-- strain
    |   |   |-- strain.step0
    |   |   |-- strain.step1
    |   |   `-- strain.step2
    |   `-- stress
    |       |-- stress.step0
    |       |-- stress.step1
    |       `-- stress.step2
    `-- nodes
        `-- coo
            |-- coo.step0
            |-- coo.step1
            `-- coo.step2

Simulation Results#

The stress-strain curve is computed from the volume averages of the stress and the strain at the end of each step, written by Neper’s post-processing (neper -S) to simulation.sim/results/mesh; the stress of face z1 at every increment is its force over its current area, from simulation.sim/results/forces/z1. The curves are plotted with Python (the script tutorials/tools/tutorial_pages.py of the source distribution; see also Post-Processing in Python):

../../_images/curves9.png

Fig. 3 (left) Volume-averaged stress against strain at the end of each step; (right) stress of face z1 (force over current area) at every increment.#

The fields at the end of each step are plotted with Neper, on the deformed mesh (displacements magnified 10 times), with the color scale beside each image (ImageMagick):

../../_images/strain33_step1.png

Fig. 4 Strain field \(\epsilon_{33}\) at 0.5 % strain (end of step 1).#

../../_images/strain33_step2.png

Fig. 5 Strain field \(\epsilon_{33}\) at 1 % strain (end of step 2).#

../../_images/stress33_step1.png

Fig. 6 Stress field \(\sigma_{33}\) at 0.5 % strain (end of step 1).#

../../_images/stress33_step2.png

Fig. 7 Stress field \(\sigma_{33}\) at 1 % strain (end of step 2).#

The commands, in the simulation’s directory:

$ neper -S simulation.sim -resmesh stress,strain
$ neper -V simulation.msh -showelt1d all -dataelt1drad 0.004 -dataelt3dedgerad 0.0015 \
    -dataelt3dedgecol 32:32:32 -cameraangle 13.5 -imagesize 800:800 -dataelsetcol id \
    -print img_mesh
$ convert img_mesh.png -trim -bordercolor white -border 20 -resize 600x600 -strip \
    PNG8:mesh.png
$ neper -V simulation.sim -step 1 -datanodecoo coo -datanodecoofact 10 -showelt1d all \
    -dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
    13.5 -imagesize 800:800 -dataeltcol strain33 -dataeltscale \
    0.002:0.004:0.006:0.008:0.010:0.012:0.014:0.016:0.018 -print img_strain33_step1
$ convert "(" img_strain33_step1.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size \
    240x -background white -font DejaVu-Serif -pointsize 30 "caption:Strain 33" \
    -bordercolor white -border 0x12 "(" img_strain33_step1-scale3d.png -trim ")" \
    -gravity west -append ")" -background white -gravity center +append -bordercolor \
    white -border 20 -resize 600x600 -strip PNG8:strain33_step1.png
$ neper -V simulation.sim -step 1 -datanodecoo coo -datanodecoofact 10 -showelt1d all \
    -dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
    13.5 -imagesize 800:800 -dataeltcol stress33 -dataeltscale \
    200:250:300:350:400:450:500:550 -print img_stress33_step1
$ convert "(" img_stress33_step1.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size \
    240x -background white -font DejaVu-Serif -pointsize 30 "caption:Stress 33 [MPa]" \
    -bordercolor white -border 0x12 "(" img_stress33_step1-scale3d.png -trim ")" \
    -gravity west -append ")" -background white -gravity center +append -bordercolor \
    white -border 20 -resize 600x600 -strip PNG8:stress33_step1.png
$ neper -V simulation.sim -step 2 -datanodecoo coo -datanodecoofact 10 -showelt1d all \
    -dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
    13.5 -imagesize 800:800 -dataeltcol strain33 -dataeltscale \
    0.002:0.004:0.006:0.008:0.010:0.012:0.014:0.016:0.018 -print img_strain33_step2
$ convert "(" img_strain33_step2.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size \
    240x -background white -font DejaVu-Serif -pointsize 30 "caption:Strain 33" \
    -bordercolor white -border 0x12 "(" img_strain33_step2-scale3d.png -trim ")" \
    -gravity west -append ")" -background white -gravity center +append -bordercolor \
    white -border 20 -resize 600x600 -strip PNG8:strain33_step2.png
$ neper -V simulation.sim -step 2 -datanodecoo coo -datanodecoofact 10 -showelt1d all \
    -dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
    13.5 -imagesize 800:800 -dataeltcol stress33 -dataeltscale \
    200:250:300:350:400:450:500:550 -print img_stress33_step2
$ convert "(" img_stress33_step2.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size \
    240x -background white -font DejaVu-Serif -pointsize 30 "caption:Stress 33 [MPa]" \
    -bordercolor white -border 0x12 "(" img_stress33_step2-scale3d.png -trim ")" \
    -gravity west -append ")" -background white -gravity center +append -bordercolor \
    white -border 20 -resize 600x600 -strip PNG8:stress33_step2.png
$ python3 tutorial_pages.py plot simple_simulation . simulation.sim

Printing Intermediate Results#

The face forces are written at every increment, but the nodal and elemental results only at the end of each step (and at the initial state, step 0). Intermediate results are therefore obtained by cutting the loading into several steps: here two, ending at 5 s and 10 s, so that the fields above are available at 0.5 % and 1 % strain. With a single step (number_of_steps 1, target_time 10.0), only the final fields would be written. The results of a step can also be left out with print_results 0 for that step (see Simulation Results (simulation.cfg)).