📄 userdefinedvariables.m
字号:
function UserDefinedVariables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electromagnetic Finite-Difference Time-Domain %
% Version 1.20, Release 1 %
% %
% (C) Copyright 2005 %
% Sharif University of Technology %
% School of Electrical Engineering %
% All Rights Reserved %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global TE TM Mode BoundaryType Source
global StructureType Animate Air Silicon
global dT TimeSteps TimeDecimation
global SnapshotTimes PowerTime PowerPlanes
global DefaultFileNamePrefix FileExtension
global xCenter yCenter xProbe yProbe
global Alpha NoDiv NormalizedFrequency
global SourceDuration xSource ySource
global ModeNumber WaveguideWidth Threshold
global eC mC eF mF SourceWidth MaximumFreqency
global False True Structure ShowStructure
global StructureColor ShowPML DrawStructure
global LatticeCnt xCells yCells
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Simulation Type %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Mode=TM; % TE (H-polarization) or TM (E-polarization)
StructureType=0; % 0 => Square Lattice, 1 => Triangular Lattice, -1 => Extended Square Lattice
BoundaryType=1; % 0 => Zero(x-y), 1 => Bloch(x-y), 2 => Bloch(x)/Zero(y)
% 3 => Zero(x)/Bloch(y), 4 => Bloch(x)/PML(y), 5 => PML(x)/Bloch(y), 6 => PML(x-y)
Source=0; % 0 => Initial Field, 1 => Point Source, 2 => Huygens Source
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Control Variables %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LatticeCnt=24; % Number of Grid Points Per Lattice Constant
xCells=1; % Number of primitive cells along x-direction
yCells=1; % Number of primitive cells along y-direction
xGrid=xCells*LatticeCnt;
yGrid=yCells*round(LatticeCnt*(1+(StructureType==1)*(sqrt(3)-1)));
dT=0.25; % Time step compared to the maximum allowed time step
TimeSteps=2^14; % The total number of time steps
TimeDecimation=1; % The sampling decimation factor
SnapshotTimes=[]; % An array declaring the snapshot moments
PowerTime=2^6; % The time step from which power integration starts
PowerPlanes=[2 xGrid-1]; % An array declaring the x-position of integration planes of power
DefaultFileNamePrefix='Square'; % Default file name prefix
FileExtension='.dat'; % Extension name
xProbe=round(xGrid/2); % x-coordinate of field Probe
yProbe=round(yGrid/2); % y-coordinate of field Probe
NoDiv=16; % Number of divisions along each direction in inverse lattice
MaximumFreqency=0.6; % Maximum normalized frequency in band-structure simulations
Threshold=0.001; % Minimum relative detectable peak in the Fourier spectrum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Source Variables %%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gaussian Initial Field
Alpha=1.2/xGrid; % Decay factor in initial Gaussion field
xCenter=round(xGrid/2); % x-coordinate of Center of Gaussion initial field
yCenter=round(yGrid/2); % y-coordinate of Center of Gaussion initial field
% Point Source
NormalizedFrequency=0.2373; % Normalized Source Frequency a/l (Lattice Constant/Free Space Lambda)
SourceDuration=TimeSteps; % The time step at which source is turned off
xSource=round(xGrid/2); % x-coordinate of the point source
ySource=round(yGrid/2); % y-coordinate of the point source
% Symmetric Huygens Slab Waveguide Source
ModeNumber=0; % Mode number
WaveguideWidth=LatticeCnt; % Film thickness
eC=Air; % Permittivity of Cladding
mC=1; % Permeability of Cladding
eF=Silicon; % Permittivity of Film
mF=1; % Permeability of Film
SourceWidth=2*WaveguideWidth; % Width of the Huygens source
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Garphics Controls %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShowStructure=True; % Plot the structure on snapshots
StructureColor=0.33; % Structure color level (ranging from -1 to 1)
ShowPML=False; % Hide the PML layers around
DrawStructure=False; % Generate separate Permittivity and Permeability plots
Animate=False; % No Frame by Frame Display & Pause
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -