Skip to content

Commit

Permalink
[1D] split updateProperties and add 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 a8cbfd2 commit 2472e08
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
5 changes: 2 additions & 3 deletions include/cantera/oneD/IonFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ class IonFlow : public FreeFlame
vector_fp& mobi_e_fixed);

protected:
virtual void updateProperties(size_t jg, double* x, double* rsd,
int* diag, double rdt, size_t j0,
size_t j1, size_t jmin, size_t jmax);
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);
virtual void updateDiffFluxes(const double* x, size_t j0, size_t j1);
//! Solving phase one: the fluxes of charged species are turned off
Expand Down
8 changes: 5 additions & 3 deletions include/cantera/oneD/StFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,11 @@ 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 j0,
size_t j1, size_t jmin, size_t jmax);
virtual void updateProperties(size_t jg, double* x, double* rsd, int* diag,
double rdt, size_t jmin, size_t jmax);

virtual void evalResidual(double* x, double* rsd, int* diag,
double rdt, size_t jmin, size_t jmax);

/**
* Update the thermodynamic properties from point j0 to point j1
Expand Down
7 changes: 3 additions & 4 deletions src/oneD/IonFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,10 @@ void IonFlow::setElectricPotential(const double v1, const double v2)
m_outletVoltage = v2;
}

void IonFlow::updateProperties(size_t jg, double* x, double* rsd,
int* diag, double rdt, size_t j0,
size_t j1, size_t jmin, size_t jmax)
void IonFlow::evalResidual(double* x, double* rsd, int* diag,
double rdt, size_t jmin, size_t jmax)
{
StFlow::updateProperties(jg, x, rsd, diag, rdt, j0, j1, jmin, jmax);
StFlow::evalResidual(x, rsd, diag, rdt, jmin, jmax);
if (m_stage != 3) {
return;
}
Expand Down
18 changes: 11 additions & 7 deletions src/oneD/StFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,17 @@ void StFlow::eval(size_t jg, doublereal* xg,
jmax = std::min(jpt+1,m_points-1);
}

updateProperties(jg, 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,
double rdt, 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;
size_t j1 = std::min(jmax+1,m_points-1);

updateProperties(jg, x, rsd, diag, rdt, j0, j1, jmin, jmax);
}

void StFlow::updateProperties(size_t jg, double* x, double* rsd,
int* diag, double rdt, size_t j0,
size_t j1, size_t jmin, size_t jmax)
{
updateThermo(x, j0, j1);
if (jg == npos || m_force_full_update) {
// update transport properties only if a Jacobian is not being
Expand All @@ -267,7 +267,11 @@ void StFlow::updateProperties(size_t jg, double* x, double* rsd,
// update the species diffusive mass fluxes whether or not a
// Jacobian is being evaluated
updateDiffFluxes(x, j0, j1);
}

void StFlow::evalResidual(double* x, double* rsd, int* diag,
double rdt, size_t jmin, size_t jmax)
{
//----------------------------------------------------
// evaluate the residual equations at all required
// grid points
Expand Down

0 comments on commit 2472e08

Please sign in to comment.