Electromagnetic Fields of Geophysics

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

LEM
Posts: 15
Joined: Thu 10 Oct 2013, 09:17

Re: Electromagnetic Fields of Geophysics

Post by LEM » Tue 03 Dec 2013, 03:26

Hi,

This is my script:

Code: Select all

close all
clear
clc

physical_constants;
unit=1;    %drawing unit in m
numTS=10000;   %max number of timesteps
f0=5;           %nyquist rate
% compute frequency
f_start=1e-5;
f_stop=1;
%% define compute area
a=500;   %block length
b=500;   %block width
c=500;   %block heigth

% TE_mode='TE11';
mesh_res=[10,10,10]; %homogeneous mesh

%% setup FDTD parameter & excitation function
FDTD=InitFDTD();
FDTD=SetCustomExcite(FDTD,f0,'(t<5)*1');

%% boundary conditions
BC=[3 3 3 3 3 3];  %set PML condition
FDTD=SetBoundaryCond(FDTD,BC);

%% setup CSXCAD mesh
CSX=InitCSX();
mesh.x=SmoothMeshLines([0 a],mesh_res(1));
mesh.y=SmoothMeshLines([0 b],mesh_res(2));
mesh.z=SmoothMeshLines([0 c],mesh_res(3));
CSX=DefineRectGrid(CSX,unit,mesh);

%% apply 
%define loop source material:metal
CSX=AddMetal(CSX,'loop');

%define the source loop
Spoints(1,1)=350;Spoints(2,1)=350;Spoints(3,1)=250;
Spoints(1,2)=350;Spoints(2,2)=150;Spoints(3,2)=250;
Spoints(1,3)=150;Spoints(2,3)=150;Spoints(3,3)=250;
Spoints(1,4)=150;Spoints(2,4)=350;Spoints(3,4)=250;
Spoints(1,5)=350;Spoints(2,5)=350;Spoints(3,5)=250;
CSX=AddCurve(CSX,'loop',1,Spoints);

start=Spoints(:,1);
stop=Spoints(:,2);
[CSX,port{1}]=AddLumpedPort(CSX,2,1,0,start,stop,[0 1 0],true);

start=Spoints(:,2);
stop=Spoints(:,3);
[CSX,port{2}]=AddLumpedPort(CSX,2,2,0,start,stop,[1 0 0],true);

start=Spoints(:,3);
stop=Spoints(:,4);
[CSX,port{2}]=AddLumpedPort(CSX,2,3,0,start,stop,[0 1 0],true);

start=Spoints(:,4);
stop=Spoints(:,5);
[CSX,port{4}]=AddLumpedPort(CSX,2,4,0,start,stop,[1 0 0],true);

%% creat box
% define air material
CSX=AddMaterial(CSX,'air');
CSX=SetMaterialProperty(CSX,'air','Epsilon',1,'Mue',1, 'Kappa',0);

% define earth material
CSX=AddMaterial(CSX,'earth');
CSX=SetMaterialProperty(CSX,'earth','Epsilon',5,'mu',1,'Kappa',0.01);


start = [mesh.x(1)   mesh.y(1)   mesh.z(1)];
stop  = [mesh.x(end) mesh.y(end) mesh.z(25)];
CSX=AddBox(CSX,'air',0,start,stop);

start = [mesh.x(1)   mesh.y(1)   mesh.z(25)];
stop  = [mesh.x(end) mesh.y(end) mesh.z(end)];
CSX=AddBox(CSX,'earth',0,start,stop);

%% prepare simulation folder
Sim_Path = 'tmp';
Sim_CSX = 'box.xml';

[status, message, messageid] = rmdir( Sim_Path, 's' ); % clear previous directory
[status, message, messageid] = mkdir( Sim_Path ); % create empty simulation folder

%% write openEMS compatible xml-file
WriteOpenEMS([Sim_Path '/' Sim_CSX], FDTD, CSX);

%% show the structure
CSXGeomPlot([Sim_Path '/' Sim_CSX]);

%% run openEMS
RunOpenEMS(Sim_Path, Sim_CSX);

%% post processing
freq=linspace(f_start,f_stop,200);
port= calcPort(port, Sim_Path, freq);

U=port{1}.uf.tot;
II=port{1}.if.tot;
% plot
figure
loglog(freq,U,'k-','LineWidth',2);
grid on;
hold on
loglog(freq,II,'k--','LineWidth',2);
l = legend('U','II','Location','Best');
set(l,'FontSize',12);
% ylabel('S-Parameter (dB)','FontSize',12);
xlabel('frequency (MHz) \rightarrow','FontSize',12);
the excitation function is very '(t<5)*1'. I don't know when the excitation is done.

regards
LEM

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

Re: Electromagnetic Fields of Geophysics

Post by thorsten » Thu 05 Dec 2013, 20:24

The custom excite is not very good. You just switch on a step and switch it of again after 5s. That sharp switches require an infinite bandwidth... I recommended (read above) to ramp up slowly and after some hold time, shut off quickly using some exponential decay (band limited)...

What is the timestep by the way? Afterall you try to do a 5s long excitation...
Maybe you use InitFDTD with "MaxTime" at 20s or something. Than you can see how many timesteps the total simulation will take...
I fear that your timestep is way to small to simulate some signal this extremely ling. Usually I have excitations is the pico to nanosecond range... but that is RF..

regards
Thorsten

LEM
Posts: 15
Joined: Thu 10 Oct 2013, 09:17

Re: Electromagnetic Fields of Geophysics

Post by LEM » Mon 09 Dec 2013, 03:09

Hi,

I think my main problem is that how to get the U or I of the port at some particular time series (t0,t1,t2,t3...). I want to plot a curve of U/I change over time.

regards
LEM

hannesko
Posts: 6
Joined: Wed 03 Jun 2020, 10:36

Re: Electromagnetic Fields of Geophysics

Post by hannesko » Wed 26 Aug 2020, 15:49

thorsten wrote:
Thu 28 Nov 2013, 14:32
Hi,
Another problem, :oops:. For example, I want to define a rectangular wire frame by using AddCurvePort(...), what's the meaning of the parameter 'start' and 'end '? How to assign them to form a rectangular wire frame?
Maybe calling it a line port would be more precise. This port is just a line, going from start to end with the port (resistance, voltage and current probe) in the middle.
To close your rectangle you should use a regular metal curve (AddCurve).
I got a problem. I can't understand how to relate the excitation to the curve port which I defined? I have read the tutorials. I can't really understood what the shape and location of excitation is?
I'm not sure I understand, you just define the excite vector (e.g. [1 0 0] for 1V/m in x-direction). But this value is only the amplitude which gets multiplied by the excitation time-signal you defined with "SetCustomExcite" or "SetGaussExcite". This time signal is global for all excitations. Your ports or AddExcitation can only define where (location) and with which amplitude and decay you can excite the time signal...

Maybe you can help improve the doc on the topic? http://openems.de/index.php/Excitation

regards
Thorsten
Hello Thorsten!

I have to add two questions here:
1) My problem has to be initialized as follows: I simulate a lightning strike, which is an array of sources following such a time signal, that "travel up" the lightning channel to the cloud. They are replica of the same time signal, that are attenuated with exponential decay (spatially) and activated in a time-delayed manner with respect to the "return stroke" wave propagation speed. This I assume is possible to do in openEMS. I just need to initialize a bunch of Box primitives in a for loop to form the channel and apply the AddExcitation with the respective "Delay" parameter. Is that correct?

2) What if I have a measured current that I want to use as a source term (see current density "J" in Maxwell equations)? Any chance, that I could feed the openEMS FDTD domain with such completely arbitrary signals (e.g. as an array of current values?)

3) Because you mention "This time signal is global for all excitations" --> is there any way to apply several different excitation signals for differently located Boxes?

These questions are especially crucial for my simulations, since we are interested in actual field values / signatures at a sampling point!

Thanks a lot in advance,
Hannes

Mitchel88
Posts: 1
Joined: Thu 27 Aug 2020, 11:31
Contact:

Re: Electromagnetic Fields of Geophysics

Post by Mitchel88 » Thu 27 Aug 2020, 11:37

Electromagnetic geophysical methods are based on the study of EM field propagation in the earth and on determining the electromagnetic parameters of the earth, containing unique information about petrophysical properties, lithological characteristics, and mineral content of the rocks in the earth's interior.
Complete guide about [url= https://eta-govt.com/sri-lanka-on-arrival-visa-fee-for-indian/] sri lanka arrival visa fees for Indian citizens [/url] is available.

Post Reply