[1D] Sim1D::setProfile checks range of position array

This commit is contained in:
Ray Speth 2016-04-18 20:00:15 -04:00
parent 6a928b57f9
commit f4ad150905
2 changed files with 13 additions and 1 deletions

View file

@ -41,7 +41,14 @@ public:
*/
//@{
/// Set initial guess based on equilibrium
/// Set initial guess for one component for all domains
/**
* @param comp component name
* @param pos A vector of relative positions, beginning with 0.0 at the
* left of the domain, and ending with 1.0 at the right of the domain.
* @param values A vector of values corresponding to the relative position
* locations.
*/
void setInitialGuess(const std::string& component, vector_fp& locs,
vector_fp& vals);

View file

@ -71,6 +71,11 @@ doublereal Sim1D::workValue(size_t dom, size_t comp, size_t localPoint) const
void Sim1D::setProfile(size_t dom, size_t comp,
const vector_fp& pos, const vector_fp& values)
{
if (pos.front() != 0.0 || pos.back() != 1.0) {
throw CanteraError("Sim1D::setProfile",
"`pos` vector must span the range [0, 1]. Got a vector spanning "
"[{}, {}] instead.", pos.front(), pos.back());
}
Domain1D& d = domain(dom);
doublereal z0 = d.zmin();
doublereal z1 = d.zmax();