Skip to content

Prescribed condition from initial composition#6889

Open
lhy11009 wants to merge 1 commit intogeodynamics:mainfrom
lhy11009:prescribe_from_initial_composition
Open

Prescribed condition from initial composition#6889
lhy11009 wants to merge 1 commit intogeodynamics:mainfrom
lhy11009:prescribe_from_initial_composition

Conversation

@lhy11009
Copy link
Contributor

@lhy11009 lhy11009 commented Mar 8, 2026

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.

Prescribe the composition field from the initial composition fields.

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.

@lhy11009
Copy link
Contributor Author

lhy11009 commented Mar 8, 2026

Currently, this works for the field methods, and I don't think it works for the particle method. In the test I included, I modified from the composition_passive.prm and prescribed the composition on the left half of the domain. So the left side would stay the same value while the right side is advecting.

t = 0
image

t = 10
image

@lhy11009
Copy link
Contributor Author

lhy11009 commented Mar 8, 2026

Ideally, I would want a method that works for the particle method. At least that's something I was thinking when creating the PR. However, I feel this is also useful with the field method.

Copy link
Contributor

@danieldouglas92 danieldouglas92 left a comment

Choose a reason for hiding this comment

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

This is great @lhy11009 thanks for this! I only had a few minor comments about cleaning up the test file and the formatting of things, but other then that I think looks great.

Copy link
Contributor

Choose a reason for hiding this comment

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

With the exception of the postprocessor, the mesh refinement, and of course the prescribed solutions bits, this is exactly the same file as composition_passive.prm. I would instead only keep these sections which you've changed and just put include $ASPECT_SOURCE_DIR/tests/composition_passive.prm at the top.

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 think that prm file resides in the cookbooks folder: $ASPECT_SOURCE_DIR/cookbooks/composition_passive/composition_passive.prm
I tried to include this the way you suggested, but for some reason, the test hangs forever.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry that's my mistake! I just assumed it was in the test directory. If you instead put include $ASPECT_SOURCE_DIR/cookbooks/composition_passive/composition_passive.prm does that work?

Comment on lines +109 to +123
const unsigned int first_comp =
this->introspection().component_indices.compositional_fields[0];

const unsigned int last_comp =
this->introspection().component_indices.compositional_fields[this->introspection().n_compositional_fields-1];

const auto &geometry_model = this->get_geometry_model();

for (unsigned int q=0; q<positions.size(); ++q)
{
const unsigned int component = component_indices[q];

if (component < first_comp ||
component > last_comp)
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be helpful to add some comments describing what is happening here just for future reference. At first I thought it was this was a strange way to go through the compositional fields instead of just looping over all of the compositional fields like how we do in the material model for example, but then I remembered that this is constraining the DoF's and that the components here include temperature and velocities etc.

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, these are the comments I add:
// Determine the component range corresponding to compositional fields.
// These component indices are originally mapped from local DoFs and
// determine which DoFs in the system belong to compositional fields.

@lhy11009 lhy11009 force-pushed the prescribe_from_initial_composition branch from bf0ec1e to 23b9afd Compare March 12, 2026 05:44
@lhy11009
Copy link
Contributor Author

Hi @danieldouglas92, Thanks for reviewing my changes.
See my reply on the test file and check the comments I added to the code. Otherwise, I have resolved the conversations.

@danieldouglas92
Copy link
Contributor

@lhy11009 the rest of your changes look great! Thanks for addressing them so quickly. If including the cookbook parameter file also causes the model to hang don't worry about it, but I would try adding the include statement to that cookbook file if you haven't already and see what happens.

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.

2 participants