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

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

?? ptfsf-demo.c

?? The tar file contains the following files: ptfsf.c: heart of the perfect TFSF code ptfsf.h: he
?? C
字號:
/*      
 * ptfsf-demo: a bare-bones 2D code which demonstrates use of the ptfsf code.
 *
 *     The field at four observations points is recorded to a file.
 *     (If the wrtraw package is installed and used, dumps of the entire
 *     computational domain are made periodically and these can be used
 *     to make 2D color maps of the field.)
 *
 * Copyright (C) 2004 John B. Schneider
 *
 * This code uses the FFTw routines for the Fourier transforms.  See
 * www.fftw.org for that code if you wish to use that code too.
 * Otherwise you will have to replace the calls to the FFTw routines
 * to some other discrete Fourier transform routines.
 *
 * To compile this code, you would use something such as:
 *
 *  gcc -Wall -O2 -c ptfsf.c 
 *  gcc -Wall -O2 ptfsf-demo.c -o ptfsf-demo ptfsf.o\
 *         -lm -lfftw3 -lfftw3_threads -lpthread 
 *
 * For the GNU C compiler the "-Wall" flag turns on all warnings
 * (always a good idea) and "-O2" gives second-level optimization.
 * You must ensure the included header files are on the search path.
 * If you do not want to use the threaded version of FFTw, you may
 * remove those calls (see the FFTw documentation) and then there is
 * no need to link to the pthread library (which may not be installed
 * on some systems).
 *
 * If you want timing data reported, add the -DTIMING directive to the
 * second compile command.
 *
 * I have written a suite or routines to generate color-mapped images
 * of fields.  Part of that suite is the wrtraw function.  Since I'm
 * not including that here (contact me if you want it), there is a
 * WRTRAW compiler directive which, if unset, removes all the wrtraw
 * stuff.  So, you can safely ignore that directive.
 *
 *********************************************************************
 * 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 <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "ptfsf.h"

/* Timing stuff. */
#ifdef TIMING
  #include <sys/time.h>
  #include <sys/resource.h>
#endif

/* wrtraw stuff */
#ifdef WRTRAW
#include "wrtraw.h"
#endif

/* Size of computational domain. */
#define LIMX 141
#define LIMY 141

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

#define ALLOC_2D(name,nx,ny,type) { \
 name = (type *)calloc((nx)*(ny),sizeof(type)); \
 if (!name) { perror("ALLOC_2D"); \
              fprintf(stderr,"Allocation failed for " #name "\n"); \
              exit(-1); \
             }; \
 }

/* The ptfsf_init() function is passed a time-series function
 * that takes a single argument (the time step) and returns a double
 * (the incident field at that time step).  I usually use a Ricker
 * wavelet function with three arguments: the time-step, the Courant
 * number, and the points per wavelength at the most energetic
 * frequency.  To use the usual Ricker function, we pass
 * ptfsf_init() a wrapper which only has one argument and then
 * calls the usual Ricker routine with the missing arguments supplied.
 */
double ricker_wrapper(double ntime);
double ricker(double time, double cdtds, double ppw);

/* global variables -- for the sake of getting the wrapper to work. */
double cdtds, // Courant number
  ppw;        // points per wavelength at most energetic frequency


int main()
{
  const double eta=376.7303662;

  /* Electric and magnetic fields.  The array memory is allocated as a
   * large one-dimensional block, but these arrays are treated as
   * two-dimensional things via the macros given above.
   */
  double *ez, *hx, *hy;

  double phi,     // incident angle [degrees]
    dteta, doeta; // update equation coefficients
  int idum, jdum, // spatial indices (dummy indices)
    nend_tfsf,    // time at which incident field assumed to go to zero
    nend_total,   // total length of simulation
    ntime,        // temporal step
    x_ll, y_ll,   // lower-left corner of TFSF region
    x_ur, y_ur,   // upper-right corner of TFSF region
    x_ref, y_ref; // reference point where incident time series exists

  /* observation-point stuff  */
  char filnam[80];
  FILE *obs_point;

  /* wrtraw stuff */
#ifdef WRTRAW
  img_sequence *images=NULL;
  char *basename = "junk";
#endif

  /* timing stuff */
#ifdef TIMING
  int old_seconds, old_useconds;  
  struct rusage tp;
#endif

  /* Allocate and initialize fields arrays. */
  ALLOC_2D(ez,LIMX,LIMY,double);
  ALLOC_2D(hx,LIMX,LIMY-1,double);
  ALLOC_2D(hy,LIMX-1,LIMY,double);

#ifdef WRTRAW
  images = wrtraw_open2d(0,LIMX-1,1,
			 0,LIMY-1,1,
			 LIMX,LIMY,
			 basename,ez);
  images->verbose = WRTRAW_MAX_INFO;
#endif

  /* Get user-settable parameters. */
  printf("Size of computational domain: %d x %d\n",LIMX,LIMY);

  printf("Enter indices for lower-left corner of TF/SF region: ");
  scanf("%d %d",&x_ll,&y_ll);

  printf("Enter indices for upper-right corner of TF/SF region: ");
  scanf("%d %d",&x_ur,&y_ur);

  printf("Enter indices for reference point where incident time series\n"
	 "  assumed to be given (should be on or in TFSF boundary): ");
  scanf("%d %d",&x_ref,&y_ref);

  printf("Enter number of time steps overall: ");
  scanf("%d",&nend_total);

  printf("Enter time step when the TFSF turns off, i.e., the time step\n"
	 "  at which the incident field is essentially zero over the TFSF\n"
	 "  boundary (should be no larger than %d): ",nend_total);
  scanf("%d",&nend_tfsf);

  printf("Enter the points per wavelength at peak of Ricker spectrum: ");
  scanf("%lf",&ppw);

  printf("Enter the incident angle (should be between 0 and 90) [degrees]: ");
  scanf("%lf",&phi);

  printf("Enter the output file name: ");
  scanf("%s",filnam);
  obs_point = fopen(filnam,"w");
  if (obs_point == NULL) {
    fprintf(stderr,
	    "Observation point output file failed to open.  Terminating...\n");
    exit(-1);
  }


  /* 
   * Calculate the needed constants.
   * Courant number is set here.
   */ 
  cdtds  = 1.0/sqrt(3.0);
  doeta  = cdtds/eta;
  dteta  = cdtds*eta;
      
#ifdef TIMING
  getrusage(0,&tp);
  old_seconds = tp.ru_utime.tv_sec;
  old_useconds = tp.ru_utime.tv_usec;
#endif 

  /* Calculate the incident field using the "perfect" TFSF code. */
  ptfsf_init(nend_tfsf,
    x_ll,  y_ll,       // indices of lower-left corner of TF region
    x_ur, y_ur,        // indices of upper-right corner of TF region
    x_ref,  y_ref,     // indices of "reference" point
    LIMX,  LIMY,       // size of computational domain
    phi,               // incident angle [degrees]		      
    cdtds,             // Courant number
    eta,               // characteristic impedance
    ez,  hx,  hy,      // field arrays
    ricker_wrapper,    // time-stepping function 
    PTFSF_PROGRESS | PTFSF_INFO | PTFSF_ESTIMATE // flags to control behavior
   );

#ifdef TIMING
  getrusage(0,&tp);
  printf("Calculation of incident field took %.3f seconds.\n",
	 tp.ru_utime.tv_sec-old_seconds +
	 (tp.ru_utime.tv_usec-old_useconds)/1.e6);
#endif

  printf("Electric field written for these points: "
	 "(%d,%d), (%d,%d), (%d,%d)\n",
	 x_ll,y_ll,
	 (int)(x_ur+x_ll)/2,(int)(y_ur+y_ll)/2,x_ur,y_ur);

  /* Do the time stepping. */
  for (ntime=0; ntime<nend_total; ntime++) {

    if (ntime%10 == 0)
      printf("%d...\n",ntime);

    /* Calculate electric field. */
    for (idum=1; idum<LIMX-1; idum++)
      for (jdum=1; jdum<LIMY-1; jdum++)
	Ez(idum,jdum) +=
	  + dteta*(Hy(idum,jdum)-Hy(idum-1,jdum)
                   - (Hx(idum,jdum)-Hx(idum,jdum-1)));

    /* Can uncomment the following to throw in a scatterer to make
     * sure TFSF really transparent.
     */
    // idum = LIMX/2;
    // for (jdum=y_ll+15; jdum<y_ur-15; jdum++)
    //   Ez(idum,jdum) = 0.0;

    /* Electric field is correct after this routines is called, i.e.,
     * total field in the total-field region and scattered field in
     * the scattered-field region.  HOWEVER, the magnetic field is
     * not correct until after the magnetic fields have been
     * updated.
     */
    ptfsf_update(ntime);

    /* printf value at observations point to a file */
    fprintf(obs_point,"%i %g %g %g %g\n",ntime,
	    Ez(x_ll,y_ll),
	    Ez((int)(x_ur+x_ll)/2,(int)(y_ur+y_ll)/2),
	    Ez(x_ur,y_ur),
	    Ez(x_ur+5,y_ur+5));

    /* Calculate Hx. */
    for(idum=0; idum<LIMX; idum++)
      for(jdum=0; jdum<LIMY-1; jdum++)
	Hx(idum,jdum) -= doeta*(Ez(idum,jdum+1)-Ez(idum,jdum));

    /* Calculate Hy. */
    for(idum=0; idum<LIMX-1; idum++)
      for(jdum=0; jdum<LIMY; jdum++)
	Hy(idum,jdum) += doeta*(Ez(idum+1,jdum)-Ez(idum,jdum));
        
    /* generate the output image */
#ifdef WRTRAW
    if (ntime % 10 == 0)
      wrtraw(images);
#endif
    
  }

#ifdef TIMING
  getrusage(0,&tp);
  printf("Total run time: %.3f seconds.\n",
	 tp.ru_utime.tv_sec + tp.ru_utime.tv_usec/1.e6);
#endif

  return 0;
}
/* ------------------------- end of main() --------------------------*/


/* ######################## ricker_wrapper() ####################### */
/* A trivial wrapper to be able to call my usual ricker function with
 * a single argument.
 */
double ricker_wrapper(double ntime) {
  return ricker(ntime,cdtds,ppw);
}

/* ############################ ricker() ########################### */
/* Ricker wavelet. */
double ricker(double time,  // time step 
	      double cdtds, // Courant number
	      double ppw    // points/wavelength at most energetic frequency
	      ) {
  double arg,
    arg_max = 70.0, // arguments beyond this value are assumed to yield zero
                    //         this allows us to avoid calling exponential
                    //         when result will be effectively zero
    delay = 2.0;    // delay = multiple of inverse of most energetic frequency,
                    //         i.e., multiple of period at that frequency

  arg = pow(M_PI*((cdtds*time)/ppw - delay),2);
  if (arg > arg_max) {
    return 0.0;
  } else {
    return (1.0 - 2.0*arg) * exp(-arg);
  }
}
/* ------------------------- end of ricker() ----------------------- */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频在线观看三级| 国产精品一区二区三区四区| 成人一区二区三区| 亚洲欧美在线另类| 欧美成人一区二区三区片免费 | 成人国产精品免费观看动漫| 日本一区二区三区视频视频| 成人免费视频国产在线观看| 中文字幕五月欧美| 91久久免费观看| 婷婷久久综合九色国产成人| 日韩三级精品电影久久久| 国产一区在线观看视频| 亚洲丝袜自拍清纯另类| 欧美视频一二三区| 免费一区二区视频| 亚洲精品在线观| 99综合影院在线| 视频一区二区中文字幕| 久久久三级国产网站| 奇米影视一区二区三区小说| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 国产乱码精品1区2区3区| 久久久精品综合| 日本高清不卡一区| 麻豆国产精品官网| 国产精品久久久久久妇女6080| 日本韩国一区二区三区| 精品一区精品二区高清| 综合久久久久综合| 日韩久久久精品| 成人av在线电影| 丝袜美腿亚洲综合| 国产精品的网站| 欧美一二三区精品| 色综合色综合色综合色综合色综合| 欧美日韩国产综合一区二区 | 精品欧美一区二区三区精品久久 | 欧美精品一区二区三区蜜桃| 99精品视频一区二区| 亚洲1区2区3区视频| 国产亚洲美州欧州综合国| 91黄视频在线观看| 国产成人亚洲精品狼色在线| 亚洲成av人片观看| 欧美激情在线观看视频免费| 欧美亚洲综合久久| 成人福利视频网站| 麻豆91免费观看| 亚洲色图视频网| 国产婷婷色一区二区三区在线| 欧美日韩免费观看一区二区三区| 国产在线精品不卡| 午夜伊人狠狠久久| 成人免费在线播放视频| 久久久久亚洲蜜桃| 欧美日韩1区2区| 91丨九色丨黑人外教| 国内外精品视频| 蜜桃av一区二区在线观看| 亚洲激情欧美激情| 欧美韩国一区二区| 欧美日韩国产一级| 91麻豆文化传媒在线观看| 国产精品一二三四区| 免费人成黄页网站在线一区二区| 亚洲免费视频成人| 亚洲欧美成人一区二区三区| 欧美国产综合一区二区| 日韩欧美一二区| 日韩一区二区精品葵司在线| 欧美日韩亚洲综合一区| 91电影在线观看| 91热门视频在线观看| 福利一区二区在线| 成人蜜臀av电影| 国产二区国产一区在线观看| 韩国三级中文字幕hd久久精品| 欧美aaa在线| 日韩电影在线一区二区三区| 亚洲一区二区在线观看视频| 亚洲一区二区三区三| 一区二区三区久久久| 亚洲美女少妇撒尿| 一区二区三区四区在线播放| 午夜精品久久久久久久99水蜜桃| 91蜜桃在线免费视频| 成人综合婷婷国产精品久久 | 久久er99热精品一区二区| 日本美女一区二区三区| 免费观看在线综合| 精品一区二区国语对白| 国产精品亚洲专一区二区三区| 国产一区二区三区在线看麻豆| 国产一区不卡在线| 国产成人啪午夜精品网站男同| 国产成人无遮挡在线视频| 成人精品视频一区二区三区尤物| 成人激情免费网站| 在线免费观看日本欧美| 欧美性videosxxxxx| 欧美高清视频一二三区| 精品久久久久久久久久久久包黑料 | 欧美精品成人一区二区三区四区| 欧美嫩在线观看| 精品久久久久久最新网址| 久久久蜜臀国产一区二区| 国产精品电影一区二区| 亚洲午夜久久久久久久久电影院| 欧美aaa在线| av中文字幕不卡| 欧美肥胖老妇做爰| 国产午夜精品久久| 一个色妞综合视频在线观看| 91在线看国产| 色乱码一区二区三区88| 91精品国产色综合久久ai换脸| 26uuu色噜噜精品一区| 国产精品久久夜| 日日夜夜免费精品视频| 风流少妇一区二区| 欧美日韩国产色站一区二区三区| 精品国产亚洲一区二区三区在线观看| 亚洲国产精品精华液2区45| 日本不卡一二三| av不卡在线播放| 日韩一本二本av| 亚洲裸体xxx| 国产在线精品免费| 欧美人牲a欧美精品| 日本一区二区三区视频视频| 日本美女一区二区| 91网站在线观看视频| 2欧美一区二区三区在线观看视频| 亚洲视频 欧洲视频| 久久99精品久久久| 欧美性受极品xxxx喷水| 国产蜜臀av在线一区二区三区| 日韩精品五月天| 日本精品一区二区三区高清| 久久久久亚洲蜜桃| 日韩福利视频导航| 国产一区日韩二区欧美三区| 风间由美中文字幕在线看视频国产欧美| 91福利在线观看| 国产精品久久久久久一区二区三区| 欧美aⅴ一区二区三区视频| 色综合网站在线| 中国av一区二区三区| 激情综合网天天干| 欧美精品日韩一区| 亚洲福利视频一区| 91麻豆免费观看| 中文字幕精品综合| 国产毛片一区二区| 精品国产免费人成电影在线观看四季| 亚洲二区在线观看| 在线观看视频一区| 亚洲欧美日韩综合aⅴ视频| 成人性视频免费网站| 国产欧美日韩三级| 国产一区二区在线影院| 精品日韩在线观看| 久久精品国产精品青草| 日韩欧美国产综合在线一区二区三区| 亚洲va国产va欧美va观看| 欧美亚洲日本一区| 一区二区不卡在线播放 | 国产乱对白刺激视频不卡| 在线播放91灌醉迷j高跟美女| 一区二区三区在线视频免费| 99久久免费国产| 亚洲少妇中出一区| 一本到不卡免费一区二区| 综合中文字幕亚洲| av在线综合网| 一区二区三区中文字幕| 91免费看`日韩一区二区| 亚洲欧美电影院| 欧美日韩国产免费一区二区| 午夜私人影院久久久久| 欧美一级欧美一级在线播放| 美女视频黄a大片欧美| 欧美不卡一二三| 国产大陆精品国产| 国产精品天美传媒沈樵| 色综合久久天天| 亚洲国产精品影院| 日韩欧美一二三四区| 国产一区二区三区四区五区美女 | 捆绑紧缚一区二区三区视频| 欧美不卡一区二区| 国产成人精品免费看| 欧美日韩高清影院| 亚洲成av人影院| 日韩视频一区二区三区| 国产精品77777竹菊影视小说| 综合久久久久久久| 欧美日韩情趣电影| 久久国产福利国产秒拍|