3d-tfsf-demo.c

来自「利用VC++进行FDTD三维远近场变换」· C语言 代码 · 共 29 行

C
29
字号
/* 3D simulation with a TFSF boundary. */

 #include "fdtd-alloc.h"
 #include "fdtd-macro.h"
 #include "fdtd-proto.h"

 int main()
 {
	 Grid *g;

	 ALLOC_1D(g,1,Grid); // allocate memory for grid structure
	 gridInit(g); // initialize 3D grid

	 tfsfInit(g); // initialize TFSF boundary
	 abcInit(g); // initialize ABC
	 snapshotInit3d(g); // initialize snapshots

	 /* do time stepping */
	 for (Time=0; Time<MaxTime; Time++) {
		 updateH(g); // update magnetic fields
		 tfsf(g); // apply correction to TFSF boundary
		 updateE(g); // update electric fields
		 abc(g); // apply ABC
		 snapshot3d(g); // take a snapshot (if appropriate)
		 printf("\n %f", Ex(8,8,8));
	 } // end of time-stepping

 	return 0;
 }

⌨️ 快捷键说明

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