Fixed incomp JSON files and added prototypes to incompressible backend

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-07-08 15:40:32 +02:00
parent 77fa6d9887
commit 4aa8c5ac61
8 changed files with 391 additions and 360 deletions

View File

@@ -27,40 +27,38 @@ IncompressibleBackend::IncompressibleBackend(const std::vector<std::string> &com
}
void IncompressibleBackend::update(long input_pair, double value1, double value2) {
switch (input_pair) {
case PT_INPUTS: {
switch (input_pair)
{
case PT_INPUTS: {
_p = value1; _T = value2;
break;
}
case DmassP_INPUTS: {
break;
}
case PUmass_INPUTS: {
break;
}
case PSmass_INPUTS: {
break;
}
case HmassP_INPUTS: {
break;
}
default: {
throw ValueError(
format("This pair of inputs [%s] is not yet supported",
get_input_pair_short_desc(input_pair).c_str()));
}
}
if (_p < 0){ throw ValueError("p is less than zero");}
if (!ValidNumber(_p)){ throw ValueError("p is not a valid number");}
if (_T < 0){ throw ValueError("T is less than zero");}
if (!ValidNumber(_T)){ throw ValueError("T is not a valid number");}
}
break;
}
// case DmassP_INPUTS: {
//
// }
// break;
// }
// case HmassP_INPUTS: {
// // Call again, but this time with molar units
// // H: [J/kg] * [kg/mol] -> [J/mol]
// update(HmolarP_INPUTS, value1 * (double) _molar_mass, value2);
// return;
// }
// case PUmass_INPUTS: {
// // Call again, but this time with molar units
// // U: [J/kg] * [kg/mol] -> [J/mol]
// update(PUmolar_INPUTS, value1, value2 * (double) _molar_mass);
// return;
// }
// case PSmass_INPUTS: {
// // Call again, but this time with molar units
// // U: [J/kg] * [kg/mol] -> [J/mol]
// update(PUmolar_INPUTS, value1, value2 * (double) _molar_mass);
// return;
// }
default: {
throw ValueError(
format("This pair of inputs [%s] is not yet supported",
get_input_pair_short_desc(input_pair).c_str()));
}
}
long double IncompressibleBackend::calc_viscosity(void){
return visc(_T,_p);
}
/// Set the mole fractions

View File

@@ -56,6 +56,36 @@ public:
/// Check if the mole fractions have been set, etc.
void check_status();
/// Calculate T given pressure and density
/**
@param rhomass The mass density in kg/m^3
@param p The pressure in Pa
@returns T The temperature in K
*/
long double DmassP_flash(long double rhomass, long double p);
/// Calculate T given pressure and enthalpy
/**
@param hmass The mass enthalpy in J/kg
@param p The pressure in Pa
@returns T The temperature in K
*/
long double HmassP_flash(long double hmass, long double p);
/// Calculate T given pressure and entropy
/**
@param smass The mass entropy in J/kg/K
@param p The pressure in Pa
@returns T The temperature in K
*/
long double PSmass_flash(long double p, long double smass);
/// Calculate T given pressure and internal energy
/**
@param umass The mass internal energy in J/kg
@param p The pressure in Pa
@returns T The temperature in K
*/
long double PUmass_flash(long double p, long double umass);
/// Get the viscosity [Pa-s]
long double calc_viscosity(void);