Skip to content

Allow non-uniform initial magnetization - #56

Open
samjrholt wants to merge 2 commits into
mainfrom
allow-nonuniform-initial-state
Open

samjrholt wants to merge 2 commits into
mainfrom
allow-nonuniform-initial-state

Conversation

@samjrholt

Copy link
Copy Markdown

Closes #46

Summary

  • allow named non-uniform initial states from .p2
  • add --ini / --initial-state CLI support
  • allow loading nodal magnetisation from Tommos VTU snapshots
  • preserve uniform mx, my, mz initialisation
  • validate and normalize all initial magnetisation fields

Behaviour

The resolution priority is:

  1. CLI --ini / --initial-state
  2. CLI --m0-dir
  3. .p2 state
  4. .p2 mx, my, mz
  5. applied field direction

VTU initialisation requires the same mesh and node ordering. This restores the nodal magnetisation field only and is not a complete numerical restart.

Validation

  • /usr/bin/python3 -m py_compile src/tommos/initial_state.py src/tommos/io_utils.py src/tommos/loop.py tests/test_initial_state.py tests/test_package_imports.py
  • pixi run -e test pytest tests/test_initial_state.py (28 passed)
  • pixi run test (63 passed)
  • pixi run lint
  • pixi run -e lint ruff check src/tommos/initial_state.py tests/test_initial_state.py
  • pixi run -e lint ruff format --check src/tommos/initial_state.py tests/test_initial_state.py
  • pixi run build-package

@samjrholt
samjrholt requested a review from thomasschrefl July 31, 2026 12:23
samjrholt and others added 2 commits July 31, 2026 16:32
@lang-m
lang-m force-pushed the allow-nonuniform-initial-state branch from 0af6bda to 5e20603 Compare July 31, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow non-uniform initial magnetization

2 participants