MCPcopy Create free account
hub / github.com/Cantera/cantera / vcs_basopt

Method vcs_basopt

src/equil/vcs_solve_TP.cpp:2015–2497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2013}
2014
2015int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], double sm[],
2016 double ss[], double test, bool* const usedZeroedSpecies)
2017{
2018 size_t k;
2019 size_t juse = npos;
2020 size_t jlose = npos;
2021 DenseMatrix C;
2022 clockWC tickTock;
2023 if (m_debug_print_lvl >= 2) {
2024 plogf(" ");
2025 for (size_t i=0; i<77; i++) {
2026 plogf("-");
2027 }
2028 plogf("\n");
2029 plogf(" --- Subroutine BASOPT called to ");
2030 if (doJustComponents) {
2031 plogf("calculate the number of components\n");
2032 } else {
2033 plogf("reevaluate the components\n");
2034 }
2035 if (m_debug_print_lvl >= 2) {
2036 plogf("\n");
2037 plogf(" --- Formula Matrix used in BASOPT calculation\n");
2038 plogf(" --- Active | ");
2039 for (size_t j = 0; j < m_nelem; j++) {
2040 plogf(" %1d ", m_elementActive[j]);
2041 }
2042 plogf("\n");
2043 plogf(" --- Species | ");
2044 for (size_t j = 0; j < m_nelem; j++) {
2045 writelog(" {:>8.8s}", m_elementName[j]);
2046 }
2047 plogf("\n");
2048 for (k = 0; k < m_nsp; k++) {
2049 writelog(" --- {:>11.11s} | ", m_speciesName[k]);
2050 for (size_t j = 0; j < m_nelem; j++) {
2051 plogf(" %8.2g", m_formulaMatrix(k,j));
2052 }
2053 plogf("\n");
2054 }
2055 writelogendl();
2056 }
2057 }
2058
2059 // Calculate the maximum value of the number of components possible. It's
2060 // equal to the minimum of the number of elements and the number of total
2061 // species.
2062 size_t ncTrial = std::min(m_nelem, m_nsp);
2063 m_numComponents = ncTrial;
2064 *usedZeroedSpecies = false;
2065 vector<int> ipiv(ncTrial);
2066
2067 // Use a temporary work array for the mole numbers, aw[]
2068 std::copy(m_molNumSpecies_old.begin(),
2069 m_molNumSpecies_old.begin() + m_nsp, aw);
2070
2071 // Take out the Voltage unknowns from consideration
2072 for (k = 0; k < m_nsp; k++) {

Callers

nothing calls this directly

Calls 9

writelogFunction · 0.85
writelogendlFunction · 0.85
CanteraErrorClass · 0.85
solveFunction · 0.85
secondsWCMethod · 0.80
beginMethod · 0.45
resizeMethod · 0.45
ptrColumnMethod · 0.45
zeroMethod · 0.45

Tested by

no test coverage detected