solaris port:

sqrt to std:sqrt
This commit is contained in:
Harry Moffat 2006-12-14 16:53:15 +00:00
parent 62094d1efa
commit 8b581a8c8b

View file

@ -24,16 +24,16 @@
namespace Cantera {
typedef IdealGasPhase igthermo_t;
class MultiJac;
//------------------------------------------
// constants
//------------------------------------------
// Offsets of solution components in the solution array.
const unsigned int c_offset_U = 0; // axial velocity
const unsigned int c_offset_V = 1; // strain rate
@ -46,8 +46,8 @@ namespace Cantera {
const int c_Multi_Transport = 1;
const int c_Soret = 2;
//-----------------------------------------------------------
// Class StFlow
//-----------------------------------------------------------
@ -56,7 +56,7 @@ namespace Cantera {
/**
* This class represents 1D flow domains that satisfy the
* one-dimensional similarity solution for chemically-reacting,
* axisymmetric, flows.
* axisymmetric, flows.
*/
class StFlow : public Domain1D {
@ -70,7 +70,7 @@ namespace Cantera {
/// @param gas Object representing the gas phase. This object
/// will be used to evaluate all thermodynamic, kinetic, and transport
/// properties.
/// @param nsp Number of species.
/// @param nsp Number of species.
StFlow(igthermo_t* ph = 0, int nsp = 1, int points = 1);
/// Destructor.
@ -88,14 +88,14 @@ namespace Cantera {
virtual void init(){
}
/**
* Set the thermo manager. Note that the flow equations assume
* the ideal gas equation.
*/
void setThermo(igthermo_t& th) { m_thermo = &th; }
/// Set the kinetics manager. The kinetics manager must
/// Set the kinetics manager. The kinetics manager must
void setKinetics(kinetics_t& kin) { m_kin = &kin; }
/// set the transport manager
@ -106,7 +106,7 @@ namespace Cantera {
/// throughout the flow.
void setPressure(doublereal p) { m_press = p; }
/// @todo remove? may be unused
virtual void setState(int point, const doublereal* state,
doublereal *x) {
@ -117,9 +117,9 @@ namespace Cantera {
}
}
/// Write the initial solution estimate into
/// array x.
/// array x.
virtual void _getInitialSoln(doublereal* x) {
int k, j;
for (j = 0; j < m_points; j++) {
@ -128,11 +128,11 @@ namespace Cantera {
x[index(4+k,j)] = Y_fixed(k,j);
}
}
}
}
virtual void _finalize(const doublereal* x);
/// Sometimes it is desired to carry out the simulation
/// using a specified temperature profile, rather than
/// computing it by solving the energy equation. This
@ -162,18 +162,18 @@ namespace Cantera {
m_fixedy(k,j) = y;
m_do_species[k] = true; // false;
}
/// The fixed temperature value at point j.
doublereal T_fixed(int j) const {return m_fixedtemp[j];}
/// The fixed mass fraction value of species k at point j.
doublereal Y_fixed(int k, int j) const {return m_fixedy(k,j);}
virtual std::string componentName(int n) const;
//added by Karl Meredith
int componentIndex(std::string name) const;
@ -191,7 +191,7 @@ namespace Cantera {
if (j < 0)
for (int i = 0; i < m_points; i++)
m_do_energy[i] = true;
else
else
m_do_energy[j] = true;
m_refiner->setActive(0, true);
m_refiner->setActive(1, true);
@ -216,7 +216,7 @@ namespace Cantera {
void solveSpecies(int k=-1) {
if (k == -1) {
for (int i = 0; i < m_nsp; i++)
for (int i = 0; i < m_nsp; i++)
m_do_species[i] = true;
}
else m_do_species[k] = true;
@ -225,7 +225,7 @@ namespace Cantera {
void fixSpecies(int k=-1) {
if (k == -1) {
for (int i = 0; i < m_nsp; i++)
for (int i = 0; i < m_nsp; i++)
m_do_species[i] = false;
}
else m_do_species[k] = false;
@ -266,13 +266,13 @@ namespace Cantera {
}
doublereal cbar(const doublereal* x,int k, int j) const {
return sqrt(8.0*GasConstant * T(x,j) / (Pi * m_wt[k]));
return std::sqrt(8.0*GasConstant * T(x,j) / (Pi * m_wt[k]));
}
doublereal wdot(int k, int j) const {return m_wdot(k,j);}
/// write the net production rates at point j into array m_wdot
void getWdot(doublereal* x,int j) {
void getWdot(doublereal* x,int j) {
setGas(x,j);
m_kin->getNetProductionRates(&m_wdot(0,j));
}
@ -296,7 +296,7 @@ namespace Cantera {
// central-differenced derivatives
//--------------------------------
doublereal cdif2(const doublereal* x, int n, int j,
doublereal cdif2(const doublereal* x, int n, int j,
const doublereal* f) const {
doublereal c1 = (f[j] + f[j-1])*(x[index(n,j)] - x[index(n,j-1)]);
doublereal c2 = (f[j+1] + f[j])*(x[index(n,j+1)] - x[index(n,j)]);
@ -313,18 +313,18 @@ namespace Cantera {
return x[index(c_offset_T, j)];
}
doublereal& T(doublereal* x,int j) {return x[index(c_offset_T, j)];}
doublereal T_prev(int j) const {return prevSoln(c_offset_T, j);}
doublereal T_prev(int j) const {return prevSoln(c_offset_T, j);}
doublereal rho_u(const doublereal* x,int j) const {
return m_rho[j]*x[index(c_offset_U, j)];}
return m_rho[j]*x[index(c_offset_U, j)];}
doublereal u(const doublereal* x,int j) const {
return x[index(c_offset_U, j)];}
return x[index(c_offset_U, j)];}
doublereal V(const doublereal* x,int j) const {
return x[index(c_offset_V, j)];}
doublereal V_prev(int j) const {
return prevSoln(c_offset_V, j);}
return prevSoln(c_offset_V, j);}
doublereal lambda(const doublereal* x,int j) const {
return x[index(c_offset_L, j)];
@ -357,18 +357,18 @@ namespace Cantera {
doublereal dVdz(const doublereal* x,int j) const {
int jloc = (u(x,j) > 0.0 ? j : j + 1);
return (V(x,jloc) - V(x,jloc-1))/m_dz[jloc-1];
}
}
doublereal dYdz(const doublereal* x,int k, int j) const {
int jloc = (u(x,j) > 0.0 ? j : j + 1);
return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
}
return (Y(x,k,jloc) - Y(x,k,jloc-1))/m_dz[jloc-1];
}
doublereal dTdz(const doublereal* x,int j) const {
int jloc = (u(x,j) > 0.0 ? j : j + 1);
return (T(x,jloc) - T(x,jloc-1))/m_dz[jloc-1];
}
doublereal shear(const doublereal* x,int j) const {
doublereal c1 = m_visc[j-1]*(V(x,j) - V(x,j-1));
doublereal c2 = m_visc[j]*(V(x,j+1) - V(x,j));
@ -475,20 +475,20 @@ namespace Cantera {
AxiStagnFlow(igthermo_t* ph = 0, int nsp = 1, int points = 1) :
StFlow(ph, nsp, points) { m_dovisc = true; }
virtual ~AxiStagnFlow() {}
virtual void eval(int j, doublereal* x, doublereal* r,
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual std::string flowType() { return "Axisymmetric Stagnation"; }
};
/**
* A class for freely-propagating premixed flames.
* A class for freely-propagating premixed flames.
*/
class FreeFlame : public StFlow {
public:
FreeFlame(igthermo_t* ph = 0, int nsp = 1, int points = 1) :
StFlow(ph, nsp, points) { m_dovisc = false; }
virtual ~FreeFlame() {}
virtual void eval(int j, doublereal* x, doublereal* r,
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual std::string flowType() { return "Free Flame"; }
virtual bool fixed_mdot() { return false; }
@ -502,7 +502,7 @@ namespace Cantera {
StFlow(ph, nsp, points) {
}
virtual ~OneDFlow() {}
virtual void eval(int j, doublereal* x, doublereal* r,
virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt);
virtual std::string flowType() { return "OneDFlow"; }
doublereal mdot(doublereal* x, int j) {