Skip to main content

Agent-oriented finite-element workflow tools built on DOLFINx/PETSc.

Project description

AgentFEM

AgentFEM is an agent-oriented finite-element workflow platform built on DOLFINx/PETSc. It aims to make finite-element scripts readable to both researchers and AI agents by keeping the standard CAE workflow visible:

Study -> Model -> Mesh/Regions -> Fields -> Materials -> Loads/Constraints
      -> Operators -> Step -> Solve -> Diagnostics/Output

The current MVP focuses on linear elasticity, transient heat conduction, explicit elastodynamics, reusable loads and constraints, material records, operator-level K/M/C/F notation, model inspection, and ParaView/XDMF output.

Why AgentFEM

  • Finite-element language for humans: model.linear_static_step(...), model.tree(), operators.xtmx(...), and field algebra such as u_next = u + dt * v + 0.5 * dt**2 * a.
  • Inspectable objects for agents: study.summary(), model.manifest(), operator.summary(), and step summaries.
  • Transparent layers: daily workflows use models, fields, loads, operators, and problems; advanced users can still drop to forms, assembly, PETSc, or DOLFINx when needed.

Install

AgentFEM currently expects a working FEniCSx/DOLFINx stack. The recommended route is conda-forge:

mamba create -n agentfem-env -c conda-forge \
  python=3.11 fenics-dolfinx=0.11 gmsh mpi4py petsc4py \
  meshio matplotlib jupyterlab ipykernel
mamba activate agentfem-env

For local development from this repository:

python -m pip install -e .

After the first PyPI release, users will install AgentFEM with:

python -m pip install agentfem

requirements.txt records the tested MVP stack and optional documentation / notebook helpers. Pure pip installation of DOLFINx can be fragile because MPI, PETSc, and HDF5 must match.

Quick Start

Run the beginner static-elasticity example:

python examples/static_elasticity_2d.py

From the parent development directory used in this workspace:

python agentfem/examples/static_elasticity_2d.py

The output is written to examples_output/static_elasticity_2d.xdmf and can be opened in ParaView.

Minimal Workflow

from mpi4py import MPI
import numpy as np

from agentfem import fields, mesh, models, studies
from agentfem.constitutive import elasticity

study = studies.linear_static(
    physics="solid_mechanics",
    dimension=2,
    assumption="plane_strain",
)

domain = mesh.rectangle(
    lower=(0.0, 0.0),
    upper=(1.0, 0.2),
    cells=(40, 8),
    comm=MPI.COMM_WORLD,
    cell_type="quadrilateral",
)
model = models.create(study=study, mesh=domain, name="cantilever")

u = model.field(fields.displacement(domain, degree=1))
model.material(elasticity.isotropic_elastic(young=210e9, poisson=0.3, density=7800))

left = mesh.boundary(domain, lambda x: np.isclose(x[0], 0.0), name="left", tag=1)
right = mesh.boundary(domain, lambda x: np.isclose(x[0], 1.0), name="right", tag=2)
model.fix(u, on=left, value=0.0)
model.traction(value=(0.0, -1.0e6), on=right)

step = model.linear_static_step(target=u)
step.solve()

print(model.tree())

The Step path is the recommended public workflow. It still exposes the operator system for review:

print(step.system.summary())

Public Workflow Modules

Beginner and agent-generated workflows should prefer:

from agentfem import studies, mesh, models, fields, materials, constitutive
from agentfem import amplitudes, constraints, loads, operators, problems
from agentfem import solvers, time, io, diagnostics

Lower-level modules such as forms, assembly, spaces, and kernel remain available for extension work and debugging, but they should not be the first thing a new model exposes.

Examples

  • examples/static_elasticity_2d.py: beginner linear-static mechanics example.
  • examples/transient_heat_2d.py: intermediate first-order transient heat solve.
  • examples/wave_packet_plate_2d.py: advanced explicit dynamics wave example.
  • examples/wave_packet_inclusion_2d.py: advanced wave propagation with regional material assignment and absorbing/periodic boundary handling.

Documentation

  • WORKFLOW.md: standard AgentFEM modeling sequence.
  • INSTALL.md: tested MVP environment and smoke-test command.
  • LICENSE: Apache-2.0 license for the open-source core.
  • CONTRIBUTING.md: contribution expectations and sign-off guidance.
  • CONCEPTS.md: shared vocabulary for finite-element and agent workflows.
  • AGENT_GUIDE.md: first file for AI agents working in this repository.
  • docs/: design notes, module map, validation notes, and extension rules.
  • docs/licensing.md: licensing strategy for the open-source core and optional commercial extensions.
  • docs/publishing.md: PyPI release checklist and Trusted Publisher setup.
  • site/index.html: generated static documentation site.

Rebuild the local documentation site with:

python build_docs.py

MVP Status

AgentFEM is a research-oriented MVP. It is not yet a general-purpose CAE replacement. The stable direction is:

  • model-first workflows for common analyses,
  • operator-first workflows for transparent research code,
  • structured model manifests for agents,
  • examples and benchmarks that make assumptions explicit.

License

AgentFEM is licensed under the Apache License, Version 2.0. The open-source core can be used in research, education, and commercial settings under that license. Commercial services, validated industrial workflows, hosted products, and proprietary extensions may be developed separately.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentfem-0.1.2.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentfem-0.1.2-py3-none-any.whl (70.1 kB view details)

Uploaded Python 3

File details

Details for the file agentfem-0.1.2.tar.gz.

File metadata

  • Download URL: agentfem-0.1.2.tar.gz
  • Upload date:
  • Size: 82.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for agentfem-0.1.2.tar.gz
Algorithm Hash digest
SHA256 889391dc0524bcaef3b6fd0b6dfd20e2dfbfdc4c966f724508c65c4e5a926604
MD5 899fe965a4088a24e1b746eb868bd47d
BLAKE2b-256 07ee3ba95b68c2dde27ad59ceb38b339f2bcd982b6115c4effb5f54782944319

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfem-0.1.2.tar.gz:

Publisher: publish-pypi.yml on haoming-luo/agentfem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentfem-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agentfem-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 70.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for agentfem-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b7813fd8462512d39255301dc4d3c24187cbfc1f155ad80ffa590a4439cd103
MD5 2bed781d4a86c7755c64b7613ec0eade
BLAKE2b-256 af18a1997c5145544b319605a51d88e3a8ba45399498c04d8c9d896b3e31d4c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfem-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on haoming-luo/agentfem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page