Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTSE medium model doesn't work properly #29

Closed
casella opened this issue Mar 30, 2021 · 5 comments
Closed

TTSE medium model doesn't work properly #29

casella opened this issue Mar 30, 2021 · 5 comments

Comments

@casella
Copy link
Collaborator

casella commented Mar 30, 2021

@jowr, I'm very interested at using the TTSE and bicubic interpolations for my simulations.

I tried the TestStatesSupercritical example in the attached package, which sets enable_TTSE=1 in the CO2 medium model. The first time I ran the program, the simulation executable ran for quite some time, generating a ludicrous amount of output. I understand it was generating the table file, but I suspect it spent most of the CPU time just sending the dump to the screen. I guess we may want to suppress this output, and give instead a message like "precomputing the tables, please wait, this will only be carried out the first time you use the TTSE properties", possibly with some explicit reference to where these tables are actually saved (to be honest, I don't have the slightest idea, which is kind of creepy).

The second time I ran it, I briefly saw the message "Simulation successfully terminated" flashing in the executable command windows, followed by several garbled characters. Unfortunately, when the executable process exits, Dymola reports "Simulation in progress; use Simulation->Show Log if you want to see the actual log file. (It may initially be empty.)" and does not load any result file. In fact, there is no result .mat file at all in Dymola's output directory. Something fishy's happening, but I have little clue what it is.

Did you manage to run some TTSE or bicubic medium model successfully in ExternalMedia during your tests? Do you have any idea what is happening here?

Thanks!

@jowr jowr added this to the v3.3.0 milestone Apr 16, 2021
@jowr
Copy link
Collaborator

jowr commented Apr 19, 2021

  • CoolProp stores the zipped data for tabular interpolation in: HOME/.CoolProp/Tables
  • You can always add "|debug=100" to the Medium definition to get more output

@jowr
Copy link
Collaborator

jowr commented Apr 19, 2021

I can confirm that I get the same output as you do.

@casella
Copy link
Collaborator Author

casella commented Apr 20, 2021

I can confirm that I get the same output as you do.

OK, I'll investigate more and try to figure out what is going wrong. BTW, do you have any idea where is the HOME directory under Windows 10?

@jowr jowr modified the milestones: v3.3.0, v3.4.0 May 5, 2021
@casella
Copy link
Collaborator Author

casella commented May 13, 2021

@jowr, I tested again the TTSE tables with 3.3.0, using the attached test model, which tests CO2 with TTSE, substanceNames="CO2|enable_TTSE=1|debug=100".

I figured out where the tables are, deleted them and restarted the process. The first time I run the simulation of CO2CoolPropTTSE.TestStatesSupercritical, the dymosim.exe simulation executable runs for about a minute to compute the tables. I see lots of lines like

x: 20616.8 y: 4.77258e+08

on the console, and occasionally something like

unable to solve 1phase PY flash with Tmin=216.592, Tmax=1650 due to error: HSU_P_flash_singlephase_Brent could not find a solution because Hmolar [96714.8 J/mol] is above the maximum value of 92833.995887 J/mol

I guess these errors refer to supercritical conditions where there is no solution, so they are normal and handled by CoolProp. I hope they don't mean something's broken. Maybe you can comment on that.

Eventually this ends, and I can see four files in the home/CoolProp directory:

phase_envelope.bin.z (1 KB)
pure_saturation.bin.z  (147 KB)
single_phase_logph.bin.z (6673 KB)
single_phase_logpT.bin.z (8749 KB)

I tried to open those files with 7zip, but they are not recognized, I don't know which format you used to store this data. The first one is really small, is it possible that something went wrong there, or are the sizes as you'd expect?

Then, I can see the "Simulation terminated correctly" message in the dymosim.exe window, followed by some non-ASCII characters; I guess those mean that something goes wrong, e.g. because of some C array written past its end or something. In any case, the dymosim.exe terminates in an abnormal way, before writing anything onto the log file and before generating the .mat file, so that Dymola cannot proceed correctly.

I'm still unsure where the problem is - maybe we could simply try to add a printf statement inside setState_ph, printing out some computed properties to the console, to check if the program can at least get correct values from the TTSE medium. If that is the case, we're a bit in trouble, because it means that for some reason the TTSE routine is interfering with Dymola's runtime memory management, which could be hard to debug. If it isn't, then the problem is within ExternalMedia's code, and we can try to investigate further.

I can do this myself, but I am currently unable to compile the binaries on my pc, so I need to open a branch and use GitHub's CI to get the binaries. If you have times in the next few days to try this out, please let me know, otherwise I'll proceed this way.

Thanks!

@bilderbuchi
Copy link
Collaborator

I tried to open those files with 7zip, but they are not recognized, I don't know which format you used to store this data. The first one is really small, is it possible that something went wrong there, or are the sizes as you'd expect?

@casella The file format and how to extract it using Python is described here.

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

No branches or pull requests

3 participants