资源简介
Matlab模拟的电磁学时域有限差分法(电子书+程序)
代码片段和文件信息
% This program demonstrates a one-dimensional FDTD simulation.
% The problem geometry is composed of two PEC plates extending to
% infinity in y and z dimensions parallel to each other with 1 meter
% separation. The space between the PEC plates is filled with air.
% A sheet of current source paralle to the PEC plates is placed
% at the center of the problem space. The current source excites fields
% in the problem space due to a z-directed current density Jz
% which has a Gaussian waveform in time.
% Define initial constants
eps_0 = 8.854187817e-12; % permittivity of free space
mu_0 = 4*pi*1e-7; % permeability of free space
c = 1/sqrt(mu_0*eps_0); % speed of light
% Define problem geometry and parameters
domain_size = 1; % 1D problem space length in meters
dx = 1e-3; % cell size in meters
dt = 3e-12; % duration of time step in seconds
number_of_time_steps = 2000; % number of iterations
nx = round(domain_size/dx); % number of cells in 1D problem space
source_position = 0.5; % position of the current source Jz
% Initialize field and material arrays
Ceze = zeros(nx+11);
Cezhy = zeros(nx+11);
Cezj = zeros(nx+11);
Ez = zeros(nx+11);
Jz = zeros(nx+11);
eps_r_z = ones (nx+11); % free space
sigma_e_z = zeros(nx+11); % free space
Chyh = zeros(nx1);
Chyez = zeros(nx1);
Chym = zeros(nx1);
Hy = zeros(nx1);
My = zeros(nx1);
mu_r_y = ones (nx1); % free space
sigma_m_y = zeros(nx1); % free space
% Calculate FDTD updating coefficients
Ceze = (2 * eps_r_z * eps_0 - dt * sigma_e_z) ...
./(2 * eps_r_z * eps_0 + dt * sigma_e_z);
Cezhy = (2 * dt / dx) ...
./(2 * eps_r_z * eps_0 + dt * sigma_e_z);
Cezj = (-2 * dt) ...
./(2 * eps_r_z * eps_0 + dt * sigma_e_z);
Chyh = (2 * mu_r_y * mu_0 - dt * sigma_m_y) ...
./(2 * mu_r_y * mu_0 + dt * sigma_m_y);
Chyez = (2 * dt / dx) ...
./(2 * mu_r_y * mu_0 + dt * sigma_m_y);
Chym = (-2 * dt) ...
./(2 * mu_r_y * mu_0 + dt * sigma_m_y);
% Define the Gaussian source waveform
time = dt*[0:number_of_time_steps-1].‘;
Jz_waveform = exp(-((time-2e-10)/5e-11).^2);
source_position_index = round(nx*source_position/domain_size)+1;
% Subroutine to initialize plotting
initialize_plotting_parameters;
% FDTD loop
for time_step = 1:number_of_time_steps
% Update Jz for the current time step
Jz(source_position_index) = Jz_waveform(time_step);
% Update magnetic field
Hy(1:nx) = Chyh(1:nx) .* Hy(1:nx) ...
+ Chyez(1:nx) .* (Ez(2:nx+1) - Ez(1:nx)) ...
+ Chym(1:nx) .* My(1:nx);
% Update electric field
Ez(2:nx) = Ceze (2:nx) .* Ez(2:nx) ...
+ Cezhy(2:nx) .* (Hy(2:nx) - Hy(1:nx-1)) ...
+ Cezj(2:nx) .* Jz(2:nx);
Ez(1) = 0; % A
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3184 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Appendix_A\fdtd_1d_code.m
文件 836 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Appendix_A\initialize_plotting_parameters.m
文件 353 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Appendix_A\plot_fields.m
文件 3206 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Appendix_C\polar_plot_constant_phi.m
文件 2418 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Appendix_C\polar_plot_constant_theta.m
文件 4529 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_1\figure_1_2.m
文件 5155 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\calculate_domain_size.m
文件 600 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\define_geometry.m
文件 606 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\example_10_a\define_geometry.m
文件 1364 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\example_10_a\define_output_parameters.m
文件 2723 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\example_10_a\define_problem_space_parameters.m
文件 853 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\example_10_a\define_sources_and_lumped_elements.m
文件 2640 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\initialize_thin_wire_updating_coefficients.m
文件 1820 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_10\initialize_updating_coefficients.m
文件 4054 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\calculate_and_display_farfields.m
文件 7067 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\calculate_farfields_per_plane.m
文件 506 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\calculate_incident_plane_wave_power.m
文件 661 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\define_sources_and_lumped_elements.m
文件 4680 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\display_transient_parameters.m
文件 250 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_a\define_geometry.m
文件 1352 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_a\define_output_parameters.m
文件 2718 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_a\define_problem_space_parameters.m
文件 661 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_a\define_sources_and_lumped_elements.m
文件 303 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_b\define_geometry.m
文件 964 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_b\define_output_parameters.m
文件 2712 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_b\define_problem_space_parameters.m
文件 663 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_b\define_sources_and_lumped_elements.m
文件 1826 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_c\capture_sampled_electric_fields.m
文件 292 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_c\define_geometry.m
文件 1803 2012-09-07 15:40 MATLAB模拟的电磁学时域有限差分法\Chapter_11\example_11_c\define_output_parameters.m
............此处省略437个文件信息
评论
共有 条评论