diff --git a/doc/index.rst b/doc/index.rst index 5267cf8de6ad2e1cc1b82753da1a680a0375ed02..85fbd27078b46a530c8d851d19ee5230599f7342 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -24,7 +24,7 @@ TetraX Documentation .. automodule:: tetrax -**Version**: 1.3.0 +**Version**: 1.3.1 TetraX is a package for finite-element-method (FEM) micromagnetic modeling with the aim to provide user friendly and versatile micromagnetic workflows. Apart from energy minimizers and an LLG solver, it aims to provide implementations of several FEM dynamic-matrix approaches to numerically calculate the normal modes and associated frequencies for magnetic specimen of different geometries such as confined samples, infinitely long waveguides, or infinitely extended multilayers. Apart from ferromagnets, the package also supports antiferromagnets as an experimental feature. diff --git a/doc/quickstart.rst b/doc/quickstart.rst index b2238fdafe4d61d0ab120d8ce4032662356a920e..1a8736e4c329252cdf05e7fcb8b6251c422b5034 100644 --- a/doc/quickstart.rst +++ b/doc/quickstart.rst @@ -215,6 +215,26 @@ We can plot the obtained dispersion easily using matplotlib. As seen, we have recovered the asymmetric spin-wave dispersion in a vortex-state magnetic nanotube. [1]_ The mode profiles can be visualized, for example, using ParaView. A built-in method to visualize mode profiles will be implemented in the future. +.. _howtoscript: + +Run as a script +^^^^^^^^^^^^^^^ + +Of course, you can also run `TetraX` experiments in Python scripts (e.g. ``my_simulation.py``), +for example, to deploy them on a cluster. For this, it is important to add ``if __name__ == ‘__main__’`` +to the beginning of your script, otherwise the multiprocessing will overflow your memory +and your script will crash. A valid script will look like this: + +.. code-block:: python + + if __name__ == ‘__main__’: + + import tetrax as tx + + sample = tx.create_sample() + ... + + Where to go from here ^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/release_notes.rst b/doc/release_notes.rst index d066d9326e46b514a53c4af33c04d8d28515ef3d..158f0fe76c176d23e0719df1e88b225dad38f92b 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -1,6 +1,20 @@ Release Notes ============= +Version 1.3.1 +------------- +`2023-06-12` + +Hotfixes +^^^^^^^^ +- fixed installation problem on Windows related to compilation +- fixed problem related to multiprocessing on Windows +- fixed error on calculating absorption when some frequencies are ``NaN`` (now it properly skips these modes) + +Other +^^^^^ + +- included description in :any:`documentation <howtoscript>` on how to use `TetraX` in standalone python scripts. Version 1.3.0 ------------- diff --git a/doc/usage/introduction.rst b/doc/usage/introduction.rst index e979da4aaffa92fc153e6f0d41cdc5ea5f99a6fb..1f4f967658abb4ec7e096313a93cbab05f9aa8e3 100644 --- a/doc/usage/introduction.rst +++ b/doc/usage/introduction.rst @@ -11,7 +11,7 @@ Basic usage `TetraX` is a package for finite-element-method (FEM) micromagnetic modeling with the aim to provide user friendly and versatile micromagnetic workflows. Usually, for FEM simulations one requires a software to create the finite element mesh which is used for doing the actual simulations and a visualization program to analyse the results. With the possibility to use `TetraX` from Jupter notebooks we tried to combine the mesh creation, simulation and visualization into one package. Furthermore, by providing pre-defined functions to create finite element meshes of different geometries scientist do not need to become experts of finite element mesh creation but can right away perform simulations and concentrate on the science. By running the simulations in Jupyter notebooks, one can use all the benefits of Python, such as running multiple simulations over large parameter spaces, easy visualization of dataframes or vectorfields defined on the finite element meshes. Moreover, the workflows of simulations can be shared between colleagues or published as supplementary materials of manscuripts. To get the taste, please check the :doc:`/quickstart`. -Those who prefer to run simulations remotely or have access to high-performance clusters, do not need to use Jupyter notebooks. However, we strongly recommend to create a Juptyer notebook and export it as a python code that can be run on clusters using a job scheduling system as the `SLURM <https://www.schedmd.com/index.php>`_. +Those who prefer to run simulations remotely or have access to high-performance clusters, do not need to use Jupyter notebooks. However, we strongly recommend to create a Juptyer notebook and export it as a python code that can be run on clusters using a job scheduling system as the `SLURM <https://www.schedmd.com/index.php>`_. To see how to set-up your numerical experiments in a python script file, see :any:`here <howtoscript>`. diff --git a/setup.py b/setup.py index 6b769061c184582cb31fce0f5e742547ba7ac648..61bddb519f3348224035722e987286dc40a508f6 100644 --- a/setup.py +++ b/setup.py @@ -37,14 +37,14 @@ extensions = [ setup( name='TetraX', - version='1.3.0', + version='1.3.1', entry_points={'console_scripts': ['TetraX=fem_core:main']}, packages=find_packages(), ext_modules=cythonize(extensions, language_level=3), py_modules=["tetrax"], author="Lukas Körber, Attila Kákay", author_email="l.koerber@hzdr.de, a.kakay@hzdr.de", - url="https://gitlab.hzdr.de/kakay24/tetrax", + url="https://codebase.helmholtz.cloud/micromagnetic-modeling/tetrax", description="Finite-element micromagnetic modeling package.", long_description=long_description, long_description_content_type="text/markdown", diff --git a/tetrax/core/fem_core/dense3D.c b/tetrax/core/fem_core/dense3D.c index 71abca1f94b99d6504a9b4a0934fb2797aac243a..9e5c8b0ab88b2dee776875033759098694aa9f32 100644 --- a/tetrax/core/fem_core/dense3D.c +++ b/tetrax/core/fem_core/dense3D.c @@ -25,8 +25,8 @@ int Lindholm3D(double *x0, double *x1, double *x2, double *x3, double *nv, int i,j; int changed; int vlength = 3*4; - double x[vlength],xi[vlength], rho[vlength]; - double rho0[4], s[4], eta[vlength],eta0[4], chi0; + double x[12],xi[12], rho[12]; + double rho0[4], s[4], eta[12],eta0[4], chi0; double gamma[3][3], P[3]; double Omega, Omega_tmp; diff --git a/tetrax/experiments/calculate_absorption.py b/tetrax/experiments/calculate_absorption.py index a7bde958f65f953e468da91ba1da9fdca3614f4b..f4ac002f77a5a2e21c6d2f4eae0d460a8ee98be6 100644 --- a/tetrax/experiments/calculate_absorption.py +++ b/tetrax/experiments/calculate_absorption.py @@ -123,6 +123,9 @@ def calculate_absorption(sample, exp_name, dispersion, antenna, fmin, fmax, Nf, if not isinstance(freq, float): continue + if np.isnan(freq): + continue + fname = "{}/mode_k{}radperum_{:03d}.vtk".format(modes_path, k * 1e-6, i) # print(freq) diff --git a/tetrax/experiments/eigen.py b/tetrax/experiments/eigen.py index c7dda2561e37e01742bd06054c8e90ae09e47cb6..8902f9704c1abb06af5dda239c7d947a3df79c2f 100644 --- a/tetrax/experiments/eigen.py +++ b/tetrax/experiments/eigen.py @@ -17,6 +17,7 @@ from ..helpers.math import flattened_mesh_vec_scalar_product, diag_matrix_from_v matrix_elem, flattened_AFMmesh_vec_scalar_product, flattened_AFMmesh_vec_scalar_product_separate from ..experiments.calculate_absorption import get_ellipticy_factor +from sys import platform def not_implemented_eigensolver(sample, Bext, exp_name, kmin=-40e6, kmax=40e6, Nk=81, num_modes=20, k=None, no_dip=False, num_cpus=1, save_modes=False, save_local=False, save_magphase=False): @@ -162,13 +163,20 @@ def calculate_normal_modes(sample, Bext, exp_name, kmin=-40e6, kmax=40e6, Nk=81, else: pass -# with mp.Pool(processes=num_cpus) as p: - with mp.get_context('fork').Pool(processes=num_cpus) as p: - res_list = [] - with tqdm.tqdm(total=len(k_), disable=(not verbose)) as pbar: - for i, res in enumerate(p.imap_unordered(modes_per_k_partial, k_)): - res_list.append(res) - pbar.update() + if platform == "win32": + with mp.Pool(processes=num_cpus) as p: + res_list = [] + with tqdm.tqdm(total=len(k_), disable=(not verbose)) as pbar: + for i, res in enumerate(p.imap_unordered(modes_per_k_partial, k_)): + res_list.append(res) + pbar.update() + else: + with mp.get_context('fork').Pool(processes=num_cpus) as p: + res_list = [] + with tqdm.tqdm(total=len(k_), disable=(not verbose)) as pbar: + for i, res in enumerate(p.imap_unordered(modes_per_k_partial, k_)): + res_list.append(res) + pbar.update() df_freqs = pd.concat(res_list, sort=False).sort_values("k (rad/m)").reset_index(drop=True) # .fillna("nan") return df_freqs