⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdtd_2d_te_lorentz.cpp

📁 用C++编写的处理色散媒质的FDTD程序
💻 CPP
字号:
// FDTD_2D_TE_LORENTZ.cpp: implementation of the CFDTD_2D_TE_LORENTZ class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "fdtd_2D_TE_PML_Lorentz.h"
#include "FDTD_2D_TE_LORENTZ.h"
#include "Matrix.h"
#include "Math.h"
#include <stdlib.h>         /* For _MAX_PATH definition */
#include <malloc.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CFDTD_2D_TE_LORENTZ::CFDTD_2D_TE_LORENTZ()
{
	Fz = NULL; Hz = NULL; 
	Ex = NULL; Dx = NULL; Gx = NULL; 
	Sx = NULL; Sx_2 = NULL;
	Ey = NULL; Dy = NULL; Gy = NULL;  
	Sy = NULL; Sy_2 = NULL;

	W = NULL;

	//PML
	K_E1_a  = NULL; K_E1_b  = NULL; K_E2_a = NULL; K_E2_b = NULL;
	K_E3_a  = NULL; K_E3_b  = NULL; K_E4_a = NULL; K_E4_b = NULL;
	K_E7_a  = NULL; K_E7_b  = NULL; K_E8_a = NULL; K_E8_b = NULL;
	
	//Material
	K_a = NULL; K_b = NULL; K_c = NULL;
	
	Hz_Foll = NULL; Ex_Foll = NULL; Ey_Foll = NULL;
	W_Foll = NULL;

	pi = 3.1415926535897932384626433832795;
	eps_0 = 8.854e-12; // [F/m]
	mu_0 = 4*pi*1e-7; // [H/m]

}

CFDTD_2D_TE_LORENTZ::~CFDTD_2D_TE_LORENTZ()
{
	Free_Mem();
}

///////////////////////////////////////////////////////////////////////////////////////
//Init Main Parameters
///////////////////////////////////////////////////////////////////////////////////////
BOOL CFDTD_2D_TE_LORENTZ::Init_Main_Param(int **&index, int n_x, int n_y, double **&mater, int n_mat, 
	  						     int n_pml, double d_t, double d_x, double d_y)
{
	Index = index; //contains the indices of the material type. Dimension [nx][ny]

	//dimensions of the computational space
    nx = n_x;
	ny = n_y; 
	
	//contains the material parameters [eps_r mu_r]
	Mater = mater;
	n_Mat = n_mat;
	
	//dimension of the PML region
	n_PML = n_pml;
	
	dx = d_x;
	dy = d_y;
	dt = d_t; //the time step
	
	//////////////////////////////////////////////////////

⌨️ 快捷键说明

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