You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Database object can now be constructed using a file or a string containing a ThermoDataSet in valid JSON
* fixed division by zero problem in the propagation of derivatives
* fix calculation of derivatives in Cp f(T) method at reference T-P
* example properties reaction
* bug-fix entropy of reaction
@@ -35,16 +36,8 @@ auto thermoPropertiesEmpCpIntegration(Reaktoro_::Temperature TK, Reaktoro_::Pres
35
36
return thermo_properties_PrTr;
36
37
}
37
38
38
-
// aW.twp->devG = dc[q].Gs[1];
39
-
// ??????????????????????????????????????'
40
-
// if( !dc[q].Cp )
41
-
// {
42
-
// aW.twp->Cp = (double)dc[q].Cps[0];
43
-
// goto NEXT;
44
-
// }
45
-
46
39
// get Cp interval -> this has to go!!!!
47
-
for (size_t i=0; i<thermo_parameters.temperature_intervals.size(); i++)
40
+
for (size_t i = 0; i < thermo_parameters.temperature_intervals.size(); i++)
48
41
{
49
42
if (thermo_parameters.temperature_intervals[i].size() > 0)
50
43
{
@@ -60,120 +53,134 @@ auto thermoPropertiesEmpCpIntegration(Reaktoro_::Temperature TK, Reaktoro_::Pres
60
53
}
61
54
}
62
55
63
-
if (k<0)
56
+
if (k < 0)
64
57
{
65
58
if (TK_ < thermo_parameters.temperature_intervals[0][0])
66
59
k = 0;
67
-
if (TK_ > thermo_parameters.temperature_intervals[thermo_parameters.temperature_intervals.size()-1][1])
68
-
k = thermo_parameters.temperature_intervals.size()-1;
69
-
std::cout << "The given temperature: "<< TK_ <<" is not inside the specified interval/s for the Cp calculation.";
70
-
std::cout << "The temperature is not inside the specified interval for the substance "<< substance.symbol() << "." << std::endl << __FILE__ << std::endl << __LINE__;
71
-
// Exception exception;
72
-
// exception.error << "The given temperature: "<< TK_ <<" is not inside the specified interval/s for the Cp calculation.";
73
-
// exception.reason << "The temperature is not inside the specified interval for the substance "<< substance.symbol() << ".";
74
-
// exception.file = __FILE__;
75
-
// exception.line = __LINE__;
76
-
// RaiseError(exception)
60
+
if (TK_ > thermo_parameters.temperature_intervals[thermo_parameters.temperature_intervals.size() - 1][1])
61
+
k = thermo_parameters.temperature_intervals.size() - 1;
62
+
std::cout << "The given temperature: " << TK_ << " is not inside the specified interval/s for the Cp calculation.";
63
+
std::cout << "The temperature is not inside the specified interval for the substance " << substance.symbol() << "." << std::endl
64
+
<< __FILE__ << std::endl
65
+
<< __LINE__;
77
66
}
78
67
68
+
k = 0;
79
69
80
-
81
-
k=0;
82
-
83
-
for (unsigned i=0; i<thermo_parameters.Cp_coeff[k].size(); i++)
70
+
for (unsigned i = 0; i < thermo_parameters.Cp_coeff[k].size(); i++)
TK = TK_.val/* + C_to_K*/; // current T is the end T for phase transition Cp calculations
101
-
else TK = thermo_parameters.temperature_intervals[j][1] /*+ C_to_K*/; // takes the upper bound from the j-th Tinterval
102
-
103
-
if( !j )
104
-
TrK = substance.referenceT() /*+ C_to_K*/; // if j=0 the first interval should contain the reference T (Tcr)
105
-
else TrK = thermo_parameters.temperature_intervals[j][0] /*+ C_to_K*/; // if j>0 then we are in a different Tinterval and the reference T becomes the lower bound of the interval
106
-
107
-
auto Tst2 = TrK * TrK;
108
-
auto Tst3 = Tst2 * TrK;
109
-
auto Tst4 = Tst3 * TrK;
110
-
auto Tst05 = std::sqrt( TrK );
111
-
112
-
// going trough the phase transitions parameters in FtP
113
-
// for (unsigned ft = 0; ft < thermo_parameters.phase_transition_prop.size(); ft++)
114
-
115
-
if (j && thermo_parameters.phase_transition_prop.size() == 0)
116
-
{
117
-
Exception exception;
118
-
exception.error << "No phase transition properties present in the record.";
TK = TK_.val/* + C_to_K*/; // current T is the end T for phase transition Cp calculations
92
+
else
93
+
TK = thermo_parameters.temperature_intervals[j][1] /*+ C_to_K*/; // takes the upper bound from the j-th Tinterval
123
94
124
-
if ( j && thermo_parameters.phase_transition_prop[ft][0] <= TrK/*-C_to_K*/ )
125
-
{ // Adding parameters of phase transition
126
-
if ( thermo_parameters.phase_transition_prop[ft].size() > 1 ) // dS
127
-
S += thermo_parameters.phase_transition_prop[ft][1];
128
-
if ( thermo_parameters.phase_transition_prop[ft].size() > 2 ) // dH
129
-
H += thermo_parameters.phase_transition_prop[ft][2];
130
-
if ( thermo_parameters.phase_transition_prop[ft].size() > 3 ) // dV
131
-
V += thermo_parameters.phase_transition_prop[ft][3];
132
-
// More to be added ?
133
-
ft++;
134
-
}
95
+
if (!j)
96
+
TrK = substance.referenceT() /*+ C_to_K*/; // if j=0 the first interval should contain the reference T (Tcr)
97
+
else
98
+
TrK = thermo_parameters.temperature_intervals[j][0] /*+ C_to_K*/; // if j>0 then we are in a different Tinterval and the reference T becomes the lower bound of the interval
135
99
136
-
G -= S * (TK - TrK);
100
+
auto Tst2 = TrK * TrK;
101
+
auto Tst3 = Tst2 * TrK;
102
+
auto Tst4 = Tst3 * TrK;
103
+
auto Tst05 = std::sqrt(TrK);
137
104
138
-
for (unsigned i=0; i<thermo_parameters.Cp_coeff[j].size(); i++)
139
-
{
140
-
if (i== 16) break;
141
-
ac[i] = thermo_parameters.Cp_coeff[j][i];
142
-
}
105
+
// going trough the phase transitions parameters in FtP
106
+
// for (unsigned ft = 0; ft < thermo_parameters.phase_transition_prop.size(); ft++)
143
107
108
+
if (j && thermo_parameters.phase_transition_prop.size() == 0)
109
+
{
110
+
Exception exception;
111
+
exception.error << "No phase transition properties present in the record.";
0 commit comments