《一维fdtd模拟程序C语言》由会员分享,可在线阅读,更多相关《一维fdtd模拟程序C语言(5页珍藏版)》请在人人文库网上搜索。
1、include H-.88 #include j53Td. #include wwHV;i PKM8MY vo #define NUM_of_ZAXIS 400 nE3m) 2U;ImC1g float gauss_pulse(float T,float t0,float spread); IZkQmA= L: ;L/ int file_save(float* data,char* filename); m:7$oq| ,!s;o6|*y sSMcF2I WU -_Y void main() _8CE|Z ?X1vU0 c float dt,ddz; %8)GuxG* float source。
2、,T; 4|ryt4B int pos_driv_source; P| o_/BS int i,n,Nsteps; var_cb=dt/Epsilon; lP*_dt9 var_cp=0.5*h_sigma*dt/Mu; okfGd= & var_cq=dt/Mu; :_;9&H9ha hsIC5s3 ca=(1-var_ca)/(1+var_ca); 4.|-?qG cb=var_cb/(1+var_ca); sWw cp=(1-var_cp)/(1+var_cp); #9aB3C cq=var_cq/(1+var_cp); 07WZ w1(; 4.)hCb var_border=(C*dt。
3、-ddz)/(C*dt+ddz); /i;/$ o ex_high_m1=0; :7 .a._WZF ex_low_s1=0; =ML6jr ex_low_s2=0; 4naL2 Y! ex_high_s1=0; z(14250 ex_high_s2=0; 6.? Ke8iC 8z&7wO / 上 ,下 边界位置 S#+Dfa8X e_low=20; p%) 1(R8qM e_high=380; RRh0G* k.nq, pos_driv_source=200; FHpS?htRy ihCa $ +92/0 for(i=0;i0) u#,#z_ /2 V printf(Nsteps); nPl。
4、g5&E scanf(%d,&Nsteps); fc,LFvZ +5AWX,9,- for(n=0;nT 7X$+S ex_low_s2=ex_low_s1; Q$)z_jai ex_low_s1=exe_low+1; 0Qr|!B:+9) 36QZV*P ex_high_m2=ex_high_m1; 1$n! Lj=5 ex_high_m1=exe_high; n2N:rP &BOG&ot ex_high_s2=ex_high_s1; , / 存储数据 95-ptO1 (6 e$j fp=fopen(Ex,w); V38v2LI for(i=0;iUl0&Mf? fclose(fp); vw /X PtT$#hx fp=fopen(Hy,w); kz?m 1 for(i=0;i= Mg8 3kS M*#UV2 float gauss_pulse(float T,float t0,float spread) Pw ZHY R6/vhze4L2 float pulse; XKkIo : pulse=exp(-0.5*(pow(T-t0)/spread,2); GO=3Q; return pulse; c DOz AB1,G|L lYa9k XP7+/A。