main.cxx update

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-05-30 17:15:33 +02:00
parent 873eab5baa
commit fdd329fb7b

View File

@@ -19,13 +19,12 @@ using namespace CoolProp;
#include <vld.h>
void generate_melting_curve_data(const char* file_name, const char *fluid_name, double Tmin, double Tmax)
{
FILE *fp;
fp = fopen(file_name,"w");
AbstractState *State = AbstractState::factory(std::string("REFPROP"),std::string(fluid_name));
std::tr1::shared_ptr<AbstractState> State(AbstractState::factory(std::string("REFPROP"),std::string(fluid_name)));
for (double T = Tmin; T < Tmax; T += 0.1)
{
try{
@@ -49,10 +48,10 @@ void generate_melting_curve_data(const char* file_name, const char *fluid_name,
}
}
fclose(fp);
delete State;
}
int main()
{
set_debug_level(10);
if (0)
{
generate_melting_curve_data("Ethylene-I.mlt","ethylene",103.989,110.369);
@@ -113,20 +112,34 @@ int main()
}
if (1)
{
AbstractState *ASS = AbstractState::factory("HEOS","Water");
ASS->update(DmassT_INPUTS, 1e-10, 300);
delete ASS;
double rrr0 = PropsSI("O","T",350,"Q",0,"REFPROP::Water");
double rrr2 = PropsSI("O","T",350,"Q",0,"Water");
double rrr =0 ;
}
if (0)
if (1)
{
std::tr1::shared_ptr<AbstractState> ASR(AbstractState::factory("REFPROP","CO2"));
ASR->update(QT_INPUTS, 1, 304);
double muR0 = ASR->conductivity();
std::tr1::shared_ptr<AbstractState> ASC(AbstractState::factory("HEOS","CO2"));
ASC->update(QT_INPUTS, 1, 304);
double muC = ASC->conductivity();
double rr = 4;
}
if (1)
{
//std::vector<std::string> tags;
//tags.push_back("[RP1485]");
//run_user_defined_tests(tags);
//run_tests();
std::string s = get_BibTeXKey("n-Propane", "rr");
std::vector<std::string> tags;
tags.push_back("[helmholtz]");
run_user_defined_tests(tags);
run_tests();
std::string fl = get_global_param_string("FluidsList");
double rr = PropsSI("D", "P", 3e5, "T", 300, "Nitrogen");
AbstractState *AS = AbstractState::factory("HEOS","Nitrogen");
std::tr1::shared_ptr<AbstractState> AS(AbstractState::factory("HEOS","Nitrogen"));
AS->update(DmolarT_INPUTS, 40, 300);
double p1 = AS->umolar();
@@ -227,21 +240,20 @@ int main()
}
if (0)
{
AbstractState *MixRP = AbstractState::factory(std::string("REFPROP"),std::string("propane"));
std::tr1::shared_ptr<AbstractState> MixRP(AbstractState::factory(std::string("REFPROP"),std::string("propane")));
MixRP->update(QT_INPUTS, 0, 330);
long double s1 = MixRP->surface_tension();
AbstractState *Mix = AbstractState::factory(std::string("HEOS"), std::string("propane"));
std::tr1::shared_ptr<AbstractState> Mix(AbstractState::factory(std::string("HEOS"), std::string("propane")));
Mix->update(QT_INPUTS, 0, 330);
long double s2 = Mix->surface_tension();
delete Mix; delete MixRP;
}
if (0)
{
double T = 300;
AbstractState *MixRP = AbstractState::factory(std::string("REFPROP"), std::string("propane"));
std::tr1::shared_ptr<AbstractState> MixRP(AbstractState::factory(std::string("REFPROP"),std::string("propane")));
{
long N = 100000;
double t1 = clock(), summer = 0;
@@ -259,7 +271,7 @@ int main()
double cp2 = MixRP->cpmolar();
double T2 = MixRP->T();
AbstractState *Mix = AbstractState::factory(std::string("CORE"),std::string("n-Propane"));
std::tr1::shared_ptr<AbstractState> Mix(AbstractState::factory(std::string("HEOS"), std::string("propane")));
{
long N = 100000;
double t1 = clock(), summer = 0;
@@ -277,7 +289,6 @@ int main()
double cp1 = Mix->cpmolar();
double T1 = Mix->T();
delete Mix; delete MixRP;
double rr = 0;
}
if (0)
@@ -288,7 +299,7 @@ int main()
int inputs = PQ_INPUTS; double val1 = p, val2 = Q;
AbstractState *MixRP = AbstractState::factory(std::string("REFPROP"), std::string("Ethane,propane"));
std::tr1::shared_ptr<AbstractState> MixRP(AbstractState::factory(std::string("REFPROP"), std::string("Ethane,propane")));
MixRP->set_mole_fractions(z);
MixRP->update(inputs, val1, val2);
double p2 = MixRP->p();
@@ -301,7 +312,7 @@ int main()
double phi20 = MixRP->fugacity_coefficient(0);
double phi21 = MixRP->fugacity_coefficient(1);
AbstractState *Mix = AbstractState::factory(std::string("CORE"), std::string("Ethane,n-Propane"));
std::tr1::shared_ptr<AbstractState> Mix(AbstractState::factory(std::string("HEOS"), std::string("Ethane,propane")));
Mix->set_mole_fractions(z);
Mix->update(inputs, val1, val2);
double p1 = Mix->p();
@@ -313,7 +324,6 @@ int main()
double phi10 = Mix->fugacity_coefficient(0);
double phi11 = Mix->fugacity_coefficient(1);
delete Mix; delete MixRP;
double rr = 0;
}
if (0)
@@ -322,7 +332,8 @@ int main()
std::vector<long double> z(N, 1.0/N);
double Q = 0, T = 250, p = 300000;
AbstractState *Mix = AbstractState::factory(std::string("CORE"),std::string("Ethane,n-Propane"));
std::tr1::shared_ptr<AbstractState> Mix(AbstractState::factory(std::string("HEOS"), std::string("Ethane,n-Propane")));
Mix->set_mole_fractions(z);
for (double T = 210; ;T += 0.1)
@@ -330,14 +341,14 @@ int main()
Mix->update(QT_INPUTS, Q, T);
std::cout << format(" %g %g\n",Mix->p(),Mix->T());
}
delete(Mix);
}
if(0)
{
time_t t1,t2;
std::size_t N = 1000000;
AbstractState *State = AbstractState::factory(std::string("CORE"), std::string("Water"));
std::tr1::shared_ptr<AbstractState> State(AbstractState::factory(std::string("HEOS"), std::string("Water")));
double p = State->p();
double summer = 0;
t1 = clock();
@@ -355,26 +366,22 @@ int main()
summer += State->p();
}
t2 = clock();
delete State;
double elap = ((double)(t2-t1))/CLOCKS_PER_SEC/((double)N)*1e6;
printf("%g %g\n",elap, summer/((double)N));
double eee = 0;
return 0;
}
if (0)
{
AbstractState *State = AbstractState::factory(std::string("REFPROP"), std::string("Methane|Ethane"));
std::tr1::shared_ptr<AbstractState> State(AbstractState::factory(std::string("REFPROP"), std::string("Methane|Ethane")));
std::vector<long double> x(2,0.5);
State->set_mole_fractions(x);
State->update(DmassT_INPUTS,1,250);
double hh = State->hmolar();
double mu = State->viscosity();
double sigma = State->surface_tension();
delete State;
}
if (0)
{
@@ -383,9 +390,8 @@ int main()
long N = 100000;
for (long ii = 0; ii < N; ii++)
{
AbstractState *State = AbstractState::factory(std::string("REFPROP"), std::string("Methane"));
std::tr1::shared_ptr<AbstractState> State(AbstractState::factory(std::string("REFPROP"), std::string("Methane")));
//AbstractState *State = new REFPROPBackend("Methane");
delete State;
}
t2 = clock();
double elap = ((double)(t2-t1))/CLOCKS_PER_SEC/((double)N)*1e6;
@@ -394,7 +400,8 @@ int main()
if(0)
{
AbstractState *State = AbstractState::factory(std::string("REFPROP"), std::string("Methane"));
std::tr1::shared_ptr<AbstractState> State(AbstractState::factory(std::string("REFPROP"), std::string("Methane")));
State->update(DmassT_INPUTS,1,300);
double hh = State->hmolar();
double mu = State->viscosity();
@@ -411,8 +418,5 @@ int main()
t2 = clock();
double elap = ((double)(t2-t1))/CLOCKS_PER_SEC;
printf("%g\n",elap);
//double sigma = State->surface_tension();
delete State;
}
}