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

Use squeryWithParser instead of squeryval in pp_make_parser #4060

Conversation

AlexanderSinn
Copy link
Member

Summary

When an input parameter refers to a user constant or another input parameter, this change will enable the user constant/second parameter to contain spaces without the need for "" instead of only parsing it up to the first space.

Additional background

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@WeiqunZhang
Copy link
Member

I am not sure this is desired. The issue is we get different values depending on whether we query it directly or indirectly.

@AlexanderSinn
Copy link
Member Author

Right now, one would get different values compared to using queryWithParser directly. My thinking is that ignoring part of the input (after space) makes no sense for constants, as they are always scalar. At least there should be an assert that there is no space.

@WeiqunZhang
Copy link
Member

WeiqunZhang commented Aug 1, 2024 via email

@AlexanderSinn
Copy link
Member Author

That would still have the issue as it is possible for constants to be used by multiple parameters.

# works with pp.queryWithParser, silently incorrect with pp.query
my_constants.kp_inv = clight / wp
my_constants.kp = wp / clight
my_constants.wp = sqrt( ne * q_e^2/(m_e *epsilon0) )
my_constants.ne = 1.0505e23
# pp.query
geometry.prob_lo     = -18*kp_inv   -18*kp_inv   -1.5*kp_inv
# pp.query
geometry.prob_hi     =  18*kp_inv    18*kp_inv    1.5*kp_inv 
# pp.queryWithParser
laser.w0 = 3 * kp_inv 
# pp.query, would be kp_inv with amrex develepment, 2.083*kp_inv with this PR, ideally this would give an error
laser.L0 = -prob_lo/18 

@WeiqunZhang
Copy link
Member

Maybe add a new method, queryarrWithParser?

@AlexanderSinn
Copy link
Member Author

Yes it would be nice to have a parser function for an array that asserts that the length of the input is correct.

@WeiqunZhang
Copy link
Member

@AlexanderSinn Could you give #4073 a try?

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