Jukka Aho 025bed90af refactor(mesh): slim Mesh core and harden surface extraction
Strip experimental permutation/coloring/ghost/named-ID baggage from the
concrete mesh type, adopt SPDX headers, and route boundary extraction through
an explicit `surface_topology` trait with clearer limitations.

- Replace the legacy banner with SPDX lines and tighten the struct/docstring to
  the fields that actually ship today.
- Drop bandwidth/permutation maps, industrial ID dictionaries, and parallel
  coloring/ghost sets from `Mesh` plus their helpers.
- Introduce `surface_topology(::Type{<:AbstractTopology})` for Tet/Hex volumes
  and guard `extract_surface` with `hasmethod` errors for unsupported solids.
- Remove `create_node_set_from_element_set!` (surface workflows should build sets
  explicitly or use topology-aware helpers later).
- Document that `extract_surface` still assumes the first `nnodes(FaceT)` nodes
  per volume element describe the boundary patch.
2026-05-09 17:38:39 +03:00
2026-05-09 16:30:27 +03:00
2026-05-09 16:30:28 +03:00
2026-05-09 16:30:23 +03:00

JuliaFEM.jl

logo

DOI License

JuliaFEM.jl is an open-source finite element framework written in Julia. The package is still 0.x; the repository is in the middle of a deliberate architectural reset toward a stable 1.0 with a type-stable, zero-allocation, GPU-friendly assembly pipeline. Many older READMEs and tutorials still describe the previous API; when in doubt, trust the code and AGENTS.md. Contributions (bug reports, docs, tests, and features) are welcome.

Status

Current focus areas:

  • Element{K, P, S, N} template with compile-time DOF layout.
  • DOFHandler and DOFBasedCOOAssembler (zero-allocation hot paths).
  • Microkernel-style physics in src/domains/{continuum, heat, thermo_elastic}/.
  • Matrix-free apply_K!, apply_M!, Dirichlet, multipoint constraints, IC(0) / Jacobi / block-Jacobi preconditioners and a generalized eigensolver in src/assemblers/.
  • A KernelAbstractions backend for the matrix-free path with a Float32 Metal smoke test in test/backend/metal/.

The legacy element-based API (Problem, update!, Analysis, …) is still present under src/legacy/ for backward compatibility but is not the recommended entry point.

Installing

using Pkg
Pkg.add("JuliaFEM")

A modern minimal example

using JuliaFEM

mesh = create_structured_box_mesh(Hex8;
    xmin = 0.0, xmax = 1.0, nx = 4,
    ymin = 0.0, ymax = 1.0, ny = 4,
    zmin = 0.0, zmax = 1.0, nz = 4,
)

S  = @DOFSet{u::DOF{Displacement{3}, Vertex}}
ET = Element{Hex8, Lagrange{1}, S}
elements, handler = create_elements!(mesh, ET)

material = LinearElastic(E = 210e9, ν = 0.3)
kernel   = ContinuumKernel(ContinuumFormulation{FullThreeD}(),
                           material, Displacement{3}())

asm   = DOFBasedCOOAssembler()
cache = create_cache(asm, elements, handler, mesh, kernel)
assemble!(cache, asm, kernel, mesh)
K, f  = extract_system(cache)

The same block is parsed from this file in test/docs/readme_example.jl, so it stays copy-pasteable as the API evolves.

For a matrix-free Krylov solve, see test/assemblers/test_dof_based_apply_K.jl and test/assemblers/test_eigensolve.jl.

Documentation

Contributing

Please read docs/CONTRIBUTING.md before opening a pull request: fork and branch, keep changes review-sized, run tests, and describe what you changed.

Git commits. Keep history easy to read: small commits, usually one file; two files in one commit is fine when they are inseparable (e.g. a helper and its only caller). An optional hook (.githooks/, set core.hooksPath) caps staged paths at two. If that workflow feels unfamiliar, open your PR with tests passing and ask for help splitting history in review.

Code expectations. Assembly hot paths must stay type-stable and allocation-free after warmup; CI and test/assemblers/test_dof_based_zero_alloc.jl guard that. The full suite:

julia --project=. -e 'using Pkg; Pkg.test()'

Use that locally before opening a PR; CI runs the same tests.

Citing

If you use JuliaFEM.jl in academic work, please cite

@article{frondelius2017juliafem,
  title   = {Julia{FEM} - open source solver for both industrial and academia usage},
  volume  = {50},
  url     = {https://rakenteidenmekaniikka.journal.fi/article/view/64224},
  doi     = {10.23998/rm.64224},
  number  = {3},
  journal = {Rakenteiden Mekaniikka},
  author  = {Frondelius, Tero and Aho, Jukka},
  year    = {2017},
  pages   = {229-233}
}
S
Description
Languages
Julia 98%
Python 1.7%
Shell 0.3%