Skip to content

[WIP] Fugacity cookbook creation - #7250

Open
anacarolinamg98eth wants to merge 6 commits into
geodynamics:mainfrom
anacarolinamg98eth:fugacity_cookbook
Open

[WIP] Fugacity cookbook creation#7250
anacarolinamg98eth wants to merge 6 commits into
geodynamics:mainfrom
anacarolinamg98eth:fugacity_cookbook

Conversation

@anacarolinamg98eth

Copy link
Copy Markdown
Contributor

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:

  • I have tested my new feature locally to ensure it is correct.
  • I have created a testcase for the new feature/benchmark in the tests/ directory.
  • I have added a changelog entry in the doc/modules/changes directory that will inform other users of my change.

Addressed Daniel's comments

Add Peng-Robinson fugacity weakening to visco-plastic rheology

Fixed Bob's comments

Remove unused fugacity output declaration
Copilot AI review requested due to automatic review settings July 30, 2026 15:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_fugacity viscosity 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.

Comment on lines +104 to +125
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);
Comment on lines +210 to +212
// The zero-pressure limit is an ideal, infinitely dilute vapor.
if (pressure == 0.0)
return 0.0;
Comment on lines +106 to +107
const double pressure_for_fugacity =
std::min(adiabatic_pressure, 2.5e9);
Comment on lines +50 to +53
/**
* Peng-Robinson fugacity of a pure fluid in Pa for each compositional field
*/
std::vector<double> fugacities;
Comment thread cookbooks/peng_robinson_fugacity/doc/peng-robinson-fugacity.md Outdated
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`.
@bangerth

Copy link
Copy Markdown
Contributor

I know nothing about fugacity, but these copilot comments are remarkably good (assuming the raised points are true).

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.

3 participants