예제 #1
0
int main(int, char **) {
  FILE *out = fopen("papers/fuzzy-fmt/figs/bh-homogeneous.dat", "w");
  const double Tmax = 10.0, dT = 0.01, Tmin = dT;
  fprintf(out, "# n_reduced");
  for (double T = Tmin; T<= Tmax + dT/2; T += dT) {
    fprintf(out, "\tp(kT=%g)/nkT", T);
  }
  fprintf(out, "\n0");
  for (double T = Tmin; T<= Tmax + dT/2; T += dT) {
    fprintf(out, "\t%g", T);
  }
  fprintf(out, "\n");

  const double dn = 0.01, nmax = 2.5;
  for (double n_reduced = dn; n_reduced <= nmax; n_reduced += dn) {
    fprintf(out, "%g", n_reduced);
    for (double T = Tmin; T<= Tmax + dT/2; T += dT) {
      const double temp = T;
      double rad = R_BH(temp);
      Functional f = HardFluid(rad,0);
      double usekT = temp;
      //if (temp == 0) usekT = 1.0;
      const double n = n_reduced*pow(2,-5.0/2.0);
      // return *reduced* pressure!
      fprintf(out, "\t%g", pressure(OfEffectivePotential(f), usekT, n)/pow(2,-5.0/2.0));
    }
    fprintf(out, "\n");
  }
  fclose(out);
  return 0;
}
예제 #2
0
int main(int argc, char **argv) {
  double reduced_density, temp;
  if (argc != 3) {
    printf("usage: %s reduced_density kT\n", argv[0]);
    return 1;
  }
  printf("git version: %s\n", version_identifier());

  sscanf(argv[1], "%lg", &reduced_density);
  sscanf(argv[2], "%lg", &temp);

  HomogeneousWhiteBearFluid hf;
  printf("dx is %g\n", dx);

  double rad_bh = R_BH(temp);
  printf("rad is %g\n", rad_bh);

  hf.R() = rad_bh;
  hf.kT() = temp;
  hf.n() = reduced_density*pow(2,-5.0/2.0);
  printf("dividing by sigma = %g\n", sigma);
  printf("eta is %g\n", hf.n()*uipow(radius,3)*M_PI*4/3);
  hf.mu() = 0;
  hf.mu() = hf.d_by_dn(); // set mu based on derivative of hf
  printf("bulk energy is %g\n", hf.energy());
  printf("cell energy should be %g\n", hf.energy()*dx*dx*dx);

  WhiteBearFluidVeff f(xmax, ymax, zmax, dx);
  f.R() = hf.R();
  f.kT() = hf.kT();
  f.mu() = hf.mu();
  f.Vext() = 0;
  f.Veff() = -temp*log(hf.n());

  {
    const int Ntot = f.Nx()*f.Ny()*f.Nz();
    const Vector r = f.get_r();
    const double Vmax = 100*temp;
    for (int i=0; i<Ntot; i++) {
      f.Vext()[i] = 4*epsilon*(uipow(sigma/r[i], 12) - uipow(sigma/r[i], 6));
      if (!(f.Vext()[i] < Vmax)) f.Vext()[i] = Vmax;
      f.Veff()[i] += f.Vext()[i]*temp/10; // adjust uniform guess based on repulsive potential
    }
  }
  
  took("setting up the potential and Veff");
  printf("initial energy is %g\n", f.energy());
  took("Finding initial energy");
  printf("Here is a new line!\n");

  run_minimization(reduced_density, &f, temp);

  return 0;
}