Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
overengineer committed Apr 15, 2019
1 parent 9653798 commit 18a944f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 13 deletions.
14 changes: 7 additions & 7 deletions TR2D.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; %2GHz
%f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
srcx = round(nx/2);
srcy = ny;
eps_r = 4.58;
sigma = 0.52; %S/m
srcy = round(ny/2);
eps_r = 1;
sigma = 0;
ksi = (dt * sigma) / ( 2 * eps0* eps_r );
%calculation parameters
n_iter = 10000;
Expand All @@ -29,7 +29,7 @@
Hy = zeros(nx,ny);
Ez = zeros(nx,ny);
%iteration
for n=1:1:n_iter
for n=n_iter:-1:1
%Maxwell Equations (TMz)
Ezx = diff(Ez,1,1);
Ezy = diff(Ez,1,2);
Expand All @@ -40,7 +40,7 @@
Ez(2:nx-1,2:ny-1) = ((1-ksi)/(1+ksi))*Ez(2:nx-1,2:ny-1) - ((1/(1+ksi))*(dt/(eps0*eps_r)))*((1/dx)*Hyx(2:nx-1,2:ny-1) - (1/dy)*Hxy(2:nx-1,2:ny-1));

for i=1:1:23
Ez(i*10,:) = Ez(i*10,:) + receivers(i,:);
Ez(i*10,:) = Ez(i*10,:) + receivers(i,end:-1:1);
end
%Neuman Condition
Ez(:,2) = -Ez(:,1);
Expand All @@ -51,7 +51,7 @@
pcolor(Ez')
shading interp
colorbar
title(round(n))
title(n)
drawnow
end

Expand Down
61 changes: 61 additions & 0 deletions bitirme5.asv
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
clear all
close all
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
%f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
srcx = round(nx/2);
srcy = round(ny/2);
eps_r = 4.58;
sigma = 0.52; %S/m
ksi = (dt * sigma) / ( 2 * eps0* eps_r );
%calculation parameters
n_iter = 10000;
%initalization
Hx = zeros(nx,ny);
Hy = zeros(nx,ny);
Ez = zeros(nx,ny);
receivers = zeros(23,ny);
%iteration
for n=1:1:n_iter
%Maxwell Equations (TMz)
Ezx = diff(Ez,1,1);
Ezy = diff(Ez,1,2);
Hx(2:nx-1,2:ny) = Hx(2:nx-1,2:ny) - (dt/(mu0*dy))*Ezy(2:nx-1,:);
Hy(2:nx,2:ny-1) = Hy(2:nx,2:ny-1) + (dt/(mu0*dx))*Ezx(:,2:ny-1);
Hxy = diff(Hx,1,2);
Hyx = diff(Hy,1,1);
Ez(2:nx-1,2:ny-1) = ((1-ksi)/(1+ksi))*Ez(2:nx-1,2:ny-1) + ((1/(1+ksi))*(dt/(eps0*eps_r)))*((1/dx)*Hyx(2:nx-1,2:ny-1) - (1/dy)*Hxy(2:nx-1,2:ny-1));
%Gaussian Source
f(n)= (-2*(n*dt-t0)*dt/(tw^2))*exp(-(n*dt-t0)^2/(tw^2))/dy;
Ez(srcx,srcy) = Ez(srcx,srcy) + f(n);
%Neuman Condition
Ez(:,2) = -Ez(:,1);
Ez(2,:) = -Ez(1,:);
Ez(:,ny-1) = -Ez(:,ny);
Ez(nx-1,:) = -Ez(nx,:);
%display
%n = n + 1;
for i=1:1:23
receivers(i,:) = Ez(i*10,:);
end
pcolor(Ez');
shading interp;
drawnow
end

save('bitirme5.mat','receivers');


16 changes: 10 additions & 6 deletions bitirme5.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; %2GHz
%f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
srcx = round(nx/2);
srcy = ny;
srcy = round(ny/2);
eps_r = 4.58;
sigma = 0.52; %S/m
ksi = (dt * sigma) / ( 2 * eps0* eps_r );
ksi = (dt * sigma) / ( 2 * eps0 * eps_r );
%calculation parameters
n_iter = 10000;
%initalization
Expand All @@ -39,7 +39,7 @@
Hyx = diff(Hy,1,1);
Ez(2:nx-1,2:ny-1) = ((1-ksi)/(1+ksi))*Ez(2:nx-1,2:ny-1) + ((1/(1+ksi))*(dt/(eps0*eps_r)))*((1/dx)*Hyx(2:nx-1,2:ny-1) - (1/dy)*Hxy(2:nx-1,2:ny-1));
%Gaussian Source
f(n)= sin(2*pi*f0*n*dt)*exp(-(n*dt-t0)^2/(tw^2))/dy;
f(n)= (-2*(n*dt-t0)*dt/(tw^2))*exp(-(n*dt-t0)^2/(tw^2))/dy;
Ez(srcx,srcy) = Ez(srcx,srcy) + f(n);
%Neuman Condition
Ez(:,2) = -Ez(:,1);
Expand All @@ -51,11 +51,15 @@
for i=1:1:23
receivers(i,:) = Ez(i*10,:);
end
pcolor(Ez');
shading interp;
pcolor(Ez')
colorbar
shading interp
title(n)
drawnow
end

plot(f)

save('bitirme5.mat','receivers');


Binary file removed bitirme5.mat
Binary file not shown.

0 comments on commit 18a944f

Please sign in to comment.