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

Units of property functions #250

Open
larschrj opened this issue Jan 16, 2024 · 9 comments
Open

Units of property functions #250

larschrj opened this issue Jan 16, 2024 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@larschrj
Copy link

larschrj commented Jan 16, 2024

It would be nice if the documentation explicitly stated that properties are per unit mol when dealing with a single fluid (for the functions that are not already explicitly intensive such as density). That might be the assumption for some people but certainly not all 😉.

Also, there seems to be a copy-paste error in the docstring for mass_density. It states that it calculates the molar density, not mass density.

@longemen3000
Copy link
Member

hi!,
on documenting that, do you mean as a preface? all functions that are volume derivatives tend to be intensive (pressure does not depend on the amount of matter), but temperature derivative functions (like Cp and Cv) are extensive. each function has their units documented, but adding additional information never hurts.

on the doc error, i'm fixing that right away

@larschrj
Copy link
Author

Some comment in the preface would be helpful at least to me but I take your point that the information is there in the documentation 🙂.

As a tangent to this, it would be nice if mass could passed as an argument to f.ex. volume when dealing with single fluids like IAPWS95 (which is what I have been using so far). I noticed in the docs that this is an option when dealing with mixtures. It would save some tedious calculations for me, but perhaps it is not a good idea for some reason.

@longemen3000
Copy link
Member

longemen3000 commented Jan 17, 2024

single fluids are mixtures! (of only one component), you can pass a mass argument in the following way:

julia> using Clapeyron, Unitful

julia> model = IAPWS95()
MultiParameter Equation of state for water:
 Polynomial power terms: 7
 Exponential terms: 44
 Gaussian bell-shaped terms: 3
 Non Analytic terms: 2

julia> volume(model,1u"atm",30u"°C",1u"kg",phase = :l, output = u"L")
1.0043695560170631 L

In this particular example, i pass 1u"kg as a number, i technically abuse one of julia quirks that a number is considered a vector of length 1 in some cases. the correct way would be to pass a [1u"kg"] instead, but that would cause some slowdowns

@larschrj
Copy link
Author

My mistake. I must have made an error when trying this previously. That's great 🙂 Thanks 👍

@longemen3000
Copy link
Member

I will keep this open in the meantime. The typo in mass_density was corrected. There is a docs PR that should fix this, but it isn't merged yet.

@larschrj
Copy link
Author

Although if I pass the vector argument for the mass I get a no method matching error for a_res. But in any case your solution was what I was looking for.

@longemen3000 longemen3000 added the documentation Improvements or additions to documentation label Jan 17, 2024
@longemen3000
Copy link
Member

Yeah, a_res is more of an internal function 😅, but there should be an api to access those (something like helmholtz_free_energy_res that I thought we had)

@larschrj
Copy link
Author

larschrj commented Jan 17, 2024

Ooops, missed your comment about keeping this open. Reopened with this.

@larschrj larschrj reopened this Jan 17, 2024
@ianhbell
Copy link
Contributor

Aside: it should be helmholtz_energy_res rather than helmholtz_free_energy_res according to IUPAC

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

No branches or pull requests

3 participants