FDTD with Mur ABC

Embed Size (px)

DESCRIPTION

Matlab code for FDTD with Mur ABC for gussian source.you can change the source (like sinus source) and see what happend.

Citation preview

  • 1

    13820239

    DTDF -1

    : 2(

    volfaT 6 .

    :0=x @

    =y=x htiW dnA

  • 2

    @ x=h ,y=0, y=h the way is similar to x=0 , and by using 6.28b 6.28c 6.28d ,equations similar to 6.34 can be obtained

    MATLAB : a=2; %length b=2; %width c=3e8 ; %Light Speed % Simulation parameter s=0.5; %Courant Stability Factor d=.01; %Delta x,delta y dt=s*d/3e8; %Delta t N=floor(a/d); %Intrvals on length M=floor(b/d); %Intrvals on width Nt=1200; %Total number of simulation time xn1=floor(0.7/d)+1; %Field Point Location yn1=floor(0.5*a/d)+1; %Field Point Location xn2=floor(0.5*a/d)+1; %Field Point Location yn2=floor(1.3/d)+1; %Field Point Location xn3=floor(0.2/d)+1; %Field Point Location yn3=floor(1.3/d)+1; %Field Point Location xnp=floor(0.5*a/d); %Source Point Location ynp=floor(0.5*b/d); %Source Point Location % Initial fields Ez2=zeros(M+1,N+1,3); Hx2=zeros(M,N+1,3); Hy2=zeros(M+1,N,3); Es1=zeros(1,Nt); Es2=zeros(1,Nt); Es3=zeros(1,Nt); Ez=zeros(M+1,N+1); Hx=zeros(M,N+1); Hy=zeros(M+1,N); % FDTD nx=N;ny=M; %%% To Determine Mur Absorbing Boundery Condition We need Fields at 3 Time

  • 3

    %%% Steps,And For This I Write This 'for' Here for n=3:Nt %Apply Source % Ez(xnp,ynp)=sin(1e9*2*pi*dt*n); Ez(xnp,ynp)=exp(-(((n-2)*dt-2e-9)/(.5e-9))^2); % Yee Cubic Field Calculation Hx=Hx-dt/(4*pi*1e-7*d)*(Ez(2:end,:)-Ez(1:end-1,:)); Hy=Hy+dt/(4*pi*1e-7*d)*(Ez(:,2:end)-Ez(:,1:end-1)); Ez(2:end-1,2:end-1)=Ez(2:end-1,2:end-1)+dt/(8.854e-12*d)*(Hy(2:end-1,2:end)-Hy(2:end-1,1:end-1)-(Hx(2:end,2:end-1)-Hx(1:end-1,2:end-1))); % First time Step if n-3*floor(n/3)==0 m11=1;%next m10=2;%before m=3;%curent Hx2(:,:,1)=Hx; Hy2(:,:,1)=Hy; Ez2(:,:,1)=Ez; % Second time Step elseif n-3*floor(n/3)==1 m11=2;%next m10=3;%before m=1;%curent Hx2(:,:,2)=Hx; Hy2(:,:,2)=Hy; Ez2(:,:,2)=Ez; % Third time Step elseif n-3*floor(n/3)==2 m11=3;%next m10=1;%before m=2;%curent Hx2(:,:,3)=Hx; Hy2(:,:,3)=Hy; Ez2(:,:,3)=Ez; end %Apply Boundary Condition for i=1:N for j=1:M % For Corners Ez2(1,1,m11)=Ez2(2,2,m10); Ez2(1,M,m11)=Ez2(2,M-1,m10); Ez2(N,M,m11)=Ez2(N-1,M-1,m10); Ez2(N,1,m11)=Ez2(N-1,2,m10); %@x=0 if i==1

  • 4

    if j>1 && j1 && j

  • 5

    dne ;)11m,:,:(2zE=zE ))m,:,:(2zE(csegami ))m,:,:(2zE(frus % ;)02,'eziStnoF',acg(tes rabroloc )]1.0 0[(sixac % )]4 4-[(milz % % % % % % % % ;emarfteg ;)1+n,:,:(xH=xH % ;)1+n,:,:(yH=yH % ;)1+n,:,:(zE=zE % tniop dleif ta atad niamod emit evaS% ;)1ny,1nx(2zE=)n(1sE tniop dleif ta atad niamod emit evaS% ;)2ny,2nx(2zE=)n(2sE tniop dleif ta atad niamod emit evaS% ;)3ny,3nx(2zE=)n(3sE dnE ;)'3sE','2sE','1sE','tam.5_1c_laciremuN_tseT'(evas

    : rof ty x

    . draH . eeY

    zE ruM zE rof n

    . m 11m 01m m 321

    1=01m 2=m . 3=11m

    0=y 0=x h=y h=x

    . 0=y 0=x

  • 6

    frus csegami .

    zE . eeY

    3sE 2sE 1sE . )3.0,3.0( )0,3.0( )3.0,0(

    (

    s . 5.1=s 1=s .

    .

    : baltaM ;)'3sE','2sE','1sE','tam.5_1c_2laciremuN_tseT'(daol ;1sE=sE ;3.0=nx ;3.0=ny emit noitalumis fo rebmun latoT% ;002=tN rotcaF ytilibatS tnaruoC% ;5.0=s y atled,x atleD% ;10.=d t atleD% ;8e3/d*s=td ;9e3=sF ;)sE(htgnel=L y fo htgnel morf 2 fo rewop txeN % ;)L(2woptxen^2 = TFFN ;)TFFN,sE(tff = Y ;)1+2/TFFN,1,0(ecapsnil*2/sF = f ;))1+2/TFFN:1(Y(sba=lpmA_sE ;)Y(gami=gami_Y ;)Y(laer=laer_Y ;))1+2/TFFN:1(laer_Y/.)1+2/TFFN:1(gami_Y(dnata=esahp %%%%%%%%%%%% ;td*tN:td:0=x ;)2^.))9-e5.0(/)9-e2-x((-(pxe = gis ;9e3=sF

  • 7

    ;)gis(htgnel=L ;T*)1-L:0( = t % y fo htgnel morf 2 fo rewop txeN % ;)L(2woptxen^2 = TFFN ;)TFFN,gis(tff = AY ;)1+2/TFFN,1,0(ecapsnil*2/sF =f ;)2^ny+2^nx(trqs=p ;8e3/f*ip*2=evaw_k ;21-e458.8=spe ;)1+2/TFFN:1(AY=I ;)p*evaw_k,2,0(hlesseb*.)spe*f*.ip*2*4(/)2^.)evaw_k(*.I-(=p_AzE

    :

    evas ) daol.

    sE ( . ) ny , nx(

    .

    : td

    y x d 8e3/d*s=td t .

    10.0 d . 11-e7666.1=td

  • 8

    :

    DTDF zE .

    : 5.0=C )3.0,0(

    zE .

    .

    DTDF .1

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

  • 51

    : 0,3.0

  • 16

  • 17

  • 18

  • 19

  • 20

  • 12

    5.0=c 3.0,3.0

  • 22

  • 23

  • 24

  • 25

  • 26

  • 72

    DTDF 1=c .

    : 3.0,0

  • 28

  • 29

  • 30

  • 31

  • 32

  • 33

    : 0,3.0

  • 34

  • 35

  • 36

  • 37

  • 38

  • 93

    : 3.0,3.0

  • 40

  • 41

  • 42

  • 43

  • 44

    : 5.1=c

    . DTDF

    3.0,0

  • 45

  • 46

  • 47

  • 48

  • 49

  • 50

  • 15

    0,3.0

  • 52

  • 53

  • 54

  • 55

  • 56

  • 75

    3.03.0

  • 58

  • 59

  • 60

  • 61

  • 26

    DTDF ( .

    DTDF .

    41.0 5.0=c 3.0,3.0 . 1.0

  • 36

    :

    5.0=C

    3.0,0

  • 64

  • 65

  • 66

  • 67

  • 68

  • 96

    0,3.0

  • 70

  • 71

  • 72

  • 73

  • 74

  • 57

    3.03.0

  • 76

  • 77

  • 87

  • 79

  • 08

    1=c

    3.0,0

  • 81

  • 82

  • 83

  • 84

  • 85

  • 68

    0,3.0

  • 87

  • 88

  • 89

  • 90

  • 91

  • 29

    3.03.0

  • 93

  • 94

  • 95

  • 96

  • 97

  • 89

    5.1=c

    3.0,0

  • 99

  • 100

  • 101

  • 102

  • 103

  • 401

    0,3.0

  • 105

  • 106

  • 107

  • 108

  • 109

  • 011

    3.0,3.0

  • 111

  • 112

  • 113

  • 114

  • 115