Skip to content

Tutorial fluid modelling #1385

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

Merged
merged 26 commits into from
May 19, 2025
Merged

Tutorial fluid modelling #1385

merged 26 commits into from
May 19, 2025

Conversation

vlipovac
Copy link
Contributor

Closes #1254

Proposed changes

Adding a tutorial for modeling of multiphase and multicomponent fluids.

Changing the configuration of phases to omit the default EquationOfState and hence simplifying the setup for models not relying on EoS computations.

Types of changes

  • Minor change (e.g., dependency bumps, broken links).
  • Bugfix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Testing (contribution related to testing of existing or new functionality).
  • Documentation (contribution related to adding, improving, or fixing documentation).
  • Maintenance (e.g., improve logic and performance, remove obsolete code).
  • Other: Tutorial

Checklist

  • The documentation is up-to-date.
  • Static typing is included in the update.
  • This PR does not duplicate existing functionality.
  • The update is covered by the test suite (including tests added in the PR).
  • If new skipped tests have been introduced in this PR, pytest was run with the --run-skipped flag.

@vlipovac vlipovac self-assigned this Mar 27, 2025
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@mariusnevland
Copy link
Contributor

Some high-level comments after the first readthrough:

  • As a complete newbie to multiphase, multicomponent flow, I do not know e.g. the difference between overall fractions and partial fractions, as well as some other technical terms. Maybe it is a good idea to state some "prerequisites" for the tutorial?

  • It is unclear to me how to use the heuristic approach in the case of multiple phases and/or components. Did I understand correctly that the default constitutive laws will stop working if I add more phases/components? If so, how can they be redefined?

  • Regarding the EoS classes, I do not understand how the return_dummy_properties() function should look like in the case of non-trivial phase properties. But otherwise, this code block was very helpful in understanding how to use the EoS framework.

  • It would be very nice to have an actual runable model in the very end, but would this significantly increase the complexity of the tutorial? Is it possible to construct some "minimal working example" that still introduces most/all of the important functionality, e.g. some relatively simple two-phase, two-component setup?

@keileg
Copy link
Contributor

keileg commented Apr 3, 2025

Thanks for the feedback @mariusnevland. I'll have a look and keep your comments in mind.

@keileg
Copy link
Contributor

keileg commented Apr 4, 2025

Most important: This will become extremely useful for everyone as we introduce more advanced fluid modeling.

I only managed to read half the tutorial before I had to run, will try to cover the second half no later than Monday. I tried to keep the comments on a high level, it seems to me we should focus on getting the context and general disposition of the tutorial right before getting into details.

@keileg
Copy link
Contributor

keileg commented Apr 7, 2025

I left a few more comments. @vlipovac I suggest we discuss how to approach this PR at some point.

@vlipovac
Copy link
Contributor Author

Some high-level comments after the first readthrough:

  • As a complete newbie to multiphase, multicomponent flow, I do not know e.g. the difference between overall fractions and partial fractions, as well as some other technical terms. Maybe it is a good idea to state some "prerequisites" for the tutorial?
  • It is unclear to me how to use the heuristic approach in the case of multiple phases and/or components. Did I understand correctly that the default constitutive laws will stop working if I add more phases/components? If so, how can they be redefined?
  • Regarding the EoS classes, I do not understand how the return_dummy_properties() function should look like in the case of non-trivial phase properties. But otherwise, this code block was very helpful in understanding how to use the EoS framework.
  • It would be very nice to have an actual runable model in the very end, but would this significantly increase the complexity of the tutorial? Is it possible to construct some "minimal working example" that still introduces most/all of the important functionality, e.g. some relatively simple two-phase, two-component setup?

@mariusnevland

  1. I have added some links in the tutorial to the implementation of various fractions. The docstring take care of the formal definition.
  2. There are a couple of notes after the implementation of FluiDensityFromPressure is discussed, They cover your concerns. It does not stop working, but all phases get the same properties assigned. for more phases, you need to define more functions inside the factory method, and then return the right one depending on the argument phase. Please have a look again and let me know if it is still not clear.
  3. The return dummy is just a placeholder to return some values so that prepare_simulation() can be called. In essence you just have to return a filled PhaseProperties instance with all the values from your computation.
  4. Yes it would, it's not a trivial task to set a thermodynamic model for multiphase flow. I am not sure we want to have that as part of a tutorial, if there is nothing in the source code (so far).

@vlipovac vlipovac requested a review from keileg May 8, 2025 10:15
@vlipovac vlipovac merged commit febb87b into develop May 19, 2025
6 checks passed
@vlipovac vlipovac deleted the tutorial_fluid_modelling branch May 19, 2025 10:12
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

Successfully merging this pull request may close these issues.

Tutorial on how to create general fluid objects for porepy models.
3 participants