[1D] Add accessor functions for steady and relative tolerances
The existing functions for getting tolerances are difficult to use because they return the tolerances based on the steady/unsteady mode of the solver which the user shouldn't have to care about (and can't easily set).
This commit is contained in:
parent
809223f670
commit
f13e2715bb
3 changed files with 68 additions and 0 deletions
|
|
@ -271,6 +271,26 @@ public:
|
|||
return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
|
||||
}
|
||||
|
||||
//! Steady relative tolerance of the nth component
|
||||
double steady_rtol(size_t n) {
|
||||
return m_rtol_ss[n];
|
||||
}
|
||||
|
||||
//! Steady absolute tolerance of the nth component
|
||||
double steady_atol(size_t n) {
|
||||
return m_atol_ss[n];
|
||||
}
|
||||
|
||||
//! Transient relative tolerance of the nth component
|
||||
double transient_rtol(size_t n) {
|
||||
return m_rtol_ts[n];
|
||||
}
|
||||
|
||||
//! Transient absolute tolerance of the nth component
|
||||
double transient_atol(size_t n) {
|
||||
return m_atol_ts[n];
|
||||
}
|
||||
|
||||
//! Upper bound on the nth component.
|
||||
doublereal upperBound(size_t n) const {
|
||||
return m_max[n];
|
||||
|
|
|
|||
|
|
@ -604,6 +604,10 @@ cdef extern from "cantera/oneD/Domain1D.h":
|
|||
void setSteadyTolerances(double, double, size_t)
|
||||
double rtol(size_t)
|
||||
double atol(size_t)
|
||||
double steady_rtol(size_t)
|
||||
double steady_atol(size_t)
|
||||
double transient_rtol(size_t)
|
||||
double transient_atol(size_t)
|
||||
double grid(size_t)
|
||||
void setupGrid(size_t, double*) except +
|
||||
void setID(string)
|
||||
|
|
|
|||
|
|
@ -131,6 +131,50 @@ cdef class Domain1D:
|
|||
k = self.component_index(component)
|
||||
return self.domain.rtol(k), self.domain.atol(k)
|
||||
|
||||
def steady_reltol(self, component=None):
|
||||
"""
|
||||
Return the relative error tolerance for the steady state problem for a
|
||||
specified solution component, or all components if none is specified.
|
||||
"""
|
||||
if component is None:
|
||||
return np.array([self.domain.steady_rtol(n)
|
||||
for n in range(self.n_components)])
|
||||
else:
|
||||
return self.domain.steady_rtol(self.component_index(component))
|
||||
|
||||
def steady_abstol(self, component=None):
|
||||
"""
|
||||
Return the absolute error tolerance for the steady state problem for a
|
||||
specified solution component, or all components if none is specified.
|
||||
"""
|
||||
if component is None:
|
||||
return np.array([self.domain.steady_atol(n)
|
||||
for n in range(self.n_components)])
|
||||
else:
|
||||
return self.domain.steady_atol(self.component_index(component))
|
||||
|
||||
def transient_reltol(self, component=None):
|
||||
"""
|
||||
Return the relative error tolerance for the transient problem for a
|
||||
specified solution component, or all components if none is specified.
|
||||
"""
|
||||
if component is None:
|
||||
return np.array([self.domain.transient_rtol(n)
|
||||
for n in range(self.n_components)])
|
||||
else:
|
||||
return self.domain.transient_rtol(self.component_index(component))
|
||||
|
||||
def transient_abstol(self, component=None):
|
||||
"""
|
||||
Return the absolute error tolerance for the transient problem for a
|
||||
specified solution component, or all components if none is specified.
|
||||
"""
|
||||
if component is None:
|
||||
return np.array([self.domain.transient_atol(n)
|
||||
for n in range(self.n_components)])
|
||||
else:
|
||||
return self.domain.transient_atol(self.component_index(component))
|
||||
|
||||
property grid:
|
||||
""" The grid for this domain """
|
||||
def __get__(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue