📄 fdtd_2d_tm.h
字号:
#pragma once
//#include "fdtd_1D_EzHy.h"
#include "FDTD_1D_EZHY_PML_LOSS.h"
class CFDTD_2D_TM
{
private:
double pi, eps_0, mu_0;
int ** Ind; //indicates the material type in each FDTD cell
double ** Mat; //contains the material properties eps_r sigma
int **Coord_ptSource; //the location of the point sources
double **Par_ptSource; //the parameters of the point sources
//the field components
double **Fz, **Ez, **Hx, **Gx, **Hy, **Gy;
int n_PML;
//the PML matrices
double *K_Fz_a, *K_Ez_a, *K_Gx_a, *K_Hx_a, *K_Gy_a, *K_Hy_a;
double *K_Fz_b, *K_Ez_b, *K_Gx_b, *K_Hx_b, *K_Gy_b, *K_Hy_b;
//dimensions of the computational space
int nx, ny;
//number of materials present in the investigated geometry
int n_Mat;
//number of point sources present in the computational domain
int n_ptSource;
int source_type;
int jel_plane_wave;
//the position of the total field scatterd field interface
int n_TS_xa, n_TS_xb, n_TS_ya, n_TS_yb, n_1D;
//CFdtd_1D_EzHy fdtd_1D;
CFDTD_1D_EZHY_PML_LOSS fdtd_1D;
double *Ez_1D, *Hy_1D;
double phi; //the direction of propagation related to x axis
double cos_phi, sin_phi;
//the interface between the total field-scattered field zone
double *ll_1D_E, *ll_1D_H;
double *d_f_E, *d_b_E, *d_l_E, *d_r_E;
double *d_f_H, *d_b_H, *d_l_H, *d_r_H;
double *Ez_f_1D, *Ez_b_1D, *Ez_l_1D, *Ez_r_1D;
double *Hx_f_1D, *Hx_b_1D, *Hy_l_1D, *Hy_r_1D;
int l_x, l_y;
double d; //the 1D space steep
int l_1D;
//time increment
double dt;
//elementary cell sizes
double dx, dy, invdx, invdy, dtDIVdx, dtDIVdy;
double K_Ez_x, K_Ez_y, K_Hx, K_Hy;
//the coordinates of the followed field components
int **Ind_Foll;
//number of the followed points and the number of iterations
int length_Ind_Foll, n_tot;
//stores the followed field components
double **Hx_Foll, **Hy_Foll, **Ez_Foll;
//to save the field components
int jel_Save;
int n_x_a, n_x_b, n_y_a, n_y_b; //identify the saved volume
char *path_name_Ez_1D;
char *path_name_Ez;
char *path_name_Hx;
char *path_name_Hy;
int nr_save;
#ifdef senddata
Engine *ep;
#endif
public:
CFDTD_2D_TM(void);
~CFDTD_2D_TM(void);
bool Init(int **&Index, int n_x, int n_y, double **&Mater, int nMat, int n_PML, double d_t,
double d_x, double d_y);
//Index - describe the geometry, each element indicating the material type in
// the computational grid
//nx, ny - the dimensions of the computational space
//Mater - contains the permittivity and conductivity. Dimension [n_Mat][2]
//init the PML parameters
void Init_PML_Param();
// in case of point sorces
void Init_ptSource(int **Coord, int nCoord, double **Par_Excit, int s_type);
// in case of total field - scattered field formulation
int Init_plWave_Gauss(double E0, double t0, double tw, double PHIA, int nxa,
int nxb, int nya, int nyb);
int Init_plWave_Sin(double E0, double omega, double PHI, int nxa, int nxb,
int nya, int nyb);
int Init_plWave_GaussSin(double E0, double omega, double t0, double tw,
double PHI, int nxa, int nxb, int nya, int nyb);
//collection of the main fdtd routines
int fdtd_marching(int n_max_steep);
//functions to save output data
bool Init_Followed(int **Ind_Followed, int n, int n_t);
bool Init_Save_Field(int nxa, int nxb, int nya, int nyb, int nr_Save, char *path);
void Get_Data_Followed(double **&hx, double **&hy, double **&ez);
int phase_velocity(double dx, double dy, double dt, double eps_r,
double mu_r, double om_0, double teta, double *phase_vel);
//free up the allocated memory
void Free_Mem();
#ifdef senddata
void set_MATLABengine(Engine *ep);
#endif
private:
//the field components from Maxwell equations
void calc_Ez();
void calc_Hx();
void calc_Hy();
//Functions referring to the excitation
//Point Source
void ptSource_J(double **&xx, double **&Par_ptS, double time);
//total field scattered field interface in x direction
void TS_Ez();
void TS_Hx();
void TS_Hy();
//the coordinates of the followed field components
void Set_Data_Followed(int n_t);
int Save_Field(int iter);
int interp_1D(double *x, int length_x, double *f, double *x_i,
int length_x_i, double *g);
int Init_TS_Param();
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -