pmlfunctions.c

来自「a full 3D simulation of electromagnetic 」· C语言 代码 · 共 66 行

C
66
字号
/* Copyright notice:   radarFDTD - A free 3D-FDTD simulation for EM-waves with GPML-ABCs ;-)   Copyright (C) 2000 Carsten Aulbert   (    I used the following program as a 'manual', so in my opinion this needs to be quoted:   ToyFDTD, version 1.02    The if-I-can-do-it-you-can-do-it FDTD!    Copyright (C) 1998,1999 Laurie E. Miller, Paul Hayes, Matthew O'Keefe    )    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/PRECISION ReturnStretching (PRECISION position, PRECISION pmlThickness, PRECISION maxStretching, int stretchSteepness){  /* I use the profile discribed in: Fang and Wu, Generlized PML for the Absorpion of Porpagating and Evanescent Waves, IEEE Transactions on Microwave Theory and Techniques, Volume 44, No.12, December 1996 */  /* formula for this profile: s(pos) = 1 + s_max * (pos / thickness)**steepness */  PRECISION tmp = 1.0 + maxStretching * pow(position / pmlThickness, stretchSteepness);  return tmp;}PRECISION ReturnConductivity (PRECISION position, PRECISION pmlThickness, PRECISION maxConductivity){  /* I use the profile discribed in: Fang and Wu, Generlized PML for the Absorpion of Porpagating and Evanescent Waves, IEEE Transactions on Microwave Theory and Techniques, Volume 44, No.12, December 1996 */  PRECISION tmp = sin(M_PI * position / (2.0 * pmlThickness));     return maxConductivity * tmp * tmp;     /*  PRECISION tmp;    switch(((int) (0.5+position/pmlThickness)))    {    case 0: tmp= 0.001064;break;    case 1: tmp= 0.001210;break;    case 2: tmp= 0.001296;break;    case 3: tmp= 0.001385;break;    case 4: tmp= 0.001487;break;    case 5: tmp= 0.001606;break;    case 6: tmp= 0.001746;break;    case 7: tmp= 0.001916;break;    case 8: tmp= 0.002126;break;    case 9: tmp= 0.002395;break;    case 10: tmp= 0.002752;break;    case 11: tmp= 0.003257;break;    case 12: tmp= 0.004040;break;    case 13: tmp= 0.005446;break;    case 14: tmp= 0.008747;break;    case 15: tmp= 0.042007;break;    default: tmp= 0.042007;    }    return tmp;*/  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?