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

Add Tian Parametrization to Reactive Fluid Transport #5313

Merged
merged 4 commits into from Feb 27, 2024

Conversation

danieldouglas92
Copy link
Contributor

@danieldouglas92 danieldouglas92 commented Jul 14, 2023

Implement a solid-fluid reaction scheme that uses parametrized phase diagrams from Tian et al., 2019 https://doi.org/10.1029/2019GC008488.

A comparison between the peridotite phase diagram defined in the study and the ASPECT reproduction are shown below. Note that the y-axis is inverted in the ASPECT models since pressure increases with depth. The low-res output shows what is implemented as a test, and the high-res output is shown for better comparison to the study.

image image image

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.

Describe what you did in this PR and why you did it.

Before your first pull request:

For all pull requests:

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.

@danieldouglas92 danieldouglas92 changed the title Add Tian Parametrization to Reactive Fluid Transport [WIP] Add Tian Parametrization to Reactive Fluid Transport Jul 14, 2023
Copy link
Contributor

@naliboff naliboff left a comment

Choose a reason for hiding this comment

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

@danieldouglas92 - Thanks for the contribution and at first glance the PR is in good shape. I made comments on the portions specific to the Tian et al. implementation. For now, a number of comments about documentation. Let's discuss how to proceed after #5245 is ready to be merged.

source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
tests/tian_approximation.prm Outdated Show resolved Hide resolved
@anne-glerum anne-glerum added this to In Progress in Fluids and Melts Feb 23, 2024
@danieldouglas92 danieldouglas92 force-pushed the tian_parametrization branch 2 times, most recently from a1c8993 to e0ac649 Compare February 23, 2024 20:42
Copy link
Contributor

@naliboff naliboff left a comment

Choose a reason for hiding this comment

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

@danieldouglas92 - Thanks for continuing the work on this and including all of the tests! Overall, I think the structure of the code is in good shape and the PR is not far off from being after some moderate revisions.

I have some initial comments throughout, but one thing that stood out is that some of the code in your commits is not related to the Tian approximation and may have been introduced during a rebase?

doc/modules/changes/20230714_danieldouglas92 Outdated Show resolved Hide resolved
@@ -137,6 +141,10 @@ namespace aspect

// Time scale for fluid release and absorption.
double fluid_reaction_time_scale;
double max_peridotite_water;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
double max_peridotite_water;
// Parameters for Tian et al. 2018 (tian_approximation) reactive fluid transport scheme
double max_peridotite_water;

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should rename these variables to something like tian_max_peridotite water to avoid confusion with other schemes that involve volatiles, or perhaps these variables are general enough to be reused for other schemes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspect that at least for now they're specific to the Tian scheme

// at any point (stored in the melt_fractions vector) is
// equal to the sum of the bound fluid content and porosity.
const unsigned int bound_fluid_idx = this->introspection().compositional_index_for_name("bound_fluid");
// A fluid-rock reaction model where no reactions occur.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this part of this PR, or was it included as part of a rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh I must have made a mistake resolving the merge conflicts! good catch

source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
@@ -137,6 +141,10 @@ namespace aspect

// Time scale for fluid release and absorption.
double fluid_reaction_time_scale;
double max_peridotite_water;
double max_gabbro_water;
Copy link
Contributor

Choose a reason for hiding this comment

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

Look farther ahead, it looks like this and the other variables below are currently not being used to enforce upper limits? Is the plan to add them in a forthcoming commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are used in the function tian_equilibrium_bound_water_content() to limit the bound water for the respective rock type.

source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
@@ -246,12 +356,26 @@ namespace aspect
"computed. If the model does not use operator splitting, this parameter is not used. "
"Units: yr or s, depending on the ``Use years "
"in output instead of seconds'' parameter.");
prm.declare_entry ("Maximum weight percent sediment", "3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the plan to automatically convert these values to a true fraction (i.e., 0.03) down the line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is already done in the function tian_equilibrium_bound_water_content, I figured it was more intuitive to input weight % as a % instead of a fraction, but I'm not attached to it if you think a fraction is a better convention

Copy link
Contributor

@naliboff naliboff left a comment

Choose a reason for hiding this comment

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

@danieldouglas92 - Thanks for the updates and this is getting much closer. I added another round of comments, and after that will probably only need to look at it once more (@jdannberg - can you also take a look at some point)? Thanks!

doc/modules/changes/20230714_danieldouglas92 Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
{
AssertThrow(this->get_material_model().is_compressible() == false,
ExcMessage("The Fluid-reaction scheme zero solubility must be used with an incompressible base model."));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was a mistake! Thanks for catching that

tests/tian_MORB.prm Outdated Show resolved Hide resolved
tests/tian_peridotite.prm Outdated Show resolved Hide resolved

# Post processing
subsection Postprocess
set List of postprocessors = visualization, composition statistics, velocity statistics
Copy link
Contributor

Choose a reason for hiding this comment

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

The visualization files are included in this PR, but would be great to have so the data to reproduce the figures can be quickly plotted without running the models. Also, I would output in ascii rather than vtu format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually didn't mean to include the visualization postprocessor, if you think it would be worth it I can output it to ASCII but I don't think it's necessary for the tests to be effective so I can just remove it

tests/tian_peridotite.prm Outdated Show resolved Hide resolved
@naliboff
Copy link
Contributor

@danieldouglas92 - To follow up on a comment from my last review, I think it would be really useful to include some figures in the discussion to show how running the tests at higher resolutions can be used to reproduce the figures in the Tian paper. You could also include the python script showing how to make the plots, and then later add it is as part of a new cookbook.

Copy link
Contributor

@jdannberg jdannberg left a comment

Choose a reason for hiding this comment

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

Thank you for adding this to ASPECT. I've made some suggestions, but otherwise this looks good to me!

include/aspect/material_model/reactive_fluid_transport.h Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
source/material_model/reactive_fluid_transport.cc Outdated Show resolved Hide resolved
tests/tian_peridotite.prm Outdated Show resolved Hide resolved
Copy link
Contributor

@jdannberg jdannberg left a comment

Choose a reason for hiding this comment

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

Looks good to me (other than the two typos)!

include/aspect/material_model/reactive_fluid_transport.h Outdated Show resolved Hide resolved
include/aspect/material_model/reactive_fluid_transport.h Outdated Show resolved Hide resolved
@jdannberg
Copy link
Contributor

But I agree with @naliboff, it would be great to include an output of one of the tests in the discussion in this pull request, just so that we have a documentation of how it looks like in relation to the figures from the Tian model.

@danieldouglas92
Copy link
Contributor Author

But I agree with @naliboff, it would be great to include an output of one of the tests in the discussion in this pull request, just so that we have a documentation of how it looks like in relation to the figures from the Tian model.

Updated it in the initial PR message!

@naliboff naliboff merged commit 0d29d13 into geodynamics:main Feb 27, 2024
7 checks passed
Fluids and Melts automation moved this from In Progress to Done Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants