微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > TF/SF Taflove Computer Implementation

TF/SF Taflove Computer Implementation

时间:03-30 整理:3721RD 点击:
I am trying to implement my own 3D FDTD based on Taflove's book, however I'm running into trouble with my TF/SF implementation. I am attempting to model free space, with no scatterers, yet I am getting significant fields outside the Total Field region. I am modelling a 10 GHz sine wave with a deltax of 0.002.

I don't expect you to debug my code, but if anyone has an implementation of the fully general 3D TF/SF, not just in one direction, that would be fantastic. I am confident that I have accounted for the 1/2 offsets correctly, but I would like to confirm.

Thanks for your help

Code:
	
Code C - [expand]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 void FDTD::TFSF() { int i,j,k; /****************** * Y Face H Updates ******************/ //Initial Y j = TFSF_y0-1; for(i = TFSF_x0; i < TFSF_x1; i++) for(k = TFSF_z0; k <= TFSF_z1; k++) Hz(i,j,k) -= Ce1D*ExInc(i,j+1,k); for(i = TFSF_x0; i <= TFSF_x1; i++) for(k = TFSF_z0; k < TFSF_z1; k++) Hx(i,j,k) += Ce1D*EzInc(i,j+1,k); //Final Y j = TFSF_y1; for(i = TFSF_x0; i < TFSF_x1; i++) for(k = TFSF_z0; k <= TFSF_z1; k++) Hz(i,j,k) += Ce1D*ExInc(i,j,k); for(i = TFSF_x0; i <= TFSF_x1; i++) for(k = TFSF_z0; k < TFSF_z1; k++) Hx(i,j,k) -= Ce1D*EzInc(i,j,k); /******************** * Z Face H Updates *******************/ //Initial Z k = TFSF_z0-1; for(i = TFSF_x0; i < TFSF_x1; i++) for(j = TFSF_y0; j <= TFSF_y1; j++) Hy(i,j,k) += Ce1D*ExInc(i,j,k+1); for(i = TFSF_x0; i <= TFSF_x1; i++) for(j = TFSF_y0; j < TFSF_y1; j++) Hx(i,j,k) -= Ce1D*EyInc(i,j,k+1); //Final Z k = TFSF_z1; for(i = TFSF_x0; i < TFSF_x1; i++) for(j = TFSF_y0; j <= TFSF_y1; j++) Hy(i,j,k) -= Ce1D*ExInc(i,j,k); for(i = TFSF_x0; i <= TFSF_x1; i++) for(j = TFSF_y0; j < TFSF_y1; j++) Hx(i,j,k) += Ce1D*EyInc(i,j,k); /***************** * X Face H Updates ****************/ //Initial X i = TFSF_x0-1; for(j = TFSF_y0; j < TFSF_y1; j++) for(k = TFSF_z0; k <= TFSF_z1; k++) Hz(i,j,k) += Ce1D*EyInc(i+1,j,k); for(j = TFSF_y0; j <= TFSF_y1; j++) for(k = TFSF_z0; k < TFSF_z1; k++) Hy(i,j,k) -= Ce1D*EzInc(i+1,j,k); //Final X i = TFSF_x1; for(j = TFSF_y0; j < TFSF_y1; j++) for(k = TFSF_z0; k <= TFSF_z1; k++) Hz(i,j,k) -= Ce1D*EyInc(i,j,k); for(j = TFSF_y0; j <= TFSF_y1; j++) for(k = TFSF_z0; k < TFSF_z1; k++) Hy(i,j,k) += Ce1D*EzInc(i,j,k); /****************** * Update 1D Grid *****************/ Update1D(); //Increment time for the 1D grid /************** * Y Face E Updates *************/ //Initial y j = TFSF_y0; for(i = TFSF_x0; i < TFSF_x1; i++) for(k = TFSF_z0; k <= TFSF_z1; k++) Ex(i,j,k) -= Ch1D*HzInc(i,j-1,k); j = TFSF_y0; for(i = TFSF_x0; i <= TFSF_x1; i++) for(k = TFSF_z0; k < TFSF_z1; k++) Ez(i,j,k) += Ch1D * HxInc(i,j-1,k); //Final Y j = TFSF_y1; for(i = TFSF_x0; i < TFSF_x1; i++) for(k = TFSF_z0; k <= TFSF_z1; k++) Ex(i,j,k) += Ch1D*HzInc(i,j,k); for(i = TFSF_x0; i <= TFSF_x1; i++) for(k = TFSF_z0; k < TFSF_z1; k++) Ez(i,j,k) -= Ch1D*HxInc(i,j,k); /******************** * Z Face E Updates *******************/ //Initial Z k = TFSF_z0; for(i = TFSF_x0; i < TFSF_x1; i++) for(j = TFSF_y0; j <= TFSF_y1; j++) Ex(i,j,k) += Ch1D*HyInc(i,j,k-1); for(i = TFSF_x0; i <= TFSF_x1; i++) for(j = TFSF_y0; j < TFSF_y1; j++) Ey(i,j,k) -= Ch1D*HxInc(i,j,k-1); //Final Z k = TFSF_z1; for(i = TFSF_x0; i < TFSF_x1; i++) for(j = TFSF_y0; j <= TFSF_y1; j++) Ex(i,j,k) -= Ch1D*HyInc(i,j,k); for(i = TFSF_x0; i <= TFSF_x1; i++) for(j = TFSF_y0; j < TFSF_y1; j++) Ey(i,j,k) += Ch1D*HxInc(i,j,k); /************************** * X Face E Updates *************************/ //Initial X i = TFSF_x0; for(j = TFSF_y0; j < TFSF_y1; j++) for(k = TFSF_z0; k <= TFSF_z1; k++) Ey(i,j,k) += Ch1D*HzInc(i-1,j,k); for(j = TFSF_y0; j <= TFSF_y1; j++) for(k = TFSF_z0; k < TFSF_z1; k++) Ez(i,j,k) -= Ch1D*HyInc(i-1,j,k); //Final X i = TFSF_x1; for(j = TFSF_y0; j < TFSF_y1; j++) for(k = TFSF_z0; k <= TFSF_z1; k++) Ey(i,j,k) -= Ch1D*HzInc(i,j,k); for(j = TFSF_y0; j <= TFSF_y1; j++) for(k = TFSF_z0; k < TFSF_z1; k++) Ez(i,j,k) += Ch1D*HyInc(i,j,k); return; }

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top