Closed JDalzell745 closed 3 years ago
Hi @JDalzell745,
Thank you for your question. (Did we talk already via email? Code looks a bit familiar to me...)
I have had a look at your notebook and found a few things which are probably wrong. I attach a notebook with some suggestions on how this can be fixed. The simulations are huge and I do not have time to run the notebook myself. Could you please have a careful look, address all points I commented on in the notebook, and let us know? There are also some suggestions on how to write simpler code using some convenience functions from Ubermag.
The main issue you noticed is because the exchange energy constant is defined between layers. Therefore, you need to define it between layers as well. If not, two layers behave independently.
There is also probably an issue with the size of the sample and its discretisation, but we can comment on that later.
Hi marijan
We have talked before through email, we had the initial problem that we missed gamma being to e-5 and not e5, simple mistake.
Thanks for the additions made to the code, it has cleared some things up a bit. With the changes made, we now have a coupling between the layers for the initial experimental conditions. The only issue is that the resonant frequency is still higher than expected.
I'm wondering if the size of the sample may be beyond the limit of what OOMMF is capable of simulating? Seen a couple of papers reference that the mesh resolution should be somewhat comparable to the exchange length, and for our size that would require more memory than the program allows. Is this perhaps the issue you think we may be having?
Thanks very much for you assistants
James.
Hi James, I haven't looked at your code, but you may find the discussion on cell size at http://nmag.soton.ac.uk/nmag/current/manual/html/tutorial/doc.html useful.
Thanks fangohr, ill give it a look
Hi @JDalzell745, thank you for adding the changes I suggested. As I mentioned in my previous comment and @fangohr noticed, there is an issue with discretisation. Your sample is 15 um x 15 um x 100 nm, which is huge for micromagnetics. That sample is then discretised in 10 x 10 x 15 cells, which makes your disretisation cells huge. Disretisation cell size should not be larger than the exchange length (first formula in 11.3.1 in http://nmag.soton.ac.uk/nmag/current/manual/html/tutorial/doc.html).
I would suggest doing the following two things:
cell=...
)I hope this helps. Please keep us updated.
This is an interesting problem you are solving and it could be useful to others to learn from it, so if you could make a short tutorial on this topic, we could include it in Ubermag documentation and acknowledge you as the author.
Hi @JDalzell745, I am going to close this issue since I assume we addressed it so far, but please feel free to open a new one if there are any further questions you have on this topic.
Hi @JDalzell745, I am beginner to use ubermag and oommf to fmr calculation for single layer thin film as well as multilayer. so please tell me that can i use this above code in oommf nanohub for the simulation of multilayer structure and share me something about single layer thin film.
kind regards asif
Hi jmiasif,
It is alright to use the above code for FMR simulating however as it was a couple years ago I cant say anything about that versions optimisation or accuracy
Hi JDalzell745 Respected Sir, Thank you so much for your kind responce, Can i run this code in ubermag? this is very silly question to ask but i am beginner to use this stuff. sir, please help me out. Thank you sir
i want to calculate fmr on difrent thickness. but i am confused in discretisation of cell.
You can subdivide the system in z-direction into two cells: each being 5nm thick. Together, this is the thickness of your film (10nm). dx=dy=dz= 5e-9 is generally better than dx=dy=5nm, and dz=10nm.
Thank you so much ### fangohr
Hello ### @fangohr Respected sir, I want table of ylabel('Psa (a.u.)' and xlabel('f (GHz)'. How can i get this table? Please suggest with code. Becouse i want merge all the graph based diffrent parameter. once i get table i will merge it by other software. I had calculated table by using this code ### system.table.data. But i can not understand how to calculate table for ylabel('Psa (a.u.)' and xlabel('f (GHz). I attached my sulation page below please see for easy understanding. https://drive.google.com/file/d/1pSizdL7SsjKZLowQ4jZ5bE55-qMImWqQ/view?usp=drive_link thankyou
Hii ubermag team i had generated mumax table.txt, now i want postprocessing our data through ubermag for fft. but i do not understand how call .txt table in ubermag, whenver i do it gives syntax error in very first step. i attached screen shot of my problome below. please help me out thanl you
import os
import ubermagtable as ut
dirname = os.path.join(os.path.C:\Users\MOHAMMAD ASIF\Desktop(tabletable.txt), odtfile = os.path.join(dirname, "tabletable.txt")
table = ut.Table.fromfile(odtfile)
import os
import ubermagtable as ut
dirname = os.path.join("..", "ubermagtable", "tests", "test_sample") odtfile = os.path.join(dirname, "oommf-new-file2.odt")
table = ut.Table.fromfile(odtfile)
i simply write our directory name where this table (tabletable.txt) is saved and it givs sytanx error. please resolve
@jmiasif before we can give any advice, please:
Hi @lang-m thank you so much sir for your kind responce 1- i simply download miniconda in our machine and simulation done on jupyter notebook simmply by copy the code from ubermag example only just by changing the numerical value. 2- currently i use ubermag is just for post processing our mumax data table. i am beginer to use this, so i just take sample code from ubermag table basic and write our directory where i saved my mumax table. In table basic oommf genertae file as .odt and mumax as .txt hence i saved my table as 'tabletable.txt'. actually i want to calculate fft of my data.
below code i try to run in ubermag
import os
import ubermagtable as ut
dirname = os.path.join('C:/Users/MOHAMMAD ASIF/Desktop/tabletable.txt', "ubermagtable", "tests", "test_sample")
odtfile = os.path.join(dirname, "tabletable.txt")
table = ut.Table.fromfile(txtfile)
it gives syntax error
Cell In[12], line 9
table = ut.Table.fromfile(.txtfile)
^
SyntaxError: invalid syntax
You define the variable odtfile
to point to your tabletable.txt
file but then use an undefined variable txtfile
when you try to load the data. Instead, use:
odtfile = os.path.join(dirname, "tabletable.txt")
table = ut.Table.fromfile(odtfile)
I don't know what file formats Origin can read, so I don't know if Ubermag could help save the tabular data in a suitable format. Ubermag gives you access to the data in the form of a pandas.DataFrame
, which can be saved in many standard formats such as csv. That might be useful for you.
@lang-m Thank you so much sir for your kind responce that helped me alot.
i had succesfully upload our data in jupyter and fft is calculated for our table data.
1 . now sir i want to get this fft_table in csv format but when i doing this with this fft_table.to_csv('xyz.csv')
i is giving an error that table object has no attribute to csv
import os import numpy as np import ubermagtable odtfile = os.path.join("tabletable.txt") table = ubermagtable.Table.fromfile(odtfile, x="t") table.data fft_table = table.rfft(y=["mx", "my", "mz"]) fft_table fft_table.to_csv("cs.csv") AttributeError: 'Table' object has no attribute 'to_csv'
when i export table in csv using df it works and data sucessfully saved in csv. but fft is not run it is giving an error df object has no attribute to rfft.
import pandas as pd df=pd.read_csv('ft.csv') df fft_df = df.ifft(y=["mx", "my", "mz", "B_extx", "B_exty", "B_extz"]) fft_df AttributeError: 'DataFrame' object has no attribute 'ifft'
hence
The Table
class internally uses a pandas dataframe (the property data
of the table
object). So to save as csv, you can use fft_table.data.to_csv("cs.csv")
.
Hi ... @JDalzell745 and ubermag team i want to calculate FMR in single layer thin film from fmr standard problome given in ubermag example keeping all the thing as iit is while only chnage in iether in thickness or Hdc or Ms and alpha. https://ubermag.github.io/examples/notebooks/10-tutorial-standard-problem-fmr.html. i am beginner in this field so...... 1- when we change thickness of thin film 5nm, 10nm, 15nm, 20nm etc. and keeping all prameter constant by increasing thickness fmr is decreasing why this is happens and expert are saying when keeping all parameter contant and thickness is change then fmr should be constant. 2- when i change parameter like Hdc (applied filed) and keeping all parameter constant then in fmr multiple notches are there, how can i remove it and why it is arises. if any relevent information is neede please let me know. i am very gratefull to you all. thankyou
Hii @lang-m
First of all Thank you so much for your kind advise and that is worked properly.
Dear Sir, now i want to get another csv data from jupyter notebook to plot multiple graph in one frame.
import oommfc as oc import discretisedfield as df import micromagneticmodel as mm import numpy as np lx = ly = 12000e-9 # x and y dimensions of the sample(m) lz = 25e-9 # sample thickness (m) dx = 12000e-9 dy = 12000e-9 dz = 25e-9 # discretisation in x, y, and z directions (m) Ms = 1671.6e3 # saturation magnetisation (A/m) A = 1.3e-11 # exchange energy constant (J/m) H = 8e4 * np.array([0.81345856316858023, 0.58162287266553481, 0.0]) alpha = 0.008 # Gilbert damping gamma0 = 2.211e5 mesh = df.Mesh(p1=(0, 0, 0), p2=(lx, ly, lz), cell=(dx, dy, dz)) system = mm.System(name='stdprobfmr') system.energy = mm.Demag() + mm.Zeeman(H=H) system.dynamics = mm.Precession(gamma0=gamma0) + mm.Damping(alpha=alpha) system.m = df.Field(mesh, dim=3, value=(0, 0, 1), norm=Ms) md = oc.MinDriver() md.drive(system) H = 8e4 * np.array([0.81923192051904048, 0.57346234436332832, 0.0]) system.energy.zeeman.H = H T = 20e-9 n = 1000 td = oc.TimeDriver() td.drive(system, t=T, n=n) import matplotlib.pyplot as plt t = system.table.data['t'].values my = system.table.data['mx'].values plt.figure(figsize=(30, 10)) plt.plot(t, my) plt.xlabel('t (ns)') plt.ylabel('my average') plt.grid() import scipy.fft import pandas as pd psd = np.log10(np.abs(scipy.fft.fft(my))**2) f_axis = scipy.fft.fftfreq(1000, d=20e-9/1000) plt.plot(f_axis/1e9, psd) plt.xlim([1, 20]) plt.xlabel('f (GHz)') plt.ylabel('Psa (a.u.)') plt.grid()
Sir, i want to get psd data and f_axis data.
when i run code f_axis.data
then out is <memory at 0x000002100BE907C0>
and similerly when i run code psd.data
then out is <memory at 0x000002100BE901C0>
, so how can i get this data please help me with code.
Thank you
@jmiasif - please pose your question in a more appropriate way taking into account that the people who you would like to help you are under no obligation to do so: you should make it as easy (and that means as little time consuming) as possible for them. Every 15 minutes they need to try to understand your question, they cannot do something else: this includes fixing bugs or improve Ubermag in other places, giving up their personal time or other objectives. For starters, your code is not readable. You have shown before (for example https://github.com/ubermag/help/issues/119#issuecomment-1723180644) that you can do better. Thanks.
If you want to include Python code (such as the ubermag code snippet from above), please use triple backticks as explained on https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks.
instead of
```ruby
as in the example at https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting, you can write
```python
to get syntax highligthing (i.e. coloured source code), which also improves readability. Example:
print("hello world")
@fangohr Sir, problem solved. thank you so much
`Hi @marijanbeg and ubermag team I worked on ubermag jupyter notebook for my research purpose. but unfortunately my laptop is crashed. now i want to download ubermag through miniconda by help of your youtube vedio [https://youtu.be/7uwwz4q4iAU?si=RA7KYmPe8_kQGCqx](url) but whenever i try to put code in conda prompt. it says conda ran out of memory please try again why is it so while there is lot of space free
(ubermag) C:\Users\HP>conda install --channel conda-forge ubermag
Collecting package metadata (current_repodata.json): | Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Read timed out. (read timeout=9.15)")': /pkgs/r/win-64/current_repodata.json
done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
CondaMemoryError: The conda process ran out of memory. Increase system memory and/or try again.
please help me out thank you
@jmiasif Please make sure you are installing into a clean environment and then try using mamba rather than conda.
mamba install --channel conda-forge ubermag
In the future please feel free to create a new issue if it is on a different topic so it is easier for people who have the same issue to find and reference.
@samjrholt sir, thank you so much for you reply but still not download ubermag while i put above commond into anaconda prompt it says below, `
(base) C:\Users\HP>mamba create -n ubermag python=3.8
'mamba' is not recognized as an internal or external command,
operable program or batch file.
(base) C:\Users\HP>mamba create -n ubermag python=3.11
'mamba' is not recognized as an internal or external command,
operable program or batch file.
(base) C:\Users\HP>conda create -n ubermag python=3.8
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\HP\miniconda3\envs\ubermag
added / updated specs:
- python=3.8
The following packages will be downloaded:
package | build
---------------------------|-----------------
pip-23.3 | py38haa95532_0 2.8 MB
------------------------------------------------------------
Total: 2.8 MB
The following NEW packages will be INSTALLED:
ca-certificates pkgs/main/win-64::ca-certificates-2023.08.22-haa95532_0
libffi pkgs/main/win-64::libffi-3.4.4-hd77b12b_0
openssl pkgs/main/win-64::openssl-3.0.11-h2bbff1b_2
pip pkgs/main/win-64::pip-23.3-py38haa95532_0
python pkgs/main/win-64::python-3.8.18-h1aa4202_0
setuptools pkgs/main/win-64::setuptools-68.0.0-py38haa95532_0
sqlite pkgs/main/win-64::sqlite-3.41.2-h2bbff1b_0
vc pkgs/main/win-64::vc-14.2-h21ff451_1
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
wheel pkgs/main/win-64::wheel-0.41.2-py38haa95532_0
Proceed ([y]/n)? y
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate ubermag
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) C:\Users\HP>conda activate ubermag
(ubermag) C:\Users\HP>mamba install --channel conda-forge ubermag
'mamba' is not recognized as an internal or external command,
operable program or batch file.
(ubermag) C:\Users\HP>mamba install --channel mamba-forge ubermag
'mamba' is not recognized as an internal or external command,
operable program or batch file.
(ubermag) C:\Users\HP>
please help Thank you
First install mamba
conda install -c conda-forge mamba
Hii @samjrholt Sir, after follow your instruction i reached some where but still jupyter notebook not opening.
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================== short test summary info ===================================================================================
FAILED tests/test_ovf2vtk.py::test_ovf2vtk - FileNotFoundError: [WinError 2] The system cannot find the file specified
============================================================ 1 failed, 3909 passed, 5 skipped, 307 warnings in 4083.27s (1:08:03) =============================================================
(ubermag) C:\Users\HP\ubermag-test>jupyter notebook &
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir] [--paths] [--json] [--debug] [subcommand]
Jupyter: Interactive Computing
positional arguments:
subcommand the subcommand to launch
options:
-h, --help show this help message and exit
--version show the versions of core jupyter packages and exit
--config-dir show Jupyter config dir
--data-dir show Jupyter data dir
--runtime-dir show Jupyter runtime dir
--paths show all Jupyter paths. Add --json for machine-readable format.
--json output paths as machine-readable json
--debug output debug information about paths
Available subcommands: dejavu events execute kernel kernelspec lab labextension labhub migrate nbconvert run script server troubleshoot trust
Jupyter command `jupyter-notebook` not found.
I am very gratefull to you for your kind help. thank you
Jupyter Notebook is deprecated and it is advised to transition to JupyterLab which should have been installed with ubermag
.
Simply run jupyter lab
from the terminal
Respected Sir, @samjrholt Thank you so much for guiding me in such nice way. i am very gratefull you and ubermag group to create such nice plateform. sir i want to ask one more thing. whenever i will start from begining previously in jupyter notebook i usually use commond in anaconda prompt
(base) C:\Users\HP>conda activate ubermag
(ubermag) C:\Users\HP>jupyter notebook &
so in my case can we use below commond or any thing else
(base) C:\Users\HP>mamba activate ubermag
(ubermag) C:\Users\HP>jupyter lab &
thank you sir
Respected sir @samjrholt Thank you so much for you kind help and support. Now jupyter lab is working properly. Thanks a lot.
Hi @ubermag_team I currently looking field sweep Ferromagnetic resonance using ubermag. i produced some good result frequency sweep using FMR standard problome code given https://ubermag.github.io/examples/notebooks/10-tutorial-standard-problem-fmr.html so now i want to calculate field sweep fmr. please share some relevent code which help us to get field sweep fmr. thank you
Hello Marijan and the team at Ubermag!
We are currently looking into the functionality of OOMMF in simulating FMR responses in thin films. We were able to reproduce some good results for single layer films showing typical expected trends in our data. The only issue was that resonance frequencies are typically out be <1GHz to experimental values.
We have however moved to our main scope of looking into multilayer systems and have a observed a greater disconnect between the expected frequency and the simulated result.
We are wondering if anyone in the team can have a look at our current python script and provide any advice that can help to greater improve the simulated results. Within the notebook there is a short rundown of what we have attempted and looked at for the overall system. If anything proves unclear please get in touch and we will try to explain.
The general issue is that the two layers operated independently, until we forced the two external fields to drive the systems to their experimental single layer values. when put together within a bilayer the resonant frequency had greatly increased to an unexpected value.
BiLayer_Notebook - Copy.zip
We appreciate any help and advice that you may have in improving our simulation. Thank you very much for your time and effort
Kind Regards
James