Пример #1
0
void
compute_deltat(real_t *dt, const hydroparam_t H, hydrowork_t * Hw, hydrovar_t * Hv, hydrovarwork_t * Hvw) {
  real_t cournox, cournoy;
  int j, jend, slices, Hstep, Hmin, Hmax;
  real_t (*e)[H.nxyt];
  real_t (*c)[H.nxystep];
  real_t (*q)[H.nxystep][H.nxyt];
  WHERE("compute_deltat");

  //   compute time step on grid interior
  cournox = zero;
  cournoy = zero;

  c = (real_t (*)[H.nxystep]) Hw->c;
  e = (real_t (*)[H.nxystep]) Hw->e;
  q = (real_t (*)[H.nxystep][H.nxyt]) Hvw->q;

  Hstep = H.nxystep;
  Hmin = H.jmin + ExtraLayer;
  Hmax = H.jmax - ExtraLayer;
  for (j = Hmin; j < Hmax; j += Hstep) {
    jend = j + Hstep;
    if (jend >= Hmax)
      jend = Hmax;
    slices = jend - j;          // numbre of slices to compute
    ComputeQEforRow(j, H.smallr, H.nx, H.nxt, H.nyt, H.nxyt, H.nvar, slices, Hstep, Hv->uold, q, e);
    equation_of_state(0, H.nx, H.nxyt, H.nvar, H.smallc, H.gamma, slices, Hstep, e, q, c);
    courantOnXY(&cournox, &cournoy, H.nx, H.nxyt, H.nvar, slices, Hstep, c, q, Hw->tmpm1, Hw->tmpm2);
    // fprintf(stdout, "[%2d]\t%g %g %g %g\n", H.mype, cournox, cournoy, H.smallc, H.courant_factor);
  }

  *dt = H.courant_factor * H.dx / MAX(cournox, MAX(cournoy, H.smallc));
  FLOPS(1, 1, 2, 0);
  // fprintf(stdout, "[%2d]\t%g %g %g %g %g %g\n", H.mype, cournox, cournoy, H.smallc, H.courant_factor, H.dx, *dt);
}                               // compute_deltat
void densityFilter(void)
{
    int i,nstart_Shepard;
//    itime_check=1E8;   //!0    !10e8   !0    !
//    i_ParticleCheck=23197; //  !41805   !231   !nb_local + 1   !3299   !
//    if(itime>=itime_check)rhop_old = rhop[i_ParticleCheck];
    nstart_Shepard=nbp1;   //nstart
    ac_Shepard();
/*
    if(itime>=itime_check)
    {
        i=i_ParticleCheck;
        sum_wab_check= sum_wab[i];
        rhop_sum_check= rhop_sum[i];
    }
*/
    for(i=nstart_Shepard;i<=np;i++)
    {
        sum_wab[i] = sum_wab[i]+ adh*pm[i]/rhop[i];  //self contribution
        rhop_sum[i] = rhop_sum[i]+ adh*pm[i];  //self contribution
        rhop[i] = rhop_sum[i]/sum_wab[i];
        pVol[i] = pm[i]/rhop[i];
        equation_of_state(rhop[i],TEp[i],&p[i],&cs[i],i_EoS);
    }
}
Пример #3
0
void
compute_deltat (hydro_real_t *dt, const hydroparam_t H, hydrowork_t * Hw,
		hydrovar_t * Hv, hydrovarwork_t * Hvw)
{
  hydro_real_t cournox, cournoy;
  int j, jend, slices, Hstep, Hmin, Hmax;
  hydro_real_t (*e)[H.nxyt];
  hydro_real_t (*c)[H.nxyt];
  hydro_real_t (*q)[H.nxystep][H.nxyt];
  WHERE ("compute_deltat");

  //   compute time step on grid interior
  cournox = zero;
  cournoy = zero;
  //Hvw->q = (double (*)) calloc (H.nvar * H.nxystep * H.nxyt, sizeof (double));
  //Hw->e = (double (*)) malloc ((H.nxyt) * H.nxystep * sizeof (double));
  //Hw->c = (double (*)) malloc ((H.nxyt) * H.nxystep * sizeof (double));

  c = (hydro_real_t (*)[H.nxyt]) Hw->c;
  e = (hydro_real_t (*)[H.nxyt]) Hw->e;
  q = (hydro_real_t (*)[H.nxystep][H.nxyt]) Hvw->q;

  Hstep = H.nxystep;
  Hmin = H.jmin + ExtraLayer;
  Hmax = H.jmax - ExtraLayer;
  
  for (j = Hmin; j < Hmax; j += Hstep)
  {
      jend = j + Hstep;
      if (jend >= Hmax)
			jend = Hmax;
      slices = jend - j;	// numbre of slices to compute
      ComputeQEforRow (j, H.smallr, H.nx, H.nxt, H.nyt, H.nxyt, H.nvar,
		       slices, Hstep, Hv->uold, q, e);
		       
//#pragma acc update device (q[0:H.nvar], e[0:H.nxystep], c[0:H.nxystep])
      equation_of_state (0, H.nx, H.nxyt, H.nvar, H.smallc, H.gamma, slices, Hstep, e, q, c);

			//download everything on Host
      //#pragma acc update host (q[0:H.nvar],c[0:H.nxystep])
      courantOnXY (&cournox, &cournoy, H.nx, H.nxyt, H.nvar, slices, Hstep, c, q);
		   
		   
#ifdef FLOPS
      flops += 10;
#endif /*  */
    }
  //Free (Hvw->q);
  //Free (Hw->e);
  //Free (Hw->c);
  *dt =(hydro_real_t)( H.courant_factor * H.dx / MAX (cournox, MAX (cournoy, H.smallc)));
#ifdef FLOPS
  flops += 2;

#endif /*  */

  // fprintf(stdout, "%g %g %g %g\n", cournox, cournoy, H.smallc, H.courant_factor);
}				// compute_deltat
Пример #4
0
int main(int, char **argv) {
  Functional n = EffectivePotentialToDensity();
  double Veff = -hughes_water_prop.kT*log(hughes_water_prop.liquid_density);

  const double nmin = 1e-11, nmax = 0.007;

  {
    double ngas = 2e-5;
    double mu = find_chemical_potential(IdealGasOfVeff(), hughes_water_prop.kT, ngas);
    test_eos("ideal gas", IdealGasOfVeff() + ChemicalPotential(mu)(n), ngas, ngas*hughes_water_prop.kT);
  }

  test_eos("quadratic", 0.5*sqr(n) - n, 1.0, 0.5, 2e-6);
  test_pressure("quadratic(2)", 0.5*sqr(n) - n, 2, 2);
  test_pressure("quadratic(3)", 0.5*sqr(n) - n, 3, 4.5);

  {
    //FILE *o = fopen("ideal-gas.dat", "w");
    //equation_of_state(o, IdealGasOfVeff(), hughes_water_prop.kT, nmin, nmax);
    //fclose(o);
  }

  {
    FILE *o = fopen("dispersion.dat", "w");
    //equation_of_state(o, DispersionSAFT(hughes_water_prop.lengthscale, hughes_water_prop.kT,
    //                                    hughes_water_prop.epsilon_dispersion,
    //                                    hughes_water_prop.lambda_dispersion)(n),
    //                  hughes_water_prop.kT, nmin, nmax);
    fclose(o);
    printf("Got dispersion!\n");

    Functional f = OfEffectivePotential(SaftFluid2(hughes_water_prop.lengthscale,
                                                  hughes_water_prop.epsilonAB, hughes_water_prop.kappaAB,
                                                  hughes_water_prop.epsilon_dispersion,
                                                  hughes_water_prop.lambda_dispersion,
                                                  hughes_water_prop.length_scaling, 0));


    const double n_1atm = pressure_to_density(f, hughes_water_prop.kT, atmospheric_pressure,
					      0.001, 0.01);
    printf("density at 1 atmosphere is %g\n", n_1atm);
    printf("error in density at 1 atmosphere is %g\n", n_1atm/hughes_water_prop.liquid_density - 1);
    if (fabs(n_1atm/hughes_water_prop.liquid_density - 1) > 0.01) {
      printf("FAIL! error in water density is too big! %g\n",
             n_1atm/hughes_water_prop.liquid_density - 1);
      retval++;
    }

    test_pressure("saft at 1 atm", f, n_1atm, atmospheric_pressure);

    {
      printf("working onfoo\n");
      double nv = coexisting_vapor_density(f, hughes_water_prop.kT, hughes_water_prop.liquid_density);
      printf("predicted vapor density: %g\n", nv);
      printf("actual vapor density:    %g\n", hughes_water_prop.vapor_density);
    }

    if (0) {
      o = fopen("saft-fluid.dat", "w");
      double mu = f.derive(hughes_water_prop.kT, Veff)*hughes_water_prop.kT/hughes_water_prop.liquid_density; // convert from derivative w.r.t. V
      equation_of_state(o, f + ChemicalPotential(mu)(n), hughes_water_prop.kT, nmin, nmax);
      fclose(o);
    }

    {
      double nl, nv, mu;
      saturated_liquid_vapor(f, hughes_water_prop.kT, 1e-14, 0.0017, 0.0055, &nl, &nv, &mu, 1e-5);
      printf("saturated water density is %g\n", nl);
      printf("1 atm water density ? is %g\n", hughes_water_prop.liquid_density);
      if (fabs(nl/hughes_water_prop.liquid_density - 1) > 0.1) {
        printf("FAIL: error in saturated water density is too big! %g\n",
               nl/hughes_water_prop.liquid_density - 1);
        retval++;
      }

      printf("predicted saturated vapor density: %g\n", nv);
      printf("actual vapor density:    %g\n", hughes_water_prop.vapor_density);
      //double mu = f.derive(-hughes_water_prop.kT*log(nl))*hughes_water_prop.kT/nl; // convert from derivative w.r.t. V
      //o = fopen("saft-fluid-saturated.dat", "w");
      //equation_of_state(o, f + ChemicalPotential(mu)(n), hughes_water_prop.kT, nmin, 1.1*nl);
      //fclose(o);

      double pv = pressure(f, hughes_water_prop.kT, nv);
      printf("vapor pressure is %g\n", pv);
      if (fabs(pv/hughes_water_prop.kT/nv - 1) > 1e-3) {
        printf("FAIL: error in vapor pressure, steam isn't ideal gas? %g\n",
               pv/hughes_water_prop.kT/nv - 1);
        retval++;
      }
    }

    {
      o = fopen("room-temperature.dat", "w");
      Functional f = OfEffectivePotential(SaftFluid2(hughes_water_prop.lengthscale,
                                                        hughes_water_prop.epsilonAB, hughes_water_prop.kappaAB,
                                                        hughes_water_prop.epsilon_dispersion,
                                                        hughes_water_prop.lambda_dispersion,
                                                        hughes_water_prop.length_scaling, 0));
      double mufoo = find_chemical_potential(f, hughes_water_prop.kT,
                                             hughes_water_prop.liquid_density);
      f = OfEffectivePotential(SaftFluid2(hughes_water_prop.lengthscale,
                                             hughes_water_prop.epsilonAB, hughes_water_prop.kappaAB,
                                             hughes_water_prop.epsilon_dispersion,
                                             hughes_water_prop.lambda_dispersion,
                                             hughes_water_prop.length_scaling, mufoo));
      double nl, nv, mu;
      saturated_liquid_vapor(f, hughes_water_prop.kT, 1e-14, 0.0017, 0.0055, &nl, &nv, &mu, 1e-5);
      for (double dens=0.1*nv; dens<=1.2*nl; dens *= 1.01) {
        double V = -hughes_water_prop.kT*log(dens);
        double Vl = -hughes_water_prop.kT*log(nl);
        fprintf(o, "%g\t%g\t%g\n",
                dens, f(hughes_water_prop.kT, V), f(hughes_water_prop.kT, Vl) - (dens-nl)*mu);
      }
      fclose(o);
      printf("Finished plotting room-temperature.dat...\n");
    }
  }

  {
    FILE *o = fopen("hard-sphere-fluid.dat", "w");
    Functional f = HardSpheresWBnotensor(hughes_water_prop.lengthscale)(n) + IdealGasOfVeff();
    double mu = f.derive(hughes_water_prop.kT, Veff)*hughes_water_prop.kT/hughes_water_prop.liquid_density; // convert from derivative w.r.t. V
    equation_of_state(o, f + ChemicalPotential(mu)(n), hughes_water_prop.kT, nmin, nmax);
    fclose(o);
  }

  if (retval == 0) {
    printf("\n%s passes!\n", argv[0]);
  } else {
    printf("\n%s fails %d tests!\n", argv[0], retval);
    return retval;
  }
}
Пример #5
0
void
hydro_godunov(long idim, double dt, const hydroparam_t H, hydrovar_t * Hv, hydrowork_t * Hw, hydrovarwork_t * Hvw)
{

  // Local variables
  long i, j;
  double dtdx;

  double *dq;
  double *e;
  double *flux;
  double *q;
  double *qleft, *qright;
  double *qxm, *qxp;
  double *u;
  double *c;
  double *uold;
  double *rl, *ul, *pl, *cl, *wl, *rr, *ur, *pr, *cr, *wr, *ro, *uo, *po, *co, *wo,
    *rstar, *ustar, *pstar, *cstar, *spin, *spout, *ushock, *frac, *scr, *delp, *pold;
  long *sgnm, *ind, *ind2;
  double *qgdnv;

  WHERE("hydro_godunov");

  // constant
  dtdx = dt / H.dx;

  // Update boundary conditions
  if (H.prt) {
    fprintf(stdout, "godunov %ld\n", idim);
    PRINTUOLD(H, Hv);
  }
  make_boundary(idim, H, Hv);
  PRINTUOLD(H, Hv);

  // Allocate work space for 1D sweeps
  allocate_work_space(H, Hw, Hvw);
  uold = Hv->uold;
  qgdnv = Hvw->qgdnv;
  flux = Hvw->flux;
  c = Hw->c;
  q = Hvw->q;
  e = Hw->e;
  u = Hvw->u;
  qxm = Hvw->qxm;
  qxp = Hvw->qxp;
  qleft = Hvw->qleft;
  qright = Hvw->qright;
  dq = Hvw->dq;
  rl = Hw->rl;
  ul = Hw->ul;
  pl = Hw->pl;
  cl = Hw->cl;
  wl = Hw->wl;
  rr = Hw->rr;
  ur = Hw->ur;
  pr = Hw->pr;
  cr = Hw->cr;
  wr = Hw->wr;
  ro = Hw->ro;
  uo = Hw->uo;
  po = Hw->po;
  co = Hw->co;
  wo = Hw->wo;
  rstar = Hw->rstar;
  ustar = Hw->ustar;
  pstar = Hw->pstar;
  cstar = Hw->cstar;
  sgnm = Hw->sgnm;
  spin = Hw->spin;
  spout = Hw->spout;
  ushock = Hw->ushock;
  frac = Hw->frac;
  scr = Hw->scr;
  delp = Hw->delp;
  pold = Hw->pold;
  ind = Hw->ind;
  ind2 = Hw->ind2;

  if (idim == 1) {
    for (j = H.jmin + ExtraLayer; j < H.jmax - ExtraLayer; j++) {
      double *qID = &q[IHvw(0, ID)];
      double *qIP = &q[IHvw(0, IP)];
      gatherConservativeVars(idim, j, uold, u, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt);

      // Convert to primitive variables
      constoprim(u, q, e, H.nxt, H.nxyt, H.nvar, H.smallr);
      equation_of_state(qID, e, qIP, c, 0, H.nxt, H.smallc, H.gamma);
      Dmemset(dq, 0, (H.nxyt + 2) * H.nvar);

      // Characteristic tracing
      if (H.iorder != 1) {
        slope(q, dq, H.nxt, H.nvar, H.nxyt, H.slope_type);
      }
      trace(q, dq, c, qxm, qxp, dtdx, H.nxt, H.scheme, H.nvar, H.nxyt);
      qleftright(idim, H.nx, H.ny, H.nxyt, H.nvar, qxm, qxp, qleft, qright);

      // Solve Riemann problem at interfaces
      riemann(qleft, qright, qgdnv,
              rl, ul, pl, cl, wl, rr, ur, pr, cr, wr, ro, uo, po, co, wo,
              rstar, ustar, pstar, cstar,
              sgnm, spin, spout, ushock, frac,
              scr, delp, pold, ind, ind2, H.nx + 1, H.smallr, H.smallc, H.gamma, H.niter_riemann, H.nvar, H.nxyt);

      // Compute fluxes
      cmpflx(qgdnv, flux, H.nxt, H.nxyt, H.nvar, H.gamma);
      updateConservativeVars(idim, j, dtdx, uold, u, flux, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt);
    }                           // for j

    if (H.prt) {
      printf("After pass %ld\n", idim);
      PRINTUOLD(H, Hv);
    }
  } else {
    for (i = H.imin + ExtraLayer; i < H.imax - ExtraLayer; i++) {
      double *qID = &Hvw->q[IHvw(0, ID)];
      double *qIP = &Hvw->q[IHvw(0, IP)];
      gatherConservativeVars(idim, i, uold, u, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt);
      PRINTARRAYV(Hvw->u, H.nyt, "uY", H);

      // Convert to primitive variables
      constoprim(u, q, e, H.nyt, H.nxyt, H.nvar, H.smallr);

      equation_of_state(qID, e, qIP, c, 0, H.nyt, H.smallc, H.gamma);
      PRINTARRAY(Hw->c, H.nyt, "cY", H);

      // Characteristic tracing
      // compute slopes
      Dmemset(dq, 0, H.nyt * H.nvar);
      if (H.iorder != 1) {
        slope(q, dq, H.nyt, H.nvar, H.nxyt, H.slope_type);
      }
      PRINTARRAYV(Hvw->dq, H.nyt, "dqY", H);
      trace(q, dq, c, qxm, qxp, dtdx, H.nyt, H.scheme, H.nvar, H.nxyt);
      qleftright(idim, H.nx, H.ny, H.nxyt, H.nvar, qxm, qxp, qleft, qright);
      PRINTARRAYV(Hvw->qleft, H.ny + 1, "qleftY", H);
      PRINTARRAYV(Hvw->qright, H.ny + 1, "qrightY", H);

      // Solve Riemann problem at interfaces
      riemann(qleft, qright, qgdnv, rl, ul,
              pl, cl, wl, rr, ur, pr,
              cr, wr, ro, uo, po, co,
              wo, rstar, ustar, pstar, cstar,
              sgnm, spin, spout, ushock, frac,
              scr, delp, pold, ind, ind2, H.ny + 1, H.smallr, H.smallc, H.gamma, H.niter_riemann, H.nvar, H.nxyt);

      // Compute fluxes
      cmpflx(qgdnv, flux, H.nyt, H.nxyt, H.nvar, H.gamma);
      PRINTARRAYV(Hvw->flux, H.ny + 1, "fluxY", H);
      // updateConservativeVars(idim, i, dtdx, H, Hv, Hvw);
      updateConservativeVars(idim, i, dtdx, uold, u, flux, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt);
    }                           // else
    if (H.prt) {
      printf("After pass %ld\n", idim);
      PRINTUOLD(H, Hv);
    }
  }
  // Deallocate work space
  deallocate_work_space(H, Hw, Hvw);
}                               // hydro_godunov
Пример #6
0
// variables auxiliaires pour mettre en place le mode resident de HMPP
void
hydro_godunov(int idimStart, real_t dt, const hydroparam_t H, hydrovar_t * Hv, hydrowork_t * Hw, hydrovarwork_t * Hvw) {
  // Local variables
  struct timespec start, end;
  int j;
  real_t dtdx;
  int clear=0;

  real_t (*e)[H.nxyt];
  real_t (*flux)[H.nxystep][H.nxyt];
  real_t (*qleft)[H.nxystep][H.nxyt];
  real_t (*qright)[H.nxystep][H.nxyt];
  real_t (*c)[H.nxyt];
  real_t *uold;
  int (*sgnm)[H.nxyt];
  real_t (*qgdnv)[H.nxystep][H.nxyt];
  real_t (*u)[H.nxystep][H.nxyt];
  real_t (*qxm)[H.nxystep][H.nxyt];
  real_t (*qxp)[H.nxystep][H.nxyt];
  real_t (*q)[H.nxystep][H.nxyt];
  real_t (*dq)[H.nxystep][H.nxyt];

  static FILE *fic = NULL;

  if (fic == NULL && H.prt == 1) {
    char logname[256];
    sprintf(logname, "TRACE.%04d_%04d.txt", H.nproc, H.mype);
    fic = fopen(logname, "w");
  }

  WHERE("hydro_godunov");

  // int hmppGuard = 1;
  int idimIndex = 0;

  for (idimIndex = 0; idimIndex < 2; idimIndex++) {
    int idim = (idimStart - 1 + idimIndex) % 2 + 1;
    // constant
    dtdx = dt / H.dx;

    // Update boundary conditions
    if (H.prt) {
      fprintf(fic, "godunov %d\n", idim);
      PRINTUOLD(fic, H, Hv);
    }
    // if (H.mype == 1) fprintf(fic, "Hydro makes boundary.\n");
    start = cclock();
    make_boundary(idim, H, Hv);
    end = cclock();
    functim[TIM_MAKBOU] += ccelaps(start, end);

    if (H.prt) {fprintf(fic, "MakeBoundary\n");}
    PRINTUOLD(fic, H, Hv);

    uold = Hv->uold;
    qgdnv = (real_t (*)[H.nxystep][H.nxyt]) Hvw->qgdnv;
    flux = (real_t (*)[H.nxystep][H.nxyt]) Hvw->flux;
    c = (real_t (*)[H.nxyt]) Hw->c;
    e = (real_t (*)[H.nxyt]) Hw->e;
    qleft = (real_t (*)[H.nxystep][H.nxyt]) Hvw->qleft;
    qright = (real_t (*)[H.nxystep][H.nxyt]) Hvw->qright;
    sgnm = (int (*)[H.nxyt]) Hw->sgnm;
    q = (real_t (*)[H.nxystep][H.nxyt]) Hvw->q;
    dq = (real_t (*)[H.nxystep][H.nxyt]) Hvw->dq;
    u = (real_t (*)[H.nxystep][H.nxyt]) Hvw->u;
    qxm = (real_t (*)[H.nxystep][H.nxyt]) Hvw->qxm;
    qxp = (real_t (*)[H.nxystep][H.nxyt]) Hvw->qxp;

    int Hmin, Hmax, Hstep;
    int Hdimsize;
    int Hndim_1;

    if (idim == 1) {
      Hmin = H.jmin + ExtraLayer;
      Hmax = H.jmax - ExtraLayer;
      Hdimsize = H.nxt;
      Hndim_1 = H.nx + 1;
      Hstep = H.nxystep;
    } else {
      Hmin = H.imin + ExtraLayer;
      Hmax = H.imax - ExtraLayer;
      Hdimsize = H.nyt;
      Hndim_1 = H.ny + 1;
      Hstep = H.nxystep;
    }

    if (!H.nstep && idim == 1) {
      /* LM -- HERE a more secure implementation should be used: a new parameter ? */
    }
    // if (H.mype == 1) fprintf(fic, "Hydro computes slices.\n");
    for (j = Hmin; j < Hmax; j += Hstep) {
      // we try to compute many slices each pass
      int jend = j + Hstep;
      if (jend >= Hmax)
        jend = Hmax;
      int slices = jend - j;    // numbre of slices to compute
      // fprintf(stderr, "Godunov idim=%d, j=%d %d \n", idim, j, slices);

      if (clear) Dmemset((H.nxyt) * H.nxystep * H.nvar, (real_t *) dq, 0);
      start = cclock();
      gatherConservativeVars(idim, j, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep, uold,
                             u);
      end = cclock();
      functim[TIM_GATCON] += ccelaps(start, end);
      if (H.prt) {fprintf(fic, "ConservativeVars %d %d %d %d %d %d\n", H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep);}
      PRINTARRAYV2(fic, u, Hdimsize, "u", H);

      if (clear) Dmemset((H.nxyt) * H.nxystep * H.nvar, (real_t *) dq, 0);

      // Convert to primitive variables
      start = cclock();
      constoprim(Hdimsize, H.nxyt, H.nvar, H.smallr, slices, Hstep, u, q, e);
      end = cclock();
      functim[TIM_CONPRI] += ccelaps(start, end);
      PRINTARRAY(fic, e, Hdimsize, "e", H);
      PRINTARRAYV2(fic, q, Hdimsize, "q", H);

      start = cclock();
      equation_of_state(0, Hdimsize, H.nxyt, H.nvar, H.smallc, H.gamma, slices, Hstep, e, q, c);
      end = cclock();
      functim[TIM_EOS] += ccelaps(start, end);
      PRINTARRAY(fic, c, Hdimsize, "c", H);
      PRINTARRAYV2(fic, q, Hdimsize, "q", H);

      // Characteristic tracing
      if (H.iorder != 1) {
	start = cclock();
        slope(Hdimsize, H.nvar, H.nxyt, H.slope_type, slices, Hstep, q, dq);
	end = cclock();
	functim[TIM_SLOPE] += ccelaps(start, end);
        PRINTARRAYV2(fic, dq, Hdimsize, "dq", H);
      }

      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qxm, 0);
      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qxp, 0);
      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qleft, 0);
      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qright, 0);
      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) flux, 0);
      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qgdnv, 0);
      start = cclock();
      trace(dtdx, Hdimsize, H.scheme, H.nvar, H.nxyt, slices, Hstep, q, dq, c, qxm, qxp);
      end = cclock();
      functim[TIM_TRACE] += ccelaps(start, end);
      PRINTARRAYV2(fic, qxm, Hdimsize, "qxm", H);
      PRINTARRAYV2(fic, qxp, Hdimsize, "qxp", H);

      start = cclock();
      qleftright(idim, H.nx, H.ny, H.nxyt, H.nvar, slices, Hstep, qxm, qxp, qleft, qright);
      end = cclock();
      functim[TIM_QLEFTR] += ccelaps(start, end);
      PRINTARRAYV2(fic, qleft, Hdimsize, "qleft", H);
      PRINTARRAYV2(fic, qright, Hdimsize, "qright", H);

      start = cclock();
      riemann(Hndim_1, H.smallr, H.smallc, H.gamma, H.niter_riemann, H.nvar, H.nxyt, slices, Hstep, qleft, qright, qgdnv, sgnm, Hw);
      end = cclock();
      functim[TIM_RIEMAN] += ccelaps(start, end);
      PRINTARRAYV2(fic, qgdnv, Hdimsize, "qgdnv", H);

      start = cclock();
      cmpflx(Hdimsize, H.nxyt, H.nvar, H.gamma, slices, Hstep, qgdnv, flux);
      end = cclock();
      functim[TIM_CMPFLX] += ccelaps(start, end);
      PRINTARRAYV2(fic, flux, Hdimsize, "flux", H);
      PRINTARRAYV2(fic, u, Hdimsize, "u", H);

      start = cclock();
      updateConservativeVars(idim, j, dtdx, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep,
                             uold, u, flux);
      end = cclock();
      functim[TIM_UPDCON] += ccelaps(start, end);
      PRINTUOLD(fic, H, Hv);
    }                           // for j

    if (H.prt) {
      // printf("[%d] After pass %d\n", H.mype, idim);
      PRINTUOLD(fic, H, Hv);
    }
  }

  if ((H.t + dt >= H.tend) || (H.nstep + 1 >= H.nstepmax)) {
    /* LM -- HERE a more secure implementation should be used: a new parameter ? */
  }

}                               // hydro_godunov