mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Fixed a bunch of coverity warnings; still quite a few to go
This commit is contained in:
@@ -670,7 +670,7 @@ void FlashRoutines::HSU_D_flash_twophase(HelmholtzEOSMixtureBackend &HEOS, CoolP
|
||||
parameters other; // Key for other value
|
||||
CoolPropDbl value; // value for S,H,U
|
||||
CoolPropDbl Qd; // Quality from density
|
||||
Residual(HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl rhomolar_spec, parameters other, CoolPropDbl value) : HEOS(HEOS), rhomolar_spec(rhomolar_spec), other(other), value(value){};
|
||||
Residual(HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl rhomolar_spec, parameters other, CoolPropDbl value) : HEOS(HEOS), rhomolar_spec(rhomolar_spec), other(other), value(value){ Qd = _HUGE; };
|
||||
double call(double T){
|
||||
HEOS.update(QT_INPUTS, 0, T);
|
||||
HelmholtzEOSMixtureBackend &SatL = HEOS.get_SatL(),
|
||||
@@ -1342,7 +1342,7 @@ void FlashRoutines::HS_flash(HelmholtzEOSMixtureBackend &HEOS)
|
||||
{
|
||||
public:
|
||||
HelmholtzEOSMixtureBackend &HEOS;
|
||||
CoolPropDbl hmolar, smolar, Qs;
|
||||
CoolPropDbl hmolar, smolar;
|
||||
Residual(HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl hmolar_spec, CoolPropDbl smolar_spec) : HEOS(HEOS), hmolar(hmolar_spec), smolar(smolar_spec){};
|
||||
double call(double T){
|
||||
HEOS.update(SmolarT_INPUTS, smolar, T);
|
||||
|
||||
@@ -42,7 +42,6 @@ IncompressibleBackend::IncompressibleBackend(const std::string &fluid_name) {
|
||||
|
||||
IncompressibleBackend::IncompressibleBackend(const std::vector<std::string> &component_names) {
|
||||
throw NotImplementedError("Mixture-style constructor is not implemented yet for incompressible fluids");
|
||||
this->fluid = NULL;
|
||||
}
|
||||
|
||||
void IncompressibleBackend::update(CoolProp::input_pairs input_pair, double value1, double value2) {
|
||||
|
||||
@@ -17,7 +17,11 @@ class CellCoeffs{
|
||||
bool _valid, _has_valid_neighbor;
|
||||
public:
|
||||
double dx_dxhat, dy_dyhat;
|
||||
CellCoeffs(){_valid = false; _has_valid_neighbor = false;}
|
||||
CellCoeffs(){
|
||||
_valid = false; _has_valid_neighbor = false;
|
||||
dx_dxhat= _HUGE; dy_dyhat = _HUGE;
|
||||
alt_i = 9999999; alt_j = 9999999;
|
||||
}
|
||||
std::vector<double> T, rhomolar, hmolar, p, smolar, umolar;
|
||||
/// Return a const reference to the desired matrix
|
||||
const std::vector<double> & get(parameters params){
|
||||
|
||||
@@ -146,10 +146,12 @@ void CoolProp::PureFluidSaturationTableData::build(shared_ptr<CoolProp::Abstract
|
||||
// Last point is at the critical point
|
||||
AS->update(PQ_INPUTS, AS->p_critical(), 1);
|
||||
std::size_t i = N-1;
|
||||
pV[i] = p; TV[i] = AS->T(); rhomolarV[i] = AS->rhomolar();
|
||||
pV[i] = AS->p(); TV[i] = AS->T(); rhomolarV[i] = AS->rhomolar();
|
||||
hmolarV[i] = AS->hmolar(); smolarV[i] = AS->smolar(); umolarV[i] = AS->umolar();
|
||||
pL[i] = p; TL[i] = AS->T(); rhomolarL[i] = AS->rhomolar();
|
||||
pL[i] = AS->p(); TL[i] = AS->T(); rhomolarL[i] = AS->rhomolar();
|
||||
hmolarL[i] = AS->hmolar(); smolarL[i] = AS->smolar(); umolarL[i] = AS->umolar();
|
||||
logpV[i] = log(AS->p()); logrhomolarV[i] = log(rhomolarV[i]);
|
||||
logpL[i] = log(AS->p()); logrhomolarL[i] = log(rhomolarL[i]);
|
||||
}
|
||||
|
||||
void CoolProp::SinglePhaseGriddedTableData::build(shared_ptr<CoolProp::AbstractState> &AS)
|
||||
@@ -302,8 +304,6 @@ void CoolProp::TabularBackend::load_tables(){
|
||||
std::string path_to_tables = this->path_to_tables();
|
||||
single_phase_logph.AS = this->AS;
|
||||
single_phase_logpT.AS = this->AS;
|
||||
single_phase_logph.AS->set_mole_fractions(AS->get_mole_fractions());
|
||||
single_phase_logpT.AS->set_mole_fractions(AS->get_mole_fractions());
|
||||
single_phase_logph.set_limits();
|
||||
single_phase_logpT.set_limits();
|
||||
load_table(single_phase_logph, path_to_tables, "single_phase_logph.bin.z");
|
||||
|
||||
@@ -289,7 +289,12 @@ class SinglePhaseGriddedTableData{
|
||||
|
||||
virtual void set_limits() = 0;
|
||||
|
||||
SinglePhaseGriddedTableData(){Nx = 200; Ny = 200; revision = 0;}
|
||||
SinglePhaseGriddedTableData(){
|
||||
Nx = 200; Ny = 200; revision = 0;
|
||||
xkey = INVALID_PARAMETER; ykey = INVALID_PARAMETER;
|
||||
logx = false; logy = false;
|
||||
xmin = _HUGE; xmax = _HUGE; ymin = _HUGE; ymax = _HUGE;
|
||||
}
|
||||
|
||||
/* Use X macros to auto-generate the variables; each will look something like: std::vector< std::vector<double> > T; */
|
||||
#define X(name) std::vector< std::vector<double> > name;
|
||||
@@ -559,7 +564,15 @@ class TabularBackend : public AbstractState
|
||||
std::vector<CoolPropDbl> mole_fractions;
|
||||
public:
|
||||
|
||||
TabularBackend(shared_ptr<CoolProp::AbstractState> AS) : tables_loaded(false), using_single_phase_table(false), AS(AS) {};
|
||||
TabularBackend(shared_ptr<CoolProp::AbstractState> AS) : tables_loaded(false), using_single_phase_table(false), AS(AS) {
|
||||
selected_table = SELECTED_NO_TABLE;
|
||||
// Flush the cached indices (set to large number)
|
||||
cached_single_phase_i = std::numeric_limits<std::size_t>::max();
|
||||
cached_single_phase_j = std::numeric_limits<std::size_t>::max();
|
||||
cached_saturation_iL = std::numeric_limits<std::size_t>::max();
|
||||
cached_saturation_iV = std::numeric_limits<std::size_t>::max();
|
||||
z = NULL; dzdx, dzdy = NULL; d2zdx2 = NULL; d2zdxdy = NULL; d2zdy2 = NULL;
|
||||
};
|
||||
|
||||
// None of the tabular methods are available from the high-level interface
|
||||
bool available_in_high_level(void){return false;}
|
||||
|
||||
@@ -716,7 +716,8 @@ void set_reference_stateS(const std::string &fluid_string, const std::string &re
|
||||
double h0 = 0, s0 = 0, t0 = 0, p0 = 0;
|
||||
char herr[255], hrf[4];
|
||||
double x0[1] = {1};
|
||||
if (reference_state.size() > 3){
|
||||
const char * refstate = reference_state.c_str();
|
||||
if (strlen(refstate) > 3){
|
||||
if (reference_state == "ASHRAE"){
|
||||
strcpy(hrf, "ASH");
|
||||
}
|
||||
@@ -725,7 +726,7 @@ void set_reference_stateS(const std::string &fluid_string, const std::string &re
|
||||
}
|
||||
}
|
||||
else{
|
||||
strcpy(hrf, reference_state.c_str());
|
||||
strcpy(hrf, refstate);
|
||||
}
|
||||
REFPROP_SETREF(hrf, ixflag, x0, h0, s0, t0, p0, ierr, herr, 3, 255);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user