Skip to content

Commit

Permalink
Replace doublereal by double
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingmar Schoegl committed Oct 28, 2019
1 parent 06be0c6 commit 5b3c41c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions samples/cxx/NASA_coeffs/NASA_coeffs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ void demoprog()
int nsp = gas->nSpecies();

int type;
doublereal c[15];
doublereal minTemp, maxTemp, refPressure;
double c[15];
double minTemp, maxTemp, refPressure;

// get a reference to the species thermo property manager
MultiSpeciesThermo& sp = gas->speciesThermo();
Expand Down
28 changes: 14 additions & 14 deletions samples/cxx/flamespeed/flamespeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ int flamespeed(double phi)
auto sol = newSolution("gri30.yaml", "gri30", "None");
auto gas = getIdealGasPhasePtr(sol);

doublereal temp = 300.0; // K
doublereal pressure = 1.0*OneAtm; //atm
doublereal uin = 0.3; //m/sec
double temp = 300.0; // K
double pressure = 1.0*OneAtm; //atm
double uin = 0.3; //m/sec

size_t nsp = gas->nSpecies();
vector_fp x(nsp, 0.0);

doublereal C_atoms = 1.0;
doublereal H_atoms = 4.0;
doublereal ax = C_atoms + H_atoms / 4.0;
doublereal fa_stoic = 1.0 / (4.76 * ax);
double C_atoms = 1.0;
double H_atoms = 4.0;
double ax = C_atoms + H_atoms / 4.0;
double fa_stoic = 1.0 / (4.76 * ax);
x[gas->speciesIndex("CH4")] = 1.0;
x[gas->speciesIndex("O2")] = 0.21 / phi / fa_stoic;
x[gas->speciesIndex("N2")] = 0.79 / phi/ fa_stoic;

gas->setState_TPX(temp, pressure, x.data());
doublereal rho_in = gas->density();
double rho_in = gas->density();

vector_fp yin(nsp);
gas->getMassFractions(&yin[0]);

gas->equilibrate("HP");
vector_fp yout(nsp);
gas->getMassFractions(&yout[0]);
doublereal rho_out = gas->density();
doublereal Tad = gas->temperature();
double rho_out = gas->density();
double Tad = gas->temperature();
print("phi = {}, Tad = {}\n", phi, Tad);

//============= build each domain ========================
Expand All @@ -57,11 +57,11 @@ int flamespeed(double phi)

// create an initial grid
int nz = 6;
doublereal lz = 0.1;
double lz = 0.1;
vector_fp z(nz);
doublereal dz = lz/((doublereal)(nz-1));
double dz = lz/((double)(nz-1));
for (int iz = 0; iz < nz; iz++) {
z[iz] = ((doublereal)iz)*dz;
z[iz] = ((double)iz)*dz;
}

flow.setupGrid(nz, &z[0]);
Expand All @@ -81,7 +81,7 @@ int flamespeed(double phi)
Inlet1D inlet;

inlet.setMoleFractions(x.data());
doublereal mdot=uin*rho_in;
double mdot=uin*rho_in;
inlet.setMdot(mdot);
inlet.setTemperature(temp);

Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/kinetics1/kinetics1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int kinetics1(int np, void* p)


// print final temperature and timing data
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
double tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
cout << " Tfinal = " << r.temperature() << endl;
cout << " time = " << tmm << endl;
cout << " number of residual function evaluations = "
Expand Down
66 changes: 33 additions & 33 deletions samples/f77/demo_ftnlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,24 @@ extern "C" {
}

/// integer function nElements()
integer nelements_()
int nelements_()
{
return _gas->nElements();
}

/// integer function nSpecies()
integer nspecies_()
int nspecies_()
{
return _gas->nSpecies();
}

/// integer function nReactions()
integer nreactions_()
int nreactions_()
{
return _kin->nReactions();
}

void getspeciesname_(integer* k, char* name, ftnlen n)
void getspeciesname_(int* k, char* name, ftnlen n)
{
int ik = *k - 1;
std::fill(name, name + n, ' ');
Expand All @@ -133,7 +133,7 @@ extern "C" {
//-------------- setting the state ----------------------------

/// subroutine setState_TPX(T, P, X)
void setstate_tpx_(doublereal* T, doublereal* P, doublereal* X)
void setstate_tpx_(double* T, double* P, double* X)
{
try {
_gas->setState_TPX(*T, *P, X);
Expand All @@ -143,7 +143,7 @@ extern "C" {
}

/// subroutine setState_TPX_String(T, P, X)
void setstate_tpx_string_(doublereal* T, doublereal* P,
void setstate_tpx_string_(double* T, double* P,
char* X, ftnlen lenx)
{
try {
Expand All @@ -153,7 +153,7 @@ extern "C" {
}
}

void setstate_try_(doublereal* T, doublereal* rho, doublereal* Y)
void setstate_try_(double* T, double* rho, double* Y)
{
try {
_gas->setState_TRY(*T, *rho, Y);
Expand All @@ -162,7 +162,7 @@ extern "C" {
}
}

void setstate_tpy_(doublereal* T, doublereal* p, doublereal* Y)
void setstate_tpy_(double* T, double* p, double* Y)
{
try {
_gas->setState_TPY(*T, *p, Y);
Expand All @@ -171,7 +171,7 @@ extern "C" {
}
}

void setstate_sp_(doublereal* s, doublereal* p)
void setstate_sp_(double* s, double* p)
{
try {
_gas->setState_SP(*s, *p);
Expand All @@ -183,95 +183,95 @@ extern "C" {
//-------------- thermodynamic properties ----------------------

/// Temperature (K)
doublereal temperature_()
double temperature_()
{
return _gas->temperature();
}

/// Pressure (Pa)
doublereal pressure_()
double pressure_()
{
return _gas->pressure();
}

/// Density (kg/m^3)
doublereal density_()
double density_()
{
return _gas->density();
}

/// Mean molar mass (kg/kmol).
doublereal meanmolarmass_()
double meanmolarmass_()
{
return _gas->meanMolecularWeight();
}

/// Molar enthalpy (J/kmol)
doublereal enthalpy_mole_()
double enthalpy_mole_()
{
return _gas->enthalpy_mole();
}

/// Molar internal energy (J/kmol)
doublereal intenergy_mole_()
double intenergy_mole_()
{
return _gas->intEnergy_mole();
}

/// Molar entropy (J/kmol-K)
doublereal entropy_mole_()
double entropy_mole_()
{
return _gas->entropy_mole();
}

/// Molar heat capacity at constant P (J/kmol-K)
doublereal cp_mole_()
double cp_mole_()
{
return _gas->cp_mole();
}

/// Molar Gibbs function (J/kmol)
doublereal gibbs_mole_()
double gibbs_mole_()
{
return _gas->gibbs_mole();
}

doublereal enthalpy_mass_()
double enthalpy_mass_()
{
return _gas->enthalpy_mass();
}

doublereal intenergy_mass_()
double intenergy_mass_()
{
return _gas->intEnergy_mass();
}

doublereal entropy_mass_()
double entropy_mass_()
{
return _gas->entropy_mass();
}

doublereal cp_mass_()
double cp_mass_()
{
return _gas->cp_mass();
}

doublereal cv_mass_()
double cv_mass_()
{
return _gas->cv_mass();
}

doublereal gibbs_mass_()
double gibbs_mass_()
{
return _gas->gibbs_mass();
}

void gotmolefractions_(doublereal* x)
void gotmolefractions_(double* x)
{
_gas->getMoleFractions(x);
}

void gotmassfractions_(doublereal* y)
void gotmassfractions_(double* y)
{
_gas->getMassFractions(y);
}
Expand All @@ -292,7 +292,7 @@ extern "C" {

//---------------- kinetics -------------------------

void getreactioneqn_(integer* i, char* eqn, ftnlen n)
void getreactioneqn_(int* i, char* eqn, ftnlen n)
{
int irxn = *i - 1;
std::fill(eqn, eqn + n, ' ');
Expand All @@ -302,32 +302,32 @@ extern "C" {
copy(e.begin(), e.begin()+nmx, eqn);
}

void getnetproductionrates_(doublereal* wdot)
void getnetproductionrates_(double* wdot)
{
_kin->getNetProductionRates(wdot);
}

void getcreationrates_(doublereal* cdot)
void getcreationrates_(double* cdot)
{
_kin->getCreationRates(cdot);
}

void getdestructionrates_(doublereal* ddot)
void getdestructionrates_(double* ddot)
{
_kin->getDestructionRates(ddot);
}

void getnetratesofprogress_(doublereal* q)
void getnetratesofprogress_(double* q)
{
_kin->getNetRatesOfProgress(q);
}

void getfwdratesofprogress_(doublereal* q)
void getfwdratesofprogress_(double* q)
{
_kin->getFwdRatesOfProgress(q);
}

void getrevratesofprogress_(doublereal* q)
void getrevratesofprogress_(double* q)
{
_kin->getRevRatesOfProgress(q);
}
Expand Down
10 changes: 5 additions & 5 deletions test_problems/cxx_ex/equil_example1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ int equil_example1(int job)
Array2D output(nsp+2, ntemps);

// main loop
doublereal temp;
doublereal thigh = gas->maxTemp();
doublereal tlow = 500.0;
doublereal dt = (thigh - tlow)/(ntemps);
doublereal pres = 0.01*OneAtm;
double temp;
double thigh = gas->maxTemp();
double tlow = 500.0;
double dt = (thigh - tlow)/(ntemps);
double pres = 0.01*OneAtm;
for (int i = 0; i < ntemps; i++) {
temp = tlow + dt*i;
if (temp > gas->maxTemp()) {
Expand Down
4 changes: 2 additions & 2 deletions test_problems/cxx_ex/transport_example1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ int transport_example1(int job)

auto sol = newSolution("gri30.yaml", "gri30", "Mix");
auto gas = getIdealGasPhasePtr(sol);
doublereal temp = 500.0;
doublereal pres = 2.0*OneAtm;
double temp = 500.0;
double pres = 2.0*OneAtm;
gas->setState_TPX(temp, pres, "H2:1.0, CH4:0.1");

// create a transport manager that implements
Expand Down
4 changes: 2 additions & 2 deletions test_problems/cxx_ex/transport_example2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ int transport_example2(int job)

auto sol = newSolution("gri30.yaml", "gri30", "Multi");
auto gas = getIdealGasPhasePtr(sol);
doublereal temp = 2000.0;
doublereal pres = 2.0*OneAtm;
double temp = 2000.0;
double pres = 2.0*OneAtm;
gas->setState_TPX(temp, pres, "H2:1.0, O2:0.5, CH4:0.1, N2:0.2");
gas->equilibrate("TP");

Expand Down

0 comments on commit 5b3c41c

Please sign in to comment.