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

Permit pgen-defined custom source terms #30

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pdmullen
Copy link
Collaborator

@pdmullen pdmullen commented Dec 17, 2024

Background

Permits custom pgen-defined source terms.

Description of Changes

Adds logic to enroll a custom pgen source term. The task is called independent of enrollment, but checks for nullptr.

Checklist

  • New features are documented
  • Tests added for bug fixes and new features
  • (@lanl.gov employees) Update copyright on changed files

Copy link
Collaborator

@brryan brryan left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me... is this ready to go now without any actual use in anticipation of (I assume) your radiating planet problem, or should we try to merge that in with this work as part of it?

@pdmullen
Copy link
Collaborator Author

pdmullen commented Dec 17, 2024

Seems reasonable to me... is this ready to go now without any actual use in anticipation of (I assume) your radiating planet problem, or should we try to merge that in with this work as part of it?

I think I'd prefer to not push the isolated planet setup. Adam and I are discussing other pgen setups that better exploit some of artemis's functionality. If the functionality in this PR is too isolated and not more generally useful to the artemis community, I would be totally fine with killing this PR.

@brryan
Copy link
Collaborator

brryan commented Dec 17, 2024

Seems reasonable to me... is this ready to go now without any actual use in anticipation of (I assume) your radiating planet problem, or should we try to merge that in with this work as part of it?

I think I'd prefer to not push the isolated planet setup. Adam and I are discussing other pgen setups that better exploit some of artemis's functionality. If the functionality in this PR too isolated and not more generally useful to the artemis community, I would be totally fine with killing this PR.

It seems to me that we want to provide a general problem-specific source function? It would just be nice to combine it with a use case so that it is, like, compiled during the CI to check that it works. Maybe we don't have an immediate idea of when such a source for a problem will be needed by us.

@adamdempsey90
Copy link
Collaborator

Seems reasonable to me... is this ready to go now without any actual use in anticipation of (I assume) your radiating planet problem, or should we try to merge that in with this work as part of it?

I think I'd prefer to not push the isolated planet setup. Adam and I are discussing other pgen setups that better exploit some of artemis's functionality. If the functionality in this PR too isolated and not more generally useful to the artemis community, I would be totally fine with killing this PR.

It seems to me that we want to provide a general problem-specific source function? It would just be nice to combine it with a use case so that it is, like, compiled during the CI to check that it works. Maybe we don't have an immediate idea of when such a source for a problem will be needed by us.

I agree it would be nice to have a working example to go with this change. I'm sure we can think of some minor source function for one of the existing test problems. Like maybe in the conduction problem, you add some heat source/sink. Or you implement some special damping function in the disk problem. Doesn't have to be something serious. But I don't feel strongly about needing something so long as you've tested separately that this works

@pdmullen
Copy link
Collaborator Author

Seems reasonable to me... is this ready to go now without any actual use in anticipation of (I assume) your radiating planet problem, or should we try to merge that in with this work as part of it?

I think I'd prefer to not push the isolated planet setup. Adam and I are discussing other pgen setups that better exploit some of artemis's functionality. If the functionality in this PR too isolated and not more generally useful to the artemis community, I would be totally fine with killing this PR.

It seems to me that we want to provide a general problem-specific source function? It would just be nice to combine it with a use case so that it is, like, compiled during the CI to check that it works. Maybe we don't have an immediate idea of when such a source for a problem will be needed by us.

I think this feature might be a nicety for some folks and is a commonly provided utility in other astro-codes.

Luckily the CI will compile the new task and its execution (but it will always trigger the nullptr pathway).

I feel goofy adding in a no-op source term to a pgen for the sole purpose of checking that the other pathway triggers correctly. Maybe we need a unique pgen dedicated to testing every possible custom enrollment, but it isn't actually a true pgen, moreso just a unit test --- but this is out-of-scope for this PR.

Copy link
Collaborator

@brryan brryan left a comment

Choose a reason for hiding this comment

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

LGTM, good feature to have. Any objections to merge @adamdempsey90?

Comment on lines +820 to +825
template <Coordinates GEOM>
TaskStatus ProblemGeneratorSourceTerm(MeshData<Real> *md, const Real time,
const Real dt) {
PARTHENON_FAIL("Disk pgen-defined source term not yet implemented!");
return TaskStatus::complete;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason why you put a stub in this pgen and not all others? I'm not sure it's needed since it's clear from the std::function in problem_modifier what the signature is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just as a demonstration. Notice that we also use the disk pgen to hold a stub for user-defined refinement criteria.

@adamdempsey90
Copy link
Collaborator

LGTM, good feature to have. Any objections to merge @adamdempsey90?

I would still like to see a modification of one of the existing tests with a super simple source term. @pdmullen is that out of the question right now?

@pdmullen
Copy link
Collaborator Author

pdmullen commented Dec 19, 2024

LGTM, good feature to have. Any objections to merge @adamdempsey90?

I would still like to see a modification of one of the existing tests with a super simple source term. @pdmullen is that out of the question right now?

This is a totally reasonable request. But I think the "right" solution here is introducing a unit_pgen.cpp that makes every possible custom enrollment that artemis supports (FYI user-defined refinement criteria are also not checked under CI currently). I am happy to delay the merge of this MR until I implement something of the sort, if you'd like.

@adamdempsey90
Copy link
Collaborator

LGTM, good feature to have. Any objections to merge @adamdempsey90?

I would still like to see a modification of one of the existing tests with a super simple source term. @pdmullen is that out of the question right now?

This is a totally reasonable request. But I think the "right" solution here is introducing a unit_pgen.cpp that makes every possible custom enrollment that artemis supports (FYI user-defined refinement criteria are also not checked under CI currently). I am happy to delay the merge of this MR until I implement something of the sort, if you'd like.

I don't see the rush in merging this, so I'm fine with waiting until the CI covers this new stuff. You could add the user defined refinement criteria to your new test too ;)

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