Skip to main content

Structural FEM task generator and solver

Project description

CI PyPI – latest Test PyPI Docker pulls License: MIT

Generate random or predefined beam / plane‑stress (CST) tasks, solve them with CalFEM and produce:

  • PDF task cards (TikZ, Tectonic)
  • PNG plots (internal forces, displacements, stresses)
  • JSON results for auto‑grading

Powered by NumPy, CALFEM, gmsh & Tectonic; wrapped in a single Typer CLI and container image.

Requires

  • for local runs requires Tectonic 0.15.0 installed
    • As in https://tectonic-typesetting.github.io/book/latest/installation you can install using curl --proto '=https' --tlsv1.2 -fsSL https://drop-sh.fullyjustified.net |sh
  • Docker image comes with shipped Tectonic 0.15.0

Install

Tool Command
Stable wheel pip install structural-fem-taskgen-cli
Test PyPI pip install -i https://test.pypi.org/simple structural-fem-taskgen-cli
Docker image docker pull lukpacho/taskgen:latest

Quick Use ⚡️

CLI summary

taskgen --help
usage: taskgen [OPTIONS] COMMAND [ARGS]...

Options:
  --out-root, -o  Output directory (default: "./out" for docker, "~/.cache/taskgen" for local Python)
  --version, -V   Print version and exit
  --help          Show this message and exit

Commands:
  beam     Generate / solve 1‑D beam problems
  plane2d  Generate / solve 2‑D plane (CST) problems
  
Args: (see docs for beam/plan2d geometries)
  --beam-version (-v)     Available options: [1, 2, 3, 4, 5, 6, 7, 8, 999]
  --plane2d-version (-v)  Available options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  --num (-n)              Number of simulations per beam/plane2d version

Examples

Local Python / Docker container

# Create out/ directory
mkdir out
# Generate 10 random beams of beam-version 2 with task PDFs and solutions
taskgen --out-root ./out beam random -v 2 -n 10
# Generate 5 random beam tasks of beam-versions 2, 3, 4, 5 with task PDFs and solutions
takgen --out-root ./out beam random -v 2 -v 3 -v 4 -v 5 -n 5
# Do the same for plane2d through Docker (keeps host UID/GID)
docker run --rm \
  -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
  -v "$PWD/out:/out" \
  lukpacho/taskgen \
  plane2d random -v 2 -v 3 -v 4 -v 5 -n 5

Develop 🛠️

git clone https://github.com/lukpacho/structural-fem-taskgen.git
cd structural-fem-taskgen

# new env with deps
python -m venv .venv && source .venv/bin/activate
pip install -e .[dev]

# one‑shot lint | type‑check | tests
ruff check .
mypy src/ tests/
pytest -q

# auto‑format before commit
pre-commit install

Local smoke test

python -m build --wheel -o /tmp/dist
pipx run --spec /tmp/dist/*.whl taskgen --help
docker build -t taskgen-dev .
docker run --rm taskgen-dev --help

Release 📦 GitHub Actions workflow

  1. Lint, type‑check, test on 3.11 & 3.12.
  2. Build wheel + sdist → pip checktaskgen --help
  3. Upload to Test PyPI or PyPI (PYPI_TARGET (test/prod)).
  4. Build & push multi‑arch Docker images to GHCR and DockerHub.
  5. Run container smoke-test (docker run … --help).

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

structural_fem_taskgen_cli-0.1.6-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

Details for the file structural_fem_taskgen_cli-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for structural_fem_taskgen_cli-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 07a0ad25e7b38ffff68c1df0b3511a74e6504086940ff5c625defbf38fc7a4cf
MD5 dd565d4b3950e33fe2622f7409a42b60
BLAKE2b-256 bdc28b28bef9f04a0d0f016661aa1b25ed8c47aa0443654ed7708c9a3955b57f

See more details on using hashes here.

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