agentfem 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. agentfem-0.1.1/AGENT_GUIDE.md +67 -0
  2. agentfem-0.1.1/CONCEPTS.md +194 -0
  3. agentfem-0.1.1/INSTALL.md +51 -0
  4. agentfem-0.1.1/MANIFEST.in +18 -0
  5. agentfem-0.1.1/PKG-INFO +199 -0
  6. agentfem-0.1.1/README.md +163 -0
  7. agentfem-0.1.1/WORKFLOW.md +78 -0
  8. agentfem-0.1.1/__init__.py +76 -0
  9. agentfem-0.1.1/agentfem.egg-info/PKG-INFO +199 -0
  10. agentfem-0.1.1/agentfem.egg-info/SOURCES.txt +122 -0
  11. agentfem-0.1.1/agentfem.egg-info/dependency_links.txt +1 -0
  12. agentfem-0.1.1/agentfem.egg-info/requires.txt +20 -0
  13. agentfem-0.1.1/agentfem.egg-info/top_level.txt +1 -0
  14. agentfem-0.1.1/amplitudes.py +211 -0
  15. agentfem-0.1.1/assembly.py +65 -0
  16. agentfem-0.1.1/benchmarks/README.md +11 -0
  17. agentfem-0.1.1/benchmarks/__init__.py +3 -0
  18. agentfem-0.1.1/boundary_models/__init__.py +5 -0
  19. agentfem-0.1.1/boundary_models/absorbing.py +119 -0
  20. agentfem-0.1.1/build_docs.py +351 -0
  21. agentfem-0.1.1/constitutive/__init__.py +31 -0
  22. agentfem-0.1.1/constitutive/elasticity.py +225 -0
  23. agentfem-0.1.1/constraints/__init__.py +388 -0
  24. agentfem-0.1.1/constraints/boundary.py +66 -0
  25. agentfem-0.1.1/diagnostics.py +61 -0
  26. agentfem-0.1.1/docs/api_style.md +94 -0
  27. agentfem-0.1.1/docs/architecture_review.md +82 -0
  28. agentfem-0.1.1/docs/documentation_site.md +52 -0
  29. agentfem-0.1.1/docs/extension_rules.md +64 -0
  30. agentfem-0.1.1/docs/module_map.md +33 -0
  31. agentfem-0.1.1/docs/publishing.md +56 -0
  32. agentfem-0.1.1/docs/tutorial_design.md +97 -0
  33. agentfem-0.1.1/docs/validation.md +52 -0
  34. agentfem-0.1.1/elements/README.md +8 -0
  35. agentfem-0.1.1/elements/__init__.py +7 -0
  36. agentfem-0.1.1/examples/README.md +54 -0
  37. agentfem-0.1.1/examples/static_elasticity_2d.py +85 -0
  38. agentfem-0.1.1/examples/transient_heat_2d.py +120 -0
  39. agentfem-0.1.1/examples/wave_packet_inclusion_2d.py +342 -0
  40. agentfem-0.1.1/examples/wave_packet_plate_2d.py +234 -0
  41. agentfem-0.1.1/fields.py +387 -0
  42. agentfem-0.1.1/forms.py +101 -0
  43. agentfem-0.1.1/io.py +120 -0
  44. agentfem-0.1.1/kernel/__init__.py +6 -0
  45. agentfem-0.1.1/kernel/constants.py +51 -0
  46. agentfem-0.1.1/kernel/dofs.py +55 -0
  47. agentfem-0.1.1/loads.py +225 -0
  48. agentfem-0.1.1/materials/__init__.py +24 -0
  49. agentfem-0.1.1/materials/data/__init__.py +1 -0
  50. agentfem-0.1.1/materials/data/aluminum_generic.json +14 -0
  51. agentfem-0.1.1/materials/data/orthotropic_template.json +24 -0
  52. agentfem-0.1.1/materials/data/silicon_generic.json +14 -0
  53. agentfem-0.1.1/materials/data/silicon_nitride_generic.json +14 -0
  54. agentfem-0.1.1/materials/data/steel_generic.json +14 -0
  55. agentfem-0.1.1/materials/library.py +169 -0
  56. agentfem-0.1.1/materials/properties.py +105 -0
  57. agentfem-0.1.1/materials/schemas.py +84 -0
  58. agentfem-0.1.1/mesh/__init__.py +479 -0
  59. agentfem-0.1.1/mesh/formats.py +198 -0
  60. agentfem-0.1.1/models.py +861 -0
  61. agentfem-0.1.1/operators/README.md +53 -0
  62. agentfem-0.1.1/operators/__init__.py +88 -0
  63. agentfem-0.1.1/operators/core.py +577 -0
  64. agentfem-0.1.1/operators/elasticity.py +68 -0
  65. agentfem-0.1.1/operators/system.py +117 -0
  66. agentfem-0.1.1/problems.py +497 -0
  67. agentfem-0.1.1/pyproject.toml +67 -0
  68. agentfem-0.1.1/setup.cfg +4 -0
  69. agentfem-0.1.1/skills/agentfem/SKILL.md +53 -0
  70. agentfem-0.1.1/skills/agentfem/references/concepts.md +45 -0
  71. agentfem-0.1.1/skills/agentfem/references/extension_rules.md +24 -0
  72. agentfem-0.1.1/skills/agentfem/references/module_map.md +27 -0
  73. agentfem-0.1.1/skills/agentfem/references/validation.md +14 -0
  74. agentfem-0.1.1/skills/agentfem/references/workflow.md +27 -0
  75. agentfem-0.1.1/solvers.py +86 -0
  76. agentfem-0.1.1/spaces.py +52 -0
  77. agentfem-0.1.1/studies.py +240 -0
  78. agentfem-0.1.1/time/__init__.py +70 -0
  79. agentfem-0.1.1/time/explicit.py +175 -0
  80. agentfem-0.1.1/time/runtime.py +91 -0
@@ -0,0 +1,67 @@
1
+ # AgentFEM Agent Guide
2
+
3
+ Use this guide when an AI agent is asked to build, review, extend, or debug a
4
+ finite-element simulation with AgentFEM.
5
+
6
+ ## First Steps
7
+
8
+ 1. Read `WORKFLOW.md` to identify the standard finite-element sequence.
9
+ 2. Read `CONCEPTS.md` to align terminology before changing code.
10
+ 3. Identify or create the `studies.Study` before choosing constitutive laws or
11
+ operators.
12
+ 4. Inspect or create a mesh summary before reasoning about boundary tags,
13
+ material regions, or output dimensions.
14
+ 5. Inspect the target application only after mapping it to AgentFEM concepts.
15
+ 6. Prefer existing `agentfem` APIs before adding new helpers.
16
+ 7. Add reusable code only when it belongs to a standard FEM concept.
17
+
18
+ ## Progressive Reading
19
+
20
+ - Mesh or boundary tagging: read `docs/module_map.md`, then use
21
+ `mesh.summarize_mesh`, `mesh.require_cell_tags`, and
22
+ `mesh.require_facet_tags`.
23
+ - Study setup: use `studies.linear_static`, `studies.first_order_transient`, or
24
+ `studies.second_order_dynamics` before building operators.
25
+ - Model audit: use `model.tree()`, `model.manifest()`, `model.summary()`, and
26
+ `model.check()` when multiple fields, regions, loads, constraints, or steps
27
+ must be inspected.
28
+ - Model registration: use `model.field(...)`, `model.material(...)`,
29
+ `model.fix(...)`, and `model.traction(...)` in application workflows when the
30
+ assets should stay visible and auditable.
31
+ - Application unknowns: use `fields.py` before dropping to `spaces.py`.
32
+ - Function spaces: inspect `spaces.py`; only inspect `kernel/dofs.py` for
33
+ implementation-level dof work.
34
+ - Essential boundary conditions: read `CONCEPTS.md`, then use `constraints/`.
35
+ - Natural loads: read `CONCEPTS.md`, then use `loads.body_load`,
36
+ `loads.neumann`, or `loads.boundary_load`.
37
+ - Constitutive laws: read `docs/extension_rules.md`, then use `constitutive/`.
38
+ - Absorbing or Robin-like terms: use `boundary_models/`.
39
+ - Assembly or lumped operators: inspect `assembly.py`.
40
+ - Time stepping: inspect `time/` and `problems.py`.
41
+ - Solves: inspect `solvers.py`.
42
+ - Analysis steps: prefer `model.step(...)` or `model.linear_static_step(...)`
43
+ when a model owns fields, materials, loads, and constraints. Use
44
+ `problems.linear_static` or `problems.first_order_transient` when a workflow
45
+ intentionally starts from explicit K/C/F operators without model ownership.
46
+ - Problem summaries: use `problems.FEMProblem` when a workflow needs a
47
+ broader structured audit record.
48
+ - Results: inspect `diagnostics.py`, then use `io.CSVLogger`,
49
+ `io.XDMFTimeSeries`, or `io.ResultWriter`.
50
+ - Example workflows: inspect `examples/` after reading `WORKFLOW.md`.
51
+
52
+ ## Agent Rules
53
+
54
+ - Do not mix constraints, loads, and boundary models.
55
+ - Do not hide the finite-element workflow inside overly broad abstractions.
56
+ - Keep application-specific geometry, source definitions, and parameter choices
57
+ outside the core platform.
58
+ - Validate imports, syntax, and a small runnable case after structural changes.
59
+ - When changing a public concept, update `CONCEPTS.md`, `WORKFLOW.md`, and the
60
+ relevant skill references.
61
+
62
+ ## Current Platform Focus
63
+
64
+ AgentFEM currently focuses on DOLFINx/PETSc workflows, linear elasticity,
65
+ explicit dynamics, weak loads, absorbing boundary models, diagnostics, and XDMF
66
+ output. The architecture should remain open to thermal, multiphysics,
67
+ viscoelastic, anisotropic, and coupled simulations.
@@ -0,0 +1,194 @@
1
+ # AgentFEM Concepts
2
+
3
+ This file defines the vocabulary that humans and AI agents should use when
4
+ working with AgentFEM.
5
+
6
+ ## Study
7
+
8
+ The early analysis context: analysis type, physics, dimension, and modeling
9
+ assumptions. Examples include linear static solid mechanics in 2D plane strain,
10
+ transient heat transfer in 2D, or second-order dynamics in 3D. A study is a
11
+ modeling declaration and validation object; it does not assemble or solve.
12
+ Constitutive laws and operators may use it to select modeling assumptions such
13
+ as 2D plane strain or plane stress.
14
+
15
+ ## Model
16
+
17
+ A lightweight registry of mesh, regions, fields, amplitudes, materials,
18
+ constraints, loads, and boundary models under a study. A model supports checks
19
+ and summaries for humans and agents. It should not hide operator construction
20
+ or solving.
21
+
22
+ ## Mesh
23
+
24
+ The computational domain and its topology/geometry. Mesh generation may be
25
+ application-specific, but standard mesh import, reading, tagging, and boundary
26
+ measures should use reusable helpers when possible.
27
+
28
+ A mesh summary records dimension, local/global entity counts, and available
29
+ cell/facet tags. A required-tag check is a modeling guard: it should fail early
30
+ when a material region or boundary label is missing.
31
+
32
+ External CAE mesh formats such as Abaqus input, NASTRAN bulk data, VTK, and
33
+ COMSOL-exported neutral formats should be converted into a DOLFINx-readable
34
+ format before analysis. AgentFEM treats this as mesh-format conversion, not as a
35
+ physics or solver concern.
36
+
37
+ ## Mesh Region
38
+
39
+ A named geometric location on the mesh, such as a boundary, material region, or
40
+ point set. Loads and constraints should be described as acting on regions and
41
+ targeting unknown fields.
42
+
43
+ Boundary regions provide restricted `ds(tag)` measures. Cell regions provide
44
+ restricted `dx(tag)` measures for material-dependent domain integrals.
45
+
46
+ ## Function Space
47
+
48
+ The finite-element approximation space for scalar, vector, or mixed unknowns.
49
+ Examples include displacement, temperature, pressure, and internal variables.
50
+
51
+ ## Unknown Field
52
+
53
+ An application-level finite-element unknown that bundles the space, solution
54
+ field, trial function, and test function. Unknown fields let beginner workflows
55
+ say `displacement` or `temperature` instead of manually managing `V`, `u`,
56
+ `du`, and `v`.
57
+
58
+ ## Field
59
+
60
+ A finite-element function living in a function space. Fields may represent an
61
+ unknown, a state variable, a coefficient, or an output quantity.
62
+
63
+ AgentFEM fields support eager same-space field algebra. For compatible fields
64
+ on the same function space, operations such as `u + dt * v` immediately compute
65
+ and return a new field with numerical dof values, similar to Cast3M field
66
+ operations or tensor-style array arithmetic. This is intentionally different
67
+ from symbolic weak-form expressions.
68
+
69
+ ## Amplitude
70
+
71
+ A named time history or scale factor used to drive prescribed data. Amplitudes
72
+ may be constant, ramped, tabular, sinusoidal, or application-defined. They are
73
+ model assets, but they are not finite-element fields: they do not own a
74
+ function space or spatial degrees of freedom.
75
+
76
+ Loads, constraints, sources, and prescribed data may reference amplitudes.
77
+
78
+ ## Constitutive Law
79
+
80
+ A local response relation that maps state to stress, flux, tangent, or another
81
+ response quantity. Elastic stress-strain equations belong here. Future
82
+ viscoelasticity, plasticity, thermal conduction, and coupled response laws
83
+ should also live here.
84
+
85
+ ## Material Record
86
+
87
+ A reusable set of material constants with units and provenance. Material
88
+ records are data assets. Constitutive laws are equations. Keep these concepts
89
+ separate so one material record can be used by different solvers or law
90
+ families when appropriate.
91
+
92
+ ## Material Properties
93
+
94
+ A typed parameter object created directly by a user or loaded from a material
95
+ record. For example, isotropic elastic properties store `young`, `poisson`, and
96
+ `density`; the constitutive relation uses those properties to compute stress.
97
+
98
+ ## Constraint
99
+
100
+ An essential or algebraic restriction on degrees of freedom. Dirichlet data,
101
+ periodicity, and MPC relations are constraints.
102
+
103
+ Neumann force, flux, and traction terms are not constraints.
104
+
105
+ ## Load
106
+
107
+ A weak right-hand-side source term, such as body force, heat source, Neumann
108
+ flux, or traction.
109
+
110
+ Natural boundary data is expressed as a load because it enters the weak form,
111
+ not as a direct dof restriction.
112
+
113
+ ## Boundary Model
114
+
115
+ A weak boundary physics model that is not simply an external load. Robin,
116
+ impedance, convection, and absorbing boundaries are boundary models.
117
+
118
+ ## Form
119
+
120
+ A UFL expression representing a weak-form contribution before assembly.
121
+
122
+ ## Operator
123
+
124
+ An assembled vector, matrix, diagonal/lumped operator, or linear algebra object
125
+ that acts on a field or residual.
126
+
127
+ At the application layer, operators should read like engineering finite-element
128
+ notation: `K u = F`, `M a + C v + K u = F`, or
129
+ `(C/dt + K) T = C T_old/dt + Q`. AgentFEM operator constructors may still
130
+ store UFL expressions before assembly, but their names should communicate the
131
+ matrix/vector role.
132
+
133
+ Operator contributions should remain addable. A multi-material stiffness may be
134
+ represented explicitly as `K = K1 + K2` or, preferably in audited scripts, as
135
+ `operators.combine(K1, K2, name="K")`.
136
+
137
+ Model-first helpers such as `model.stiffness(u)` may generate these
138
+ contribution sums from registered materials and regions, but the generated
139
+ operator should still be inspectable.
140
+
141
+ ## Analysis Step
142
+
143
+ A solve stage under a study. A step records the analysis method, time increment
144
+ when relevant, visible operators, boundary conditions, and solver options.
145
+
146
+ Examples include a linear static step solving `K U = F` and an implicit Euler
147
+ heat-transfer step solving `(C / dt + K) T_next = C T_old / dt + Q`.
148
+
149
+ The step should not hide the finite-element meaning. It is the place where
150
+ visible operators become a solveable algebraic problem.
151
+
152
+ ## Element Policy
153
+
154
+ A reusable interpolation, quadrature, or integration choice. DOLFINx should
155
+ remain the backend, but AgentFEM may eventually name common element policies for
156
+ consistent human and agent workflows.
157
+
158
+ ## State
159
+
160
+ A collection of fields used by a solver or time integrator. Examples include
161
+ first-order transient states and second-order displacement/velocity/acceleration
162
+ states.
163
+
164
+ For explicit second-order dynamics, the state may also store a mid-step
165
+ velocity such as `v_mid`, because central-difference boundary damping and
166
+ absorbing boundaries often use half-step velocity data.
167
+
168
+ ## Time Integrator
169
+
170
+ A time integrator advances a transient state according to a named numerical
171
+ method. In AgentFEM, `time.explicit.central_difference(...)` represents the
172
+ explicit central-difference method, i.e. the Newmark family with `beta=0` and
173
+ `gamma=1/2`.
174
+
175
+ Integrator names should describe the analysis route first, such as explicit
176
+ dynamics, and expose method parameters through `summary()` rather than forcing
177
+ beginner workflows to start from algorithm parameters.
178
+
179
+ ## Problem
180
+
181
+ A discrete algebraic or transient system, such as `K x = F`,
182
+ `C xdot + K x = F`, or `M a + C v + K u = F`. Problems solve systems; steps
183
+ describe the analysis stage, studies declare context, and models register
184
+ assets.
185
+
186
+ ## Diagnostic
187
+
188
+ A scalar or field quantity used to inspect correctness, convergence, stability,
189
+ or physical behavior.
190
+
191
+ ## Benchmark
192
+
193
+ A standard verification problem with expected quantities and tolerances.
194
+ Benchmarks validate platform capabilities; examples teach workflows.
@@ -0,0 +1,51 @@
1
+ # Install AgentFEM
2
+
3
+ AgentFEM depends on the FEniCSx/DOLFINx stack. For the MVP release, use
4
+ conda-forge unless you already maintain a compatible MPI/PETSc/DOLFINx build.
5
+
6
+ ## Recommended Environment
7
+
8
+ ```bash
9
+ mamba create -n agentfem-env -c conda-forge \
10
+ python=3.11 fenics-dolfinx=0.11 gmsh mpi4py petsc4py \
11
+ meshio matplotlib jupyterlab ipykernel
12
+ mamba activate agentfem-env
13
+ ```
14
+
15
+ Then install AgentFEM from the repository root:
16
+
17
+ ```bash
18
+ python -m pip install -e .
19
+ ```
20
+
21
+ ## Smoke Test
22
+
23
+ From the `agentfem` repository directory:
24
+
25
+ ```bash
26
+ python examples/static_elasticity_2d.py
27
+ ```
28
+
29
+ From the parent development directory:
30
+
31
+ ```bash
32
+ python agentfem/examples/static_elasticity_2d.py
33
+ ```
34
+
35
+ Expected output:
36
+
37
+ ```text
38
+ Model: cantilever_model
39
+ ...
40
+ Static elasticity result: .../examples_output/static_elasticity_2d.xdmf
41
+ ```
42
+
43
+ ## Optional Tools
44
+
45
+ - `meshio`: external CAE mesh conversion, including Abaqus `.inp` and NASTRAN
46
+ `.bdf/.nas` formats where supported by meshio.
47
+ - `mkdocs`, `mkdocs-material`, `pymdown-extensions`: documentation site.
48
+ - `jupyterlab`, `ipykernel`: notebook workflows.
49
+
50
+ `requirements.txt` records the tested MVP stack, but direct pip installation of
51
+ DOLFINx/PETSc/MPI packages may be fragile across platforms.
@@ -0,0 +1,18 @@
1
+ include README.md
2
+ include INSTALL.md
3
+ include WORKFLOW.md
4
+ include CONCEPTS.md
5
+ include AGENT_GUIDE.md
6
+ include pyproject.toml
7
+ recursive-include materials/data *.json
8
+ recursive-include docs *.md
9
+ recursive-include skills *.md
10
+ recursive-include examples *.py *.md
11
+ recursive-include benchmarks *.py *.md
12
+ recursive-include elements *.md
13
+ recursive-include operators *.md
14
+ prune site
15
+ prune examples_output
16
+ global-exclude .DS_Store
17
+ global-exclude __pycache__
18
+ global-exclude *.py[cod]
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentfem
3
+ Version: 0.1.1
4
+ Summary: Agent-oriented finite-element workflow tools built on DOLFINx/PETSc.
5
+ Author: Haoming Luo
6
+ Project-URL: Homepage, https://github.com/haoming-luo/agentfem
7
+ Project-URL: Repository, https://github.com/haoming-luo/agentfem
8
+ Project-URL: Issues, https://github.com/haoming-luo/agentfem/issues
9
+ Project-URL: Documentation, https://github.com/haoming-luo/agentfem#readme
10
+ Keywords: finite-element,fem,cae,dolfinx,fenicsx,scientific-computing,agent-oriented
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: numpy
21
+ Requires-Dist: mpi4py
22
+ Provides-Extra: mesh-formats
23
+ Requires-Dist: meshio; extra == "mesh-formats"
24
+ Provides-Extra: docs
25
+ Requires-Dist: mkdocs; extra == "docs"
26
+ Requires-Dist: mkdocs-material; extra == "docs"
27
+ Requires-Dist: pymdown-extensions; extra == "docs"
28
+ Provides-Extra: notebooks
29
+ Requires-Dist: jupyterlab; extra == "notebooks"
30
+ Requires-Dist: ipykernel; extra == "notebooks"
31
+ Requires-Dist: nbformat; extra == "notebooks"
32
+ Requires-Dist: nbclient; extra == "notebooks"
33
+ Provides-Extra: dev
34
+ Requires-Dist: build; extra == "dev"
35
+ Requires-Dist: twine; extra == "dev"
36
+
37
+ # AgentFEM
38
+
39
+ AgentFEM is an agent-oriented finite-element workflow platform built on
40
+ DOLFINx/PETSc. It aims to make finite-element scripts readable to both
41
+ researchers and AI agents by keeping the standard CAE workflow visible:
42
+
43
+ ```text
44
+ Study -> Model -> Mesh/Regions -> Fields -> Materials -> Loads/Constraints
45
+ -> Operators -> Step -> Solve -> Diagnostics/Output
46
+ ```
47
+
48
+ The current MVP focuses on linear elasticity, transient heat conduction,
49
+ explicit elastodynamics, reusable loads and constraints, material records,
50
+ operator-level `K/M/C/F` notation, model inspection, and ParaView/XDMF output.
51
+
52
+ ## Why AgentFEM
53
+
54
+ - Finite-element language for humans: `model.linear_static_step(...)`,
55
+ `model.tree()`, `operators.xtmx(...)`, and field algebra such as
56
+ `u_next = u + dt * v + 0.5 * dt**2 * a`.
57
+ - Inspectable objects for agents: `study.summary()`, `model.manifest()`,
58
+ `operator.summary()`, and step summaries.
59
+ - Transparent layers: daily workflows use `models`, `fields`, `loads`,
60
+ `operators`, and `problems`; advanced users can still drop to `forms`,
61
+ `assembly`, PETSc, or DOLFINx when needed.
62
+
63
+ ## Install
64
+
65
+ AgentFEM currently expects a working FEniCSx/DOLFINx stack. The recommended
66
+ route is conda-forge:
67
+
68
+ ```bash
69
+ mamba create -n agentfem-env -c conda-forge \
70
+ python=3.11 fenics-dolfinx=0.11 gmsh mpi4py petsc4py \
71
+ meshio matplotlib jupyterlab ipykernel
72
+ mamba activate agentfem-env
73
+ ```
74
+
75
+ For local development from this repository:
76
+
77
+ ```bash
78
+ python -m pip install -e .
79
+ ```
80
+
81
+ After the first PyPI release, users will install AgentFEM with:
82
+
83
+ ```bash
84
+ python -m pip install agentfem
85
+ ```
86
+
87
+ `requirements.txt` records the tested MVP stack and optional documentation /
88
+ notebook helpers. Pure pip installation of DOLFINx can be fragile because MPI,
89
+ PETSc, and HDF5 must match.
90
+
91
+ ## Quick Start
92
+
93
+ Run the beginner static-elasticity example:
94
+
95
+ ```bash
96
+ python examples/static_elasticity_2d.py
97
+ ```
98
+
99
+ From the parent development directory used in this workspace:
100
+
101
+ ```bash
102
+ python agentfem/examples/static_elasticity_2d.py
103
+ ```
104
+
105
+ The output is written to `examples_output/static_elasticity_2d.xdmf` and can be
106
+ opened in ParaView.
107
+
108
+ ## Minimal Workflow
109
+
110
+ ```python
111
+ from mpi4py import MPI
112
+ import numpy as np
113
+
114
+ from agentfem import fields, mesh, models, studies
115
+ from agentfem.constitutive import elasticity
116
+
117
+ study = studies.linear_static(
118
+ physics="solid_mechanics",
119
+ dimension=2,
120
+ assumption="plane_strain",
121
+ )
122
+
123
+ domain = mesh.rectangle(
124
+ lower=(0.0, 0.0),
125
+ upper=(1.0, 0.2),
126
+ cells=(40, 8),
127
+ comm=MPI.COMM_WORLD,
128
+ cell_type="quadrilateral",
129
+ )
130
+ model = models.create(study=study, mesh=domain, name="cantilever")
131
+
132
+ u = model.field(fields.displacement(domain, degree=1))
133
+ model.material(elasticity.isotropic_elastic(young=210e9, poisson=0.3, density=7800))
134
+
135
+ left = mesh.boundary(domain, lambda x: np.isclose(x[0], 0.0), name="left", tag=1)
136
+ right = mesh.boundary(domain, lambda x: np.isclose(x[0], 1.0), name="right", tag=2)
137
+ model.fix(u, on=left, value=0.0)
138
+ model.traction(value=(0.0, -1.0e6), on=right)
139
+
140
+ step = model.linear_static_step(target=u)
141
+ step.solve()
142
+
143
+ print(model.tree())
144
+ ```
145
+
146
+ The `Step` path is the recommended public workflow. It still exposes the
147
+ operator system for review:
148
+
149
+ ```python
150
+ print(step.system.summary())
151
+ ```
152
+
153
+ ## Public Workflow Modules
154
+
155
+ Beginner and agent-generated workflows should prefer:
156
+
157
+ ```python
158
+ from agentfem import studies, mesh, models, fields, materials, constitutive
159
+ from agentfem import amplitudes, constraints, loads, operators, problems
160
+ from agentfem import solvers, time, io, diagnostics
161
+ ```
162
+
163
+ Lower-level modules such as `forms`, `assembly`, `spaces`, and `kernel` remain
164
+ available for extension work and debugging, but they should not be the first
165
+ thing a new model exposes.
166
+
167
+ ## Examples
168
+
169
+ - `examples/static_elasticity_2d.py`: beginner linear-static mechanics example.
170
+ - `examples/transient_heat_2d.py`: intermediate first-order transient heat solve.
171
+ - `examples/wave_packet_plate_2d.py`: advanced explicit dynamics wave example.
172
+ - `examples/wave_packet_inclusion_2d.py`: advanced wave propagation with
173
+ regional material assignment and absorbing/periodic boundary handling.
174
+
175
+ ## Documentation
176
+
177
+ - `WORKFLOW.md`: standard AgentFEM modeling sequence.
178
+ - `INSTALL.md`: tested MVP environment and smoke-test command.
179
+ - `CONCEPTS.md`: shared vocabulary for finite-element and agent workflows.
180
+ - `AGENT_GUIDE.md`: first file for AI agents working in this repository.
181
+ - `docs/`: design notes, module map, validation notes, and extension rules.
182
+ - `docs/publishing.md`: PyPI release checklist and Trusted Publisher setup.
183
+ - `site/index.html`: generated static documentation site.
184
+
185
+ Rebuild the local documentation site with:
186
+
187
+ ```bash
188
+ python build_docs.py
189
+ ```
190
+
191
+ ## MVP Status
192
+
193
+ AgentFEM is a research-oriented MVP. It is not yet a general-purpose CAE
194
+ replacement. The stable direction is:
195
+
196
+ - model-first workflows for common analyses,
197
+ - operator-first workflows for transparent research code,
198
+ - structured model manifests for agents,
199
+ - examples and benchmarks that make assumptions explicit.
@@ -0,0 +1,163 @@
1
+ # AgentFEM
2
+
3
+ AgentFEM is an agent-oriented finite-element workflow platform built on
4
+ DOLFINx/PETSc. It aims to make finite-element scripts readable to both
5
+ researchers and AI agents by keeping the standard CAE workflow visible:
6
+
7
+ ```text
8
+ Study -> Model -> Mesh/Regions -> Fields -> Materials -> Loads/Constraints
9
+ -> Operators -> Step -> Solve -> Diagnostics/Output
10
+ ```
11
+
12
+ The current MVP focuses on linear elasticity, transient heat conduction,
13
+ explicit elastodynamics, reusable loads and constraints, material records,
14
+ operator-level `K/M/C/F` notation, model inspection, and ParaView/XDMF output.
15
+
16
+ ## Why AgentFEM
17
+
18
+ - Finite-element language for humans: `model.linear_static_step(...)`,
19
+ `model.tree()`, `operators.xtmx(...)`, and field algebra such as
20
+ `u_next = u + dt * v + 0.5 * dt**2 * a`.
21
+ - Inspectable objects for agents: `study.summary()`, `model.manifest()`,
22
+ `operator.summary()`, and step summaries.
23
+ - Transparent layers: daily workflows use `models`, `fields`, `loads`,
24
+ `operators`, and `problems`; advanced users can still drop to `forms`,
25
+ `assembly`, PETSc, or DOLFINx when needed.
26
+
27
+ ## Install
28
+
29
+ AgentFEM currently expects a working FEniCSx/DOLFINx stack. The recommended
30
+ route is conda-forge:
31
+
32
+ ```bash
33
+ mamba create -n agentfem-env -c conda-forge \
34
+ python=3.11 fenics-dolfinx=0.11 gmsh mpi4py petsc4py \
35
+ meshio matplotlib jupyterlab ipykernel
36
+ mamba activate agentfem-env
37
+ ```
38
+
39
+ For local development from this repository:
40
+
41
+ ```bash
42
+ python -m pip install -e .
43
+ ```
44
+
45
+ After the first PyPI release, users will install AgentFEM with:
46
+
47
+ ```bash
48
+ python -m pip install agentfem
49
+ ```
50
+
51
+ `requirements.txt` records the tested MVP stack and optional documentation /
52
+ notebook helpers. Pure pip installation of DOLFINx can be fragile because MPI,
53
+ PETSc, and HDF5 must match.
54
+
55
+ ## Quick Start
56
+
57
+ Run the beginner static-elasticity example:
58
+
59
+ ```bash
60
+ python examples/static_elasticity_2d.py
61
+ ```
62
+
63
+ From the parent development directory used in this workspace:
64
+
65
+ ```bash
66
+ python agentfem/examples/static_elasticity_2d.py
67
+ ```
68
+
69
+ The output is written to `examples_output/static_elasticity_2d.xdmf` and can be
70
+ opened in ParaView.
71
+
72
+ ## Minimal Workflow
73
+
74
+ ```python
75
+ from mpi4py import MPI
76
+ import numpy as np
77
+
78
+ from agentfem import fields, mesh, models, studies
79
+ from agentfem.constitutive import elasticity
80
+
81
+ study = studies.linear_static(
82
+ physics="solid_mechanics",
83
+ dimension=2,
84
+ assumption="plane_strain",
85
+ )
86
+
87
+ domain = mesh.rectangle(
88
+ lower=(0.0, 0.0),
89
+ upper=(1.0, 0.2),
90
+ cells=(40, 8),
91
+ comm=MPI.COMM_WORLD,
92
+ cell_type="quadrilateral",
93
+ )
94
+ model = models.create(study=study, mesh=domain, name="cantilever")
95
+
96
+ u = model.field(fields.displacement(domain, degree=1))
97
+ model.material(elasticity.isotropic_elastic(young=210e9, poisson=0.3, density=7800))
98
+
99
+ left = mesh.boundary(domain, lambda x: np.isclose(x[0], 0.0), name="left", tag=1)
100
+ right = mesh.boundary(domain, lambda x: np.isclose(x[0], 1.0), name="right", tag=2)
101
+ model.fix(u, on=left, value=0.0)
102
+ model.traction(value=(0.0, -1.0e6), on=right)
103
+
104
+ step = model.linear_static_step(target=u)
105
+ step.solve()
106
+
107
+ print(model.tree())
108
+ ```
109
+
110
+ The `Step` path is the recommended public workflow. It still exposes the
111
+ operator system for review:
112
+
113
+ ```python
114
+ print(step.system.summary())
115
+ ```
116
+
117
+ ## Public Workflow Modules
118
+
119
+ Beginner and agent-generated workflows should prefer:
120
+
121
+ ```python
122
+ from agentfem import studies, mesh, models, fields, materials, constitutive
123
+ from agentfem import amplitudes, constraints, loads, operators, problems
124
+ from agentfem import solvers, time, io, diagnostics
125
+ ```
126
+
127
+ Lower-level modules such as `forms`, `assembly`, `spaces`, and `kernel` remain
128
+ available for extension work and debugging, but they should not be the first
129
+ thing a new model exposes.
130
+
131
+ ## Examples
132
+
133
+ - `examples/static_elasticity_2d.py`: beginner linear-static mechanics example.
134
+ - `examples/transient_heat_2d.py`: intermediate first-order transient heat solve.
135
+ - `examples/wave_packet_plate_2d.py`: advanced explicit dynamics wave example.
136
+ - `examples/wave_packet_inclusion_2d.py`: advanced wave propagation with
137
+ regional material assignment and absorbing/periodic boundary handling.
138
+
139
+ ## Documentation
140
+
141
+ - `WORKFLOW.md`: standard AgentFEM modeling sequence.
142
+ - `INSTALL.md`: tested MVP environment and smoke-test command.
143
+ - `CONCEPTS.md`: shared vocabulary for finite-element and agent workflows.
144
+ - `AGENT_GUIDE.md`: first file for AI agents working in this repository.
145
+ - `docs/`: design notes, module map, validation notes, and extension rules.
146
+ - `docs/publishing.md`: PyPI release checklist and Trusted Publisher setup.
147
+ - `site/index.html`: generated static documentation site.
148
+
149
+ Rebuild the local documentation site with:
150
+
151
+ ```bash
152
+ python build_docs.py
153
+ ```
154
+
155
+ ## MVP Status
156
+
157
+ AgentFEM is a research-oriented MVP. It is not yet a general-purpose CAE
158
+ replacement. The stable direction is:
159
+
160
+ - model-first workflows for common analyses,
161
+ - operator-first workflows for transparent research code,
162
+ - structured model manifests for agents,
163
+ - examples and benchmarks that make assumptions explicit.