diff --git a/SConstruct b/SConstruct index ed04a4356..b7f6dfeed 100644 --- a/SConstruct +++ b/SConstruct @@ -388,12 +388,6 @@ config_options = [ """Enable changing the 298K heats of formation directly via the C++ layer.""", False), - BoolVariable( - 'with_html_log_files', - """write HTML log files. Some multiphase equilibrium procedures can - write copious diagnostic log messages. Deprecated -- to be removed - in Cantera 2.2.""", - False), EnumVariable( 'use_sundials', """Cantera uses the CVODE or CVODES ODE integrator to time-integrate @@ -1133,9 +1127,6 @@ else: configh['SUNDIALS_VERSION'] = 0 cdefine('H298MODIFY_CAPABILITY', 'with_h298modify_capability') -cdefine('WITH_HTML_LOGS', 'with_html_log_files') -if env['with_html_log_files']: - print 'WARNING: Support for HTML log files is deprecated and will be removed in Cantera 2.2.' cdefine('LAPACK_FTN_STRING_LEN_AT_END', 'lapack_ftn_string_len_at_end') cdefine('LAPACK_FTN_TRAILING_UNDERSCORE', 'lapack_ftn_trailing_underscore') diff --git a/include/cantera/base/config.h.in b/include/cantera/base/config.h.in index 52fe862bf..161800d67 100644 --- a/include/cantera/base/config.h.in +++ b/include/cantera/base/config.h.in @@ -99,8 +99,6 @@ typedef int ftnlen; // Fortran hidden string length type // present to support conversions %(HAS_NO_PYTHON)s -%(WITH_HTML_LOGS)s - //--------------------- compile options ---------------------------- %(THREAD_SAFE_CANTERA)s diff --git a/include/cantera/base/global.h b/include/cantera/base/global.h index 555b3083f..8018a0c7a 100644 --- a/include/cantera/base/global.h +++ b/include/cantera/base/global.h @@ -1,8 +1,8 @@ /** * @file global.h * This file contains definitions for utility functions and text for modules, - * inputfiles, logs, textlogs, HTML_logs (see \ref inputfiles, \ref logs, - * \ref textlogs and \ref HTML_logs). + * inputfiles, logs, textlogs, (see \ref inputfiles, \ref logs, and + * \ref textlogs). * * @ingroup utils * @@ -13,7 +13,6 @@ * - inputfiles (see \ref inputfiles) * - logs (see \ref logs) * - textlogs (see \ref textlogs) - * - HTML_logs (see \ref HTML_logs) */ // Copyright 2001 California Institute of Technology @@ -135,11 +134,9 @@ std::string canteraRoot(); * * Writing diagnostic information to the screen or to a file. It is often * useful to be able to write diagnostic messages to the screen or to a file. - * Cantera provides two sets of procedures for this purpose. The first set is - * designed to write text messages to the screen to document the progress of a - * complex calculation, such as a flame simulation.The second set writes - * nested lists in HTML format. This is useful to print debugging output for a - * complex calculation that calls many different procedures. + * Cantera a set of procedures for this purpose designed to write text messages + * to the screen to document the progress of a complex calculation, such as a + * flame simulation. */ /*! @@ -206,61 +203,6 @@ XML_Node* get_XML_File(const std::string& file, int debug = 0); //! @copydoc Application::close_XML_File void close_XML_File(const std::string& file); -#ifdef WITH_HTML_LOGS - -/*! - * @defgroup HTML_logs Writing HTML Logfiles - * @ingroup logs - * - * These functions are designed to allow writing HTML diagnostic - * messages in a manner that allows users to control how much - * diagnostic output to print. It works like this: Suppose you - * have function A that invokes function B that invokes function - * C. You want to be able to print diagnostic messages just from - * function A, or from A and B, or from A, B, and C, or to turn - * off printing diagnostic messages altogether. All you need to - * do is call 'beginLogGroup' within function A, and specify a - * loglevel value. Then in B, call beginLogGroup again, but - * without an explicit value for loglevel. By default, the - * current level is decremented by one in beginLogGroup. If it - * is <= 0, no log messages are written. Thus, if each function - * begins with beginLogGroup and calls endLogGroup before - * returning, then setting loglevel = 3 will cause messages from - * A, B, and C to be written (in nested HTML lists), loglevel = - * 2 results in messages only being written from A and B, etc. - */ - -//! @copydoc Application::Messages::beginLogGroup -void beginLogGroup(const std::string& title, int loglevel=-99); - -//! @copydoc Application::Messages::addLogEntry(const std::string&, const std::string&) -void addLogEntry(const std::string& tag, const std::string& value); - -//! @copydoc Application::Messages::addLogEntry(const std::string&, doublereal) -void addLogEntry(const std::string& tag, doublereal value); - -//! @copydoc Application::Messages::addLogEntry(const std::string&, int) -void addLogEntry(const std::string& tag, int value); - -//! @copydoc Application::Messages::addLogEntry(const std::string&) -void addLogEntry(const std::string& msg); - -//! @copydoc Application::Messages::endLogGroup -void endLogGroup(const std::string& title=""); - -//! @copydoc Application::Messages::write_logfile -void write_logfile(const std::string& file = "log.html"); - -#else -inline void beginLogGroup(const std::string& title, int loglevel=-99) {} -inline void addLogEntry(const std::string& tag, const std::string& value) {} -inline void addLogEntry(const std::string& tag, doublereal value) {} -inline void addLogEntry(const std::string& tag, int value) {} -inline void addLogEntry(const std::string& msg) {} -inline void endLogGroup(const std::string& title="") {} -inline void write_logfile(const std::string& file = "log.html") {} -#endif - //! This routine will locate an XML node in either the input //! XML tree or in another input file specified by the file //! part of the file_ID string. diff --git a/include/cantera/equil/MultiPhase.h b/include/cantera/equil/MultiPhase.h index 524e232de..91304a7ac 100644 --- a/include/cantera/equil/MultiPhase.h +++ b/include/cantera/equil/MultiPhase.h @@ -346,8 +346,7 @@ public: * TP problem. * @param maxiter Maximum number of "outer" iterations for problems * holding fixed something other than (T,P). - * @param loglevel Level of diagnostic output, written to a file in HTML - * format. + * @param loglevel Level of diagnostic output */ doublereal equilibrate(int XY, doublereal err = 1.0e-9, int maxsteps = 1000, int maxiter = 200, int loglevel = -99); diff --git a/include/cantera/equil/MultiPhaseEquil.h b/include/cantera/equil/MultiPhaseEquil.h index f41a626c0..60794b0e4 100644 --- a/include/cantera/equil/MultiPhaseEquil.h +++ b/include/cantera/equil/MultiPhaseEquil.h @@ -65,16 +65,10 @@ public: int maxsteps = 1000, int loglevel=-99); doublereal error(); -#if defined(WITH_HTML_LOGS) - //! Return a string specifying the jth reaction. - std::string reactionString(size_t j); - void printInfo(int loglevel); -#else inline std::string reactionString(size_t j) { return std::string(""); } inline void printInfo(int loglevel) {} -#endif void setInitialMixMoles(int loglevel = 0) { setInitialMoles(loglevel); diff --git a/include/cantera/equil/equil.h b/include/cantera/equil/equil.h index caf16d246..80c3bdd56 100644 --- a/include/cantera/equil/equil.h +++ b/include/cantera/equil/equil.h @@ -44,9 +44,7 @@ namespace Cantera * to take when T and/or P is not held fixed. * @param loglevel loglevel Controls amount of diagnostic output. loglevel * = 0 suppresses diagnostics, and increasingly-verbose messages - * are written as loglevel increases. The messages are written to - * a file in HTML format for viewing in a web browser. - * @see HTML_logs + * are written as loglevel increases. * * @return The number of iterations it took to equilibrate the system. * diff --git a/include/cantera/equil/vcs_MultiPhaseEquil.h b/include/cantera/equil/vcs_MultiPhaseEquil.h index 967868da7..4c246a5c9 100644 --- a/include/cantera/equil/vcs_MultiPhaseEquil.h +++ b/include/cantera/equil/vcs_MultiPhaseEquil.h @@ -45,9 +45,7 @@ namespace Cantera * when T and/or P is not held fixed. * @param loglevel Controls amount of diagnostic output. loglevel * = 0 suppresses diagnostics, and increasingly-verbose - * messages are written as loglevel increases. The - * messages are written to a file in HTML format for viewing - * in a web browser. @see HTML_logs + * messages are written as loglevel increases. * * @ingroup equilfunctions */ @@ -88,9 +86,7 @@ int vcs_equilibrate(thermo_t& s, const char* XY, * when T and/or P is not held fixed. * @param loglevel Controls amount of diagnostic output. loglevel * = 0 suppresses diagnostics, and increasingly-verbose - * messages are written as loglevel increases. The - * messages are written to a file in HTML format for viewing - * in a web browser. @see HTML_logs + * messages are written as loglevel increases. * * @ingroup equilfunctions */ @@ -132,9 +128,7 @@ int vcs_equilibrate(MultiPhase& s, const char* XY, * not held fixed. * @param loglevel Controls amount of diagnostic output. loglevel * = 0 suppresses diagnostics, and increasingly-verbose - * messages are written as loglevel increases. The - * messages are written to a file in HTML format for viewing - * in a web browser. @see HTML_logs + * messages are written as loglevel increases. * * @ingroup equilfunctions */ @@ -157,9 +151,7 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy, * with debug flags to get some printing). * @param loglevel Controls amount of diagnostic output. loglevel * = 0 suppresses diagnostics, and increasingly-verbose - * messages are written as loglevel increases. The - * messages are written to a file in HTML format for viewing - * in a web browser. @see HTML_logs + * messages are written as loglevel increases. */ int vcs_determine_PhaseStability(MultiPhase& s, int iphase, double& funcStab, int printLvl, int loglevel); @@ -288,8 +280,7 @@ public: * compile with debug flags to get some printing). * @param err Internal error level * @param maxsteps max steps allowed. - * @param loglevel Determines the amount of printing to the HTML - * output file. + * @param loglevel Determines the amount of printing to the output file. */ int equilibrate(int XY, int estimateEquil = 0, int printLvl= 0, doublereal err = 1.0e-6, @@ -313,8 +304,7 @@ public: * compile with debug flags to get some printing). * @param err Internal error level * @param maxsteps max steps allowed. - * @param loglevel Determines the amount of printing to the HTML - * output file. + * @param loglevel Determines the amount of printing to the output file. */ int equilibrate_TP(int estimateEquil = 0, int printLvl= 0, doublereal err = 1.0e-6, @@ -352,8 +342,7 @@ public: * constructor call for meaning of the levels. * @param err Internal error level * @param maxsteps max steps allowed. - * @param loglevel Determines the amount of printing to the HTML - * output file. + * @param loglevel Determines the amount of printing to the output file. */ int equilibrate_HP(doublereal Htarget, int XY, double Tlow, double Thigh, int estimateEquil = 0, @@ -389,8 +378,7 @@ public: * constructor call for meaning of the levels. * @param err Internal error level * @param maxsteps max steps allowed. - * @param loglevel Determines the amount of printing to the HTML - * output file. + * @param loglevel Determines the amount of printing to the output file. */ int equilibrate_SP(doublereal Starget, double Tlow, double Thigh, int estimateEquil = 0, @@ -424,8 +412,7 @@ public: * main constructor call for meaning of the levels. * @param err Internal error level * @param maxsteps max steps allowed. - * @param logLevel Determines the amount of printing to the HTML - * output file. + * @param logLevel Determines the amount of printing to the output file. */ int equilibrate_TV(int XY, doublereal xtarget, int estimateEquil = 0, @@ -442,7 +429,7 @@ public: * @param printLvl Determines the amount of printing that gets sent to * stdout from the vcs package (Note, you may have to * compile with debug flags to get some printing). - * @param logLevel Determines the amount of printing to the HTML output file. + * @param logLevel Determines the amount of printing to the output file. */ int determine_PhaseStability(int iph, double& funcStab, int printLvl= 0, int logLevel = -99); diff --git a/interfaces/cython/cantera/mixture.pyx b/interfaces/cython/cantera/mixture.pyx index a26c772cf..7d7c069e0 100644 --- a/interfaces/cython/cantera/mixture.pyx +++ b/interfaces/cython/cantera/mixture.pyx @@ -313,14 +313,7 @@ cdef class Mixture: process. 0 indicates no output, while larger numbers produce successively more verbose information. :param log_level: - Controls the amount of diagnostic output written to an HTML log - file. If log_level = 0, no diagnostic output is written. For - values > 0, more detailed information is written to the log file as - log_level increases. The default log file name is - "equilibrium_log.html", but if this file exists, the log - information will be written to "equilibrium_log{n}.html", - where {n} is an integer chosen to avoid overwriting existing - log files. + Controls the amount of diagnostic output written. """ if solver == 'vcs': iSolver = 2 diff --git a/interfaces/cython/cantera/thermo.pyx b/interfaces/cython/cantera/thermo.pyx index 4669c1509..8f07bc5fa 100644 --- a/interfaces/cython/cantera/thermo.pyx +++ b/interfaces/cython/cantera/thermo.pyx @@ -117,11 +117,7 @@ cdef class ThermoPhase(_SolutionBase): 'outer' iterations on T or P when some property pair other than TP is specified. :param loglevel: - Set to a value > 0 to write diagnostic output to a file in HTML - format. Larger values generate more detailed information. The file - will be named ``equilibrate_log.html.`` Subsequent files will be - named ``equilibrate_log1.html``, etc., so that log files are - not overwritten. + Set to a value > 0 to write diagnostic output. """ cdef int iSolver if isinstance(solver, int): diff --git a/interfaces/matlab/toolbox/@Mixture/equilibrate.m b/interfaces/matlab/toolbox/@Mixture/equilibrate.m index 0d06a31f8..3246bb638 100644 --- a/interfaces/matlab/toolbox/@Mixture/equilibrate.m +++ b/interfaces/matlab/toolbox/@Mixture/equilibrate.m @@ -33,21 +33,8 @@ function r = equilibrate(self, XY, err, maxsteps, maxiter, ... % iterations. This is only relevant if a property pair other % than (T,P) is specified. Default: 200. % -% loglevel - Controls the amount of diagnostic output. If -% loglevel = 0, no diagnostic output is written. For values > 0, -% more detailed information is written to the log file as -% loglevel increases. The default is loglevel = 0. -% -% The logfile is written in HTML format, and may be viewed with -% any web browser. The default log file name is -% "equilibrium_log.html", but if this file exists, the log -% information will be written to "equilibrium_log{n}.html", -% where {n} is an integer chosen so that the log file does not -% already exist. Therefore, if 'equilibrate' is called multiple -% times, multiple log files will be written, with names -% "equilibrate_log.html", "equilibrate_log1.html", -% "equilibrate_log2.html", and so on. Existing log files will -% not be overwritten. +% loglevel -- set to a value > 0 to write diagnostic output. +% Larger values generate more detailed information. % % >> equilibrate(mix, 'TP') % >> equilibrate('TP', 1.0e-6, 500) diff --git a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m index 5f7067467..f2bce3368 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m @@ -22,13 +22,8 @@ function a = equilibrate(a, xy, solver, rtol, maxsteps, maxiter, loglevel) % specifies the number of 'outer' iterations on T or P when % some property pair other than TP is specified. % -% loglevel -- set to a value > 0 to write diagnostic output to -% a file in HTML format. Larger values generate more detailed -% information. The file will be named 'equilibrate_log.html.' -% Subsequent files will be named 'equilibrate_log1.html', -% 'equilibrate_log2.html', etc., so that log files are not -% overwritten. -% +% loglevel -- set to a value > 0 to write diagnostic output +% Larger values generate more detailed information. % % use the ChemEquil solver by default diff --git a/src/base/application.cpp b/src/base/application.cpp index d8df3b2cd..42373976f 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -54,13 +54,6 @@ Application::Messages::Messages() : errorMessage(0), errorRoutine(0), logwriter(0) -#ifdef WITH_HTML_LOGS - ,xmllog(0), - current(0), - loglevel(0), - loglevels(0), - loggroups(0) -#endif { // install a default logwriter that writes to standard // output / standard error @@ -71,13 +64,6 @@ Application::Messages::Messages(const Messages& r) : errorMessage(r.errorMessage), errorRoutine(r.errorRoutine), logwriter(0) -#ifdef WITH_HTML_LOGS - , xmllog(r.xmllog), - current(r.current), - loglevel(r.loglevel), - loglevels(r.loglevels), - loggroups(r.loggroups) -#endif { // install a default logwriter that writes to standard // output / standard error @@ -92,24 +78,12 @@ Application::Messages& Application::Messages::operator=(const Messages& r) errorMessage = r.errorMessage; errorRoutine = r.errorRoutine; logwriter = new Logger(*(r.logwriter)); -#ifdef WITH_HTML_LOGS - xmllog = r.xmllog; - current = r.current; - loglevel = r.loglevel; - loglevels = r.loglevels; - loggroups = r.loggroups; -#endif return *this; } Application::Messages::~Messages() { delete logwriter; -#ifdef WITH_HTML_LOGS - if (xmllog) { - write_logfile("orphan"); - } -#endif } void Application::Messages::addError(const std::string& r, const std::string& msg) @@ -150,144 +124,6 @@ void Application::Messages::writelogendl() logwriter->writeendl(); } -#ifdef WITH_HTML_LOGS - -void Application::Messages::beginLogGroup(const std::string& title, int _loglevel /*=-99*/) -{ - Cantera::warn_deprecated("Application::Messages::beginLogGroup", - "HTML Logs will be removed in Cantera 2.2"); - // Add the current loglevel to the vector of loglevels - loglevels.push_back(loglevel); - - // loglevel is a member of the Messages class. - if (_loglevel != -99) { - loglevel = _loglevel; - } else { - loglevel--; - } - - // Add the title of the current logLevel to the vector of titles - loggroups.push_back(title); - - if (loglevel <= 0) { - return; - } - - // If we haven't started an XML tree for the log file, do so here - if (xmllog == 0) { - // The top of this tree will have a zero pointer. - xmllog = new XML_Node("html"); - current = &xmllog->addChild("ul"); - } - // Add two children to the XML tree. - current = ¤t->addChild("li",""+title+""); - current = ¤t->addChild("ul"); -} - -void Application::Messages::addLogEntry(const std::string& tag, const std::string& value) -{ - if (loglevel > 0 && current) { - current->addChild("li",tag+": "+value); - } -} - -void Application::Messages::addLogEntry(const std::string& tag, doublereal value) -{ - if (loglevel > 0 && current) { - current->addChild("li",tag+": "+fp2str(value)); - } -} - -void Application::Messages::addLogEntry(const std::string& tag, int value) -{ - if (loglevel > 0 && current) { - current->addChild("li",tag+": "+int2str(value)); - } -} - -void Application::Messages::addLogEntry(const std::string& msg) -{ - if (loglevel > 0 && current) { - current->addChild("li",msg); - } -} - -void Application::Messages::endLogGroup(const std::string& title) -{ - if (title != "" && title != loggroups.back()) { - writelog("Logfile error." - "\n beginLogGroup: "+ loggroups.back()+ - "\n endLogGroup: "+title+"\n"); - write_logfile("logerror"); - } - - if (loggroups.size() == 1) { - write_logfile(loggroups.back()+"_log"); - } else if (loglevel > 0) { - AssertThrowMsg(current, "Application::Messages::endLogGroup", - "Error while ending a LogGroup. This is probably due to an unmatched" - " beginning and ending group"); - current = current->parent(); - AssertThrowMsg(current, "Application::Messages::endLogGroup", - "Error while ending a LogGroup. This is probably due to an unmatched" - " beginning and ending group"); - current = current->parent(); - // Get the loglevel of the previous level and get rid of - // vector entry in loglevels. - } - - loggroups.pop_back(); - loglevel = loglevels.back(); - loglevels.pop_back(); -} - -void Application::Messages::write_logfile(const std::string& file) -{ - Cantera::warn_deprecated("Application::Messages::write_logfile", - "HTML Logs will be removed in Cantera 2.2"); - - if (!xmllog) { - return; - } - std::string::size_type idot = file.rfind('.'); - std::string ext = ""; - std::string nm = file; - if (idot != std::string::npos) { - ext = file.substr(idot, file.size()); - nm = file.substr(0,idot); - } else { - ext = ".html"; - nm = file; - } - - // see if file exists. If it does, find an integer that - // can be appended to the name to create the name of a file - // that does not exist. - std::string fname = nm + ext; - int n = 0; - while (std::ifstream(fname.c_str())) { - n++; - fname = nm + int2str(n) + ext; - } - - // Now we have a file name that does not correspond to any - // existing file. Open it as an output stream, and dump the - // XML (HTML) tree to it. - - if (xmllog) { - std::ofstream f(fname.c_str()); - // go to the top of the tree, and write it all. - xmllog->root().write(f); - f.close(); - writelog("Log file " + fname + " written.\n"); - delete xmllog; - xmllog = 0; - current = 0; - } -} - -#endif // WITH_HTML_LOGS - #ifdef THREAD_SAFE_CANTERA //! Mutex for access to string messages @@ -332,12 +168,6 @@ Application::Application() : // install a default logwriter that writes to standard // output / standard error // logwriter = new Logger(); - //#ifdef WITH_HTML_LOGS - // // HTML log files - // xmllog = 0; - // current = 0; - // loglevel = 0; - //#endif setDefaultDirectories(); #if defined(THREAD_SAFE_CANTERA) Unit::units() ; diff --git a/src/base/application.h b/src/base/application.h index b8d10b785..d51491b24 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -34,7 +34,6 @@ class XML_Node; * here. At most one instance is created, and it is not destroyed * until the process terminates. * - * @ingroup HTML_logs * @ingroup textlogs * @ingroup globalData */ @@ -42,9 +41,6 @@ class Application { protected: //! Class to carry out messages - /*! - * @ingroup HTML_logs - */ class Messages { public: @@ -162,100 +158,6 @@ protected: */ void setLogger(Logger* logwriter) ; -#ifdef WITH_HTML_LOGS - - //!Create a new group for log messages. - /*! - * Usually this is called upon entering the function, with the title - * parameter equal to the name of the function or method. Subsequent - * messages written with addLogEntry will appear grouped under this - * heading, until endLogGroup() is called. - * - * @param title String name of the LogGroup - * @param loglevel loglevel of the group. - * @ingroup HTML_logs - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void beginLogGroup(const std::string& title, int loglevel) ; - - //! Add an entry to an HTML log file. - /*! - * Entries appear in the form "tag:value". - * - * @param tag tag - * @param value string value - * - * @ingroup HTML_logs - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void addLogEntry(const std::string& tag, const std::string& value) ; - - //! Add an entry to an HTML log file. - /*! - * Entries appear in the form "tag:value". - * - * @param tag tag - * @param value double value - * - * @ingroup HTML_logs - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void addLogEntry(const std::string& tag, doublereal value) ; - - //! Add an entry to an HTML log file. - /*! - * Entries appear in the form "tag:value". - * - * @param tag tag - * @param value integer value - * - * @ingroup HTML_logs - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void addLogEntry(const std::string& tag, int value) ; - - //! Add an entry to an HTML log file. - /*! - * Entries appear in the form "msg". - * - * @param msg Message to be added - * - * @ingroup HTML_logs - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void addLogEntry(const std::string& msg) ; - - //! Close the current group of log messages. - /*! - * This is typically called just before leaving a function or method, - * to close the group of messages that were output from this - * function. Subsequent messages written with addLogEntry() will - * appear at the next-higher level in the outline, unless - * beginLogGroup() is called first to create a new group. - * - * @param title Name of the log group. It defaults to the most recent - * log group created. - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void endLogGroup(const std::string& title) ; - - //! Write the HTML log file. - /*! - * Log entries are stored in memory in an XML tree until this - * function is called, which writes the tree to a file and clears the - * entries stored in memory. The output file will have the name - * specified in the 'file' argument. If this argument has no - * extension, the extension '.html' will be appended. Also, if the - * file already exists, an integer will be appended to the name so - * that no existing log file will be overwritten. WITH_HTML_LOGS must - * be defined. - * - * @param file Name of the file to be written - * @deprecated HTML logs will be removed in Cantera 2.2 - */ - void write_logfile(const std::string& file); -#endif - protected: //! Current list of error messages std::vector errorMessage; @@ -265,22 +167,6 @@ protected: //! Current pointer to the logwriter Logger* logwriter; -#ifdef WITH_HTML_LOGS - //! Current pointer to the top of the XML_Node tree for the current HTML log - XML_Node* xmllog; - - //! Pointer to the last current position in the XML_Node tree for the current HTML log - XML_Node* current; - - //! Current value of the loglevel - int loglevel; - - //! Vector of loglevels for loggroups that are open - std::vector loglevels; - - //! Current vector of loggroups that are open - std::vector loggroups; -#endif } ; #ifdef THREAD_SAFE_CANTERA @@ -467,43 +353,6 @@ public: */ void thread_complete() ; -#ifdef WITH_HTML_LOGS - //! @copydoc Messages::beginLogGroup - void beginLogGroup(const std::string& title, int loglevel) { - pMessenger->beginLogGroup(title,loglevel); - } - - //! @copydoc Messages::addLogEntry(const std::string&, const std::string&) - void addLogEntry(const std::string& tag, const std::string& value) { - pMessenger->addLogEntry(tag, value); - } - - //! @copydoc Messages::addLogEntry(const std::string&, doublereal) - void addLogEntry(const std::string& tag, doublereal value) { - pMessenger->addLogEntry(tag, value); - } - - //! @copydoc Messages::addLogEntry(const std::string&, int) - void addLogEntry(const std::string& tag, int value) { - pMessenger->addLogEntry(tag, value); - } - - //! @copydoc Messages::addLogEntry(const std::string&) - void addLogEntry(const std::string& msg) { - pMessenger->addLogEntry(msg); - } - - //! @copydoc Messages::endLogGroup - void endLogGroup(const std::string& title) { - pMessenger->endLogGroup(title) ; - } - - //! @copydoc Messages::write_logfile - void write_logfile(const std::string& file) { - pMessenger->write_logfile(file) ; - } -#endif - protected: //! Set the default directories for input files. /*! @@ -560,18 +409,6 @@ protected: //! Current pointer to the logwriter //Logger* logwriter; -#ifdef WITH_HTML_LOGS - //! Current pointer to the top of the XML_Node tree for the current HTML log - //XML_Node *xmllog; - //! Pointer to the last current position in the XML_Node tree for the current HTML log - //XML_Node *current; - //! Current value of loglevel - //int loglevel; - //! Vector of loglevels for loggroups that are open - //vector loglevels; - //! Current vector of loggroups that are open - //vector loggroups; -#endif #if defined(THREAD_SAFE_CANTERA) ThreadMessages pMessenger ; diff --git a/src/base/global.cpp b/src/base/global.cpp index 3e6710cfa..f40ded719 100644 --- a/src/base/global.cpp +++ b/src/base/global.cpp @@ -83,47 +83,6 @@ void suppress_deprecation_warnings() app()->suppress_deprecation_warnings(); } -// **************** HTML Logging **************** - -#ifdef WITH_HTML_LOGS - -void beginLogGroup(const std::string& title, int loglevel) -{ - app()->beginLogGroup(title, loglevel) ; -} - -void addLogEntry(const std::string& tag, const std::string& value) -{ - app()->addLogEntry(tag, value) ; -} - -void addLogEntry(const std::string& tag, doublereal value) -{ - app()->addLogEntry(tag, value) ; -} - -void addLogEntry(const std::string& tag, int value) -{ - app()->addLogEntry(tag, value) ; -} - -void addLogEntry(const std::string& msg) -{ - app()->addLogEntry(msg) ; -} - -void endLogGroup(const std::string& title) -{ - app()->endLogGroup(title) ; -} - -void write_logfile(const std::string& file) -{ - app()->write_logfile(file) ; -} - -#endif // WITH_HTML_LOGS - // **************** Global Data **************** Unit* Unit::s_u = 0; diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index f26391c2a..2bc55cf1a 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -1347,16 +1347,6 @@ extern "C" { } } - int write_HTML_log(const char* file) - { - try { - write_logfile(file); - return 0; - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - int getCanteraError(int buflen, char* buf) { try { @@ -1509,15 +1499,4 @@ extern "C" { return handleAllExceptions(-1, ERR); } } - - int writelogfile(char* logfile) - { - try { - write_logfile(logfile); - return 0; - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - } diff --git a/src/clib/ct.h b/src/clib/ct.h index 17a549a73..9662274f7 100644 --- a/src/clib/ct.h +++ b/src/clib/ct.h @@ -144,7 +144,6 @@ extern "C" { int nphases, int* ith, int nkin); CANTERA_CAPI int getCanteraError(int buflen, char* buf); CANTERA_CAPI int showCanteraErrors(); - CANTERA_CAPI int write_HTML_log(const char* file); CANTERA_CAPI int setLogWriter(void* logger); CANTERA_CAPI int addCanteraDirectory(size_t buflen, char* buf); CANTERA_CAPI int clearStorage(); @@ -157,7 +156,6 @@ extern "C" { CANTERA_CAPI int ck_to_cti(char* in_file, char* db_file, char* tr_file, char* id_tag, int debug, int validate); - CANTERA_CAPI int writelogfile(char* logfile); } #endif diff --git a/src/equil/ChemEquil.cpp b/src/equil/ChemEquil.cpp index bb7a1b3e6..0a162f07f 100644 --- a/src/equil/ChemEquil.cpp +++ b/src/equil/ChemEquil.cpp @@ -198,9 +198,6 @@ int ChemEquil::setInitialMoles(thermo_t& s, vector_fp& elMoleGoal, int loglevel) { int iok = 0; - if (loglevel > 0) { - beginLogGroup("ChemEquil::setInitialMoles"); - } try { MultiPhase mp; mp.addPhase(&s, 1.0); @@ -215,13 +212,6 @@ int ChemEquil::setInitialMoles(thermo_t& s, vector_fp& elMoleGoal, for (size_t m = 0; m < m_nComponents; m++) { m_component[m] = e.componentIndex(m); } - for (size_t k = 0; k < m_kk; k++) { - if (s.moleFraction(k) > 0.0) { - if (loglevel > 0) - addLogEntry(s.speciesName(k), - s.moleFraction(k)); - } - } /* * Update the current values of the temp, density, and * mole fraction, and element abundance vectors kept @@ -253,18 +243,12 @@ int ChemEquil::setInitialMoles(thermo_t& s, vector_fp& elMoleGoal, err.save(); iok = -1; } - if (loglevel > 0) { - endLogGroup(); - } return iok; } int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT, vector_fp& elMolesGoal, int loglevel) { - if (loglevel > 0) { - beginLogGroup("estimateElementPotentials"); - } //for (k = 0; k < m_kk; k++) { // if (m_molefractions[k] > 0.0) { // m_molefractions[k] = fmaxx(m_molefractions[k], 0.05); @@ -345,9 +329,6 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT, int info = solve(aa, DATA_PTR(b)); if (info) { - if (loglevel > 0) { - addLogEntry("failed to estimate initial element potentials."); - } info = -2; } for (size_t m = 0; m < m_nComponents; m++) { @@ -356,13 +337,6 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT, for (size_t m = m_nComponents; m < m_mm; m++) { lambda_RT[m_orderVectorElements[m]] = 0.0; } - if (info == 0) { - if (loglevel > 0) { - for (size_t m = 0; m < m_mm; m++) { - addLogEntry(s.elementName(m),lambda_RT[m]); - } - } - } #ifdef DEBUG_MODE if (ChemEquil_print_lvl > 0) { @@ -385,9 +359,6 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT, } } #endif - if (loglevel > 0) { - endLogGroup(); - } return info; } @@ -429,9 +400,6 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, int n; const vector& eNames = s.elementNames(); #endif - if (loglevel > 0) { - beginLogGroup("ChemEquil::equilibrate"); - } initialize(s); update(s); switch (XY) { @@ -470,24 +438,13 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, m_p2.reset(new DensityCalculator); break; default: - if (loglevel > 0) { - endLogGroup("ChemEquil::equilibrate"); - } throw CanteraError("equilibrate","illegal property pair."); } - if (loglevel > 0) { - addLogEntry("Problem type","fixed "+m_p1->symbol()+", "+m_p2->symbol()); - addLogEntry(m_p1->symbol(), m_p1->value(s)); - addLogEntry(m_p2->symbol(), m_p2->value(s)); - } // If the temperature is one of the specified variables, and // it is outside the valid range, throw an exception. if (tempFixed) { double tfixed = s.temperature(); if (tfixed > s.maxTemp() + 1.0 || tfixed < s.minTemp() - 1.0) { - if (loglevel > 0) { - endLogGroup("ChemEquil::equilibrate"); - } throw CanteraError("ChemEquil","Specified temperature (" +fp2str(s.temperature())+" K) outside " "valid range of "+fp2str(s.minTemp())+" K to " @@ -550,10 +507,6 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, doublereal tminPhase = s.minTemp(); // loop to estimate T if (!tempFixed) { - if (loglevel > 0) { - beginLogGroup("Initial T Estimate"); - } - doublereal tmin; doublereal tmax; @@ -637,18 +590,12 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, printf("We shouldn't be here\n"); exit(EXIT_FAILURE); } - if (loglevel > 0) { - addLogEntry("new T estimate", t0); - } if (t0 < 100.) { printf("t0 - we are here %g\n", t0); exit(EXIT_FAILURE); } s.setTemperature(t0); } - if (loglevel > 0) { - endLogGroup("Initial T Estimate"); // initial T estimate - } } @@ -697,19 +644,12 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, * to be very stable. */ int info = estimateEP_Brinkley(s, x, elMolesGoal); - if (info != 0) { - if (info == 1) { - addLogEntry("estimateEP_Brinkley didn't converge in given max iterations"); - } else if (info == -3) { - addLogEntry("estimateEP_Brinkley had a singular Jacobian. Continuing anyway"); - } - } else { + if (info == 0) { setToEquilState(s, x, s.temperature()); // Tempting -> However, nonideal is a problem. Turn on if not worried // about nonideality and you are having problems with the main // algorithm. //if (XY == TP) { - // endLogGroup("ChemEquil::equilibrate"); // return 0; //} } @@ -753,18 +693,11 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr, next: iter++; - if (iter > 1 && loglevel > 0) { - endLogGroup("Iteration "+int2str(iter-1)); // iteration - } - if (loglevel > 0) { - beginLogGroup("Iteration "+int2str(iter)); - } // compute the residual and the jacobian using the current // solution vector equilResidual(s, x, elMolesGoal, res_trial, xval, yval); f = 0.5*dot(res_trial.begin(), res_trial.end(), res_trial.begin()); - addLogEntry("Residual norm", f); // Compute the Jacobian matrix equilJacobian(s, x, elMolesGoal, jac, xval, yval); @@ -808,9 +741,6 @@ next: info = solve(jac, DATA_PTR(res_trial)); } catch (CanteraError& err) { err.save(); - addLogEntry("Jacobian is singular."); - endLogGroup(); // iteration - endLogGroup(); // equilibrate s.restoreState(state); throw CanteraError("equilibrate", @@ -846,7 +776,6 @@ next: } } if (fctr != 1.0) { - addLogEntry("WARNING: factor to keep solution in bounds", fctr); #ifdef DEBUG_MODE if (ChemEquil_print_lvl > 0) { writelogf("WARNING Soln Damping because of bounds: %g\n", fctr); @@ -861,9 +790,6 @@ next: x, f, elMolesGoal , xval, yval)) { fail++; if (fail > 3) { - addLogEntry("dampStep","Failed 3 times. Giving up."); - endLogGroup(); // iteration - endLogGroup(); // equilibrate s.restoreState(state); throw CanteraError("equilibrate", "Cannot find an acceptable Newton damping coefficient."); @@ -916,21 +842,9 @@ converge: && fabs(deltax) < options.relTolerance && fabs(deltay) < options.relTolerance) { options.iterations = iter; - if (loglevel > 0) { - endLogGroup("Iteration "+int2str(iter)); // iteration - beginLogGroup("Converged solution"); - addLogEntry("Iterations",iter); - addLogEntry("Relative error in "+m_p1->symbol(),deltax); - addLogEntry("Relative error in "+m_p2->symbol(),deltay); - addLogEntry("Max residual",rmax); - beginLogGroup("Element potentials"); - } doublereal rt = GasConstant* s.temperature(); for (m = 0; m < m_mm; m++) { m_lambda[m] = x[m]*rt; - if (loglevel > 0) { - addLogEntry("element "+ s.elementName(m), fp2str(x[m])); - } } if (m_eloc != npos) { @@ -941,10 +855,6 @@ converge: * to the original ThermoPhase object. */ s.setElementPotentials(m_lambda); - if (loglevel > 0) { - addLogEntry("Saving Element Potentials to ThermoPhase Object"); - endLogGroup("Element potentials"); - } if (s.temperature() > s.maxTemp() + 1.0 || s.temperature() < s.minTemp() - 1.0) { writelog("Warning: Temperature (" @@ -952,21 +862,12 @@ converge: "valid range of "+fp2str(s.minTemp())+" K to " +fp2str(s.maxTemp())+" K\n"); } - if (loglevel > 0) { - endLogGroup("Converged solution"); - endLogGroup("ChemEquil::equilibrate"); - } return 0; } // no convergence if (iter > options.maxIterations) { - if (loglevel > 0) { - addLogEntry("equilibrate","no convergence"); - endLogGroup("Iteration "+int2str(iter)); - endLogGroup("ChemEquil::equilibrate"); - } s.restoreState(state); throw CanteraError("equilibrate", "no convergence in "+int2str(options.maxIterations) @@ -1026,9 +927,6 @@ void ChemEquil::equilResidual(thermo_t& s, const vector_fp& x, const vector_fp& elmFracGoal, vector_fp& resid, doublereal xval, doublereal yval, int loglevel) { - if (loglevel > 0) { - beginLogGroup("ChemEquil::equilResidual"); - } doublereal xx, yy; doublereal temp = exp(x[m_mm]); setToEquilState(s, x, temp); @@ -1054,9 +952,6 @@ void ChemEquil::equilResidual(thermo_t& s, const vector_fp& x, resid[m] = log((1.0 + elmFracGoal[m]) / (1.0 + elmFrac[m])); } } - if (loglevel > 0) - addLogEntry(s.elementName(m),fp2str(elmFrac[m])+" (" - +fp2str(elmFracGoal[m])+")"); } #ifdef DEBUG_MODE @@ -1073,13 +968,6 @@ void ChemEquil::equilResidual(thermo_t& s, const vector_fp& x, yy = m_p2->value(s); resid[m_mm] = xx/xval - 1.0; resid[m_skip] = yy/yval - 1.0; - if (loglevel > 0) { - string xstr = fp2str(xx)+" ("+fp2str(xval)+")"; - addLogEntry(m_p1->symbol(), xstr); - string ystr = fp2str(yy)+" ("+fp2str(yval)+")"; - addLogEntry(m_p2->symbol(), ystr); - endLogGroup("ChemEquil::equilResidual"); - } #ifdef DEBUG_MODE if (ChemEquil_print_lvl > 0 && !m_doResPerturb) { @@ -1094,9 +982,6 @@ void ChemEquil::equilJacobian(thermo_t& s, vector_fp& x, const vector_fp& elmols, DenseMatrix& jac, doublereal xval, doublereal yval, int loglevel) { - if (loglevel > 0) { - beginLogGroup("equilJacobian"); - } vector_fp& r0 = m_jwork1; vector_fp& r1 = m_jwork2; size_t len = x.size(); @@ -1132,9 +1017,6 @@ void ChemEquil::equilJacobian(thermo_t& s, vector_fp& x, x[n] = xsave; } m_doResPerturb = false; - if (loglevel > 0) { - endLogGroup("equilJacobian"); - } } double ChemEquil::calcEmoles(thermo_t& s, vector_fp& x, const double& n_t, @@ -1681,7 +1563,6 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x, solve(a1, DATA_PTR(resid)); } catch (CanteraError& err) { err.save(); - addLogEntry("estimateEP_Brinkley:Jacobian is singular."); #ifdef DEBUG_MODE writelog("Matrix is SINGULAR.ERROR\n", ChemEquil_print_lvl); #endif diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index 7013eeccd..371b031da 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -595,26 +595,14 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, if (!m_init) { init(); } - if (loglevel > 0) { - beginLogGroup("MultiPhase::equilibrate", loglevel); - } if (XY == TP) { - if (loglevel > 0) { - addLogEntry("problem type","fixed T,P"); - addLogEntry("Temperature",temperature()); - addLogEntry("Pressure", pressure()); - } - // create an equilibrium manager e = new MultiPhaseEquil(this); try { e->equilibrate(XY, err, maxsteps, loglevel); } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - endLogGroup(); - } delete e; e = 0; throw err; @@ -626,10 +614,6 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, h0 = enthalpy(); Tlow = 0.5*m_Tmin; // lower bound on T Thigh = 2.0*m_Tmax; // upper bound on T - if (loglevel > 0) { - addLogEntry("problem type","fixed H,P"); - addLogEntry("H target",fp2str(h0)); - } for (n = 0; n < maxiter; n++) { // if 'strt' is false, the current composition will be used as @@ -641,9 +625,6 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, e = new MultiPhaseEquil(this, strt); // start with a loose error tolerance, but tighten it as we get // close to the final temperature - if (loglevel > 0) { - beginLogGroup("iteration "+int2str(n)); - } try { e->equilibrate(TP, err, maxsteps, loglevel); @@ -680,22 +661,8 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, } herr = fabs((h0 - hnow)/h0); - if (loglevel > 0) { - addLogEntry("T",fp2str(temperature())); - addLogEntry("H",fp2str(hnow)); - addLogEntry("H rel error",fp2str(herr)); - addLogEntry("lower T bound",fp2str(Tlow)); - addLogEntry("upper T bound",fp2str(Thigh)); - endLogGroup(); // iteration - } - if (herr < err) { // || dta < 1.0e-4) { - if (loglevel > 0) { - addLogEntry("T iterations",int2str(n)); - addLogEntry("Final T",fp2str(temperature())); - addLogEntry("H rel error",fp2str(herr)); - } goto done; } tnew = m_temp + dt; @@ -716,9 +683,6 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, catch (CanteraError& err) { err.save(); if (!strt) { - if (loglevel > 0) - addLogEntry("no convergence", - "try estimating starting composition"); strt = true; } else { tnew = 0.5*(m_temp + Thigh); @@ -726,39 +690,20 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, tnew = m_temp + 1.0; } setTemperature(tnew); - if (loglevel > 0) - addLogEntry("no convergence", - "trying T = "+fp2str(m_temp)); - } - if (loglevel > 0) { - endLogGroup(); } } delete e; e = 0; } - if (loglevel > 0) { - addLogEntry("reached max number of T iterations",int2str(maxiter)); - endLogGroup(); - } throw CanteraError("MultiPhase::equilibrate", "No convergence for T"); } else if (XY == SP) { s0 = entropy(); Tlow = 1.0; // m_Tmin; // lower bound on T Thigh = 1.0e6; // m_Tmax; // upper bound on T - if (loglevel > 0) { - addLogEntry("problem type","fixed S,P"); - addLogEntry("S target",fp2str(s0)); - addLogEntry("min T",fp2str(Tlow)); - addLogEntry("max T",fp2str(Thigh)); - } for (n = 0; n < maxiter; n++) { delete e; e = new MultiPhaseEquil(this, strt); - if (loglevel > 0) { - beginLogGroup("iteration "+int2str(n)); - } try { e->equilibrate(TP, err, maxsteps, loglevel); @@ -773,12 +718,6 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, } } serr = fabs((s0 - snow)/s0); - if (loglevel > 0) { - addLogEntry("T",fp2str(temperature())); - addLogEntry("S",fp2str(snow)); - addLogEntry("S rel error",fp2str(serr)); - endLogGroup(); - } dt = (s0 - snow)*m_temp/cp(); dtmax = 0.5*fabs(Thigh - Tlow); dtmax = (dtmax > 500.0 ? 500.0 : dtmax); @@ -787,11 +726,6 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, dt *= dtmax/dta; } if (herr < err || dta < 1.0e-4) { - if (loglevel > 0) { - addLogEntry("T iterations",int2str(n)); - addLogEntry("Final T",fp2str(temperature())); - addLogEntry("S rel error",fp2str(serr)); - } goto done; } tnew = m_temp + dt; @@ -807,34 +741,18 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, catch (CanteraError& err) { err.save(); if (!strt) { - if (loglevel > 0) { - addLogEntry("no convergence", - "setting strt to True"); - } strt = true; } else { tnew = 0.5*(m_temp + Thigh); setTemperature(tnew); - if (loglevel > 0) { - addLogEntry("no convergence", - "trying T = "+fp2str(m_temp)); - } - } - if (loglevel > 0) { - endLogGroup(); } } delete e; e = 0; } - if (loglevel > 0) { - addLogEntry("reached max number of T iterations",int2str(maxiter)); - endLogGroup(); - } throw CanteraError("MultiPhase::equilibrate", "No convergence for T"); } else if (XY == TV) { - addLogEntry("problem type","fixed T, V"); // doublereal dt = 1.0e3; doublereal v0 = volume(); doublereal dVdP; @@ -845,19 +763,12 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, pnow = pressure(); MultiPhaseEquil e(this, start); start = false; - beginLogGroup("iteration "+int2str(n)); e.equilibrate(TP, err, maxsteps, loglevel); vnow = volume(); verr = fabs((v0 - vnow)/v0); - addLogEntry("P",fp2str(pressure())); - addLogEntry("V rel error",fp2str(verr)); - endLogGroup(); if (verr < err) { - addLogEntry("P iterations",int2str(n)); - addLogEntry("Final P",fp2str(pressure())); - addLogEntry("V rel error",fp2str(verr)); goto done; } // find dV/dP @@ -868,18 +779,12 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err, } else { - if (loglevel > 0) { - endLogGroup(); - } throw CanteraError("MultiPhase::equilibrate","unknown option"); } return -1.0; done: delete e; e = 0; - if (loglevel > 0) { - endLogGroup(); - } return err; } diff --git a/src/equil/MultiPhaseEquil.cpp b/src/equil/MultiPhaseEquil.cpp index 3ec64627c..4f0d2c039 100644 --- a/src/equil/MultiPhaseEquil.cpp +++ b/src/equil/MultiPhaseEquil.cpp @@ -14,33 +14,6 @@ using namespace std; namespace Cantera { -#if defined(WITH_HTML_LOGS) - -//! Used to print reaction equations. Given a stoichiometric coefficient 'nu' -//! and a chemical symbol 'sym', return a string for this species in the -//! reaction. -//! @param first if this is false, then a " + " string will be added to the -//! beginning of the string. -//! @param nu Stoichiometric coefficient. May be positive or negative. The -//! absolute value will be used in the string. -//! @param sym Species chemical symbol. -static string coeffString(bool first, doublereal nu, string sym) -{ - if (nu == 0.0) { - return ""; - } - string strt = " + "; - if (first) { - strt = ""; - } - if (nu == 1.0 || nu == -1.0) { - return strt + sym; - } - string s = fp2str(fabs(nu)); - return strt + s + " " + sym; -} -#endif - MultiPhaseEquil::MultiPhaseEquil(MultiPhase* mix, bool start, int loglevel) : m_mix(mix) { // the multi-phase mixture @@ -206,41 +179,18 @@ doublereal MultiPhaseEquil::equilibrate(int XY, doublereal err, { int i; m_iter = 0; - string iterstr; - if (loglevel > 0) { - beginLogGroup("MultiPhaseEquil::equilibrate", loglevel); - } for (i = 0; i < maxsteps; i++) { - if (loglevel > 0) { - iterstr = "iteration "+int2str(i); - beginLogGroup(iterstr); - } stepComposition(loglevel-1); - if (loglevel > 0) { - addLogEntry("error",fp2str(error())); - endLogGroup(iterstr); - } if (error() < err) { break; } } if (i >= maxsteps) { - if (loglevel > 0) { - addLogEntry("Error","no convergence in "+int2str(maxsteps) - +" iterations"); - endLogGroup("MultiPhaseEquil::equilibrate"); - } throw CanteraError("MultiPhaseEquil::equilibrate", "no convergence in " + int2str(maxsteps) + " iterations. Error = " + fp2str(error())); } - if (loglevel > 0) { - addLogEntry("iterations",int2str(iterations())); - addLogEntry("error tolerance",fp2str(err)); - addLogEntry("error",fp2str(error())); - endLogGroup("MultiPhaseEquil::equilibrate"); - } finish(); return error(); } @@ -270,9 +220,6 @@ int MultiPhaseEquil::setInitialMoles(int loglevel) size_t ik, j; double not_mu = 1.0e12; - if (loglevel > 0) { - beginLogGroup("MultiPhaseEquil::setInitialMoles"); - } m_mix->getValidChemPotentials(not_mu, DATA_PTR(m_mu), true); doublereal dg_rt; @@ -288,9 +235,6 @@ int MultiPhaseEquil::setInitialMoles(int loglevel) // choose a set of components based on the current // composition computeN(); - if (loglevel > 0) { - addLogEntry("iteration",iter); - } redo = false; iter++; if (iter > 4) { @@ -321,9 +265,6 @@ int MultiPhaseEquil::setInitialMoles(int loglevel) // if a component has nearly zero moles, redo // with a new set of components if (!redo && delta_xi < 1.0e-10 && ik < m_nel) { - if (loglevel > 0) { - addLogEntry("component too small",speciesName(ik)); - } redo = true; } if (delta_xi < dxi_min) { @@ -340,12 +281,6 @@ int MultiPhaseEquil::setInitialMoles(int loglevel) updateMixMoles(); } for (ik = 0; ik < m_nsp; ik++) - if (moles(ik) != 0.0) { - addLogEntry(speciesName(ik), moles(ik)); - } - if (loglevel > 0) { - endLogGroup("MultiPhaseEquil::setInitialMoles"); - } return 0; } @@ -509,78 +444,10 @@ void MultiPhaseEquil::unsort(vector_fp& x) } } -#if defined(WITH_HTML_LOGS) -void MultiPhaseEquil::printInfo(int loglevel) -{ - size_t m, ik, k; - if (loglevel > 0) { - beginLogGroup("info"); - beginLogGroup("components"); - } - for (m = 0; m < m_nel; m++) { - ik = m_order[m]; - k = m_species[ik]; - if (loglevel > 0) { - addLogEntry(m_mix->speciesName(k), fp2str(m_moles[ik])); - } - } - if (loglevel > 0) { - endLogGroup("components"); - beginLogGroup("non-components"); - } - for (m = m_nel; m < m_nsp; m++) { - ik = m_order[m]; - k = m_species[ik]; - if (loglevel > 0) { - addLogEntry(m_mix->speciesName(k), fp2str(m_moles[ik])); - } - } - if (loglevel > 0) { - endLogGroup("non-components"); - addLogEntry("Error",fp2str(error())); - beginLogGroup("Delta G / RT"); - } - for (k = 0; k < nFree(); k++) { - if (loglevel > 0) { - addLogEntry(reactionString(k), fp2str(m_deltaG_RT[k])); - } - } - if (loglevel > 0) { - endLogGroup("Delta G / RT"); - endLogGroup("info"); - } -} - -string MultiPhaseEquil::reactionString(size_t j) -{ - string sr = "", sp = ""; - size_t i, k; - bool rstrt = true; - bool pstrt = true; - doublereal nu; - for (i = 0; i < m_nsp; i++) { - nu = m_N(i, j); - k = m_species[m_order[i]]; - if (nu < 0.0) { - sr += coeffString(rstrt, nu, m_mix->speciesName(k)); - rstrt = false; - } - if (nu > 0.0) { - sp += coeffString(pstrt, nu, m_mix->speciesName(k)); - pstrt = false; - } - } - return sr + " <=> " + sp; -} -#endif - void MultiPhaseEquil::step(doublereal omega, vector_fp& deltaN, int loglevel) { size_t k, ik; - if (loglevel > 0) { - beginLogGroup("MultiPhaseEquil::step"); - } if (omega < 0.0) { throw CanteraError("step","negative omega"); } @@ -588,12 +455,6 @@ void MultiPhaseEquil::step(doublereal omega, vector_fp& deltaN, for (ik = 0; ik < m_nel; ik++) { k = m_order[ik]; m_lastmoles[k] = m_moles[k]; - if (loglevel > 0) { - addLogEntry("component "+m_mix->speciesName(m_species[k])+" moles", - m_moles[k]); - addLogEntry("component "+m_mix->speciesName(m_species[k])+" step", - omega*deltaN[k]); - } m_moles[k] += omega * deltaN[k]; } @@ -608,18 +469,11 @@ void MultiPhaseEquil::step(doublereal omega, vector_fp& deltaN, } } updateMixMoles(); - if (loglevel > 0) { - endLogGroup("MultiPhaseEquil::step"); - } } doublereal MultiPhaseEquil:: stepComposition(int loglevel) { - if (loglevel > 0) { - beginLogGroup("MultiPhaseEquil::stepComposition"); - } - m_iter++; size_t ik, k = 0; doublereal grad0 = computeReactionSteps(m_dxi); @@ -678,19 +532,11 @@ stepComposition(int loglevel) } } } - if (m_moles[k] < -Tiny) { - if (loglevel > 0) - addLogEntry("Negative moles for " - +m_mix->speciesName(m_species[k]), fp2str(m_moles[k])); - } m_majorsp[k] = true; } } // now take a step with this scaled omega - if (loglevel > 0) { - addLogEntry("Stepping by ", fp2str(omegamax)); - } step(omegamax, m_work); // compute the gradient of G at this new position in the // current direction. If it is positive, then we have overshot @@ -708,15 +554,9 @@ stepComposition(int loglevel) for (k = 0; k < m_nsp; k++) { m_moles[k] = m_lastmoles[k]; } - if (loglevel > 0) { - addLogEntry("Stepped over minimum. Take smaller step ", fp2str(omega)); - } step(omega, m_work); } printInfo(loglevel); - if (loglevel > 0) { - endLogGroup("MultiPhaseEquil::stepComposition"); - } return omega; } diff --git a/src/equil/equilibrate.cpp b/src/equil/equilibrate.cpp index e645a3511..ad66c1439 100644 --- a/src/equil/equilibrate.cpp +++ b/src/equil/equilibrate.cpp @@ -15,41 +15,17 @@ doublereal equilibrate(MultiPhase& s, const char* XY, doublereal tol, int maxsteps, int maxiter, int loglevel) { - if (loglevel > 0) { - beginLogGroup("equilibrate",loglevel); - addLogEntry("multiphase equilibrate function"); - beginLogGroup("arguments"); - addLogEntry("XY",XY); - addLogEntry("tol",tol); - addLogEntry("maxsteps",maxsteps); - addLogEntry("maxiter",maxiter); - addLogEntry("loglevel",loglevel); - endLogGroup("arguments"); - } s.init(); int ixy = _equilflag(XY); if (ixy == TP || ixy == HP || ixy == SP || ixy == TV) { try { double err = s.equilibrate(ixy, tol, maxsteps, maxiter, loglevel); - if (loglevel > 0) { - addLogEntry("Success. Error",err); - endLogGroup("equilibrate"); - - } return err; } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("Failure.",lastErrorMessage()); - endLogGroup("equilibrate"); - } throw err; } } else { - if (loglevel > 0) { - addLogEntry("multiphase equilibrium can be done only for TP, HP, SP, or TV"); - endLogGroup("equilibrate"); - } throw CanteraError("equilibrate","unsupported option"); return -1.0; } @@ -64,21 +40,6 @@ int equilibrate(thermo_t& s, const char* XY, int solver, int nAttempts = 0; int retnSub = 0; - if (loglevel > 0) { - beginLogGroup("equilibrate", loglevel); - addLogEntry("Single-phase equilibrate function"); - { - beginLogGroup("arguments"); - addLogEntry("phase",s.id()); - addLogEntry("XY",XY); - addLogEntry("solver",solver); - addLogEntry("rtol",rtol); - addLogEntry("maxsteps",maxsteps); - addLogEntry("maxiter",maxiter); - addLogEntry("loglevel",loglevel); - endLogGroup("arguments"); - } - } while (redo) { if (solver >= 2) { int printLvlSub = 0; @@ -91,24 +52,12 @@ int equilibrate(thermo_t& s, const char* XY, int solver, vcs_equilibrate(m, XY, estimateEquil, printLvlSub, solver, rtol, maxsteps, maxiter, loglevel-1); redo = false; - if (loglevel > 0) { - addLogEntry("VCSnonideal solver succeeded."); - } retn = nAttempts; } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("VCSnonideal solver failed."); - } if (nAttempts < 2) { - if (loglevel > 0) { - addLogEntry("Trying single phase ChemEquil solver."); - } solver = -1; } else { - if (loglevel > 0) { - endLogGroup("equilibrate"); - } throw err; } } @@ -120,24 +69,12 @@ int equilibrate(thermo_t& s, const char* XY, int solver, nAttempts++; equilibrate(m, XY, rtol, maxsteps, maxiter, loglevel-1); redo = false; - if (loglevel > 0) { - addLogEntry("MultiPhaseEquil solver succeeded."); - } retn = nAttempts; } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("MultiPhaseEquil solver failed."); - } if (nAttempts < 2) { - if (loglevel > 0) { - addLogEntry("Trying single phase ChemEquil solver."); - } solver = -1; } else { - if (loglevel > 0) { - endLogGroup("equilibrate"); - } throw err; } } @@ -154,13 +91,7 @@ int equilibrate(thermo_t& s, const char* XY, int solver, retnSub = e.equilibrate(s, XY, useThermoPhaseElementPotentials, loglevel-1); if (retnSub < 0) { - if (loglevel > 0) { - addLogEntry("ChemEquil solver failed."); - } if (nAttempts < 2) { - if (loglevel > 0) { - addLogEntry("Trying MultiPhaseEquil solver."); - } solver = 1; } else { throw CanteraError("equilibrate", @@ -170,27 +101,15 @@ int equilibrate(thermo_t& s, const char* XY, int solver, retn = nAttempts; s.setElementPotentials(e.elementPotentials()); redo = false; - if (loglevel > 0) { - addLogEntry("ChemEquil solver succeeded."); - } } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("ChemEquil solver failed."); - } // If ChemEquil fails, try the MultiPhase solver if (solver < 0) { - if (loglevel > 0) { - addLogEntry("Trying MultiPhaseEquil solver."); - } solver = 1; } else { redo = false; - if (loglevel > 0) { - endLogGroup("equilibrate"); - } throw err; } } @@ -199,9 +118,6 @@ int equilibrate(thermo_t& s, const char* XY, int solver, /* * We are here only for a success */ - if (loglevel > 0) { - endLogGroup("equilibrate"); - } return retn; } } diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 9ae063ae8..69372523d 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -80,7 +80,6 @@ int vcs_MultiPhaseEquil::equilibrate_TV(int XY, doublereal xtarget, int printLvl, doublereal err, int maxsteps, int loglevel) { - addLogEntry("problem type","fixed T, V"); // doublereal dt = 1.0e3; doublereal Vtarget = m_mix->volume(); doublereal dVdP; @@ -108,7 +107,6 @@ int vcs_MultiPhaseEquil::equilibrate_TV(int XY, doublereal xtarget, for (int n = 0; n < maxiter; n++) { Pnow = m_mix->pressure(); - beginLogGroup("iteration "+int2str(n)); switch (XY) { case TV: iSuccess = equilibrate_TP(strt, printLvlSub, err, maxsteps, loglevel); @@ -147,14 +145,8 @@ int vcs_MultiPhaseEquil::equilibrate_TV(int XY, doublereal xtarget, } Verr = fabs((Vtarget - Vnow)/Vtarget); - addLogEntry("P",fp2str(Pnow)); - addLogEntry("V rel error",fp2str(Verr)); - endLogGroup(); if (Verr < err) { - addLogEntry("P iterations",int2str(n)); - addLogEntry("Final P",fp2str(Pnow)); - addLogEntry("V rel error",fp2str(Verr)); goto done; } // find dV/dP @@ -217,8 +209,6 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, if (Thigh <= 0.0 || Thigh > 1.0E6) { Thigh = 2.0 * m_mix->maxTemp(); } - addLogEntry("problem type","fixed H,P"); - addLogEntry("H target",fp2str(Htarget)); doublereal cpb = 1.0, dT, dTa, dTmax, Tnew; doublereal Hnow; @@ -233,8 +223,6 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, // start with a loose error tolerance, but tighten it as we get // close to the final temperature - beginLogGroup("iteration "+int2str(n)); - try { Tnow = m_mix->temperature(); iSuccess = equilibrate_TP(strt, printLvlSub, err, maxsteps, loglevel); @@ -295,13 +283,6 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, double denom = std::max(fabs(Htarget), acpb); Herr = Htarget - Hnow; HConvErr = fabs((Herr)/denom); - addLogEntry("T",fp2str(m_mix->temperature())); - addLogEntry("H",fp2str(Hnow)); - addLogEntry("Herr",fp2str(Herr)); - addLogEntry("H rel error",fp2str(HConvErr)); - addLogEntry("lower T bound",fp2str(Tlow)); - addLogEntry("upper T bound",fp2str(Thigh)); - endLogGroup(); // iteration if (printLvl > 0) { plogf(" equilibrate_HP: It = %d, Tcurr = %g Hcurr = %g, Htarget = %g\n", n, Tnow, Hnow, Htarget); @@ -310,9 +291,6 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, } if (HConvErr < err) { // || dTa < 1.0e-4) { - addLogEntry("T iterations",int2str(n)); - addLogEntry("Final T",fp2str(m_mix->temperature())); - addLogEntry("H rel error",fp2str(Herr)); if (printLvl > 0) { plogf(" equilibrate_HP: CONVERGENCE: Hfinal = %g Tfinal = %g, Its = %d \n", Hnow, Tnow, n); @@ -329,8 +307,6 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, } catch (CanteraError err) { if (!estimateEquil) { - addLogEntry("no convergence", - "try estimating composition at the start"); strt = -1; } else { Tnew = 0.5*(Tnow + Thigh); @@ -338,15 +314,10 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget, Tnew = Tnow + 1.0; } m_mix->setTemperature(Tnew); - addLogEntry("no convergence", - "trying T = "+fp2str(Tnow)); } - endLogGroup(); } } - addLogEntry("reached max number of T iterations",int2str(maxiter)); - endLogGroup(); throw CanteraError("MultiPhase::equilibrate_HP", "No convergence for T"); done: @@ -371,8 +342,6 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, if (Thigh <= 0.0 || Thigh > 1.0E6) { Thigh = 2.0 * m_mix->maxTemp(); } - addLogEntry("problem type","fixed S,P"); - addLogEntry("S target",fp2str(Starget)); doublereal cpb = 1.0, dT, dTa, dTmax, Tnew; doublereal Snow; @@ -392,8 +361,6 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, // start with a loose error tolerance, but tighten it as we get // close to the final temperature - beginLogGroup("iteration "+int2str(n)); - try { Tnow = m_mix->temperature(); int iSuccess = equilibrate_TP(strt, printLvlSub, err, maxsteps, loglevel); @@ -455,13 +422,6 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, double denom = std::max(fabs(Starget), acpb); Serr = Starget - Snow; SConvErr = fabs((Serr)/denom); - addLogEntry("T",fp2str(m_mix->temperature())); - addLogEntry("S",fp2str(Snow)); - addLogEntry("Serr",fp2str(Serr)); - addLogEntry("S rel error",fp2str(SConvErr)); - addLogEntry("lower T bound",fp2str(Tlow)); - addLogEntry("upper T bound",fp2str(Thigh)); - endLogGroup(); // iteration if (printLvl > 0) { plogf(" equilibrate_SP: It = %d, Tcurr = %g Scurr = %g, Starget = %g\n", n, Tnow, Snow, Starget); @@ -470,9 +430,6 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, } if (SConvErr < err) { // || dTa < 1.0e-4) { - addLogEntry("T iterations",int2str(n)); - addLogEntry("Final T",fp2str(m_mix->temperature())); - addLogEntry("S rel error",fp2str(Serr)); if (printLvl > 0) { plogf(" equilibrate_SP: CONVERGENCE: Sfinal = %g Tfinal = %g, Its = %d \n", Snow, Tnow, n); @@ -489,8 +446,6 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, } catch (CanteraError err) { if (!estimateEquil) { - addLogEntry("no convergence", - "try estimating composition at the start"); strt = -1; } else { Tnew = 0.5*(Tnow + Thigh); @@ -498,15 +453,10 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget, Tnew = Tnow + 1.0; } m_mix->setTemperature(Tnew); - addLogEntry("no convergence", - "trying T = "+fp2str(Tnow)); } - endLogGroup(); } } - addLogEntry("reached max number of T iterations",int2str(maxiter)); - endLogGroup(); throw CanteraError("MultiPhase::equilibrate_SP", "No convergence for T"); } @@ -607,12 +557,6 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil, "Pressure less than zero on input"); } - beginLogGroup("vcs_MultiPhaseEquil::equilibrate_TP", loglevel); - addLogEntry("problem type","fixed T,P"); - addLogEntry("Temperature", T); - addLogEntry("Pressure", pres); - - /* * Print out the problem specification from the point of * view of the vprob object. @@ -714,7 +658,6 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil, } } } - endLogGroup(); return iSuccess; } @@ -1523,11 +1466,6 @@ int vcs_MultiPhaseEquil::determine_PhaseStability(int iph, double& funcStab, int "Pressure less than zero on input"); } - beginLogGroup("vcs_MultiPhaseEquil::determine_PhaseStability", loglevel); - addLogEntry("problem type", "fixed T,P"); - addLogEntry("Temperature", T); - addLogEntry("Pressure", pres); - /* * Print out the problem specification from the point of * view of the vprob object. @@ -1616,8 +1554,6 @@ int vcs_MultiPhaseEquil::determine_PhaseStability(int iph, double& funcStab, int } } } - endLogGroup("vcs_MultiPhaseEquil::determine_PhaseStability"); - return iStable; } diff --git a/src/equil/vcs_equilibrate.cpp b/src/equil/vcs_equilibrate.cpp index b0ae3e9ff..8b78f9067 100644 --- a/src/equil/vcs_equilibrate.cpp +++ b/src/equil/vcs_equilibrate.cpp @@ -38,21 +38,6 @@ int vcs_equilibrate(thermo_t& s, const char* XY, int retn = 1; int retnSub = 0; - beginLogGroup("equilibrate", loglevel); - // retry: - addLogEntry("Single-phase equilibrate function"); - { - beginLogGroup("arguments"); - addLogEntry("phase",s.id()); - addLogEntry("XY",XY); - addLogEntry("solver",solver); - addLogEntry("rtol",rtol); - addLogEntry("maxsteps",maxsteps); - addLogEntry("maxiter",maxiter); - addLogEntry("loglevel",loglevel); - endLogGroup("arguments"); - } - if (solver == 2) { m = new MultiPhase; try { @@ -65,15 +50,9 @@ int vcs_equilibrate(thermo_t& s, const char* XY, retn = vcs_equilibrate(*m, XY, estimateEquil, printLvl, solver, rtol, maxsteps, maxiter, loglevel); - if (retn == 1) { - addLogEntry("MultiPhaseEquil solver succeeded."); - } else { - addLogEntry("MultiPhaseEquil solver returned an error code: ", retn); - } delete m; } catch (CanteraError& err) { err.save(); - addLogEntry("MultiPhaseEquil solver failed."); delete m; throw err; } @@ -83,16 +62,10 @@ int vcs_equilibrate(thermo_t& s, const char* XY, m->addPhase(&s, 1.0); m->init(); (void) equilibrate(*m, XY, rtol, maxsteps, maxiter, loglevel-1); - if (loglevel > 0) { - addLogEntry("MultiPhaseEquil solver succeeded."); - } delete m; retn = 1; } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("MultiPhaseEquil solver failed."); - } delete m; throw err; } @@ -108,9 +81,6 @@ int vcs_equilibrate(thermo_t& s, const char* XY, retnSub = e->equilibrate(s, XY, useThermoPhaseElementPotentials, loglevel-1); if (retnSub < 0) { - if (loglevel > 0) { - addLogEntry("ChemEquil solver failed."); - } delete e; throw CanteraError("equilibrate", "ChemEquil equilibrium solver failed"); @@ -118,14 +88,8 @@ int vcs_equilibrate(thermo_t& s, const char* XY, retn = 1; s.setElementPotentials(e->elementPotentials()); delete e; - if (loglevel > 0) { - addLogEntry("ChemEquil solver succeeded."); - } } catch (CanteraError& err) { err.save(); - if (loglevel > 0) { - addLogEntry("ChemEquil solver failed."); - } delete e; throw err; } @@ -137,7 +101,6 @@ int vcs_equilibrate(thermo_t& s, const char* XY, /* * We are here only for a success */ - endLogGroup("equilibrate"); return retn; } @@ -159,16 +122,6 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy, static int counter = 0; int retn = 1; - beginLogGroup("equilibrate",loglevel); - addLogEntry("multiphase equilibrate function"); - beginLogGroup("arguments"); - addLogEntry("XY",ixy); - addLogEntry("tol",tol); - addLogEntry("maxsteps",maxsteps); - addLogEntry("maxiter",maxiter); - addLogEntry("loglevel",loglevel); - endLogGroup("arguments"); - int printLvlSub = std::max(0, printLvl-1); s.init(); @@ -179,11 +132,7 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy, int err = eqsolve->equilibrate(ixy, estimateEquil, printLvlSub, tol, maxsteps, loglevel); if (err != 0) { retn = -1; - addLogEntry("vcs_equilibrate Error - ", err); - } else { - addLogEntry("vcs_equilibrate Success - ", err); } - endLogGroup("equilibrate"); // hard code a csv output file. if (printLvl > 0) { string reportFile = "vcs_equilibrate_res.csv"; @@ -197,31 +146,18 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy, } catch (CanteraError& e) { e.save(); retn = -1; - addLogEntry("Failure.", lastErrorMessage()); - endLogGroup("equilibrate"); throw e; } } else if (solver == 1) { if (ixy == TP || ixy == HP || ixy == SP || ixy == TV) { try { double err = s.equilibrate(ixy, tol, maxsteps, maxiter, loglevel); - - addLogEntry("Success. Error",err); - endLogGroup("equilibrate"); - return 0; } catch (CanteraError& e) { e.save(); - addLogEntry("Failure.",lastErrorMessage()); - endLogGroup("equilibrate"); - throw e; } } else { - - addLogEntry("multiphase equilibrium can be done only for TP, HP, SP, or TV"); - endLogGroup("equilibrate"); - throw CanteraError("equilibrate","unsupported option"); //return -1.0; } @@ -236,25 +172,12 @@ int vcs_determine_PhaseStability(MultiPhase& s, int iphase, { int iStab = 0; static int counter = 0; - beginLogGroup("PhaseStability",loglevel); - addLogEntry("multiphase phase stability function"); - beginLogGroup("arguments"); - addLogEntry("iphase",iphase); - addLogEntry("loglevel",loglevel); - endLogGroup("arguments"); - int printLvlSub = std::max(0, printLvl-1); s.init(); try { VCSnonideal::vcs_MultiPhaseEquil* eqsolve = new VCSnonideal::vcs_MultiPhaseEquil(&s, printLvlSub); iStab = eqsolve->determine_PhaseStability(iphase, funcStab, printLvlSub, loglevel); - if (iStab != 0) { - addLogEntry("Phase is stable - ", iphase); - } else { - addLogEntry("Phase is not stable - ", iphase); - } - endLogGroup("PhaseStability"); // hard code a csv output file. if (printLvl > 0) { string reportFile = "vcs_phaseStability.csv"; @@ -266,8 +189,6 @@ int vcs_determine_PhaseStability(MultiPhase& s, int iphase, } delete eqsolve; } catch (CanteraError& e) { - addLogEntry("Failure.", lastErrorMessage()); - endLogGroup("equilibrate"); throw e; } return iStab; diff --git a/src/matlab/ctfunctions.cpp b/src/matlab/ctfunctions.cpp index 9f4235643..f62ed0d9f 100644 --- a/src/matlab/ctfunctions.cpp +++ b/src/matlab/ctfunctions.cpp @@ -13,7 +13,6 @@ using namespace std; void reportError() { - write_HTML_log("error_log.html"); int buflen = 0; char* output_buf = 0; buflen = getCanteraError(buflen, output_buf) + 1; diff --git a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp index 769e7ae0c..04b614f17 100644 --- a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp +++ b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp @@ -57,9 +57,7 @@ int main(int argc, char** argv) double pres = gas->pressure(); printf("Initial T = %g, pres = %g atm\n", tkelvin, pres/OneAtm); - beginLogGroup("topEquil", -1); equilibrate(*gas,"UV", 0, 1e-12); - endLogGroup("topEquil"); tkelvin = gas->temperature(); pres = gas->pressure();