Skip to content

Commit

Permalink
[1D] Add maxPoints and maxGridPoints functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber committed Nov 11, 2016
1 parent 4e1c45c commit 6acf755
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/cantera/oneD/Sim1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions include/cantera/oneD/refine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/oneD/Sim1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6acf755

Please sign in to comment.