Basics
The settings, the units, the command line and the conventions every script relies on.
Settings
Section titled “Settings”xfea keeps its settings in ~/.xfea/config.json, written with the defaults the first time xfea is imported. Read and
set them through xfea.settings:
from xfea import settings
settings.SOLVER_THREADS = 4 # saved to config.json as soon as it is setsettings.DEFAULT_VIEWER = "browser"print(settings.DEFAULT_BACKEND)| Setting | What it is | Saved |
|---|---|---|
SOLVER_THREADS |
Threads the solver runs with when a run does not say (cpus=). Default 1. |
yes |
DEFAULT_VIEWER |
The viewer plugin used when none is named. | yes |
DEFAULT_DATABASE |
The results database plugin used when none is named. | yes |
DEFAULT_ALGORITHM |
The meshing plugin that xfea.apply_configured_defaults() sets as the default. |
yes |
DEFAULT_BACKEND |
The local solver plugin that xfea.apply_configured_defaults() activates. |
yes |
VERBOSE |
More output and checks while running. | this session |
MESH_VERBOSE |
Show the meshing plugin’s output. | this session |
GLOBAL_FRAME |
The global frame local frames are given in (world XY). | this session |
PRECISION |
The decimals node coordinates are rounded to when nodes are matched by place. Default 2. | this session |
settings.reset() puts the defaults back and saves them.
xfea does not check or convert units. Every number goes to the solver as you wrote it, so pick one consistent set and keep to it. This documentation and the examples use newtons and millimetres:
| Quantity | N and mm | N and m |
|---|---|---|
| Length | mm | m |
| Force | N | N |
| Stress, modulus | MPa (N/mm²) | Pa |
| Mass | t | kg |
| Density | t/mm³ (steel: 7.85e-9) | kg/m³ (steel: 7850) |
| Gravity | 9810 mm/s² | 9.81 m/s² |
| Time | s | s |
Three places where the choice shows:
step.add_gravity_field()takesg=9810by default, for millimetres. In metres, passg=9.81.- The grade recipes, such as
ElasticIsotropic.steel("s355"), are in Pa and kg/m³, for a model in N and m. For a model in N and mm, write the values out:ElasticIsotropic(E=210_000, v=0.3, density=7.85e-9). - The section profiles, such as
ISection.IPE200, are in mm.
Command line
Section titled “Command line”| Command | What it prints |
|---|---|
xfea version |
The installed version. |
xfea settings |
The current settings. |
xfea meshers |
The meshing plugins installed. |
xfea viewers |
The viewer plugins installed. |
xfea backends |
The solver plugins installed here with a valid licence. An empty list is normal: solving then goes through the conversion service. |
xfea status [FOLDER] |
How the solves under a folder have gone, or are going. -f prints it again every few seconds until the solve ends. |
Conventions
Section titled “Conventions”- Axes. Coordinates, loads and results are in the global axes x, y and z unless a frame is given. Gravity acts along −z by default.
- Components. Forces and displacements are
x,y,z; moments and rotations arexx,yy,zz, about those axes, rotations in radians. - Stresses.
s11tos23, with 1, 2 and 3 for the global x, y and z. - Beams. A beam’s
orientationis the direction of its local y axis, the axis the section’sIxxis about. On a beam along x withorientation=[0, 1, 0], the section’shis vertical andIxxcarries vertical loads. - Forces at nodes.
step.add_uniform_forcefieldputs the full value on every node it is given: to spread a total force F over n nodes, give F / n. - Selecting by place. Supports and loads go on nodes found where they are:
part.find_closest_nodes_to_point(point),part.find_nodes_on_plane(plane)orpart.nodes.subgroup(lambda n: n.x < 1e-3).
© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them