示例#1
0
文件: pdate.c 项目: 99years/plan9
void
dtsetup(double d, Tim *t)
{
    double v;

    t->ifa[0] = floor(1900 + d/365.24220);
    t->ifa[1] = 1;
    t->ifa[2] = 1;
    t->ifa[3] = 0;
    t->ifa[4] = 0;
    t->ifa[1] = floor(1 + dsrc(d, t, 0)/30);
    t->ifa[2] = floor(1 + dsrc(d, t, 1));
    dsrc(d, t, 2);

    v = (d - convdate(t)) * 24;
    t->ifa[3] = floor(v);
    t->ifa[4] = (v - t->ifa[3]) * 60;
    convdate(t);	/* to set timezone */
}
示例#2
0
void geteos( double *p,    double *pion,   double *p_cold, double *cs2,
             double *dedt, double *deidt,  double *den,    double *emat,
             double *eion, double *e_cold, double *tmat,   double *tion,
             double *work3,  double *work1,    double *work2,   double  teos,
             double dt,    Domain_t *domain, SpeciesFraction_t *specfrac,
             int ifsource, int ifzstar )
{
   char *me = "geteos";
   int i, ir, n, lenx, clenx ;
   double ssmin2, fv ;
   int *cndx, *cnvg, *indx, *rzon ;
   double *cmf, *fe, *fi, *csave ;
   int ifmeos ;    
   int *wcnvg = NULL ; 
   Thermo_t ceos ;     
   Thermo_t deos ;     
   Thermo_t weos ;     
   int namix  = domain->namix  ;
   int nmixzn = domain->nmixzn ;
   int mynsrc = domain->nsrc   ;
   int *grdzn = domain->grdzn  ;
   double myflops = 0.0 ;
   FT_INITIALIZE(me, domain->hash)
   THERMO_NULL(ceos) ;
   THERMO_NULL(deos) ;
   THERMO_NULL(weos) ;
   ssmin2 = sndmin * sndmin ;
   if (ifsource == 1) {
      SourceNew_general( den, domain->vol, "SourceDensity", teos, domain, 
                        _SourceEdit_);
      SourceNew_general( emat, den, "SourceEnergy", teos, domain, 
                        _SourceEdit_);
      SourceNew_temperature( emat, tmat, dedt, den, 
                             "SourceElectronTemperature", teos, 
			      domain, _SourceNoEdit_);
      if ( iftion  == 1 ) {
         SourceNew_temperature( eion, tion, deidt, den, 
                                "SourceIonTemperature", teos, 
			         domain, _SourceNoEdit_);
      }
   }
   if ( (mynsrc > 0) && (ifsource == 1) ) {
      dsrc(  teos, den,  domain ) ;
      esrc(  teos, emat, domain ) ;
      tmsrc( teos, emat, tmat, dedt, 
                   eion, tion, deidt, domain ) ;
   }
   ifmeos = 0 ;
   lenx   = 0 ;
   clenx  = 0 ;
   for ( ir = 1 ; ir <= nreg ; ir++ ) {
      int locneos = reg[ir].numGroups ;
      int len     = domain->rlen[ir]  ;
      lenx = MAX( len, lenx ) ;
      if ( locneos > 1 ) {
         clenx  = MAX( clenx, (locneos*len) ) ;
         ifmeos = 1 ;
      }
   }
   fe          = MALLOT(double,lenx) ;
   fi          = MALLOT(double,lenx) ;
   csave       = MALLOT(double,lenx) ;
   weos.p      = MALLOT(double,lenx) ;
   weos.dpdr   = MALLOT(double,lenx) ;
   weos.dpdt   = MALLOT(double,lenx) ;
   weos.dedr   = MALLOT(double,lenx) ;
   weos.dedt   = MALLOT(double,lenx) ;
   weos.den    = MALLOT(double,lenx) ;
   weos.emat   = MALLOT(double,lenx) ;
   weos.tmat   = MALLOT(double,lenx) ;
   weos.cs2    = MALLOT(double,lenx) ;
   weos.dpde   = MALLOT(double,lenx) ;
   weos.dtde   = MALLOT(double,lenx) ;
   weos.cs     = MALLOT(double,lenx) ;
   weos.work1    = MALLOT(double,lenx) ;
   weos.work2   = MALLOT(double,lenx) ;
   weos.p_cold = MALLOT(double,lenx) ;
   weos.e_cold = MALLOT(double,lenx) ;
   weos.dtlast = MALLOT(double,lenx) ;
   wcnvg       = MALLOT(int,lenx)    ;
   if ( iftion == 1 ) {
      weos.pion   = MALLOT(double,lenx) ;
      weos.deidti = MALLOT(double,lenx) ;
      weos.eion   = MALLOT(double,lenx) ;
      weos.tion   = MALLOT(double,lenx) ;
   }