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

Fix Media.Air.MoistAir.{density_derX, s_pTX, s_pTX_der} #3069

Merged
merged 1 commit into from Sep 26, 2019

Conversation

beutlich
Copy link
Member

Back-port of #2932 to fix #2874, #2872 and #2868 in maint/3.2.3 branch.

@beutlich beutlich added bug Critical/severe issue L: Media Issue addresses Modelica.Media labels Jul 24, 2019
@beutlich beutlich added this to the MSL3.2.3+maint milestone Jul 24, 2019
@beutlich beutlich self-assigned this Jul 24, 2019
Copy link
Contributor

@casella casella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@wischhusen
Copy link
Contributor

wischhusen commented Sep 9, 2019

There is another issue with the specific entropy, when the actual pressure is smaller than the reference pressure p < reference_p, the increasing influence on the entropy is clipped:

s := Modelica.Media.IdealGases.Common.Functions.s0_Tlow(dryair, T)*(1 - X[ Water]) + Modelica.Media.IdealGases.Common.Functions.s0_Tlow(steam, T)X[Water] - Modelica.Constants.R(Utilities.smoothMax(X[Water]/MMX[Water]*Modelica.Math.log(max(Y[Water], Modelica.Constants.eps)*p/reference_p), 0.0, 1e-9) + Utilities.smoothMax((1 - X[Water])/MMX[Air]*Modelica.Math.log(max(Y[Air], Modelica.Constants.eps)*p/reference_p), 0.0, 1e-9));

A corrected version, keeping p/reference_p out of the max()-function, looks like this:

s=Modelica.Media.IdealGases.Common.Functions.s0_Tlow(dryair, T)*(1 - X[Water]) + Modelica.Media.IdealGases.Common.Functions.s0_Tlow(steam, T)X[Water]-Modelica.Constants.R(
Utilities.smoothMax(X[Water]/MMX[Water],0.0,1e-9)*Modelica.Math.log(max(Y[Water], Modelica.Constants.eps)*p/reference_p) + Utilities.smoothMax((1 - X[Water])/MMX[Air],0.0,1e-9)*Modelica.Math.log(max(Y[Air], Modelica.Constants.eps)*p/reference_p)
);

@beutlich
Copy link
Member Author

beutlich commented Sep 9, 2019

There is another issue with the specific entropy

@wischhusen Sorry, I do not understand. This PR is a backport of your PR #2932 from master to maint/3.2.3 (as we agreed to fix bugs also in the maint branch). Now, if there is another issue with the specific entropy, that is not yet reported, can you please create a new PR for master first. I'll care for the cherry-pick then.

@beutlich beutlich removed the request for review from wischhusen September 26, 2019 18:15
@beutlich beutlich merged commit b2c5346 into modelica:maint/3.2.3 Sep 26, 2019
@beutlich beutlich deleted the fix-moist-air-functions branch September 26, 2019 18:20
@beutlich beutlich changed the title maint/3.2.3: Fix Media.Air.MoistAir.{density_derX, s_pTX, s_pTX_der} Fix Media.Air.MoistAir.{density_derX, s_pTX, s_pTX_der} Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Media Issue addresses Modelica.Media
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants