Field at one point, and FFT

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
Youry
Posts: 51
Joined: Wed 22 Feb 2012, 12:50

Field at one point, and FFT

Post by Youry » Wed 07 Mar 2012, 09:48

Hello,

I simulate a waveguide in a band gap metallic crystal, the simulation seems in good agreement with commercial software of friend's simulation.

However, I cannot make a very usefull analysis...
Probably it more a paraview problem, but anyway I take a chance for question.

I would like to know the field value (for example E) at only one point in the grid. (Inside cavity or at output of my wave-guide)
My exitation is a pulse (about 1 cycle) so I am quite broadband,
By recording the output of the guide, I will be glad to see energy only in the band gap frequency of the crystal...

I am interest in both temporal and frequency signal's component.

I try something like this to obtain E(t)...
CSX = AddDump(CSX,'Probe','DumpMode',0);
CSX = AddPoint(CSX, 'Probe', 0, [x y z]);

Is it good ? If yes, how can I plot this E(t) ? Or extract values ?
Do I necessary need paraview to plot this kind of things ?

This is very basic question, but very important to me, any suggestion or help are welcome.

thorsten
Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Field at one point, and FFT

Post by thorsten » Thu 08 Mar 2012, 09:55

Hi,

please have a look at the help for AddDump.
If you use FileType 1 you will get a hdf5 file dump, which you can read with Matlab using ReadHDF5Dump.
You may want to look into the help for ReadHDF5Dump as well.
ReadHDF5Dump can also do a DFT so you can access time-domain fields and/or frequency domain results...

e.g.
CSX = AddDump(CSX,'Probe','DumpMode',0,'FileType',1);
CSX = AddPoint(CSX, 'Probe', 0, coords);

[..] Simulation [..]

[fields mesh] = ReadHDF5Dump('foldername/Probe.h5','Frequency',1e9);

You can also dump a large field domain and than just choose one point later using Matlab...

regards

Youry
Posts: 51
Joined: Wed 22 Feb 2012, 12:50

Re: Field at one point, and FFT

Post by Youry » Wed 21 Mar 2012, 07:57

Hello,

I am getting some troubles with ReadHDF5Dump function.

This step seems working...
CSX = AddDump(CSX,'Probe','DumpMode',0,'FileType',1);
CSX = AddPoint(CSX, 'Probe', 0, coords);

I get a file Probe.h5...

Then I got this, when I call the ReadHDF5Dump...
Image
As you see I use Octave interface, I wonder if I have no probleme with it. I saw that Octave sometimes needs some HDF5 library to correctly working ???

However, if I use the native HDF5 function it seems working...
load -hdf5 'Pathname/Probe.h5'
I get a FieldData structure.
Inside their is a TD structure...
Which have all the time value for x,y,z vector component...
For example,
FieldData.TD._00000000 is a vector at t=0.
FieldData.TD._00000006 is vector at the next time step.
...
But I am not able to get all the data, because I don't know the 'names fields' of time inside the m.file (Not sure if it is clear...). (_00000000 for example)


Anyway, I probably should use ReadHDF5Dump, but it doesn't work. Do you have any idea why ?
I am really sorry about useless question, but also little scare about Octave interface compatibility...

Thank you...

thorsten
Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Field at one point, and FFT

Post by thorsten » Wed 21 Mar 2012, 09:35

Hi,

you have to do

Code: Select all

setup
inside of octave to compile the missing hdf5 attribute reading, needed by openEMS...

regards
Thorsten

Youry
Posts: 51
Joined: Wed 22 Feb 2012, 12:50

Re: Field at one point, and FFT

Post by Youry » Wed 21 Mar 2012, 10:22

Hi,

My previous style was FieldData.TD._00000000(x or y or z) working... But I could change the name of the time field inside a loop.

a=ReadHDF5Dump(...)

Now it work...

Then I get :
a.TD.values(n)
Return the values of the field at the n time step.
I can make a loop to get all the time step, without having to care about names.

But new problems :oops:
However it is still difficult to obtain the value. Because it return a structure, without field name, and I don't know how to manage it.
command => a.TD.values(4)
return =>
ans=
{
[1,1] =
ans(:,:,1,1)=0
ans(:,:,1,2)=0
ans(:,:,1,3)=0
}
As this structure as no 'fieldnames' I don't know how to access the values.
I have to learn more about octave structure, so don't lose time if it is long to explain, I will check it on Octave forum.

Soon success I am sure, Thank you

Youry
Posts: 51
Joined: Wed 22 Feb 2012, 12:50

Re: Field at one point, and FFT

Post by Youry » Wed 21 Mar 2012, 11:57

I found :D

For exemple,
a=ReadHDF5Dump(...)

Next :

a.TD.values(4){1}(1) Give vector x field at t=4 step
a.TD.values(6){1}(2) Give vector y field at t=6 step

Happy

thorsten
Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Field at one point, and FFT

Post by thorsten » Wed 21 Mar 2012, 13:11

Et = a.TD.values{4} will give you a 4-dimensional array for the fields at timestep 4.

Than you can access the data like this
Et(ix,iy,iz, comp)

ix,iy,iz are the coordinate indices and comp is 1,2 or 3 for the x,y or z component

I agree this needs more documentation inside the ReadHDF5Dump help.

regards
Thorsten

Youry
Posts: 51
Joined: Wed 22 Feb 2012, 12:50

Re: Field at one point, and FFT

Post by Youry » Thu 22 Mar 2012, 07:43

Yes it seems more easy by this way, so I will dump a box, and will chose my position as you said before.
Thank you,

Post Reply