Moved the use of the transport_log.xml file into the DEBUG_MODE
capability. On certain MP platforms, the serial writing of files may cause mp programs to hang, if multiple processors are trying to write to the same file at the same time. The intermediate solution here is to stop writing from libraries until we add MPI capabilities into Cantera.
This commit is contained in:
parent
047cad3ca0
commit
d80bb19126
4 changed files with 892 additions and 825 deletions
|
|
@ -227,15 +227,22 @@ namespace Cantera {
|
|||
|
||||
void MMCollisionInt::init(XML_Writer* xml,
|
||||
doublereal tsmin, doublereal tsmax, int log_level) {
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
ostream& logfile = xml->output();
|
||||
m_xml = xml;
|
||||
#else
|
||||
m_xml = 0;
|
||||
#endif
|
||||
m_loglevel = log_level;
|
||||
if (m_loglevel > 0)
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_loglevel > 0) {
|
||||
m_xml->XML_comment(logfile, "Collision Integral Polynomial Fits");
|
||||
}
|
||||
char p[200];
|
||||
#endif
|
||||
m_nmin = -1;
|
||||
m_nmax = -1;
|
||||
char p[200];
|
||||
|
||||
for (int n = 0; n < 37; n++) {
|
||||
if (tsmin > tstar[n+1]) m_nmin = n;
|
||||
if (tsmax > tstar[n+1]) m_nmax = n+1;
|
||||
|
|
@ -244,13 +251,16 @@ namespace Cantera {
|
|||
m_nmin = 0;
|
||||
m_nmax = 36;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_loglevel > 0) {
|
||||
m_xml->XML_item(logfile, "Tstar_min", tstar[m_nmin + 1]);
|
||||
m_xml->XML_item(logfile, "Tstar_max", tstar[m_nmax + 1]);
|
||||
}
|
||||
#endif
|
||||
m_logTemp.resize(37);
|
||||
doublereal rmserr, e22 = 0.0, ea = 0.0, eb = 0.0, ec = 0.0;
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_loglevel > 0) {
|
||||
m_xml->XML_open(logfile, "dstar_fits");
|
||||
m_xml->XML_comment(logfile, "Collision integral fits at each "
|
||||
|
|
@ -263,6 +273,7 @@ namespace Cantera {
|
|||
"polynomial coefficients not printed (log_level < 4)");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
string indent = " ";
|
||||
for (int i = 0; i < 37; i++)
|
||||
|
|
@ -271,6 +282,7 @@ namespace Cantera {
|
|||
vector_fp c(DeltaDegree+1);
|
||||
|
||||
rmserr = fitDelta(0, i, DeltaDegree, DATA_PTR(c));
|
||||
#ifdef DEBUG_MODE
|
||||
if (log_level > 3) {
|
||||
sprintf(p, " Tstar=\"%12.6g\"", tstar[i+1]);
|
||||
m_xml->XML_open(logfile, "dstar_fit", p);
|
||||
|
|
@ -278,33 +290,42 @@ namespace Cantera {
|
|||
m_xml->XML_writeVector(logfile, indent, "omega22",
|
||||
c.size(), DATA_PTR(c));
|
||||
}
|
||||
#endif
|
||||
m_o22poly.push_back(c);
|
||||
if (rmserr > e22) e22 = rmserr;
|
||||
|
||||
rmserr = fitDelta(1, i, DeltaDegree, DATA_PTR(c));
|
||||
m_apoly.push_back(c);
|
||||
#ifdef DEBUG_MODE
|
||||
if (log_level > 3)
|
||||
m_xml->XML_writeVector(logfile, indent, "astar",
|
||||
c.size(), DATA_PTR(c));
|
||||
#endif
|
||||
if (rmserr > ea) ea = rmserr;
|
||||
|
||||
rmserr = fitDelta(2, i, DeltaDegree, DATA_PTR(c));
|
||||
m_bpoly.push_back(c);
|
||||
#ifdef DEBUG_MODE
|
||||
if (log_level > 3)
|
||||
m_xml->XML_writeVector(logfile, indent, "bstar",
|
||||
c.size(), DATA_PTR(c));
|
||||
#endif
|
||||
if (rmserr > eb) eb = rmserr;
|
||||
|
||||
rmserr = fitDelta(3, i, DeltaDegree, DATA_PTR(c));
|
||||
m_cpoly.push_back(c);
|
||||
if (log_level > 3)
|
||||
#ifdef DEBUG_MODE
|
||||
if (log_level > 3) {
|
||||
m_xml->XML_writeVector(logfile, indent, "cstar",
|
||||
c.size(), DATA_PTR(c));
|
||||
}
|
||||
#endif
|
||||
if (rmserr > ec) ec = rmserr;
|
||||
|
||||
if (log_level > 3)
|
||||
#ifdef DEBUG_MODE
|
||||
if (log_level > 3) {
|
||||
m_xml->XML_close(logfile, "dstar_fit");
|
||||
|
||||
}
|
||||
|
||||
if (log_level > 0) {
|
||||
sprintf(p,
|
||||
|
|
@ -316,6 +337,7 @@ namespace Cantera {
|
|||
m_xml->XML_comment(logfile, p);
|
||||
m_xml->XML_close(logfile, "dstar_fits");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -444,11 +466,14 @@ namespace Cantera {
|
|||
w[0]= -1.0;
|
||||
rmserr = polyfit(n, logT, DATA_PTR(values),
|
||||
DATA_PTR(w), degree, ndeg, 0.0, o22);
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_loglevel > 0 && rmserr > 0.01) {
|
||||
char p[100];
|
||||
sprintf(p, "Warning: RMS error = %12.6g in omega_22 fit with delta* = %12.6g\n", rmserr, deltastar);
|
||||
sprintf(p, "Warning: RMS error = %12.6g in omega_22 fit"
|
||||
"with delta* = %12.6g\n", rmserr, deltastar);
|
||||
m_xml->XML_comment(logfile, p);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MMCollisionInt::fit(ostream& logfile, int degree,
|
||||
|
|
@ -485,7 +510,7 @@ namespace Cantera {
|
|||
w[0]= -1.0;
|
||||
rmserr = polyfit(n, logT, DATA_PTR(values),
|
||||
DATA_PTR(w), degree, ndeg, 0.0, c);
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_loglevel > 2) {
|
||||
char p[100];
|
||||
sprintf(p, " dstar=\"%12.6g\"", deltastar);
|
||||
|
|
@ -511,6 +536,7 @@ namespace Cantera {
|
|||
}
|
||||
m_xml->XML_close(logfile, "tstar_fit");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -17,7 +17,16 @@ do_ranlib = @DO_RANLIB@
|
|||
|
||||
PIC_FLAG=@PIC@
|
||||
|
||||
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) $(PIC_FLAG)
|
||||
debug_mode = @CANTERA_DEBUG_MODE@
|
||||
ifeq ($(debug_mode), 1)
|
||||
DEBUG_FLAG=-DDEBUG_MODE
|
||||
else
|
||||
DEBUG_FLAG=
|
||||
endif
|
||||
|
||||
|
||||
|
||||
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) $(PIC_FLAG) $(DEBUG_FLAG)
|
||||
|
||||
# Transport Object Files
|
||||
OBJS = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o \
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -159,15 +159,15 @@ namespace Cantera {
|
|||
|
||||
/** Generate polynomial fits to viscosity, conductivity, and
|
||||
* binary diffusion coefficients */
|
||||
void fitProperties(TransportParams& tr, std::ostream& logfile=std::cout);
|
||||
void fitProperties(TransportParams& tr, std::ostream & logfile);
|
||||
|
||||
/// Generate polynomial fits to collision integrals
|
||||
void fitCollisionIntegrals(std::ostream& logfile,
|
||||
void fitCollisionIntegrals(std::ostream & logfile,
|
||||
TransportParams& tr);
|
||||
|
||||
|
||||
|
||||
void setupMM(std::ostream& flog, const XML_Node* transport_database,
|
||||
void setupMM(std::ostream &flog, const XML_Node* transport_database,
|
||||
thermo_t* thermo, int mode, int log_level,
|
||||
TransportParams& tr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue