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

When outputting a variable, Parthenon also outputs all versions with suffixes #1032

Open
bprather opened this issue Mar 25, 2024 · 1 comment

Comments

@bprather
Copy link
Collaborator

TIL this wasn't an intentional feature. I agree with the voiced consensus upon discussing it, which is that we should support a more explicit form of this trick.

When outputting variables, one specifies a list:

variables = my.variable.1, my.variable.2, another.variable

However, if your code contains the variables above, it will actually still output them all if given only the prefix:

variables = my.variable, another.variable

That is, given name, parthenon outputs all variables which match name*.

While disgusting, this is actually also really convenient. By naming variables prims.rho, prims.u, etc I can ensure that regardless of which are enabled or the theory I'm evolving, all primitive variables will be output so long as I specify a list prims, etc, etc. However, it's definitely more bug than feature, and can be a problem if you have variables with suffixes (in my case, I discovered it by naming fields prims.B and prims.Bf for faces).

Thus it seems like we should replace the limited-match behavior with globbing. i.e., rather than treat prims == prims*, require the user to write prims* if they actually want to match all suffixes. Note some jerk may also expect support for prims.*.face or *.B* or other monstrosities (or god forbid regex) so we should decide where the madness stops, and implement/document a suitable compromise.

@pgrete
Copy link
Collaborator

pgrete commented Mar 27, 2024

I also wasn't aware of this "feature" and am in favor of keeping (but documenting/properly implementing it).
The constraint might be to disallow * in the variable names (which is probably a good idea anyway).

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

No branches or pull requests

2 participants