Skip to content

Feature: Custom Quantities#384

Merged
JonathanMaes merged 10 commits into
mumax:3.11.2from
jplauzie:Custom_Quantities
Apr 13, 2026
Merged

Feature: Custom Quantities#384
JonathanMaes merged 10 commits into
mumax:3.11.2from
jplauzie:Custom_Quantities

Conversation

@jplauzie

@jplauzie jplauzie commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

This branch adds the ability for the user to promote arbitrary slices (which can be made using NewScalarMask and NewVectorMask) into a custom Quantity. The implementation is backported from @XuebingZhao 's umagnus fork. Currently, custom fields can only be made from existing Quantities, Const or Constvector , limiting the amount of spatially varying Quantities that are possible.

  • The main use case is that it allows users to create spatially varying field terms that are not limited to 256 regions, but of course there are many other options. Does not use any Cuda, so probably slower than Jakelove's Feature/spatial_quantity #289 implementation for spatial Quantities, but also probably more flexible overall.
  • Works with both Scalar and Vector slices. Adding functionality to handle tensors isn't included and would be a bit of extra work, but users can fairly easily build a rank2 tensor out of Vectors.
  • Works with normal Quantity operators (Add, Mul, etc), as well as with Run/Relax/Minimize etc.
  • Included is a test file custom_quantities.mx3. I compared it to mumax's built-in uniaxial anisotropy, it matches exactly within numerical precision.
  • In a previous PR, I mentioned potentially doing custom Excitations. After spending some more time on it, I believe it should actually be possible to do time varying Quantities as well, but it will take some more time to fully work it out and verify, so that will come at some later time in a different PR.

JonathanMaes and others added 6 commits March 12, 2026 15:12
This Branch adds the ability for the user to define promote arbitrary slices (both scalar masks and vector masks) into a Custom Quantity.

Implementation follows xfong's implementation in the https://github.com/seeder-research/umagnus fork.
Previous was old version (no functional changes, just comments)
mx3 file went to wrong folder on new PR.
@JonathanMaes
JonathanMaes changed the base branch from master to 3.11.2 March 18, 2026 15:27
Comment thread test/custom_quantities.mx3 Outdated
Comment thread engine/ext_customquantities.go Outdated
Comment thread test/custom_quantities.mx3
Comment thread test/custom_quantities.mx3 Outdated
@JonathanMaes JonathanMaes added this to the 3.12 milestone Mar 19, 2026
@JonathanMaes

Copy link
Copy Markdown
Contributor

I also think this feature is sufficiently useful to rename the file ext_customquantities.go to customquantity.go.

Fixes following comments:

Relaxes changed to short Runs. Relax was not needed, just a convenience during testing, and Run() finishes the test faster.

Renamed to customquantity.go

Description clarified that slices can be created using NewScalarMask and NewVectorMask, and that the slices should match the grid size.

Remove  a superfluous multiplication by 1 that was left over from initial testing
Remind users that custom Quantities are not limited to 256 regions
added Loadfile to description
@jplauzie jplauzie mentioned this pull request Apr 10, 2026
6 tasks
@JonathanMaes
JonathanMaes merged commit 9463049 into mumax:3.11.2 Apr 13, 2026
@JonathanMaes JonathanMaes mentioned this pull request Apr 13, 2026
4 tasks
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.

3 participants