Add a feature
SkillDev toolsChecklist for adding a solver, public function, kernel, boundary condition or material behavior to JustRelax.jl without breaking the 2D/3D, CPU/GPU and MPI module structure. Use when adding or wiring new functionality.
Available today. Use it from your connected AI after setup.
No other account needed.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the Add a feature skill
What this skill tells your AI
The instructions your AI receives, as published by ptsolvers/justrelax.jl in .claude/skills/add-feature/SKILL.md and read by ahel’s review.
Read the deep reference for the area first: .agents/solvers.md (iteration loops), .agents/api.md (dispatch, exports), .agents/grid.md (field layout), .agents/mpi.md (halos, reductions), plus the "Adding …" sections of docs/src/man/developer.md. The path-scoped rules in .claude/rules/ load automatically for the files you touch.
Most model rheology needs no JustRelax change: define phases with GeoParams SetMaterialParams in the miniapp and pass rheology and PhaseRatios to compute_viscosity!, compute_ρg! and the solver. Add code under src/rheology/ only for a new derived field or solver-side evaluation.
Checklist
- Pick the home. Start from the closest existing family:
src/stokes/,src/variational_stokes/,src/DYREL/,src/thermal_diffusion/,src/rheology/orsrc/boundaryconditions/. Code independent of both dimension and device goes insrc/common.jlor a file it includes. Keep 2D and 3D entry points separate. - Write the kernels to kernel-rules:
@parallel/@parallel_indices (I...),@idxlaunches,@dxi-style spacing access, MiniKernels helpers, GPU-safe, no scalar indexing. Copy the nearest existing kernel. - Wire the public entry point in three layers (api-rules): public function →
backend(x)trait → CPU method in shared code → CUDA and AMDGPU methods insrc/ext/{CUDA,AMDGPU}/{2D,3D}.jlforwarding to the same_impl. Prefer thekwargs...+flatten_solver_kwargsconvention for solver entry points. - Update all six module headers (backend-rules). If shared code uses a name from the root
JustRelaxmodule or from JustPIC, add it to theimportblocks of CPU 2D, CPU 3D, CUDA 2D/3D and AMDGPU 2D/3D. Check withgrep -n <name> src/JustRelax_CPU.jl src/ext/*/*.jl. A miss is a GPU-onlyUndefVarError. - Include the files. A new source file is
included fromsrc/common.jl(or from the solver file that needs it) and from every GPU module that must provide the feature. Verify against each module'sincludelines. - Export in
src/common.jl(or the root module for cross-dimensional types). - Document. Docstring per docstring-rules; add the new source file to the
Pagesof the matchingdocs/src/man/api/*.mdpage; update the relevant manual page. See thebuild-docsskill. - Test (testing-rules). A focused
test/test_<name>.jl(auto-collected). Tiny grids; 3D GPU-capable tests keep the launched range ≤ 256 cells. If the test is CPU-only, add it to the GPU exclusion list intest/runtests.jl; if it is light, add it totest_worker. A halo change needs an MPI test that also passes on one rank. - Miniapp. Update affected miniapps; add one for a new solver or physics (
new-miniapp). A convergence-affecting change needs a benchmark run, not just unit tests (miniapps-and-benchmarks). - Format and spelling.
git runic --inplaceon the changed Julia files only; CI also runstypos. - Verify in this order: the smallest relevant test → the full CPU suite for solver, type, dispatch or kernel changes (
running-tests) → docs build for public-API or docs changes →git diff --checkandgit status(no unrelated files). - Report exactly which backends and rank counts you ran. CPU-only validation does not establish accelerator or MPI correctness.
Conventions
- Files: follow the directory's existing naming. Types
PascalCase, functionssnake_case, mutating functions end with!, and_implfor the implementation behind a public function (style-rules). - Do not break the public API; deprecate first.
- Backend-generic code allocates through the backend tag, never with a plain
Array. - New dependencies go in
[deps]and[compat]of the rootProject.toml; device and plotting packages stay weakdeps behind the extensions, andGLMakiemust never appear in the rootProject.toml(CI'sCheck Dependenciesfails on it). A test-only package goes in[extras]and[targets]. - New boundary conditions: add the type or kernel under
src/boundaryconditions/, include it throughBoundaryConditions.jl, validate incompatible face combinations in the constructor, and apply throughflow_bcs!/thermal_bcs!.
PR
Title starts with [BUGFIX], [ADDITION] or [DOC]. Fill in .github/PULL_REQUEST_TEMPLATE.md: tests added or updated, miniapps updated, no public-API break, docs added, Runic formatting.
Signals
- GitHub stars
- 44
- Forks
- 12
- Last commit
- Sep 2026
Advanced
- Item type
- skill
- Key
add-feature-ptsolvers- Source
- github.com/ptsolvers/justrelax.jl