Skip to content

Commit

Permalink
add docstring and fix evalResidual
Browse files Browse the repository at this point in the history
  • Loading branch information
bangshiuh authored and speth committed Sep 22, 2017
1 parent 2472e08 commit a99004d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions include/cantera/oneD/IonFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions include/cantera/oneD/StFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions src/oneD/StFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(jmin, 1) - 1;
Expand Down

0 comments on commit a99004d

Please sign in to comment.