Examples
This section shows how to use pyFEBiOpt in realistic workflows. Start with the XPLT examples if you want to understand FEBio result reading and slicing. Move to the optimization example when you are ready to connect a FEBio template, measured data, and a SciPy optimizer.
Note
The optimization examples execute FEBio. Make sure febio4 is installed and
available on PATH, or edit FEBIO_COMMAND in the example script before
running it.
What to read first
xpltLearn how to open a FEBio
.xpltfile, inspect available variables, select domains/surfaces/nodesets, and slice by time, item, node, and component. This is the foundation for both postprocessing and optimization adapters.optimizationLearn how an optimization script is assembled: experimental series,
ParameterSpace, FEB template bindings, simulation cases, adapters,EngineOptions, monitoring, and final artifacts.
Runnable scripts
The repository includes two optimization scripts:
examples/simple_biaxial_fit.pyMinimal biaxial fit. It fits one material parameter, reads
stressfrom the generated.xpltfile, and demonstrates the basic Engine workflow.examples/simple_biaxial_hz_fit.pyHolzapfel-Gasser biaxial fit. It discovers material parameters from the FEB template, fits two stress components, and shows a larger multi-objective setup.
Run an example
From the repository root:
python examples/simple_biaxial_fit.py
Expected outputs depend on the configured storage mode, but optimization runs normally produce:
console progress from the optimizer,
optimization.logunder the work directory,exported
results/*.txtseries,final FEBio artifacts under
optimized_simulations/when final export runs,live run information in the monitor when
MonitorOptions(enabled=True)is set.
How examples relate to the API
Examples intentionally use the public API:
pyfebiopt.xplt.xpltfor result reading,pyfebiopt.optimizeclasses for optimization setup,SimulationAdapterto connect XPLT postprocessing to residual assembly,MonitorOptionsandpyfebiopt-monitorfor live run monitoring.
Use the generated API reference when you need exact constructor signatures or method details.