Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

Matlab compiling and vectorized matlab function #194

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hnil
Copy link

@hnil hnil commented Mar 25, 2014

Here is some modifications to make Matlab compiling go smoother.
(the original did not compile due to -ansi which was default on my installation.)
In addition there is new function which take vector input and output.
The aim was to be able to use your excellent work as an add on to open source Matlab Reservoir ToolBox
www.sintef.no/Projectweb/MRST/

Your work was very useful to be able to test realistic fluids for simulation of reservoir with temperature.
I have seen that you had started on an interface for mixtures. I would be very intrested to test that for our code also.

@ibell
Copy link
Owner

ibell commented Mar 25, 2014

See also http://www.mathworks.com/matlabcentral/answers/269-using-c-style-comments-in-mex-files or http://www.mathworks.com/matlabcentral/answers/8870-c-comments-in-mex-files-under-linux - I think this sort of idea is a nicer solution than a separate mexopts.sh file.

Apart from that, nice work. I am looking to deprecate the Props function fairly soon, so only using the PropsSI variants. Could you not have added your code as a conditional branch in the PropsSI mex file? That would be a nicer solution I think.

Wrapping C/C++ libraries for MATLAB sucks, and it involves a lot of ugly hacking. Have you looked into python before? I guess with your existing library, its a bit less exciting...

Also, we are completely rewriting the guts of CoolProp, partly in order to support mixtures. Watch this space. It's taking a lot more time than originally planned, which is not really surprising.

@ibell ibell changed the title Matlab compiling and vectoriced matlab function Matlab compiling and vectorized matlab function Mar 25, 2014
@hnil
Copy link
Author

hnil commented Mar 25, 2014

Hei

Thank you for your answer.
We are doing quite some C++ programing http://www.opm-project.org/ and have
Wrapped c++ code to matlab before and know the trouble. In a bit longer time we will look at using some of your fluids in the c++ code.
In this project the "advanced " fluids are based on dumux.
www.dumux.orghttp://www.dumux.org

MRST is of historical reasons in matlab. Today we probably would have started in python (even it exist advantages of the matlab programing enviroment also) If we at some point have time( and money), we would like to translate some of the MRST code to python. I do not think it will take long time to get a OK simulator up and running.

I will look at putting the vectorized version as a branch in PropsSI.

Best regards
Halvor M. Nilsen

@ibell
Copy link
Owner

ibell commented Mar 25, 2014

@hnil Thanks for your reply. If you can implement the vectorized code as a
conditional branch in PropsSI and implement the build process as I suggest,
I'd be happy to merge that PR into CoolProp.

Do the people in your project know about CoolProp? If not, who should I
contact to let them know about it? I figure if we are both open-source, it
would be great if we could work together. We could use some manpower on
our side too. Would welcome it really.

I might be able to help a bit with the python side of things. I have quite
a good amount of experience with SWIG, and experience with Cython too.
There's also the new xdress project. So there are pretty good tools for
python, certainly much more mature than MATLAB. I don't deny that MATLAB
has some nice features, but I find it extremely hard to justify the price
they are trying to charge for a full license when you can't even use C++ in
MATLAB, amongst many other small issues. Why pay thousands when python
offers most of the same functionality for $0?

On Tue, Mar 25, 2014 at 10:44 AM, hnil [email protected] wrote:

Hei

Thank you for your answer.
We are doing quite some C++ programing http://www.opm-project.org/ and
have
Wrapped c++ code to matlab before and know the trouble. In a bit longer
time we will look at using some of your fluids in the c++ code.
In this project the "advanced " fluids are based on dumux.
www.dumux.orghttp://www.dumux.org

MRST is of historical reasons in matlab. Today we probably would have
started in python (even it exist advantages of the matlab programing
enviroment also) If we at some point have time( and money), we would like
to translate some of the MRST code to python. I do not think it will take
long time to get a OK simulator up and running.

I will look at putting the vectorized version as a branch in PropsSI.

Best regards
Halvor M. Nilsen

From: Ian Bell [mailto:[email protected]]
Sent: 25. mars 2014 09:44
To: ibell/coolprop
Cc: Halvor Møll Nilsen
Subject: Re: [coolprop] Matlab compiling and vectoriced matlab function
(#194)

See also
http://www.mathworks.com/matlabcentral/answers/269-using-c-style-comments-in-mex-filesor
http://www.mathworks.com/matlabcentral/answers/8870-c-comments-in-mex-files-under-linux- I think this sort of idea is a nicer solution than a separate mexopts.sh
file.

Apart from that, nice work. I am looking to deprecate the Props function
fairly soon, so only using the PropsSI variants. Could you not have added
your code as a conditional branch in the PropsSI mex file? That would be a
nicer solution I think.

Wrapping C/C++ libraries for MATLAB sucks, and it involves a lot of ugly
hacking. Have you looked into python before? I guess with your existing
library, its a bit less exciting...

Also, we are completely rewriting the guts of CoolProp, partly in order to
support mixtures. Watch this space. It's taking a lot more time than
originally planned, which is not really surprising.

Reply to this email directly or view it on GitHub<
https://github.com/ibell/coolprop/pull/194#issuecomment-38541165>.

Reply to this email directly or view it on GitHubhttps://github.com//pull/194#issuecomment-38545821
.

@hnil
Copy link
Author

hnil commented Mar 31, 2014

Hei

Sorry for abit late answere.

I have talked to some of the developers of OPM (c++ code). I think that it would
Be a good idea be able to call your code from this code since at least some parts of it is
related to simulations with CO2.

I do not disagree with you about matlab/python. But due to historical reasons it is at the moment no
issue to change. We currently have about 2000 downloads of the last release.
And our research is contract based so if we do not have founding for changing we will not do it.

Else I am using python on my spare time. What is your prefered working enviroment for python.
Do you use something with integrated debugger like spyder? (The integrated enviroment at least for some years ago was one of the advantages of matlab)

When I have time I will look at the vertorized version and the compiling options. I will consult one of may colleages which has struggled with the mex interface many times.

Best regards
Halvor

@ibell
Copy link
Owner

ibell commented Mar 31, 2014

@hnil You might want to hold off with the C++ integration for a bit since the API is getting a full overhaul at the C++ level. I can't say when it will be finished. But the high-level integration will remain the same - the Props and PropsSI and IPropsSI functions will be supported indefinitely.

For python, I have used Eclipse+pydev - quite nice and free, debugger, etc. A bit difficult to get set up, but once you have, works fine. For lighter weight stuff, I use SciTe most of the time, or IEP is a new entrant to this market.

As soon as you've got the vectorized code ready, let me know. I don't have the time to modify/merge your changes right now unfortunately.

@hnil
Copy link
Author

hnil commented Apr 1, 2014

Hei

I will let you know have done it. No trouble for me.
(I will try to test it on windows also.)

Best wishes
Halvor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants