mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[oneD] Reorder content for named doxygen section
This commit is contained in:
parent
c5c3d86170
commit
37ad4e93d6
@ -172,7 +172,6 @@ public:
|
||||
//! Returns true if the specified component is an active part of the solver state
|
||||
virtual bool componentActive(size_t n) const;
|
||||
|
||||
//! Print the solution.
|
||||
void show(const double* x) override;
|
||||
|
||||
shared_ptr<SolutionArray> asArray(const double* soln) const override;
|
||||
@ -396,6 +395,43 @@ protected:
|
||||
AnyMap getMeta() const override;
|
||||
void setMeta(const AnyMap& state) override;
|
||||
|
||||
//! @name Updates of cached properties
|
||||
//! These methods are called by eval() to update cached properties and data that are
|
||||
//! used for the evaluation of the governing equations.
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* Update the thermodynamic properties from point j0 to point j1
|
||||
* (inclusive), based on solution x.
|
||||
*
|
||||
* The gas state is set to be consistent with the solution at the
|
||||
* points from j0 to j1.
|
||||
*
|
||||
* Properties that are computed and cached are:
|
||||
* * #m_rho (density)
|
||||
* * #m_wtm (mean molecular weight)
|
||||
* * #m_cp (specific heat capacity)
|
||||
* * #m_hk (species specific enthalpies)
|
||||
* * #m_wdot (species production rates)
|
||||
*/
|
||||
void updateThermo(const double* x, size_t j0, size_t j1) {
|
||||
for (size_t j = j0; j <= j1; j++) {
|
||||
setGas(x,j);
|
||||
m_rho[j] = m_thermo->density();
|
||||
m_wtm[j] = m_thermo->meanMolecularWeight();
|
||||
m_cp[j] = m_thermo->cp_mass();
|
||||
m_thermo->getPartialMolarEnthalpies(&m_hk(0, j));
|
||||
m_kin->getNetProductionRates(&m_wdot(0, j));
|
||||
}
|
||||
}
|
||||
|
||||
//! Update the transport properties at grid points in the range from `j0`
|
||||
//! to `j1`, based on solution `x`.
|
||||
virtual void updateTransport(double* x, size_t j0, size_t j1);
|
||||
|
||||
//! Update the diffusive mass fluxes.
|
||||
virtual void updateDiffFluxes(const double* x, size_t j0, size_t j1);
|
||||
|
||||
//! Update the properties (thermo, transport, and diffusion flux).
|
||||
//! This function is called in eval after the points which need
|
||||
//! to be updated are defined.
|
||||
@ -418,9 +454,11 @@ protected:
|
||||
*/
|
||||
void computeRadiation(double* x, size_t jmin, size_t jmax);
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Governing Equations
|
||||
//! Methods are used to evaluate residuals for each of the governing equations.
|
||||
//! @{
|
||||
//! Methods called by eval() to calculate residuals for individual governing
|
||||
//! equations.
|
||||
|
||||
/**
|
||||
* Evaluate the continuity equation residual.
|
||||
@ -572,31 +610,6 @@ protected:
|
||||
virtual void evalUo(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax);
|
||||
|
||||
/**
|
||||
* Update the thermodynamic properties from point j0 to point j1
|
||||
* (inclusive), based on solution x.
|
||||
*
|
||||
* The gas state is set to be consistent with the solution at the
|
||||
* points from j0 to j1.
|
||||
*
|
||||
* Properties that are computed and cached are:
|
||||
* * #m_rho (density)
|
||||
* * #m_wtm (mean molecular weight)
|
||||
* * #m_cp (specific heat capacity)
|
||||
* * #m_hk (species specific enthalpies)
|
||||
* * #m_wdot (species production rates)
|
||||
*/
|
||||
void updateThermo(const double* x, size_t j0, size_t j1) {
|
||||
for (size_t j = j0; j <= j1; j++) {
|
||||
setGas(x,j);
|
||||
m_rho[j] = m_thermo->density();
|
||||
m_wtm[j] = m_thermo->meanMolecularWeight();
|
||||
m_cp[j] = m_thermo->cp_mass();
|
||||
m_thermo->getPartialMolarEnthalpies(&m_hk(0, j));
|
||||
m_kin->getNetProductionRates(&m_wdot(0, j));
|
||||
}
|
||||
}
|
||||
|
||||
//! @name Solution components
|
||||
//! @{
|
||||
|
||||
@ -691,9 +704,6 @@ protected:
|
||||
return m*m_nsp*m_nsp + m_nsp*j + k;
|
||||
}
|
||||
|
||||
//! Update the diffusive mass fluxes.
|
||||
virtual void updateDiffFluxes(const double* x, size_t j0, size_t j1);
|
||||
|
||||
//! Get the gradient of species specific molar enthalpies
|
||||
virtual void grad_hk(const double* x, size_t j);
|
||||
|
||||
@ -775,10 +785,6 @@ protected:
|
||||
bool m_isFree;
|
||||
bool m_usesLambda;
|
||||
|
||||
//! Update the transport properties at grid points in the range from `j0`
|
||||
//! to `j1`, based on solution `x`.
|
||||
virtual void updateTransport(double* x, size_t j0, size_t j1);
|
||||
|
||||
//! Flag for activating two-point flame control
|
||||
bool m_twoPointControl = false;
|
||||
|
||||
|
@ -368,6 +368,100 @@ void Flow1D::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax)
|
||||
updateDiffFluxes(x, j0, j1);
|
||||
}
|
||||
|
||||
void Flow1D::updateTransport(double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
setGasAtMidpoint(x,j);
|
||||
double wtm = m_thermo->meanMolecularWeight();
|
||||
double rho = m_thermo->density();
|
||||
m_visc[j] = (m_dovisc ? m_trans->viscosity() : 0.0);
|
||||
m_trans->getMultiDiffCoeffs(m_nsp, &m_multidiff[mindex(0,0,j)]);
|
||||
|
||||
// Use m_diff as storage for the factor outside the summation
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] = m_wt[k] * rho / (wtm*wtm);
|
||||
}
|
||||
|
||||
m_tcon[j] = m_trans->thermalConductivity();
|
||||
if (m_do_soret) {
|
||||
m_trans->getThermalDiffCoeffs(m_dthermal.ptrColumn(0) + j*m_nsp);
|
||||
}
|
||||
}
|
||||
} else { // mixture averaged transport
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
setGasAtMidpoint(x,j);
|
||||
m_visc[j] = (m_dovisc ? m_trans->viscosity() : 0.0);
|
||||
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
m_trans->getMixDiffCoeffs(&m_diff[j*m_nsp]);
|
||||
} else {
|
||||
m_trans->getMixDiffCoeffsMass(&m_diff[j*m_nsp]);
|
||||
}
|
||||
|
||||
double rho = m_thermo->density();
|
||||
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
double wtm = m_thermo->meanMolecularWeight();
|
||||
for (size_t k=0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] *= m_wt[k] * rho / wtm;
|
||||
}
|
||||
} else {
|
||||
for (size_t k=0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] *= rho;
|
||||
}
|
||||
}
|
||||
m_tcon[j] = m_trans->thermalConductivity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Flow1D::updateDiffFluxes(const double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
double dz = z(j+1) - z(j);
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
double sum = 0.0;
|
||||
for (size_t m = 0; m < m_nsp; m++) {
|
||||
sum += m_wt[m] * m_multidiff[mindex(k,m,j)] * (X(x,m,j+1)-X(x,m,j));
|
||||
}
|
||||
m_flux(k,j) = sum * m_diff[k+j*m_nsp] / dz;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
double sum = 0.0;
|
||||
double dz = z(j+1) - z(j);
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) = m_diff[k+m_nsp*j] * (X(x,k,j) - X(x,k,j+1))/dz;
|
||||
sum -= m_flux(k,j);
|
||||
}
|
||||
} else {
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) = m_diff[k+m_nsp*j] * (Y(x,k,j) - Y(x,k,j+1))/dz;
|
||||
sum -= m_flux(k,j);
|
||||
}
|
||||
}
|
||||
// correction flux to insure that \sum_k Y_k V_k = 0.
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) += sum*Y(x,k,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_do_soret) {
|
||||
for (size_t m = j0; m < j1; m++) {
|
||||
double gradlogT = 2.0 * (T(x,m+1) - T(x,m)) /
|
||||
((T(x,m+1) + T(x,m)) * (z(m+1) - z(m)));
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,m) -= m_dthermal(k,m)*gradlogT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Flow1D::computeRadiation(double* x, size_t jmin, size_t jmax)
|
||||
{
|
||||
// Variable definitions for the Planck absorption coefficient and the
|
||||
@ -683,54 +777,6 @@ void Flow1D::evalContinuity(size_t j, double* x, double* rsd, int* diag, double
|
||||
"Overloaded by StFlow; to be removed after Cantera 3.1");
|
||||
}
|
||||
|
||||
void Flow1D::updateTransport(double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
setGasAtMidpoint(x,j);
|
||||
double wtm = m_thermo->meanMolecularWeight();
|
||||
double rho = m_thermo->density();
|
||||
m_visc[j] = (m_dovisc ? m_trans->viscosity() : 0.0);
|
||||
m_trans->getMultiDiffCoeffs(m_nsp, &m_multidiff[mindex(0,0,j)]);
|
||||
|
||||
// Use m_diff as storage for the factor outside the summation
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] = m_wt[k] * rho / (wtm*wtm);
|
||||
}
|
||||
|
||||
m_tcon[j] = m_trans->thermalConductivity();
|
||||
if (m_do_soret) {
|
||||
m_trans->getThermalDiffCoeffs(m_dthermal.ptrColumn(0) + j*m_nsp);
|
||||
}
|
||||
}
|
||||
} else { // mixture averaged transport
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
setGasAtMidpoint(x,j);
|
||||
m_visc[j] = (m_dovisc ? m_trans->viscosity() : 0.0);
|
||||
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
m_trans->getMixDiffCoeffs(&m_diff[j*m_nsp]);
|
||||
} else {
|
||||
m_trans->getMixDiffCoeffsMass(&m_diff[j*m_nsp]);
|
||||
}
|
||||
|
||||
double rho = m_thermo->density();
|
||||
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
double wtm = m_thermo->meanMolecularWeight();
|
||||
for (size_t k=0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] *= m_wt[k] * rho / wtm;
|
||||
}
|
||||
} else {
|
||||
for (size_t k=0; k < m_nsp; k++) {
|
||||
m_diff[k+j*m_nsp] *= rho;
|
||||
}
|
||||
}
|
||||
m_tcon[j] = m_trans->thermalConductivity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Flow1D::show(const double* x)
|
||||
{
|
||||
writelog(" Pressure: {:10.4g} Pa\n", m_press);
|
||||
@ -748,52 +794,6 @@ void Flow1D::show(const double* x)
|
||||
}
|
||||
}
|
||||
|
||||
void Flow1D::updateDiffFluxes(const double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
double dz = z(j+1) - z(j);
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
double sum = 0.0;
|
||||
for (size_t m = 0; m < m_nsp; m++) {
|
||||
sum += m_wt[m] * m_multidiff[mindex(k,m,j)] * (X(x,m,j+1)-X(x,m,j));
|
||||
}
|
||||
m_flux(k,j) = sum * m_diff[k+j*m_nsp] / dz;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
double sum = 0.0;
|
||||
double dz = z(j+1) - z(j);
|
||||
if (m_fluxGradientBasis == ThermoBasis::molar) {
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) = m_diff[k+m_nsp*j] * (X(x,k,j) - X(x,k,j+1))/dz;
|
||||
sum -= m_flux(k,j);
|
||||
}
|
||||
} else {
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) = m_diff[k+m_nsp*j] * (Y(x,k,j) - Y(x,k,j+1))/dz;
|
||||
sum -= m_flux(k,j);
|
||||
}
|
||||
}
|
||||
// correction flux to insure that \sum_k Y_k V_k = 0.
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,j) += sum*Y(x,k,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_do_soret) {
|
||||
for (size_t m = j0; m < j1; m++) {
|
||||
double gradlogT = 2.0 * (T(x,m+1) - T(x,m)) /
|
||||
((T(x,m+1) + T(x,m)) * (z(m+1) - z(m)));
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
m_flux(k,m) -= m_dthermal(k,m)*gradlogT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string Flow1D::componentName(size_t n) const
|
||||
{
|
||||
switch (n) {
|
||||
|
Loading…
Reference in New Issue
Block a user