How jd26/formopt works
Main components
a. Front-end clients
– Jupyter notebooks (Tutorial.ipynb, Examples.ipynb, Elasticity.ipynb)
– CLI scripts (test.py, load.py, plots.py)
b. Core library
– models.py (problem definitions: elasticity, heat, etc.)
– load.py / plots.py (I/O & post-processing)
c. External engines & services
– FEniCSx (dolfinx) MPI‐based PDE assembly & solver
– pygmsh (mesh generation)
– h5py (HDF5 file I/O)
– PyVista (visualization)
d. Data storage
– File system: results/ (per-test directories with out.txt and ParaView .pvsm files)
– Git repo + docs/ + tex/ for documentation and manuscript sources
Relationships & data flows
– Notebooks/scripts invoke the Core library APIs
– Core library requests mesh from pygmsh → hands mesh to FEniCSx
– FEniCSx distributes mesh & fields across MPI ranks (data parallel), or Core spawns tasks (task parallel)
– Intermediate and final results written via h5py + plain text → stored under results/
– load.py & plots.py read these results → generate plots or ParaView state files → saved back to disk
Architectural patterns & design principles
– Modular pipeline: geometry → solver → optimization → I/O
– Strategy‐style parallelism: three interchangeable modes (data, task, mixed) controlled by a single entry point in formopt.py
– Separation of concerns: models.py only defines PDE specifications; formopt.py drives optimization; load/plots handle visualization
Technologies & frameworks
– Python 3.11, numpy, scipy, matplotlib
– FEniCSx 0.9 (dolfinx) + mpi4py
– pygmsh, h5py, PyVista
– Jupyter, MkDocs for docs, LaTeX for manuscript