Skip to content

Commit

Permalink
[1D] Sim1D::setProfile checks range of position array
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Apr 19, 2016
1 parent 6a928b5 commit f4ad150
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/cantera/oneD/Sim1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ class Sim1D : public OneDim
*/
//@{

/// 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);

Expand Down
5 changes: 5 additions & 0 deletions src/oneD/Sim1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f4ad150

Please sign in to comment.