{"action":"created","issue":{"url":"https://api.github.com/repos/CoolProp/CoolProp/issues/1238","repository_url":"https://api.github.com/repos/CoolProp/CoolProp","labels_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/1238/labels{/name}","comments_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/1238/comments","events_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/1238/events","html_url":"https://github.com/CoolProp/CoolProp/issues/1238","id":177644665,"number":1238,"title":"calc_first_partial_deriv in two phase for tabular backend","user":{"login":"JonWel","id":11057909,"avatar_url":"https://avatars.githubusercontent.com/u/11057909?v=3","gravatar_id":"","url":"https://api.github.com/users/JonWel","html_url":"https://github.com/JonWel","followers_url":"https://api.github.com/users/JonWel/followers","following_url":"https://api.github.com/users/JonWel/following{/other_user}","gists_url":"https://api.github.com/users/JonWel/gists{/gist_id}","starred_url":"https://api.github.com/users/JonWel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonWel/subscriptions","organizations_url":"https://api.github.com/users/JonWel/orgs","repos_url":"https://api.github.com/users/JonWel/repos","events_url":"https://api.github.com/users/JonWel/events{/privacy}","received_events_url":"https://api.github.com/users/JonWel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-18T10:43:25Z","updated_at":"2016-11-09T15:34:55Z","closed_at":null,"body":"[calc_first_partial_deriv](https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.cpp#L602) is only defined for [using_single_phase_table](https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.cpp#L603), thus two phase points are not available.\n\nThis is required to make the equivalent to the derivatives [`drhodh_constp`](https://github.com/CoolProp/CoolProp-museum/blob/master/CoolProp/CPState.cpp#L1772) and [`drhodp_consth`](https://github.com/CoolProp/CoolProp-museum/blob/master/CoolProp/CPState.cpp#L2064) that where done for [tabular](https://github.com/CoolProp/CoolProp-museum/blob/master/CoolProp/TTSE.cpp#L2826) in `CoolProp 4` and are needed for https://github.com/CoolProp/ExternalMedia/issues/20 .\n\nI don't really know how I could do this. Tabular backend are a bit opaque to me right now. For instance, there is a [SinglePhaseGriddedTableData](https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.h#L429), but how about two phase?\nIs there a paper covering that area I could use?\n"},"comment":{"url":"https://api.github.com/repos/CoolProp/CoolProp/issues/comments/259443449","html_url":"https://github.com/CoolProp/CoolProp/issues/1238#issuecomment-259443449","issue_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/1238","id":259443449,"user":{"login":"ibell","id":1859947,"avatar_url":"https://avatars.githubusercontent.com/u/1859947?v=3","gravatar_id":"","url":"https://api.github.com/users/ibell","html_url":"https://github.com/ibell","followers_url":"https://api.github.com/users/ibell/followers","following_url":"https://api.github.com/users/ibell/following{/other_user}","gists_url":"https://api.github.com/users/ibell/gists{/gist_id}","starred_url":"https://api.github.com/users/ibell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibell/subscriptions","organizations_url":"https://api.github.com/users/ibell/orgs","repos_url":"https://api.github.com/users/ibell/repos","events_url":"https://api.github.com/users/ibell/events{/privacy}","received_events_url":"https://api.github.com/users/ibell/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T15:34:55Z","updated_at":"2016-11-09T15:34:55Z","body":"I think that this is working for the tabular backends if I am not mistaken,\nthe thing that is not working is the use of the splined derivatives with\nthe tabular backends.  But a test or two to be sure wouldn't be the end of\nthe world\n\nOn Tue, Nov 8, 2016 at 3:09 PM, JonWel <notifications@github.com> wrote:\n\n> is a derivative along the saturation curve\n>\n> I'm not really used to these derivatives as did not have to use them yet.\n> So it's possible that I do not express it in the best way.\n>\n> In the original ExternalMedia code\n> <https://github.com/modelica/ExternalMedia/blob/master/Projects/Sources/coolpropsolver.cpp#L239>,\n> there is a need for some derivatives:\n>\n> properties->ddhp = state->drhodh_constp();\n> properties->ddph = state->drhodp_consth();\n>\n> These function names are not present in the newer version of CoolProp.\n> Thus, I tried to find equivalent functions to do the job\n> <https://github.com/CoolProp/ExternalMedia/blob/master/Projects/Sources/coolpropsolver.cpp#L246>\n> :\n>\n> properties->ddhp = state->first_partial_deriv(CoolProp::iDmass, CoolProp::iHmass, CoolProp::iP);\n> properties->ddph = state->first_partial_deriv(CoolProp::iDmass, CoolProp::iP, CoolProp::iHmass);\n>\n> These two lines are also called in two phase region when neither\n> twophase_derivsmoothing_xend and rho_smoothing_xend have a (positive)\n> value.\n>\n> For now, this way to call them works for HEOS in both pure and two phase,\n> it do not need to be on the saturation curve to execute without error.\n> This also works for tabular backend on pure phase, but not in two phase,\n> hence my issue.\n>\n> Looking at your link on Two-phase derivatives\n> <https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.cpp#L654>,\n> I think this is the main missing part of the solution. What would remain is\n> to call that function from TabularBackend::calc_first_partial_deriv\n> <https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.cpp#L602>\n> instead of throwing an error\n> <https://github.com/CoolProp/CoolProp/blob/master/src/Backends/Tabular/TabularBackends.cpp#L637>\n> .\n>\n> I'll have to check this, but it looks like the solution. Thanks @jowr\n> <https://github.com/jowr>\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/CoolProp/CoolProp/issues/1238#issuecomment-259275305>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ABxhawcb6WPhD4GuWJWtuSxYN9Pbahi2ks5q8PMlgaJpZM4J_3lf>\n> .\n>\n"}}
{"actor":{"display_login":"ibell"}}