From 6acf75567053def69e84b2505060eb8e0aee6437 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Thu, 10 Nov 2016 19:25:50 -0500 Subject: [PATCH] [1D] Add maxPoints and maxGridPoints functions --- include/cantera/oneD/Sim1D.h | 13 +++++++++++++ include/cantera/oneD/refine.h | 5 +++++ src/oneD/Sim1D.cpp | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/include/cantera/oneD/Sim1D.h b/include/cantera/oneD/Sim1D.h index 127b07ec8c..53ae7cc064 100644 --- a/include/cantera/oneD/Sim1D.h +++ b/include/cantera/oneD/Sim1D.h @@ -133,8 +133,21 @@ class Sim1D : public OneDim */ void setRefineCriteria(int dom = -1, doublereal ratio = 10.0, doublereal slope = 0.8, doublereal curve = 0.8, doublereal prune = -0.1); + + /** + * Set the maximum number of grid points in the domain. If dom >= 0, + * then the settings apply only to the specified domain. If dom < 0, + * the settings are applied to each domain. @see Refiner::setMaxPoints. + */ void setMaxGridPoints(int dom = -1, int npoints = 300); + /** + * Get the maximum number of grid points in this domain. @see Refiner::maxPoints + * + * @param dom domain number, beginning with 0 for the leftmost domain. + */ + size_t maxGridPoints(size_t dom); + //! Set the minimum grid spacing in the specified domain(s). /*! * @param dom Domain index. If dom == -1, the specified spacing is applied diff --git a/include/cantera/oneD/refine.h b/include/cantera/oneD/refine.h index 220b80ed00..9c68164e52 100644 --- a/include/cantera/oneD/refine.h +++ b/include/cantera/oneD/refine.h @@ -45,6 +45,11 @@ class Refiner m_npmax = npmax; } + //! Returns the maximum number of points allowed in the domain + size_t maxPoints() const { + return m_npmax; + } + //! Set the minimum allowable spacing between adjacent grid points [m]. void setGridMin(double gridmin) { m_gridmin = gridmin; diff --git a/src/oneD/Sim1D.cpp b/src/oneD/Sim1D.cpp index c35d795264..5be6de0c8f 100644 --- a/src/oneD/Sim1D.cpp +++ b/src/oneD/Sim1D.cpp @@ -555,6 +555,12 @@ void Sim1D::setMaxGridPoints(int dom, int npoints) } } +size_t Sim1D::maxGridPoints(size_t dom) +{ + Refiner& r = domain(dom).refiner(); + return r.maxPoints(); +} + doublereal Sim1D::jacobian(int i, int j) { return OneDim::jacobian().value(i,j);