int VCS_SOLVE::vcs_TP(int ipr, int ip1, int maxit, double T_arg, double pres_arg) { /* * Store the temperature and pressure in the private global variables */ m_temperature = T_arg; m_pressurePA = pres_arg; /* * Evaluate the standard state free energies * at the current temperatures and pressures. */ int iconv = vcs_evalSS_TP(ipr, ip1, m_temperature, pres_arg); /* * Prepare the problem data: * ->nondimensionalize the free energies using * the divisor, R * T */ vcs_nondim_TP(); /* * Prep the fe field */ vcs_fePrep_TP(); /* * Decide whether we need an initial estimate of the solution * If so, go get one. If not, then */ if (m_doEstimateEquil) { int retn = vcs_inest_TP(); if (retn != VCS_SUCCESS) { plogf("vcs_inest_TP returned a failure flag\n"); } } /* * Solve the problem at a fixed Temperature and Pressure * (all information concerning Temperature and Pressure has already * been derived. The free energies are now in dimensionless form.) */ iconv = vcs_solve_TP(ipr, ip1, maxit); /* * Redimensionalize the free energies using * the reverse of vcs_nondim to add back units. */ vcs_redim_TP(); /* * Return the convergence success flag. */ return iconv; }
int VCS_SOLVE::vcs_TP(int ipr, int ip1, int maxit, double T_arg, double pres_arg) { // Store the temperature and pressure in the private global variables m_temperature = T_arg; m_pressurePA = pres_arg; // Evaluate the standard state free energies // at the current temperatures and pressures. int iconv = vcs_evalSS_TP(ipr, ip1, m_temperature, pres_arg); // Prepare the problem data: nondimensionalize the free energies using the // divisor, R * T vcs_nondim_TP(); // Prep the fe field vcs_fePrep_TP(); // Decide whether we need an initial estimate of the solution If so, go get // one. If not, then if (m_doEstimateEquil) { int retn = vcs_inest_TP(); if (retn != VCS_SUCCESS) { plogf("vcs_inest_TP returned a failure flag\n"); } } // Solve the problem at a fixed Temperature and Pressure (all information // concerning Temperature and Pressure has already been derived. The free // energies are now in dimensionless form.) iconv = vcs_solve_TP(ipr, ip1, maxit); // Redimensionalize the free energies using the reverse of vcs_nondim to add // back units. vcs_redim_TP(); // Return the convergence success flag. return iconv; }