Fixed compilation errors in the Blasius boundary layer example

This commit is contained in:
Ray Speth 2012-12-30 00:16:53 +00:00
parent 879fd3ed56
commit 2052ac5b57
2 changed files with 14 additions and 17 deletions

View file

@ -1,12 +1,10 @@
/// @file BoundaryValueProblem.h
/// Simplified interface to the capabilities provided by Cantera to
/// solve boundary value problems.
/// @todo This example cannot currently be compiled
#ifndef BVP_H
#define BVP_H
#include "cantera/Cantera.h"
#include "cantera/onedim.h"
/// Namespace for the boundary value problem package.
@ -33,7 +31,7 @@ public:
double rtol; ///< relative error tolerance
double atol; ///< absolute error tolerance
bool refine; ///< make this component active for grid refinement
string name; ///< component name
std::string name; ///< component name
/**
* Constructor. Sets default values.
@ -70,7 +68,7 @@ public:
m_left(0), m_right(0), m_sim(0) {
// Create the initial uniform grid
vector_fp z(np);
Cantera::vector_fp z(np);
int iz;
for (iz = 0; iz < np; iz++) {
z[iz] = zmin + iz*(zmax - zmin)/(np-1);
@ -132,7 +130,7 @@ public:
m_refiner->setActive(n, c.refine);
// set a default name if one has not been entered
if (c.name == "") {
c.name = "Component "+int2str(n);
c.name = "Component "+Cantera::int2str(n);
}
setComponentName(n, c.name);
}
@ -157,9 +155,9 @@ public:
* @param ztitle Title for 'z' column.
* @param dotitles If true, begin with a row of column titles.
*/
void writeCSV(string filename = "output.csv",
bool dotitles = true, string ztitle = "z") const {
ofstream f(filename.c_str());
void writeCSV(std::string filename = "output.csv",
bool dotitles = true, std::string ztitle = "z") const {
std::ofstream f(filename.c_str());
int np = nPoints();
int nc = nComponents();
int n, m;
@ -168,14 +166,14 @@ public:
for (m = 0; m < nc; m++) {
f << componentName(m) << ", ";
}
f << endl;
f << std::endl;
}
for (n = 0; n < np; n++) {
f << z(n) << ", ";
for (m = 0; m < nc; m++) {
f << m_sim->value(1, m, n) << ", ";
}
f << endl;
f << std::endl;
}
}
@ -185,7 +183,7 @@ public:
* grid points. Overload in derived classes to specify other
* choices for initial values.
*/
virtual doublereal initialValue(int n, int j) {
virtual doublereal initialValue(size_t n, size_t j) {
return 0.0;
}
@ -232,16 +230,16 @@ protected:
void start() {
// Add dummy terminator domains on either side of this one.
m_left = new Empty1D;
m_right = new Empty1D;
vector<Domain1D*> domains;
m_left = new Cantera::Empty1D;
m_right = new Cantera::Empty1D;
std::vector<Cantera::Domain1D*> domains;
domains.push_back(m_left);
domains.push_back(this);
domains.push_back(m_right);
// create the Sim1D instance that will control the
// solution process
m_sim = new Sim1D(domains);
m_sim = new Cantera::Sim1D(domains);
// set default grid refinement parameters
m_sim->setRefineCriteria(1, max_grid_ratio, max_delta,

View file

@ -1,7 +1,6 @@
/// @file blasius.cpp
/// The Blasius boundary layer
#include "cantera/Cantera.h"
#include "BoundaryValueProblem.h"
@ -54,7 +53,7 @@ public:
// specify guesses for the initial values. These can be anything
// that leads to a converged solution.
virtual doublereal initialValue(int n, int j) {
virtual doublereal initialValue(size_t n, size_t j) {
switch (n) {
case 0:
return 0.1*z(j);