TetraX merge requestshttps://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests2024-01-04T21:38:47+01:00https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/75Resolve "Implement missing interactions"2024-01-04T21:38:47+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Implement missing interactions"Closes #44Closes #44Version 2.0Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/74Merge develop downstream2024-01-04T13:05:04+01:00Koerber, Lukas (FWIN-C) - 108045Merge develop downstreamhttps://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/72Resolve "Frequency tolerance"2023-12-29T15:39:27+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Frequency tolerance"Closes #51Closes #51Version 2.0Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/71Resolve "Clean up reprs"2023-12-29T15:38:10+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Clean up reprs"Closes #56Closes #56Version 2.0https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/69Develop down merged to confined-axial-geometry.2023-12-20T11:30:24+01:00Kakay, Dr. Attila (FWIN) - 9524Develop down merged to confined-axial-geometry.Kakay, Dr. Attila (FWIN) - 9524Kakay, Dr. Attila (FWIN) - 9524https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/60Draft: Resolve "Implement numerics for confined_axial geometry."2023-12-20T11:26:26+01:00Koerber, Lukas (FWIN-C) - 108045Draft: Resolve "Implement numerics for confined_axial geometry."Closes #46Closes #46Version 2.0Kakay, Dr. Attila (FWIN) - 9524Kakay, Dr. Attila (FWIN) - 9524https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/70Fix missing scaling factor in iDMI tensor2023-12-20T11:16:55+01:00Koerber, Lukas (FWIN-C) - 108045Fix missing scaling factor in iDMI tensorOur iDMI tensor was wrong and did not include the proper scaling factor. This is now fixed.Our iDMI tensor was wrong and did not include the proper scaling factor. This is now fixed.https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/68Resolve "sample.scale and sample.mesh.scale has to be unified"2023-12-20T11:10:22+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "sample.scale and sample.mesh.scale has to be unified"Closes #54Closes #54Version 2.0Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/65Implement bulk DMI with proper boundary conditions. Tested against Jan Masell...2023-12-08T12:39:00+01:00Kakay, Dr. Attila (FWIN) - 9524Implement bulk DMI with proper boundary conditions. Tested against Jan Masell,...Implement bulk DMI with proper boundary conditions. Tested against Jan Masell, shooting method, Claas Abert.
Test completed with agreement to others for those discretizations for which the relaxation was working properly.Implement bulk DMI with proper boundary conditions. Tested against Jan Masell, shooting method, Claas Abert.
Test completed with agreement to others for those discretizations for which the relaxation was working properly.https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/64Resolve "Sorting of km space is not done properly for waveguide axial"2023-12-07T13:52:15+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Sorting of km space is not done properly for waveguide axial"Closes #49Closes #49Version 2.0https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/62Resolve "Implement unified vector products"2023-11-17T12:06:32+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Implement unified vector products"Closes #43
Cleanup, remove legacy code, and implement unified vector products in ```math.py```:
```python
AnyVector = TypeVar("AnyVector", MeshVector, FlattenedMeshVector, FlattenedLocalMeshVector, FlattenedAFMMeshVector, FlattenedLoc...Closes #43
Cleanup, remove legacy code, and implement unified vector products in ```math.py```:
```python
AnyVector = TypeVar("AnyVector", MeshVector, FlattenedMeshVector, FlattenedLocalMeshVector, FlattenedAFMMeshVector, FlattenedLocalAFMMeshVector)
LabVector = TypeVar("LabVector", MeshVector, FlattenedMeshVector)
def inner_product(vec1: AnyVector, vec2: AnyVector) -> MeshScalar:
...
def cross_product(vec1: LabVector, vec2: LabVector) -> LabVector:
...
def tensor_product(vec1: AnyVector, vec2: AnyVector) -> scipy.sparse.csr.csr_matrix:
...
```
With that, the following functions where removed:
- ```flattened_mesh_vec_scalar_product```
- ```flattened_mesh_vec_cross_product ```
- ```flattened_AFMmesh_vec_scalar_product```
- ```flattened_mesh_vec_tensor_product```
- ```flattened_mesh_vec_scalar_product2d```
- ```spherical_angles_to_mesh_vector``` (was not used anymore)
This allowed to remove the redundant ```FerromagneticSelfInteraction``` and ```AntiferromagneticSelfInteraction``` which where children of ```AbstracSelfInteraction``` and implemented the energy density with the respective adapted scalar product (which is now unified as ```inner_product```). Now all interactions directly inherit from ```AbstracSelfInteraction```. This name is no longer adequate since it also includes the ```ZeemannInteraction```. Therefore, ```AbstracSelfInteraction``` has been renamed to ```Interaction```.
Importantly ```flattened_AFMmesh_vec_scalar_product_separate``` still exist and is necessary to calculate the equilibrium field projection ```h0``` for antiferromagnetic. However, I did not want to resolve this now, since it is part of the greater issue #40.Version 2.0Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/63Merge develop downstream2023-11-13T16:54:35+01:00Koerber, Lukas (FWIN-C) - 108045Merge develop downstreamApplies changes from !62Applies changes from !62https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/61Merge develop downstream2023-11-11T15:42:25+01:00Koerber, Lukas (FWIN-C) - 108045Merge develop downstreamSmall bugfix and added ruff.tomlSmall bugfix and added ruff.tomlhttps://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/56Resolve "New architecture for experiments"2023-11-11T15:23:19+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "New architecture for experiments"## There is no more experimental result. The following major changes have been applied
- ```external_field``` or its alias (```Bext```), as well as ```antenna``` are directly attributes of ```Sample```.
- top-level numerical experiments ...## There is no more experimental result. The following major changes have been applied
- ```external_field``` or its alias (```Bext```), as well as ```antenna``` are directly attributes of ```Sample```.
- top-level numerical experiments ```relax(sample)```, ```eigenmodes(sample)``` (in the future, also, ```evolve```) are now functions that are called on the sample and are found in ```tetrax.experiments```
- Each experiment returns a result object that can be used for post-processing and plotting.
- stuff like ```show_mode()``` is now a method of the ```EigenResult``` as it should be.
- Post-processing like linewidth and absorption are now methods on the ```EigenResult``` class. Absorption also returns a plottable ```AbsorptionResult``` object.
## Example
Showing some of the new functionality
```python
import matplotlib.pyplot as plt
from tetrax import Sample, vectorfields, geometries, experiments
layer = Sample(geometries.layer.monolayer(50,1),name="new_dispersion_sample")
layer.external_field = (0,0,0)
layer.mag = (1,0.1,0)
rel = experiments.relax(layer)
rel
```
![Screen_Shot_2023-11-11_at_14.31.50](/uploads/8cbb8f0e24c7dbd194bd088e39e2d578/Screen_Shot_2023-11-11_at_14.31.50.png)
```python
rel.plot()
```
![Screen_Shot_2023-11-11_at_14.39.38](/uploads/8bcf2ef55a036acf853ad58927dc76de/Screen_Shot_2023-11-11_at_14.39.38.png)
```python
spectrum = experiments.eigenmodes(layer,num_cpus=-1,num_modes=5,Nk=81)
spectrum
```
![Screen_Shot_2023-11-11_at_14.33.08](/uploads/3b6d2f1f70790f07f3d61858be042608/Screen_Shot_2023-11-11_at_14.33.08.png)
```python
spectrum.plot()
```
![Screen_Shot_2023-11-11_at_14.39.03](/uploads/fe2fafb3917f0f90064c58de84f74374/Screen_Shot_2023-11-11_at_14.39.03.png)
```python
spectrum = experiments.eigenmodes(layer,num_cpus=-1,num_modes=5,Nk=81)
absorb = spectrum.absorption(experiments.CPWAntenna(200,10,20))
absorb.plot()
```
![Screen_Shot_2023-11-11_at_14.37.35](/uploads/af8e42d2fd7237ddcb5843a6476aad79/Screen_Shot_2023-11-11_at_14.37.35.png)
## Major stuff that is still missing
- The plotting, in general, needs to be cleaned up. Refer to #45.
- At any time, results should be saveable and loadable. Refer to #41.
Closes #39Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/54Resolve "Implement waveguide_axial geometry (including coordinate origin)"2023-11-10T14:35:54+01:00Koerber, Lukas (FWIN-C) - 108045Resolve "Implement waveguide_axial geometry (including coordinate origin)"Closes #38Closes #38Kakay, Dr. Attila (FWIN) - 9524Kakay, Dr. Attila (FWIN) - 9524https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/55Resolve "Clean up vectorfields"2023-10-21T11:49:03+02:00Koerber, Lukas (FWIN-C) - 108045Resolve "Clean up vectorfields"# Vectorfields
- include show_available, available (like in geometries)
- new fields: antivortex, hedgehog (alias for radial), uniform (alias for homogeneous), vortex radial
- revising variable names and adapting documentation
- added Un...# Vectorfields
- include show_available, available (like in geometries)
- new fields: antivortex, hedgehog (alias for radial), uniform (alias for homogeneous), vortex radial
- revising variable names and adapting documentation
- added UnitaryNumber (1,-1) and CartesianAxis (x,y,z) enums
# Other
I also added branch dependency for the CI pipelines, hopefully does stuff now only on the develop.
Closes #37Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/57Merge develop downstream2023-10-21T11:23:58+02:00Koerber, Lukas (FWIN-C) - 108045Merge develop downstreamApply changes from !55Apply changes from !55https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/51Moving refactor branch over to develop2023-10-20T21:21:53+02:00Koerber, Lukas (FWIN-C) - 108045Moving refactor branch over to developTo come back to somewhat of a clean git history, the refactor branch will be brought over to the develop again. Changes so far are a lot:
# Housekeeping
- stuff like magnetic_order or geometry_type are now proper enums in ```common```.
...To come back to somewhat of a clean git history, the refactor branch will be brought over to the develop again. Changes so far are a lot:
# Housekeeping
- stuff like magnetic_order or geometry_type are now proper enums in ```common```.
# Support for new geometries
- we now support axially symmetric waveguides (```waveguide_axial```)
- ```confined_axial``` is also possible but so far only without dipole interaction.
# new sample object
- The sample architecture has been entirely changed by getting rid of all inheritances (AbstracSample, FerromagneticMixin, WaveguideAFMSample, ConfinedFMSample, etc.) and instead using composition (Sample has mesh, material, magnetic_order as attributes).
## Sample itself
- has much less responsibilities
- is now created via the Sample(mesh) and ```create_sample``` throws a NotImplementedError
- needs a mesh upon creation; geometry_type is automatically inferred if templated geometry is used
- magnetization is automatically initialized to z direction
- information about the geometry and all differential operators are now gathered in the new ```SampleMesh``` class
- material parameters are now managed by the ```SampleMaterial``` class
- information about both in a notebook can be printed with ```sample.material``` or ```sample.mesh```
- ```Sample.plot()``` will be deprecated. It's functionality has been fully integrated in ```sample.show()```which can now take an optional field as the first argument. If no field is provided, the magnetization will be plotted.
## SampleMesh
- container that holds all the mesh information, which takes care of
- input validation and FEM preprocessing
- adding the mesh itself or its extrusion to an existing ```k3d``` plot
- quantities like the number of nodes should now be obtained as ```sample.mesh.nx```, but ```sample.nx``` is still included but throws a deprecation warning.
- Template geometries have been refactoed with more meaningful notation, reorganized into packages ```geometries.confined```, ```geometries.waveguide``` and so on, for a more overview. Available geometries can be inspected with ```geometries.available``` (a list) or ```geometries.show_available()``` which also prints the function signatures.
## SampleMaterial
- all material parameters are now managed by a container class ```SampleMaterial``` which behaves kind of like a dictionary and takes of a couple of things:
- the set of materials parameters is chosen upon creation (e.g. when using FM vs AFMs).
- checking if a parameter exists when getting or setting.
- notifying the ```Sample.interactions``` if their material parameters have changed (which then update via an observer pattern).
- a specific parameter can be obtained, for example, my ```Sample.material["Msat"]
- the parameters itself are stored as ```MaterialParameter```s which have metadata such as units, etc. They take care of input validation and possible extending of given single numbers to ```MeshScalar```s etc. They can have constraints on their values such as ```is_posive```. The numerical values themselves are retrieved with ```MaterialParameter.value```, while their is given by ```MaterialParameter.average```.
- many material parameters can be set at once with ```SampleMaterial.set_from_dict()``` which has an optional ```fill_missing``` flag that, if true, sets all parameters that were not given to zero. This is the default when using ```Sample.material = some_dict``` on the outside.
- template materials (which need to be finalized) can be found in ```materials```.
# Interactions
- what as previously a hardcoded list of magnetic tensors is now a dynamic list of ```SelfInteraction```s (likely this will be changed to ```Interaction```, which will also include Zeemann etc.
- they can be dynamically removed or added to the sample or a given experiment.
- each interaction has methods like ```unitless_field(vec)``` or ```unitless_energy(vec)```
- Dynamic usage may look like this
```python
for interaction in sample.interactions:
spam.append(interaction.unitless_field(mag)
eggs = sum(spam)
```
- by default, each unitless field should return the non-linearized expression. So higher orders can just be included into the function.
- when doing an eigenmode calculation, the interaction can return an effective spin-wave tensor ```interaction.linearized_tensor(mag)```, which gives the linearized magnetic tensor around the specific equilibrium. This behavior is the same for all interactions. Previously, we explicitly handled higher-order interactions like ```N_cub.make_sparse_mat_with_current_m0()``` for cubic anisotropy. The new architecture allows to easily expand eigenmode calculations by the linearized versions of higher interaction orders (e.g., for uniaxial anistropy).
# Experiments
It has been almost completely refactored. Only the significant behavior changes are described.
## eigen
- lot of cleanup, ```dynamic_matrix``` takes care also of km-independent stuff, etc.
- new parallelization using joblib
- interactions for the eigensolving can now be dynamically chosen ```eigenmodes(interactions=...)```. By default, they are the sample interactions + Zeemann. No more ```no_dip=True```.
- all configuration is encapsulated in a ```EigenConfiguration``` dataclass (this scheme will also be used for other experiments).
- now supports confined_axial and waveguide_axial geometries by including the azimuthal index ``m`` in the wave-vector space
- now automatically uses conjugate modes as physical ones if the geometry_type allows it.
- perturbation analysis and absorption are still missing but will be outsourced as post-processing on a possible ```EigenSpectrum``` result object.
## relax
- just like for eigen, interactions can now be freely selected.
- more relaxation parameters are user accessible, method can be freely selected.
- This means that ```continue_with_least_squares``` has been removed. Users can chain different methods as they please.
- The mistake in the Jabocian has been corrected, which should now lead to more stable equilibration.Koerber, Lukas (FWIN-C) - 108045Koerber, Lukas (FWIN-C) - 108045https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/50Merge hotfix 1.3.2 downstream2023-10-17T16:12:22+02:00Koerber, Lukas (FWIN-C) - 108045Merge hotfix 1.3.2 downstreamSee titleSee titlehttps://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax/-/merge_requests/49Resolve "show_mode on Windows machines does not work"2023-10-17T16:00:04+02:00Koerber, Lukas (FWIN-C) - 108045Resolve "show_mode on Windows machines does not work"Closes #36Closes #36