transpose and vectorize functions not working

transpose and vectorize functions not working - problems shown in post - Messages

#1 Posted: 7/9/2020 9:32:16 PM
Harvey Hensley

Harvey Hensley

4 likes in 21 posts.

Group: User

The transpose and vectorize functions don't work as expected. My guess is that these problems may be due to the use of Prode Physical Properties during the creation of the matrix and vectors involved in the examples.

transpose errorvectorize error

The Smath file for these errors is attached.

Example 7 errors.sm (84 KiB) downloaded 45 time(s).

I found the solution. I used eval() of variables obtained from Prode PP. This broke the dependency on Prode. Both transpose and vectorize of division now work for the problems shown.
#2 Posted: 7/10/2020 10:46:12 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

SS 6179 does not open your 7251 ... incorrect format.
No idea what Prode is doing ?
No interest for WASP. Get it IAPWS from Katmar, they have more than WASP.
For those properties not interpolated from system providers,
they must be available from data in your Prode Smath.
Nothing can come from not visible data from source.
Cubic is a very poor fitter unless data are cubic.
Very few phenomenons are cubic by nature.
Jean

Page14 Harvey.sm (716 KiB) downloaded 26 time(s).
#3 Posted: 7/10/2020 5:18:40 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Cubic is a very poor fitter unless data are cubic.


You can get lot more from Cholesky matrix solver.
These two examples are remarkable pieces of fitting.

Genfit Rational [2 styles Broyden, Ge].sm (117 KiB) downloaded 41 time(s).
#4 Posted: 7/12/2020 11:49:31 AM
Harvey Hensley

Harvey Hensley

4 likes in 21 posts.

Group: User

Prode obtains their data from DIPPR and DECHEMA and then fits the data for equations of state, binary interaction parameters where data are available and properties such as heat capacity. Prode has 17 different equations for heat capacity and chooses the best one for each compound. In the Prode archive, the temperature range of the data is given. For benzene, the range is 50 to 1500 K. The equation used for benzene heat capacity is highly non-linear as shown in the figure below. That equation cannot be symbolically integrated which means the reactor model would have to repeatedly integrate cpDT numerically to obtain enthalpy. Instead, I compute the heat capacity values for the range of interest from the PPP enthaly and then re-fit to a cubic equation. As you can see, the cubic fit is very good.

heat capacity fit

I knew that the sm file attached to my original post would not compute without Prode and my Prode database. However, I expected someone could look at the code and suggest a solution. Instead, I was able to find the eval solution. Using eval also reduced the computation time by an order of magnitude.

1 users liked this post
frapuano 7/12/2020 2:49:00 PM
#5 Posted: 7/12/2020 4:49:44 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Prode data sets is public but not free.
Why should I pay $ to share my skill in fitting ?
> 2300 products up to 35 properties per component.
That is no sweat for Smath. However, data sets are needed.

Page6 Pentane.sm (7 KiB) downloaded 32 time(s).
#6 Posted: 7/12/2020 7:08:44 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Harvey,
If you wish, you can exercise your cubic(s).
The red fit is one piece.

Water rho.PNG
#7 Posted: 7/14/2020 6:57:47 PM
Harvey Hensley

Harvey Hensley

4 likes in 21 posts.

Group: User

Wrote

Harvey,
If you wish, you can exercise your cubic(s).
The red fit is one piece.



Although this thread has deviated from the original subject (function errors) to the merits of different fitting functions and thermo software, I will respond with some fits to the water density data.

I don't expect the cubic polynomial to fit every set of data. In the past I have used various nonlinear functions, using genfit in Mathcad. Looking at your curve, I would probably have started with a natural log function. The first plot below shows the cubic fit and the ln fit. The latter does quite well with one term and three parameters. The cubic does fairly well except near the critical point.

cubic and ln fits

The plot below shows the Prode equation used for the liquid water density. It does well through out the data range, including near the critical point. The equation does not work with a reduced temperature of 1.

PPP fit

Finally, I think you may have misinterpreted my intent in my last post. I described what Prode uses for data and their fitting capabilities because you had said you didn't know what Prode was doing. I was not promoting Prode.
#8 Posted: 7/15/2020 2:11:59 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

The plot below shows the Prode equation used for the liquid water density. It does well through out the data range, including near the critical point. The equation does not work with a reduced temperature of 1.


In my times, Prode was the Air Liquide Bible, in English too.
I have the water rho IAPWS from B. Spang in Mathcad.
Very many data sets have model(s).
Otherwise, we rescue via interpolation methods, mostly:
1. Padé normalized rational fraction.
2. ChebyShev linfit.
3. Thiélé inverse interpolation.
4. Piece wise LSQ [can't make it work Smath].
5. Convolution Polynomials [Laser].
Some data set can only be fitted by hand [Chemist].
All that said in short, why not re-thread to be more attractive ?
Prode Discussion would attract greater audience.

Water rho.PNG

Genfit Chemist.sm (34 KiB) downloaded 24 time(s).
Inst_Type T_J NBS 125.sm (118 KiB) downloaded 29 time(s).

  • New Posts New Posts
  • No New Posts No New Posts