实例介绍
【实例简介】Understanding the Finite-Difference Time-Domain Method
【实例截图】
【核心代码】
Contents 1 Numeric Artifacts 7 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 Finite Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3 Symbolic Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Brief Review of Electromagnetics 13 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 Coulomb’s Law and Electric Field . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3 Electric Flux Density . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.4 Static Electric Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.5 Gradient, Divergence, and Curl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.6 Laplacian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.7 Gauss’s and Stokes’ Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.8 Electric Field Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.9 Conductivity and Perfect Electric Conductors . . . . . . . . . . . . . . . . . . . . 25 2.10 Magnetic Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.11 Magnetic Field Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.12 Summary of Static Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.13 Time Varying Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.14 Summary of Time-Varying Fields . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.15 Wave Equation in a Source-Free Region . . . . . . . . . . . . . . . . . . . . . . . 29 2.16 One-Dimensional Solutions to the Wave Equation . . . . . . . . . . . . . . . . . 30 3 Introduction to the FDTD Method 33 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.2 The Yee Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.3 Update Equations in 1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.4 Computer Implementation of a One-Dimensional FDTD Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.5 Bare-Bones Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.6 PMC Boundary in One Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.7 Snapshots of the Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.8 Additive Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.9 Terminating the Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.10 Total-Field/Scattered-Field Boundary . . . . . . . . . . . . . . . . . . . . . . . . 53 iii iv CONTENTS 3.11 Inhomogeneities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 3.12 Lossy Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 4 Improving the FDTD Code 75 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 4.2 Arrays and Dynamic Memory Allocation . . . . . . . . . . . . . . . . . . . . . . 75 4.3 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.4 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.5 Improvement Number One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 4.6 Modular Design and Initialization Functions . . . . . . . . . . . . . . . . . . . . . 90 4.7 Improvement Number Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 4.8 Compiling Modular Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 4.9 Improvement Number Three . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 5 Scaling FDTD Simulations to Any Frequency 115 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 5.2 Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 5.2.1 Gaussian Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 5.2.2 Harmonic Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 5.2.3 The Ricker Wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.3 Mapping Frequencies to Discrete Fourier Transforms . . . . . . . . . . . . . . . . 120 5.4 Running Discrete Fourier Transform (DFT) . . . . . . . . . . . . . . . . . . . . . 121 5.5 Real Signals and DFT’s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.6 Amplitude and Phase from Two Time-Domain Samples . . . . . . . . . . . . . . 126 5.7 Conductivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 5.8 Transmission Coefficient for a Planar Interface . . . . . . . . . . . . . . . . . . . 132 5.8.1 Transmission through Planar Interface . . . . . . . . . . . . . . . . . . . . 134 5.8.2 Measuring the Transmission Coefficient Using FDTD . . . . . . . . . . . 135 6 Differential-Equation Based ABC’s 145 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6.2 The Advection Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6.3 Terminating the Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 6.4 Implementation of a First-Order ABC . . . . . . . . . . . . . . . . . . . . . . . . 148 6.5 ABC Expressed Using Operator Notation . . . . . . . . . . . . . . . . . . . . . . 153 6.6 Second-Order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 6.7 Implementation of a Second-Order ABC . . . . . . . . . . . . . . . . . . . . . . 158 7 Dispersion, Impedance, Reflection, and Transmission 161 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 7.2 Dispersion in the Continuous World . . . . . . . . . . . . . . . . . . . . . . . . . 161 7.3 Harmonic Representation of the FDTD Method . . . . . . . . . . . . . . . . . . . 162 7.4 Dispersion in the FDTD Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 7.5 Numeric Impedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 7.6 Analytic FDTD Reflection and Transmission Coefficients . . . . . . . . . . . . . . 169 CONTENTS v 7.7 Reflection from a PEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 7.8 Interface Aligned with an Electric-Field Node . . . . . . . . . . . . . . . . . . . . 175 8 Two-Dimensional FDTD Simulations 181 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 8.2 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 8.3 Two Dimensions: TMz Polarization . . . . . . . . . . . . . . . . . . . . . . . . . 185 8.4 TMz Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 8.5 The TFSF Boundary for TMz Polarization . . . . . . . . . . . . . . . . . . . . . . 202 8.6 TMz TFSF Boundary Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 8.7 TEz Polarization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 8.8 PEC’s in TEz and TMz Simulations . . . . . . . . . . . . . . . . . . . . . . . . . 224 8.9 TEz Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 9 Three-Dimensional FDTD 241 9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 9.2 3D Arrays in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 9.3 Governing Equations and the 3D Grid . . . . . . . . . . . . . . . . . . . . . . . . 244 9.4 3D Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 9.5 TFSF Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 9.6 TFSF Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 9.7 Unequal Spatial Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 10 Dispersive Material 289 10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 10.2 Constitutive Relations and Dispersive Media . . . . . . . . . . . . . . . . . . . . . 290 10.2.1 Drude Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 10.2.2 Lorentz Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 10.2.3 Debye Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 10.3 Debye Materials Using the ADE Method . . . . . . . . . . . . . . . . . . . . . . . 294 10.4 Drude Materials Using the ADE Method . . . . . . . . . . . . . . . . . . . . . . . 296 10.5 Magnetically Dispersive Material . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 10.6 Piecewise Linear Recursive Convolution . . . . . . . . . . . . . . . . . . . . . . . 301 10.7 PLRC for Debye Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 11 Perfectly Matched Layer 307 11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 11.2 Lossy Layer, 1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 11.3 Lossy Layer, 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 11.4 Split-Field Perfectly Matched Layer . . . . . . . . . . . . . . . . . . . . . . . . . 312 11.5 Un-Split PML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 11.6 FDTD Implementation of Un-Split PML . . . . . . . . . . . . . . . . . . . . . . . 318 vi CONTENTS 12 Acoustic FDTD Simulations 323 12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 12.2 Governing FDTD Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 12.3 Two-Dimensional Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 328 13 Parallel Processing 331 13.1 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 13.2 Thread Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 13.3 Message Passing Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 13.4 Open MPI Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 13.5 Rank and Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 13.6 Communicating Between Processes . . . . . . . . . . . . . . . . . . . . . . . . . 344 14 Near-to-Far-Field Transformation 351 14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 14.2 The Equivalence Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 14.3 Vector Potentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 14.4 Electric Field in the Far-Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 14.5 Simpson’s Composite Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 14.6 Collocating the Electric and Magnetic Fields: The Geometric Mean . . . . . . . . 363 14.7 NTFF Transformations Using the Geometric Mean . . . . . . . . . . . . . . . . . 366 14.7.1 Double-Slit Radiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 14.7.2 Scattering from a Circular Cylinder . . . . . . . . . . . . . . . . . . . . . 370 14.7.3 Scattering from a Strongly Forward-Scattering Sphere . . . . . . . . . . . 371 A Construction of Fourth-Order Central Differences A.377 B Generating a Waterfall Plot and Animation B.379 C Rendering and Animating Two-Dimensional Data C.383 D Notation D.387 E PostScript Primer E.389 E.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.389 E.2 The PostScript File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.390 E.3 PostScript Basic Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.390 Index 403
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论