Overwriting Polycrystal Attributes#
Note
Read first: Simple Simulation.
Some inputs can be read from separate files, so that the same configuration and mesh files
serve several simulations in which the microstructure varies (read_phase_from_file,
read_ori_from_file, see File and Directory Formats). In this tutorial, a polycrystal of 50 grains
gets its phases from simulation.phase and per-element orientations from
simulation.ori. Neper generated the tessellation with the orientations of a file
orifile (one per grain), spread about each grain’s orientation by a normal distribution
of 5 degrees, and the mesh, with:
$ neper -T -n 50 -reg 1 -group "id<=25?1:2" -ori "file(orifile,des=rodrigues)" \
-orispread "normal(5)" -oridescriptor "rodrigues:active" -morpho gg -o simulation
$ neper -M simulation.tess -order 2 -format msh,ori -part 4
The phases are given per grain (element set) in simulation.phase: grains 1 to 25 are
of phase 1, grains 26 to 50 of phase 2:
$Groups
elset
50
1 1
2 1
...
26 2
...
50 2
$EndGroups
and the orientations per element in simulation.ori:
$ElementOrientations
5841 rodrigues:active
1 <r1> <r2> <r3>
...
$EndElementOrientations
The orientations of simulation.ori replace those of the mesh file. As Neper writes it,
the file also holds each grain’s orientation ($ElsetOrientations); the element orientations,
when given, are used instead. The material is an
LDX-2101 steel, austenite (fcc) and ferrite (bcc):
Phase |
Crystal type |
\(c_{11}\) [MPa] |
\(c_{12}\) [MPa] |
\(c_{44}\) [MPa] |
|---|---|---|---|---|
1 (austenite, \(\gamma\)) |
FCC |
\(204.6 \times 10^3\) |
\(137.7 \times 10^3\) |
\(126.2 \times 10^3\) |
2 (ferrite, \(\alpha\)) |
BCC |
\(236.9 \times 10^3\) |
\(140.6 \times 10^3\) |
\(116.0 \times 10^3\) |
\(m\) [-] |
\(\dot{\gamma}_0\) [1/s] |
\(\tau_0\) [MPa] |
\(h_0\) [MPa] |
\(\tau_s\) [MPa] |
\(n\) [-] |
|---|---|---|---|---|---|
0.02 |
1.0 |
200.0 |
391.9 |
335.0 |
1.0 |
The sample is loaded along \(z\) with the minimal conditions (uniaxial_minimal) at a
strain rate of 0.01 /s to the load 425 N, then unloaded at the same rate to 0 N; both steps end
at a load target (target_load), with time increments of 0.1 s, shortened down to 0.01 s near
the target. The orientations, the equivalent deformation rate, the work, the nodal coordinates
and the face forces are written.
Input Files#
## FEPX tutorial "Overwriting polycrystal attributes": a 50-grain two-phase polycrystal whose
## phases and orientations are read from simulation.phase and simulation.ori, loaded along z to
## 425 N and unloaded.
## Material
number_of_phases 2
phase 1
crystal_type FCC
model crystal_plasticity
c11 204.6e3
c12 137.7e3
c44 126.2e3
m 0.02
gammadot_0 1.0
tau_0 200.0
hardening saturation_isotropic
h_0 391.9
tau_s 335.0
n 1.0
phase 2
crystal_type BCC
model crystal_plasticity
c11 236.9e3
c12 140.6e3
c44 116.0e3
m 0.02
gammadot_0 1.0
tau_0 200.0
hardening saturation_isotropic
h_0 391.9
tau_s 335.0
n 1.0
## Input files
read_ori_from_file
read_phase_from_file
## Loading
boundary_conditions uniaxial_minimal
number_of_steps 2
strain_rate 33 1e-2 -1e-2
target_load 33 425.0 0.0
dtime 0.1 0.1
dtime_min 0.01 0.01
## Output
print forces
print ori
print coo
print defrate_eq
print work
print stress
print strain
Execution#
$ 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 : [i] Parsing file `simulation.ori'...
Info : - $ElsetOrientations from `simulation.ori' replaces the one
Info : from `simulation.msh'.
Info : - $ElementOrientations from `simulation.ori' replaces the one
Info : from `simulation.msh'.
Info : [i] Parsed file `simulation.ori'.
Info : [i] Parsing file `simulation.phase'...
Info : - $Groups from `simulation.phase' replaces the one from
Info : `simulation.msh'.
Info : [i] Parsed file `simulation.phase'.
Info : - Material parameters:
Info : > Number of phases: 2
Info : > Phase 1: fcc, crystal_plasticity
Info : . c11: 2.0460E+05 MPa
Info : . c12: 1.3770E+05 MPa
Info : . c44: 1.2620E+05 MPa
Info : . m: 2.0000E-02
Info : . gammadot_0: 1.0000E+00 1/s
Info : . hardening: saturation_isotropic
Info : . tau_0: 2.0000E+02 MPa
Info : . h_0: 3.9190E+02 MPa
Info : . tau_s: 3.3500E+02 MPa
Info : . n: 1.0000E+00
Info : . saturation_evolution: off (def.)
Info : . cyclic_hardening: off (def.)
Info : . precipitate_strengthening: off (def.)
Info : > Phase 2: bcc, crystal_plasticity
Info : . c11: 2.3690E+05 MPa
Info : . c12: 1.4060E+05 MPa
Info : . c44: 1.1600E+05 MPa
Info : . m: 2.0000E-02
Info : . gammadot_0: 1.0000E+00 1/s
Info : . hardening: saturation_isotropic
Info : . tau_0: 2.0000E+02 MPa
Info : . h_0: 3.9190E+02 MPa
Info : . tau_s: 3.3500E+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 uniaxial_minimal, 2 steps
Info : > Step 1: target_load 33 4.2500E+02 N from t = 0.0000E+00
Info : s, increments 1.0000E-02 to 1.0000E-01 s
Info : - Options other than the defaults:
Info : > read_ori_from_file
Info : > read_phase_from_file
Info : - Output: forces ori coo defrate_eq work stress strain
Info : (format ascii)
Info : - Mesh parameters:
Info : > Node number: 5931
Info : > Elt number: 3835 (10-node tetrahedra)
Info : > Elsets: 50; partitions: 4
Info : - Partitioning: 4 ranks
Info : > Elements per rank: 958 to 959
Info : > Ghost nodes per rank: 213 to 297 (992 in total)
Info : > Neighbors per rank: 3 to 3
Info : [o] Writing results to `simulation.sim'...
Info : Initializing simulation...
Info : - Elastic step of 1.1581E-03 s (step 1)
Info : > Iteration 1 (SA): R = 2.6701E+00 (612 CG iterations)
Info : > Iteration 2 (SA): R = 1.9275E-05 (604 CG iterations)
Info : > Converged in 2 iterations (1.531 s)
Info : Running step 1...
Info : - Increment 1: t = 1.0000E-01 s, dt = 9.8842E-02 s
Info : > Iteration 1 (SA): R = 1.1607E-03 (620 CG iterations)
Info : > Iteration 2 (NR): R = 4.1161E-06 (615 CG iterations)
Info : > Converged in 2 iterations (1.587 s)
[...]
Info : Final step terminated. Simulation completed successfully.
Info : [o] Wrote results to `simulation.sim'.
Info : - Increments: 10
Info : - Global iterations: 43 (19 NR)
Info : - CG iterations: 27805
Info : - Warnings issued: 0
Info : - Wall time per phase:
Info : > Input and setup: 0.115 s
Info : > Initialization: 1.543 s
Info : > Increments: 28.670 s
Info : . Element and material work: 17.506 s
Info : . CG: 11.025 s
Info : . Other: 0.140 s
Info : > Output: 0.560 s
Info : Elapsed time: 30.888 s
========================================================================
simulation.sim
|-- inputs
| |-- simulation.cfg
| |-- simulation.msh
| |-- simulation.ori
| `-- simulation.phase
`-- results
|-- elts
| |-- defrate_eq
| | |-- defrate_eq.step0
| | |-- defrate_eq.step1
| | `-- defrate_eq.step2
| |-- ori
| | |-- ori.step0
| | |-- ori.step1
| | `-- ori.step2
| |-- strain
| | |-- strain.step0
| | |-- strain.step1
| | `-- strain.step2
| |-- stress
| | |-- stress.step0
| | |-- stress.step1
| | `-- stress.step2
| `-- work
| |-- work.step0
| |-- work.step1
| `-- work.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#
Fig. 19 The sample colored by element orientation: the orientations vary within each grain.#
Fig. 20 Equivalent deformation rate at the end of the loading step (displacements magnified 50 times).#
Fig. 21 Work at the end of the unloading step (displacements magnified 50 times).#
Fig. 22 Stress of face z1 (force over current area) at every increment: the increments
shorten as each step approaches its load target.#
The commands:
$ neper -S simulation.sim -resmesh stress,strain
$ neper -V simulation.sim -step 0 -datanodecoo coo -showelt1d all -dataelt1drad 0.004 \
-dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle 13.5 -imagesize \
800:800 -dataeltcol ori -print img_ori
$ convert img_ori.png -trim -bordercolor white -border 20 -resize 600x600 -strip \
PNG8:ori.png
$ neper -V simulation.sim -step 1 -datanodecoo coo -datanodecoofact 50 -showelt1d all \
-dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
13.5 -imagesize 800:800 -dataeltcol defrate_eq -dataeltscale \
0.000:0.005:0.010:0.015:0.020:0.025:0.030 -print img_defrate_eq
$ convert "(" img_defrate_eq.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size 240x \
-background white -font DejaVu-Serif -pointsize 30 \
"caption:Equivalent deformation rate [1/s]" -bordercolor white -border 0x12 "(" \
img_defrate_eq-scale3d.png -trim ")" -gravity west -append ")" -background white \
-gravity center +append -bordercolor white -border 20 -resize 600x600 -strip \
PNG8:defrate_eq.png
$ neper -V simulation.sim -step 2 -datanodecoo coo -datanodecoofact 50 -showelt1d all \
-dataelt1drad 0.004 -dataelt3dedgerad 0.0015 -dataelt3dedgecol 32:32:32 -cameraangle \
13.5 -imagesize 800:800 -dataeltcol work -dataeltscale 0.0:0.5:1.0:1.5:2.0:2.5 \
-print img_work
$ convert "(" img_work.png -trim ")" "(" -size 40x1 xc:white ")" "(" -size 240x \
-background white -font DejaVu-Serif -pointsize 30 "caption:Work [mJ]" -bordercolor \
white -border 0x12 "(" img_work-scale3d.png -trim ")" -gravity west -append ")" \
-background white -gravity center +append -bordercolor white -border 20 -resize \
600x600 -strip PNG8:work.png
$ python3 tutorial_pages.py plot overwriting . simulation.sim