add docstring and fix evalResidual
This commit is contained in:
parent
2472e080c3
commit
a99004d8ef
4 changed files with 14 additions and 7 deletions
|
|
@ -79,6 +79,10 @@ public:
|
||||||
vector_fp& mobi_e_fixed);
|
vector_fp& mobi_e_fixed);
|
||||||
|
|
||||||
protected:
|
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,
|
virtual void evalResidual(double* x, double* rsd, int* diag,
|
||||||
double rdt, size_t jmin, size_t jmax);
|
double rdt, size_t jmin, size_t jmax);
|
||||||
virtual void updateTransport(double* x, size_t j0, size_t j1);
|
virtual void updateTransport(double* x, size_t j0, size_t j1);
|
||||||
|
|
|
||||||
|
|
@ -242,9 +242,13 @@ protected:
|
||||||
m_kin->getNetProductionRates(&m_wdot(0,j));
|
m_kin->getNetProductionRates(&m_wdot(0,j));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void updateProperties(size_t jg, double* x, double* rsd, int* diag,
|
//! Update the properties (thermo, transport, and diffusion flux).
|
||||||
double rdt, size_t jmin, size_t jmax);
|
//! 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,
|
virtual void evalResidual(double* x, double* rsd, int* diag,
|
||||||
double rdt, size_t jmin, size_t jmax);
|
double rdt, size_t jmin, size_t jmax);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -547,10 +547,10 @@ class IonFlame(FreeFlame):
|
||||||
csvfile = open(filename, 'w')
|
csvfile = open(filename, 'w')
|
||||||
writer = _csv.writer(csvfile)
|
writer = _csv.writer(csvfile)
|
||||||
writer.writerow(['z (m)', 'u (m/s)', 'V (1/s)', 'T (K)',
|
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):
|
for n in range(self.flame.n_points):
|
||||||
self.set_gas_state(n)
|
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)))
|
list(getattr(self.gas, species)))
|
||||||
csvfile.close()
|
csvfile.close()
|
||||||
if not quiet:
|
if not quiet:
|
||||||
|
|
|
||||||
|
|
@ -240,12 +240,11 @@ void StFlow::eval(size_t jg, doublereal* xg,
|
||||||
jmax = std::min(jpt+1,m_points-1);
|
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);
|
evalResidual(x, rsd, diag, rdt, jmin, jmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StFlow::updateProperties(size_t jg, double* x, double* rsd, int* diag,
|
void StFlow::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax)
|
||||||
double rdt, size_t jmin, size_t jmax)
|
|
||||||
{
|
{
|
||||||
// properties are computed for grid points from j0 to j1
|
// properties are computed for grid points from j0 to j1
|
||||||
size_t j0 = std::max<size_t>(jmin, 1) - 1;
|
size_t j0 = std::max<size_t>(jmin, 1) - 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue