[WIP] Fugacity cookbook creation - #7250
Conversation
Addressed Daniel's comments Add Peng-Robinson fugacity weakening to visco-plastic rheology Fixed Bob's comments Remove unused fugacity output declaration
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a new Peng–Robinson (1976) water-fugacity-based viscosity-prefactor scheme, exposes fugacity as a named additional material output, and provides a cookbook + regression test demonstrating fugacity-driven weakening in a simplified subduction setup.
Changes:
- Implement
peng_robinson76_fugacityviscosity prefactor option (including EOS parameters and fugacity evaluation). - Add a named additional material output (
fugacity) and wire it into the visco-plastic rheology. - Add a cookbook (with/without fugacity) plus a new test case and supporting references.
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/peng_robinson76_fugacity/statistics | Adds baseline statistics for the new regression test. |
| tests/peng_robinson76_fugacity/screen-output | Adds expected screen output for the new regression test. |
| tests/peng_robinson76_fugacity.prm | New test parameter file exercising the new viscosity prefactor scheme. |
| source/material_model/rheology/visco_plastic.cc | Wires fugacity additional output creation/filling into visco-plastic evaluation. |
| source/material_model/rheology/compositional_viscosity_prefactors.cc | Implements the Peng–Robinson fugacity scheme + parameter declarations/parsing. |
| source/material_model/additional_outputs/peng_robinson_fugacity76.cc | Implements the new named additional output container for fugacity. |
| include/aspect/material_model/rheology/visco_plastic.h | Minor formatting adjustments in comments/whitespace. |
| include/aspect/material_model/rheology/compositional_viscosity_prefactors.h | Documents and declares fugacity-related APIs and scheme enum entry. |
| include/aspect/material_model/additional_outputs/peng_robinson_fugacity76.h | Declares the fugacity additional output type. |
| doc/sphinx/references.bib | Adds bib entries cited by the new cookbook and scheme documentation. |
| cookbooks/peng_robinson_fugacity/peng-robinson-no-fugacity.prm | Adds the “control” model input without fugacity weakening. |
| cookbooks/peng_robinson_fugacity/peng-robinson-fugacity.prm | Adds the model input enabling fugacity weakening + EOS parameters. |
| cookbooks/peng_robinson_fugacity/doc/peng-robinson-fugacity.md | Adds cookbook documentation explaining setup, formulation, and comparison. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const double adiabatic_pressure = | ||
| this->get_adiabatic_conditions().pressure(in.position[q]); | ||
| const double pressure_for_fugacity = | ||
| std::min(adiabatic_pressure, 2.5e9); | ||
|
|
||
| // The parameters contain r/n, so the viscosity dependence is | ||
| // f^(-r/n). | ||
| const double viscosity_fugacity_exponent = modified_flow_laws == diffusion | ||
| ? | ||
| -diffusion_water_fugacity_exponents[composition_index] | ||
| : | ||
| -dislocation_water_fugacity_exponents[composition_index]; | ||
|
|
||
| const double point_water_fugacity = | ||
| compute_fugacity(in.temperature[q], pressure_for_fugacity); | ||
|
|
||
| // Apply the raw fugacity in Pa without reference-fugacity | ||
| // normalization. Consequently, creep-law prefactors must be | ||
| // calibrated for fugacity expressed in Pa. | ||
| factored_viscosities = | ||
| base_viscosity | ||
| * std::pow(point_water_fugacity, viscosity_fugacity_exponent); |
| // The zero-pressure limit is an ideal, infinitely dilute vapor. | ||
| if (pressure == 0.0) | ||
| return 0.0; |
| const double pressure_for_fugacity = | ||
| std::min(adiabatic_pressure, 2.5e9); |
| /** | ||
| * Peng-Robinson fugacity of a pure fluid in Pa for each compositional field | ||
| */ | ||
| std::vector<double> fugacities; |
| cookbooks/peng_robinson_fugacity/peng-robinson-no-fugacity.prm | ||
| ``` | ||
|
|
||
| The model with fugacity writes to `output-peng-robinson-fugacity`, and the reference model writes to `output-peng-robinson-no-fugacity`. |
|
I know nothing about fugacity, but these copilot comments are remarkably good (assuming the raised points are true). |
Pull Request Checklist. Please read and check each box with an X. Delete any part not applicable. Ask on the forum if you need help with any step.
I added a new cookbook demonstrating the viscosity-weakening effects of fluid fugacity in a simplified subduction setting. It compares otherwise identical models with and without Peng–Robinson fugacity weakening and documents the model setup, rheological formulation, pressure limitation, and resulting viscosity differences.
This is my first draft of the cookbook, so I would particularly appreciate feedback on the wording, organization, and level of technical detail. Please let me know if any sections would benefit from additional explanation, simplification, or restructuring.
Before your first pull request:
For all pull requests:
If yes, please describe your usage of AI models in the creation of this pull request
For new features/models or changes of existing features: