登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
fortran编写的3D的PML程序铁出来,大家都看看
发帖
回复
1
2
5039
阅读
13
回复
[
资料共享
]
fortran编写的3D的PML程序铁出来,大家都看看
离线
wq_463
UID :20925
注册:
2008-11-06
登录:
2021-04-22
发帖:
227
等级:
仿真三级
0楼
发表于: 2008-12-06 20:43:36
!***********************************************************************
whb,2=gIE
! 3-D FDTD code with CPML absorbing boundary conditions
o)SA^5
!***********************************************************************
p5?8E$VHV
!
=qy{8MsjA
! Program author: Jamesina J. Simpson, Ph.D. Graduate Student
Ps=<@,dks
! National Science Foundation Fellow
snti*e4"V
! NU Computational Electromagnetics Laboratory
& 8'QD~
! Director: Allen Taflove
ZB5u\NpcW
! Department of Electrical Engineering and
}$D{YHF
! Computer Science
D4;6}gRC
! Northwestern University
jQRl-[n
! 2145 Sheridan Road
l~j{i/>
! Evanston, IL 60208
yaW HGre
! [url=mailto:j-simpson@northwestern.edu]j-simpson@northwestern.edu[/url]
qytH<UB
!
wfY]J0l
! Copyright 2005
t#sw{RO
!
3lo.YLP^
! This FORTRAN 90 code implements the finite-difference time-domain
b_%W*Q
! solution of Maxwell's curl equations over a three-dimensional
wW1>#F
! Cartesian space lattice. The grid is terminated by CPML absorbing
n}!D)Gx
! boundary conditions. However, in a straightforward manner it can
/aX#j`PrH
! be altered to have PEC planes at any of the outer grid boundaries.
>#8J@=iuqv
! Also, the number of grid cells as well as the thickness of
_;8+L\
! the PML in each Cartesian direction can be varied independently.
r>.^4Z@
!
\h UE,^
! For illustrative purposes, the code supplied here models the PML
]~J.YX9ST
! numerical experiment described in Section 7.11.2. Three output
vgbk {
! files are generated having the following data:
0{zA6Xu
!
<F#/wU^9
! (1) Ez at the source for each time step;
~RIn7/A
! (2) Ey at the probe point for each time step; and
}\wTV*n`X
! (3) The plane of Ez values 1 mm above the source in the k-
le.(KgRS4
! direction recorded at the time step, "record_grid". This
IP-}J$$1
! data can be viewed in Matlab using the following commands:
bP3S{Jt-|
!
8^)K|+_'m
! >> load view_grid.dat
3E`poE
! >> for j = 1:Jmax
w?Nx^)xX
! >> image(1:Imax,j) = view_grid(1+(j-1)*Imax:j*Imax);
g4CdzN~
! >> end
:^*9Eb
! >> pcolor(image'); shading flat
0$e]?]X6
!
81&5g'
! The relative error (equation 7.135) graphed in Fig. 7.6 on
;y%C\YB#
! page 318 can be reproduced by comparing the output file
/Q*cyLv
! "probe.dat" with that of a much larger benchmark grid having
<h<4R Rj
! Imax, Jmax, and Kmax increased to the values mentioned in the text.
;VIW/
!
XJ9l,:c,
! This code has been tested using the Intel Fortran Compiler 8.0 for
oNa*|CSE>
! Linux. The executable can be created by typing
Mg^.~8\de
! "ifort fdtd3D_CPML.f90" at the command prompt.
_?J:Z*z?
!
}5{#f`Ca6
! This program is not guaranteed to be free of defects or bugs.
GFmVR2z_+
! Please report any bugs that may exist to:
w7Y>B`wm?
! [url=mailto:j-simpson@northwestern.edu]j-simpson@northwestern.edu[/url]
8"2X 8C8
!
xK;WJm"
!
o:C],G_
!***********************************************************************
s\#eD0|
`z]MQdE_w
PROGRAM fdtd3D_CPML
WTZr{)e
IMPLICIT NONE
7\p<k/TS
! ..................................
Lf} @v
! Input Fundamental Constants (MKS units)
itmQH\9 8
REAL, PARAMETER :: &
"H!2{l{
pi = 3.14159265358979, C = 2.99792458E8, &
e Zb8x
muO = 4.0 * pi * 1.0E-7, epsO = 1.0/(C*C*muO)
`Q~`Eq?@
! ..................................
Xh*p\ $
! Specify Material Relative Permittivity and Conductivity
wD'LX
REAL, PARAMETER:: &
Kl)PF),
epsR = 1.0, sigM1 = 0.0 ! free space
J^]Y`Q`
! ..................................
+(9qAB7
! Specify Number of Time Steps and Grid Size Parameters
'@Q aeFm
INTEGER, PARAMETER :: &
i~04 P
nmax = 2100, & ! total number of time steps
p/GYfa dU
Imax = 51, Jmax = 126, Kmax = 26 ! grid size corresponding to the
6:o?@%
! number of Ez field components
\/ 8 V|E
! ..................................
EPMdR66
! Specify Grid Cell Size in Each Direction and Calculate the
i][af
! Resulting Courant-Stable Time Step
]&kzIxh
REAL, PARAMETER :: &
J;S@Q/s
dx = 1.0E-3, dy = 1.0E-3, dz = 1.0E-3, & ! cell size in each direction
+ysP#uAA
dt = 0.99 / (C*(1.0/dx**2+1.0/dy**2+1.0/dz**2)**0.5)
+""8aA
! time step increment
v\ gCgx=%j
! ..................................
ob3Z I
! Specify the Impulsive Source (See Equation 7.134)
3[E)/~-
REAL, PARAMETER :: &
U3zwC5}BN
tw = 53.0E-12, tO = 4.0*tw
{@gTs
! ..................................
K;}h u(*\]
! Specify the Time Step at which the Grid is Recorded for Visualization
|Lz:i+;
INTEGER, PARAMETER :: &
.Lc<1s
record_grid = 300
Q?\rwnW?U
! ..................................
%`Q<_LTU
! Specify the PEC Plate Boundaries and the Source/Recording Points
2n`OcXCh/
INTEGER, PARAMETER :: &
V3]"ROH
istart = (Imax-1)/2-11, iend = istart+24, jstart = istart, &
MX.=k>
jend = jstart + 99, kstart = Kmax/2, kend = kstart, &
,0=@cJ
isource = istart, jsource = jstart, ksource = kend+1, &
std4Nyp
irecv1 = iend, jrecv1 = jend+1, krecv1 = kend ! Ey at probe point
V9o_Q
! ..................................
DTw3$:
! Specify the CPML Thickness in Each Direction (Value of Zero
}\oy?_8~
! Corresponds to No PML, and the Grid is Terminated with a PEC)
u teI[Q
INTEGER, PARAMETER :: &
BHW8zY=F
! PML thickness in each direction
5lMm8<v
nxPML_1 = 11, nxPML_2 = nxPML_1, nyPML_1 = nxPML_1, &
]/y&5X
nyPML_2 = nxPML_1, nzPML_1 = nxPML_1, nzPML_2 = nxPML_2
|Skxa\MI
! ..................................
hiN6]jL|O
! Specify the CPML Order and Other Parameters
zXH CP.Rmg
INTEGER, PARAMETER :: &
xo46L\
m = 3, ma = 1
u4kg#+H
REAL, PARAMETER :: &
ua-cX3E
sig_x_max = 0.75 * (0.8*(m+1)/(dx*(muO/epsO*epsR)**0.5)), &
"77 j(Vs9
sig_y_max = 0.75 * (0.8*(m+1)/(dy*(muO/epsO*epsR)**0.5)), &
I8 \Ka=w
sig_z_max = 0.75 * (0.8*(m+1)/(dz*(muO/epsO*epsR)**0.5)), &
,:!dqonn
alpha_x_max = 0.24, &
Wi?37EHr
alpha_y_max = alpha_x_max, alpha_z_max = alpha_x_max, &
RW@sh9
kappa_x_max = 15.0, &
T;u>]"S
kappa_y_max = kappa_x_max, kappa_z_max = kappa_x_max
TLk=HGw
INTEGER :: &
X)K3X:~L+
i,j,ii,jj,k,kk,n
'nFqq:2Xa
REAL :: &
kN)m"}gX
source, P1, P2
C$1}c[
! TM components
%TA3o71
REAL,DIMENSION(Imax, Jmax, Kmax) :: &
z7H[\ 4A!>
Ez, CA, CB, sig, eps
6k=ink-/
REAL,DIMENSION(Imax-1, Jmax, Kmax) :: &
!a[1rQH
Hy
fem>WPvG
REAL,DIMENSION(Imax,Jmax-1, Kmax) :: &
>/DyR+?>4
Hx
3Hli^9&OX_
REAL :: &
>|[74#}7
DA, DB
[foZO&+!
! TE components
D%0GXUp
REAL,DIMENSION(Imax-1, Jmax-1, Kmax-1) :: &
.d;XLS~
Hz
b%fn1Ag9
REAL,DIMENSION(Imax-1, Jmax, Kmax-1) :: &
i-b++R/WN
Ex
uW8LG\Z>D5
REAL,DIMENSION(Imax,Jmax-1, Kmax-1) :: &
n>Rt9
Ey
ci@U a}T
! PML
'14 G0<;yL
REAL ,DIMENSION(nxPML_1,Jmax,Kmax) :: &
jI8qiZ);~
psi_Ezx_1
v_gQCS
REAL ,DIMENSION(nxPML_2,Jmax,Kmax) :: &
o!3 -=<^
psi_Ezx_2
45hjN6
REAL ,DIMENSION(nxPML_1-1,Jmax,Kmax) :: &
P"<