René's URL Explorer Experiment


Title: More rigorous treatment of extensive states by prehner · Pull Request #330 · feos-org/feos · GitHub

Open Graph Title: More rigorous treatment of extensive states by prehner · Pull Request #330 · feos-org/feos

X Title: More rigorous treatment of extensive states by prehner · Pull Request #330 · feos-org/feos

Description: This is something I wanted to improve on since running into some issues in phase equilibrium algorithms. The core ideas: extensive properties should not appear in the evaluation of the equations of state (this was already changed in the last release) extensive properties should only be evaluatable if the state was initialized extensively there are many ways to specify the composition of a mixture, either intensively, or extensively. Interfaces become much easier and flexible to use if we are more generic here. I actually tried to do this at compile-time, which worked and actually helped a lot identifying all problems that would only be visible in run-time now. However, having yet another generic parameter to ultimately avoid some errors in edge cases is simply not worth it. The key for evaluating extensive properties is impl + Copy> State where DefaultAllocator: Allocator, { /// Total moles $N=\sum_iN_i$ pub fn total_moles(&self) -> Moles { self.total_moles.expect("Extensive properties can only be evaluated for states that are initialized with extensive properties!") } } All state methods for extensive properties have to call this method at which point they will panic if the size of the state is not known. This is a hard error (a panic even), because it is a fundamentally wrong usage on the user side. Some previous fields of State are now getters instead (volume, moles, partial_density). The field total_moles: Option> is set depending on the inputs with which the state is created. This is done via the Composition and FullComposition traits. pub trait Composition + Copy, N: Dim> where DefaultAllocator: Allocator, { fn into_molefracs>(self, eos: &E) -> (OVector, Option>); fn density(&self) -> Option> { None } } pub trait FullComposition + Copy, N: Dim>: Composition where DefaultAllocator: Allocator, { fn into_moles>(self, eos: &E) -> (OVector, Moles); } state creations that need the full composition (e.g., tp flash or TVN) can require the FullComposition trait. As mentioned before compile-time checks for this only apply to the creation of the state. The Composition trait is implemented for the following structs: components input full? density? comment 1 () - - 1 Moles ✅ - 2 f64 - - N OVector - - N &OVector - - N OVector - - Dyn only N &OVector - - Dyn only N Moles> ✅ - N &Moles> ✅ - N Density> - ✅ Composition::density is only needed in some specific cases to avoid overspecifying the density of a state. This gives the opportunity to organize the state creator methods a bit. The following methods are now implemented: // every constructor goes through this private function fn _new( eos: &E, temperature: Temperature, density: Density, molefracs: OVector, total_moles: Option>, ) -> FeosResult; // the basic extensive constructor pub fn new_nvt>( eos: &E, temperature: Temperature, volume: Volume, composition: X, ) -> FeosResult; // the basic intensive constructor pub fn new>( eos: &E, temperature: Temperature, density: Density, composition: X, ) -> FeosResult; // some small helper functions for special cases pub fn new_density( eos: &E, temperature: Temperature, partial_density: Density>, ) -> FeosResult; pub fn new_pure(eos: &E, temperature: Temperature, density: Density) -> FeosResult; // the pressure constructors pub fn new_npt>( eos: &E, temperature: Temperature, pressure: Pressure, composition: X, density_initialization: Option, ) -> FeosResult; pub fn new_tpvx( eos: &E, temperature: Temperature, pressure: Pressure, volume: Volume, molefracs: OVector, density_initialization: Option, ) -> FeosResult; // the caloric constructors (unchanged) pub fn new_nph(...) pub fn new_nth(...) pub fn new_nps(...) pub fn new_nts(...) pub fn new_nvu(...) // the builder constructors pub fn build>( eos: &E, temperature: Temperature, volume: Option>, density: Option>, composition: X, pressure: Option>, density_initialization: Option, ) -> FeosResult; pub fn build_full + Clone>( eos: &E, temperature: Option>, volume: Option>, density: Option>, composition: X, pressure: Option>, molar_enthalpy: Option>, molar_entropy: Option>, molar_internal_energy: Option>, density_initialization: Option, initial_temperature: Option>, ) -> FeosResult; With a lot of the logic being moved to the new traits, the use cases for the StateBuilder dwindle and I suggest to remove it.

Open Graph Description: This is something I wanted to improve on since running into some issues in phase equilibrium algorithms. The core ideas: extensive properties should not appear in the evaluation of the equations o...

X Description: This is something I wanted to improve on since running into some issues in phase equilibrium algorithms. The core ideas: extensive properties should not appear in the evaluation of the equations o...

Opengraph URL: https://github.com/feos-org/feos/pull/330

X: @github

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/checks(.:format)
route-controllerpull_requests
route-actionchecks
fetch-noncev2:e1debde8-e2ec-d962-a05d-2859a20dc929
current-catalog-service-hash87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a
request-idA2C6:502D5:1199818:17EC006:698F141B
html-safe-nonced8ca4a27ed839afa3009c1bd3f9adf8385e8e1ba66b097c2f49cf122548b51e4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkM2OjUwMkQ1OjExOTk4MTg6MTdFQzAwNjo2OThGMTQxQiIsInZpc2l0b3JfaWQiOiI2MDA2MTM3MTkyNTM5MTY1NzIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac0749bb6ff62d48363fa215b85e55f85dc9c2c7972cfca33de700063e82202d8c
hovercard-subject-tagpull_request:3100110763
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/checks
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/feos-org/feos/pull/330/checks
twitter:imagehttps://avatars.githubusercontent.com/u/69816385?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/69816385?s=400&v=4
og:image:altThis is something I wanted to improve on since running into some issues in phase equilibrium algorithms. The core ideas: extensive properties should not appear in the evaluation of the equations o...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2da1a0d1318592c9965539b12269c4641177dfabfc86c3807992efb13e1d96ff
turbo-cache-controlno-preview
go-importgithub.com/feos-org/feos git https://github.com/feos-org/feos.git
octolytics-dimension-user_id87855701
octolytics-dimension-user_loginfeos-org
octolytics-dimension-repository_id424905104
octolytics-dimension-repository_nwofeos-org/feos
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id424905104
octolytics-dimension-repository_network_root_nwofeos-org/feos
turbo-body-classeslogged-out env-production page-responsive full-width full-width-p-0
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released735bf238a2094bebd08cd3641a9ef4d1fe77e4b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeos-org%2Ffeos%2Fpull%2F330%2Fchecks
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeos-org%2Ffeos%2Fpull%2F330%2Fchecks
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Fchecks&source=header-repo&source_repo=feos-org%2Ffeos
Reloadhttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
Reloadhttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
Reloadhttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
feos-org https://patch-diff.githubusercontent.com/feos-org
feoshttps://patch-diff.githubusercontent.com/feos-org/feos
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Ffeos-org%2Ffeos
Fork 30 https://patch-diff.githubusercontent.com/login?return_to=%2Ffeos-org%2Ffeos
Star 177 https://patch-diff.githubusercontent.com/login?return_to=%2Ffeos-org%2Ffeos
Code https://patch-diff.githubusercontent.com/feos-org/feos
Issues 22 https://patch-diff.githubusercontent.com/feos-org/feos/issues
Pull requests 5 https://patch-diff.githubusercontent.com/feos-org/feos/pulls
Discussions https://patch-diff.githubusercontent.com/feos-org/feos/discussions
Actions https://patch-diff.githubusercontent.com/feos-org/feos/actions
Projects 0 https://patch-diff.githubusercontent.com/feos-org/feos/projects
Security 0 https://patch-diff.githubusercontent.com/feos-org/feos/security
Insights https://patch-diff.githubusercontent.com/feos-org/feos/pulse
Code https://patch-diff.githubusercontent.com/feos-org/feos
Issues https://patch-diff.githubusercontent.com/feos-org/feos/issues
Pull requests https://patch-diff.githubusercontent.com/feos-org/feos/pulls
Discussions https://patch-diff.githubusercontent.com/feos-org/feos/discussions
Actions https://patch-diff.githubusercontent.com/feos-org/feos/actions
Projects https://patch-diff.githubusercontent.com/feos-org/feos/projects
Security https://patch-diff.githubusercontent.com/feos-org/feos/security
Insights https://patch-diff.githubusercontent.com/feos-org/feos/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2Ffeos-org%2Ffeos%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2Ffeos-org%2Ffeos%2Fissues%2Fnew%2Fchoose
prehnerhttps://patch-diff.githubusercontent.com/prehner
developmenthttps://patch-diff.githubusercontent.com/feos-org/feos/tree/development
extensive_propertieshttps://patch-diff.githubusercontent.com/feos-org/feos/tree/extensive_properties
Conversation 0 https://patch-diff.githubusercontent.com/feos-org/feos/pull/330
Commits 2 https://patch-diff.githubusercontent.com/feos-org/feos/pull/330/commits
Checks 17 https://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
Files changed 62 https://patch-diff.githubusercontent.com/feos-org/feos/pull/330/files
Please reload this pagehttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
More rigorous treatment of extensive states https://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks#top
Please reload this pagehttps://patch-diff.githubusercontent.com/feos-org/feos/pull/330/checks
Build Wheels on: pull_request https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882779
linux https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882779/job/63356021627?pr=330
macos-x86_64 https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882779/job/63356021632?pr=330
macos-aarch64 https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882779/job/63356021614?pr=330
windows https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882779/job/63356021635?pr=330
Test on: pull_request https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826
test_crates (feos-core) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021796?pr=330
test_crates (feos-dft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021772?pr=330
test_python_bindings https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021768?pr=330
test_models (pcsaft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021918?pr=330
test_models (epcsaft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021883?pr=330
test_models (gc_pcsaft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021937?pr=330
test_models (pets) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021881?pr=330
test_models (uvtheory) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021877?pr=330
test_models (saftvrqmie) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021874?pr=330
test_models (saftvrmie) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021886?pr=330
test_models (multiparameter) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021870?pr=330
test_models_dft (pcsaft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021774?pr=330
test_models_dft (gc_pcsaft) https://patch-diff.githubusercontent.com/feos-org/feos/actions/runs/21937882826/job/63356021778?pr=330
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.