diff --git a/include/cantera/oneD/IonFlow.h b/include/cantera/oneD/IonFlow.h index 5ce7019e02..6143c2ceee 100644 --- a/include/cantera/oneD/IonFlow.h +++ b/include/cantera/oneD/IonFlow.h @@ -79,6 +79,10 @@ class IonFlow : public FreeFlame vector_fp& mobi_e_fixed); protected: + /*! + * This function overloads the original function. The residual function + * of Poisson's equation is added. + */ virtual void evalResidual(double* x, double* rsd, int* diag, double rdt, size_t jmin, size_t jmax); virtual void updateTransport(double* x, size_t j0, size_t j1); diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index 9f31c9c238..9b39a07683 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -242,9 +242,13 @@ class StFlow : public Domain1D m_kin->getNetProductionRates(&m_wdot(0,j)); } - virtual void updateProperties(size_t jg, double* x, double* rsd, int* diag, - double rdt, size_t jmin, size_t jmax); + //! Update the properties (thermo, transport, and diffusion flux). + //! This function is called in eval after the points which need + //! to be updated are defined. + virtual void updateProperties(size_t jg, double* x, size_t jmin, size_t jmax); + //! Evaluate the residual function. This function is called in eval + //! after updateProperties is called. virtual void evalResidual(double* x, double* rsd, int* diag, double rdt, size_t jmin, size_t jmax); diff --git a/interfaces/cython/cantera/onedim.py b/interfaces/cython/cantera/onedim.py index 2b4bc7028f..e40c786a95 100644 --- a/interfaces/cython/cantera/onedim.py +++ b/interfaces/cython/cantera/onedim.py @@ -547,10 +547,10 @@ def write_csv(self, filename, species='X', quiet=True): csvfile = open(filename, 'w') writer = _csv.writer(csvfile) writer.writerow(['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)', - 'phi (V)', 'E (V/m)', 'rho (kmol/m3)'] + self.gas.species_names) + 'phi (V)', 'E (V/m)', 'rho (kg/m3)'] + self.gas.species_names) for n in range(self.flame.n_points): self.set_gas_state(n) - writer.writerow([z[n], u[n], V[n], T[n], phi[n], E[n], self.gas.density_mole] + + writer.writerow([z[n], u[n], V[n], T[n], phi[n], E[n], self.gas.density] + list(getattr(self.gas, species))) csvfile.close() if not quiet: diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index e5d8962195..2b08d09632 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -240,12 +240,11 @@ void StFlow::eval(size_t jg, doublereal* xg, jmax = std::min(jpt+1,m_points-1); } - updateProperties(jg, x, rsd, diag, rdt, jmin, jmax); + updateProperties(jg, x, jmin, jmax); evalResidual(x, rsd, diag, rdt, jmin, jmax); } -void StFlow::updateProperties(size_t jg, double* x, double* rsd, int* diag, - double rdt, size_t jmin, size_t jmax) +void StFlow::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax) { // properties are computed for grid points from j0 to j1 size_t j0 = std::max(jmin, 1) - 1;