亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ptfsf.c

?? The tar file contains the following files: ptfsf.c: heart of the perfect TFSF code ptfsf.h: he
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
 * ptfsf: Routines for implementation of a "perfect"
 *   total-field/scattered-field boundary for the Yee FDTD scheme.
 *
 * Copyright (C) 2004  John B. Schneider
 * 
 *********************************************************************
 * This program is free software; you can redistribute it and/or     *
 * modify it under the terms of the GNU General Public License       *
 * as published by the Free Software Foundation (FSF) version 2      *
 * of the License.                                                   *
 *                                                                   *
 * This program is distributed in the hope that it will be useful,   *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     *
 * GNU General Public License for more details.                      *
 *                                                                   *
 * You should have received a copy of the GNU General Public License *
 * along with this program; if not, write to the Free Software       *
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA         *
 * 02111-1307, USA.  You may also visit the FSF web site at          *
 * www.fsf.org.  The license under which this software is publish    *
 * is available from www.fsf.org/copyleft/gpl.html or                *
 * www.fsf.org/copyleft/gpl.txt.                                     *
 *********************************************************************
 */

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <fftw3.h>
#include "ptfsf.h"
#include "fdtdgen.h"

/* local functions not visible to outside world */
void wave_numbers(int ntot, double cdtds, double phi,
		  double *kx_del, double *ky_del);
double find_root(int m, int ntot, double cdtds, double cos_p, double sin_p);
double dispersion_relation(double x);
double dispersion_relation_prime(double x);
int argument_check(
   char *label,  // name of function using this check (for reporting purposes)
   int the_x_ll, int the_y_ll,    // lower-left corner
   int the_x_ur, int the_y_ur,    // upper-right corner
   int x_ref, int y_ref,          // reference point
   int the_lim_x, int the_lim_y,  // size of computational domain
   double the_phi,                // incident angle (degrees)
   double the_cdtds,              // Courant number
   double the_eta,                // impedance 
   double *the_ez, double *the_hx, double *the_hy // field arrays
   );

/* Macros for accessing arrays */
#define Ez(I,J) ez[(I)*(lim_y)+(J)]
#define Hx(I,J) hx[(I)*(lim_y-1)+(J)]
#define Hy(I,J) hy[(I)*(lim_y)+(J)]

/* First argument indicates position, second argument indicates time-step. */
#define Time_series_ez_x0(I,N) time_series_ez_x0[(I)*time_end+(N)]
#define Time_series_ez_x1(I,N) time_series_ez_x1[(I)*time_end+(N)]
#define Time_series_ez_y0(J,N) time_series_ez_y0[(J)*time_end+(N)]
#define Time_series_ez_y1(J,N) time_series_ez_y1[(J)*time_end+(N)]
#define Time_series_hx_x0(I,N) time_series_hx_x0[(I)*time_end+(N)]
#define Time_series_hx_x1(I,N) time_series_hx_x1[(I)*time_end+(N)]
#define Time_series_hy_y0(J,N) time_series_hy_y0[(J)*time_end+(N)]
#define Time_series_hy_y1(J,N) time_series_hy_y1[(J)*time_end+(N)]

/* Global variables. */
/* length = number of samples in FFT space with a default value of
     128.  This value will be increased to a suitable multiple of 2 to
     ensure it is longer than the length of the time series. */
int length=128,
  time_end,     // number of time steps incident field non-zero
  x_ll, y_ll,   // indices of lower-left TFSF boundary corner
  x_ur, y_ur,   // indices of upper-right TFSF boundary corner
  x_ref, y_ref, // reference point
  lim_x, lim_y, // size of computational domain
  flags;        // flags to control some peripheral behavior (see header file)

double 
  eta,                 // impedance
  phi,                 // incident angle [radians!!]
  cdtds,               // Courant number
  cdtds_over_eta,      // Courant number divided by impedance
  cdtds_times_eta;     // Courant number times impedance
double *ez, *hx, *hy;  // electric and magnetic fields

/* Arrays which hold the times series at each node adjacent to TFSF boundary */
double *time_series_ez_x0=NULL, *time_series_ez_x1=NULL,
  *time_series_ez_y0=NULL, *time_series_ez_y1=NULL,
  *time_series_hx_x0=NULL, *time_series_hx_x1=NULL,
  *time_series_hy_y0=NULL, *time_series_hy_y1=NULL;

FILE *in_file; // input file if fields stored in an array

/* ===p========================= ptfsf_init() ============================ */
/* ptfsf_init: initialization routine -- calculates incident fields */
ptfsf_parameters *ptfsf_init(
      int the_time_end,           // time steps inc field non-zero
      int the_x_ll, int the_y_ll, // indices of lower-left corner of TF region
      int the_x_ur, int the_y_ur, // indices of upper-right corner of TF region
      int x_ref, int y_ref,       // indices of "reference" point
      int the_lim_x, int the_lim_y, // size of computational domain
      double the_phi,             // incident angle [degrees]		      
      double the_cdtds,           // Courant number
      double the_eta,             // characteristic impedance
      double *the_ez, double *the_hx, double *the_hy, // field arrays
      double (*time_func)(double), // time-stepping function 
      int the_flags                // collection of flags
      )
{
  int fft_flag=0;
  int error=0;

  int i, j, idum, delay, x_off, y_off, tf_width, tf_height;

  double *kx_del, *ky_del, *pi_m_over_nt, *impedance;

  ptfsf_parameters *params;

  /* FFT and transfer function stuff. */
  double *source_temporal, *source_xy_temporal;
  fftw_complex *source_spectral, *source_xy_spectral;
  fftw_plan planf, planb;

  flags = the_flags;

  /* Perform error checking and initialize global variables. */

  /* Check the arguments that are common to both the case where the
     incident field is written to a file or not. */
  error = argument_check("ptfsf_init",
			 the_x_ll, the_y_ll, 
			 the_x_ur, the_y_ur,
			 x_ref, y_ref,
			 the_lim_x, the_lim_y,
			 the_phi,
			 the_cdtds, the_eta,
			 the_ez, the_hx, the_hy);

  /* The following four constants are used various places. */
  x_off = x_ref-x_ll;  // offset from bottom to reference point
  y_off = y_ref-y_ll;  // offset from left side to reference point
  tf_width  = x_ur - x_ll + 1; // width of TF region
  tf_height = y_ur - y_ll + 1; // height of TF region

  time_end = the_time_end;
  if (time_end < 0) {
    fprintf(stderr,"ptfsf_init: "
	   "illegal number of time steps (must be positive).\n");
    error++;
  }
  /* increase the FFT length by factors of 2 if necessary */
  while (time_end > length)
    length *= 2;
  if (flags & PTFSF_INFO)
    printf("ptfsf_init: FFT's will use a length of %d.\n",length);

  /* Not much we can check with Courant number or impedance. */
  cdtds = the_cdtds;
  if (cdtds <= 0.0) {
    fprintf(stderr,"ptfsf_init: illegal Courant number\n");
    error++;
  }
  
  eta = the_eta;
  if (eta <= 0.0) {
    fprintf(stderr,"ptfsf_init: illegal impedance\n");
    error++;
  }
  cdtds_over_eta = cdtds/eta;
  cdtds_times_eta = cdtds*eta;

  if (time_func==NULL) {
    fprintf(stderr,"ptfsf_init: illegal time-stepping function\n");
    error++;
  }

  if (error != 0) {
    fprintf(stderr,"ptfsf_init: terminating...\n");
    exit(-1);
  }

  /* Allocate and initialize miscellaneous arrays. */
  ALLOC_1D_STRING(ptfsf_init:,kx_del,length/2+1,double);
  ALLOC_1D_STRING(ptfsf_init:,ky_del,length/2+1,double);
  ALLOC_1D_STRING(ptfsf_init:,pi_m_over_nt,length/2+1,double);
  ALLOC_1D_STRING(ptfsf_init:,impedance,length/2+1,double);

  for (idum=0; idum<length/2+1; idum++)
    pi_m_over_nt[idum] = M_PI*idum/(double)length;

  /* Allocate FFT-related arrays. */
  ALLOC_1D_STRING(ptfsf_init:,source_temporal,length,double);
  ALLOC_1D_STRING(ptfsf_init:,source_xy_temporal,length,double);
  ALLOC_1D_STRING(ptfsf_init:,source_spectral,length/2+1,fftw_complex);
  ALLOC_1D_STRING(ptfsf_init:,source_xy_spectral,length/2+1,fftw_complex);

  /* Allocate space for source functions */
  ALLOC_1D_STRING(ptfsf_init:,time_series_ez_x0,time_end*tf_width,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_ez_x1,time_end*tf_width,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_hx_x0,time_end*tf_width,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_hx_x1,time_end*tf_width,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_ez_y0,time_end*tf_height,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_ez_y1,time_end*tf_height,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_hy_y0,time_end*tf_height,double);
  ALLOC_1D_STRING(ptfsf_init:,time_series_hy_y1,time_end*tf_height,double);
  
  /* Find all the wavenumbers */
  if (flags & PTFSF_PROGRESS)
    printf("ptfsf_init: Generating wavenumbers...\n");
  wave_numbers(length, cdtds, phi, kx_del, ky_del);

  if (flags & PTFSF_INFO)
    printf("ptfsf_init: \n"
	   "  Can estimate optimial FFT using flag PTFSF_ESTIMATE.  This\n"
	   "    does not require much overhead to perform the initial FFT,\n"
	   "    but the FFT will not be optimal.\n"
	   "  Can potentially get faster FFTs using the flag PTFSF_MEASURE,\n"
	   "    but with more initial overhead incurred.\n"
	   "  The FFTw code will search for the best FFT if you use the flag\n"
	   "    PTFSF_PATIENT (but it takes a while).  Overhead associated\n"
	   "    with this will likely exceed any gains realized by the\n"
	   "    faster FFTs (except perhaps in some extreme circumstances).\n"
	   );

  if (flags & PTFSF_PATIENT) {
    fft_flag = FFTW_PATIENT;
    if (flags & PTFSF_INFO)
      printf("ptfsf_init: "
	     "Using flag PTFSF_PATIENT.  This may take a moment...\n");
  } else if (flags & PTFSF_MEASURE) {
    fft_flag = FFTW_MEASURE;
    if (flags & PTFSF_INFO)
      printf("ptfsf_init: Using flag PTFSF_MEASURE.\n");
  } else {
    fft_flag = FFTW_ESTIMATE;
    if (flags & PTFSF_INFO)
      printf("ptfsf_init: Using flag PTFSF_ESTIMATE.\n");
  }

  /* Create the FFT plans used by FFTW -- use threaded version. */
  if (flags & PTFSF_PROGRESS)
    printf("ptfsf_init: Generating the FFTW plans...\n");
  fftw_init_threads();
  /* Can change the number of threads by changing the argument of following 
   * function.  "2" is good for dual-processor machines.
   */
  fftw_plan_with_nthreads(2);
  planf = fftw_plan_dft_r2c_1d(length, source_temporal, source_spectral,
			       fft_flag);
  planb = fftw_plan_dft_c2r_1d(length, source_xy_spectral, source_xy_temporal,
			       fft_flag);
  if (planf == NULL || planb == NULL ) {
    fprintf(stderr,"ptfsf_init: "
	    "FFTW plan allocation failed.  Terminating...\n");
    exit(-1);
  }

  /* Create source time-series. */
  /* If reference point does not corresponds to lower left corner,
     delay the source pulse a sufficient amount to ensure we get
     required spectrum at the desired point.  See "Exact TF/SF
     boundar" notes, pages 15 for the calculation of this. */ 
  if (x_ref != x_ll || y_ref != y_ll) {
    double dist, multiplier, tmp;
    multiplier = 9.0/8.0;
    tmp = sin(asin(cdtds)/multiplier);
    dist = sqrt((x_ref-x_ll)*(x_ref-x_ll)+(y_ref-y_ll)*(y_ref-y_ll))*
      cos(atan2((y_ref-y_ll),(x_ref-x_ll))-phi);
    
    delay = dist/cdtds*sqrt(1.0-tmp*tmp)/cos(asin(tmp/cdtds));
    if (flags & PTFSF_INFO) {
      printf("ptfsf_init: Since reference point not lower-left\n"
	     "  corner, pulse is being delayed %d time steps.\n"
	     "  This is based on a distance to the phase front of %g.\n",
	     delay,dist);
      printf("  Delay assumes group velocity %g times speed of light.\n"
	     "  This is determined by velocity of fields discretized at\n"
	     "  %g times the minumum discretization for propagating waves.\n"
	     "  To change this value, change the variable 'multiplier' in\n"
	     "  the code and recompile.\n",
	     cos(asin(tmp/cdtds))/sqrt(1.0-tmp*tmp),multiplier);  
    }
  } else
    delay = 0;
  for(idum=0; idum<delay; idum++)
    source_temporal[idum] = 0.0;
  for(idum=delay; idum<length; idum++)
    source_temporal[idum] = time_func(idum-delay);

  /* Find transform of source function. */
  fftw_execute(planf);

  /* Now, for each point, create the necessary time series. */
  if (flags & PTFSF_PROGRESS)
    printf("ptfsf_init: "
	   "Generating Ez source terms along x boundaries...\n");
  for (i=0; i<tf_width; i++) {
    /* Along bottom boundary. */
    /* Multiply source spectrum and transfer function. */
    for(idum=0; idum<length/2+1; idum++) {
      double ctmp, stmp, arg;
      if (kx_del[idum] != 0.0) {
	arg = -((i-x_off)*kx_del[idum] - y_off*ky_del[idum]);
	ctmp = cos(arg);
	stmp = sin(arg);
	source_xy_spectral[idum][0] = 
	  ctmp*source_spectral[idum][0] - stmp*source_spectral[idum][1];
	source_xy_spectral[idum][1] = 
	  stmp*source_spectral[idum][0] + ctmp*source_spectral[idum][1];
      }	else {
	source_xy_spectral[idum][0] = 0.0;
	source_xy_spectral[idum][1] = 0.0;
      }
    }
    /* Take inverse FFT of theoretical spectrum to get (unnormalized)
       predicted time series.  Store result back in source_in. */
    fftw_execute(planb);
    /* Store time-series for later use. */
    for (idum=0; idum<time_end; idum++)
      Time_series_ez_x0(i,idum) = source_xy_temporal[idum]/length;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷综合五月天| 最新国产精品久久精品| 亚洲一二三级电影| 精品视频一区三区九区| 日日欢夜夜爽一区| 91精品国产综合久久精品app| 日日夜夜免费精品视频| 日韩视频一区二区在线观看| 久久成人av少妇免费| 久久久精品国产免大香伊| 成人h精品动漫一区二区三区| 亚洲欧洲日本在线| 欧美日韩国产欧美日美国产精品| 日本成人在线电影网| 精品久久久久久久久久久久包黑料 | 欧美视频精品在线| 日韩精品电影在线| 国产日韩av一区| 91国偷自产一区二区三区观看 | 欧美色国产精品| 免费观看成人av| 国产精品毛片大码女人| 欧美日韩精品一区二区| 国产自产高清不卡| 亚洲激情欧美激情| 国产精品视频线看| 一本久久精品一区二区 | 日韩精品一二三| 久久婷婷色综合| 欧美性一级生活| 国产九色sp调教91| 亚洲va欧美va人人爽| 久久一夜天堂av一区二区三区| 91在线观看高清| 肉色丝袜一区二区| 国产精品网曝门| 日韩一区二区三区视频在线| 成人动漫av在线| 喷水一区二区三区| 亚洲免费在线播放| 2023国产精品视频| 欧美揉bbbbb揉bbbbb| 成人免费黄色大片| 蜜桃一区二区三区在线| 亚洲美女在线一区| 国产欧美综合在线| 日韩视频免费观看高清完整版在线观看| 成人av动漫网站| 韩国在线一区二区| 丝袜美腿亚洲一区| 亚洲精品成人在线| 国产欧美一区二区精品忘忧草| 欧美视频一区二区在线观看| 99久久免费精品| 国产精品一区二区三区99| 午夜精品影院在线观看| 亚洲乱码中文字幕| 亚洲欧洲无码一区二区三区| 久久精品一区蜜桃臀影院| 91.麻豆视频| 欧美在线|欧美| 91在线观看视频| 99久久婷婷国产综合精品电影| 狠狠色狠狠色综合日日91app| 日韩av在线发布| 午夜精品福利一区二区三区蜜桃| 亚洲天堂av一区| 中文字幕视频一区| 中文字幕一区二区三区在线观看| 久久精品一区八戒影视| 久久午夜羞羞影院免费观看| 日韩午夜三级在线| 日韩欧美精品三级| 精品国产乱码久久久久久久久 | 免费在线看一区| 首页欧美精品中文字幕| 亚洲午夜久久久久久久久电影院| 亚洲欧美一区二区三区久本道91| 中文字幕一区二区三区在线不卡| 国产精品美女久久久久aⅴ| 欧美韩国日本综合| 中文字幕第一区| 中文字幕中文乱码欧美一区二区| 国产精品丝袜91| 亚洲男同性视频| 亚洲一区中文在线| 日韩精品一二三| 另类小说一区二区三区| 国产一区二三区好的| 国产一区二区三区免费在线观看| 国产不卡在线视频| 成人av网址在线| 在线观看国产精品网站| 欧美日韩激情一区二区三区| 91精品欧美综合在线观看最新 | 99热在这里有精品免费| av一二三不卡影片| 欧美亚洲综合另类| 欧美一区二区性放荡片| 久久色在线视频| 国产精品麻豆久久久| 一区二区三区在线观看欧美| 亚洲一区二区三区爽爽爽爽爽| 婷婷开心激情综合| 成人网在线免费视频| 91麻豆精品视频| 777久久久精品| 国产女人18水真多18精品一级做| 专区另类欧美日韩| 视频一区二区三区中文字幕| 国产一区二区看久久| 色婷婷国产精品| 欧美成人三级电影在线| 国产精品成人网| 日本美女一区二区| 成人av资源站| 7777精品伊人久久久大香线蕉完整版 | 色婷婷av一区二区三区gif| 欧美日韩精品欧美日韩精品一 | 久久精品无码一区二区三区| 最新国产成人在线观看| 天天综合色天天| 成人性生交大片免费看中文 | 日本美女一区二区三区视频| 国产91富婆露脸刺激对白| 欧美午夜片在线观看| 久久久久国产精品厨房| 亚洲成人av一区| av不卡一区二区三区| 欧美大片在线观看| 亚洲综合图片区| 成人性生交大片| 日韩欧美专区在线| 一区二区三区在线视频观看| 国产成人亚洲综合色影视| 欧美日韩一区国产| 一色桃子久久精品亚洲| 蜜桃视频一区二区三区在线观看| av一区二区三区在线| 26uuu久久天堂性欧美| 五月婷婷欧美视频| 91片在线免费观看| 欧美国产日产图区| 久久66热偷产精品| 91精品国产综合久久香蕉的特点| 国产精品二三区| 国产高清久久久久| 欧美一区二区三区在线视频| 一区二区三区不卡视频| www.亚洲色图| 中文字幕免费不卡在线| 国内久久精品视频| 日韩精品一区在线| 日韩电影一二三区| 欧美美女一区二区三区| 亚洲欧美另类小说视频| 91在线免费播放| 国产精品蜜臀在线观看| 国产91精品一区二区麻豆网站| 精品国偷自产国产一区| 精品一区二区三区av| 日韩欧美卡一卡二| 久久99精品国产麻豆婷婷| 日韩欧美一区二区三区在线| 日韩高清中文字幕一区| 欧美精品一二三四| 视频一区在线播放| 欧美一区二区三级| 蜜乳av一区二区| 精品动漫一区二区三区在线观看| 男人的天堂久久精品| 日韩午夜电影在线观看| 久久99精品国产.久久久久| 亚洲激情在线激情| 色婷婷久久久综合中文字幕| 一区二区三区成人| 欧美美女黄视频| 精品一区二区成人精品| 国产三级精品三级在线专区| 福利一区二区在线| 亚洲三级在线免费| 欧美性受xxxx| 日韩精品久久久久久| 精品日韩一区二区三区免费视频| 久久国产精品第一页| 中文av一区二区| 91国产成人在线| 日本亚洲三级在线| 国产性天天综合网| 91免费版在线| 视频一区在线播放| 国产亚洲精品精华液| av一区二区三区在线| 亚洲成人自拍偷拍| 欧美成人乱码一区二区三区| 成人手机在线视频| 亚洲国产一区二区三区| 日韩午夜中文字幕| 不卡的电视剧免费网站有什么| 亚洲一区自拍偷拍|