HiFiLES / HiFiLES-solver

High Fidelity Large Eddy Simulation Solver
Other
172 stars 131 forks source link

questions about the 'diagnostic_fields' in the input file #63

Closed javierchang closed 9 years ago

javierchang commented 9 years ago

When I run the test case of 'cylinder' in the Navier-Stokes, the tecplot file it write contains only 6 variables("x", "y", "rho", "mom_x", "mom_y", "ene"). Then I want more variables,like u,v,Mach,etc , to be written into tecplot file. So I add a new line of 'diagnostic_fields 3 u v mach' into the input file. But astonishingly, after running the code, there were still six default variables in the tecplot file, without the u,v,mach I prescribed in the input files. Then I 'cout' the value of 'n_diagnostic_fields' in the output.cpp and it turns out the value of 'n_diagnostic_fields' is still zero, indicating it remains the default setting.

I check the input.cpp and find these lines: (1) opts.getVectorValueOptional("diagnostic_fields",diagnostic_fields); (2) n_diagnostic_fields = diagnostic_fields.get_dim(0); (3) while (getline(optFile,str)) { // Remove any leading whitespace & see if first word is the input option stringstream ss; ss.str(str); ss >> optKey; if (optKey.compare(optName)==0) { int nVals; if (!(ss >> nVals)) { // This could happen if, for example, trying to assign a string to a double cerr << "WARNING: Unable to read number of entries for vector option " << optName << endl; string errMsg = "Required option not set: " + optName; FatalError(errMsg.c_str()); }

  opt.resize(nVals);
  for (int i=0; i<nVals; i++) {
    if (!ss >> opt[i]) {
      cerr << "WARNING: Unable to assign all values to vector option " << optName << endl;
      string errMsg = "Required option not set: " + optName;
      FatalError(errMsg.c_str())
    }
  }

  closeFile();
  return;
}

the value of 'n_diagnostic_fields' should be altered to 3, but I do not know why it remains default zero. So I need some helps about this.

Best regards javier chang

mlopez14 commented 9 years ago

Thanks for bringing this to our attention! In theory there should be no problem. Would you mind sending us your input file so we can take a look at it? I would suggest you upload it to a service like Dropbox and send us the link.

We have recently modified the way input files are read to allow for more flexibility and haven't gotten to updating the Wiki.

JacobCrabill commented 9 years ago

I found the bug(s) and fixed them; do a git pull and remake, and your input file should work now - let us know if it doesn't!

javierchang commented 9 years ago

Now, after the debugging, the input file with diagnostic fields works well and it can write additional variables into tecplot files. Thanks a lot, Crabill and Lopez, for the effort of fixing the bug!

Best regards! javier chang