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

Maths parser support #6

Open
ShaunD137 opened this issue Nov 6, 2024 · 2 comments
Open

Maths parser support #6

ShaunD137 opened this issue Nov 6, 2024 · 2 comments

Comments

@ShaunD137
Copy link

It would be helpful if in-line calculations in the input.deck were processed into the result. For example the input.deck might define.

omega = 2.0 * pi * c / (1.0e-6) 

But epydeck will read that as a string instead of calculating the value of 1.88 * 10^15. Also support for variables that reference previous sections would help.

#size of domain
x_min = -4e-6
x_max =  20e-6
y_min = -12e-6
y_max = -y_min

and

number_density = number_density(Electron) / 6

Which sets the number density of one species to be 1/6 the number density of the electron species.

Additional Request:
It would also be useful if this functionality would include EPOCH defined functions such as the critical() function:

$$\text{critical}(\omega) = \frac{\omega^2 m_e \epsilon_0}{e^2}$$

@JoelLucaAdams
Copy link
Collaborator

This is definitely an interesting issue that I think could be beneficial although I worry about some of the overhead it might cause by trying to parse everything. I think we should consider it being a function that either gets called exclusively by the user to convert the data or a parameter that is turned off by default and can be called during import deck.load(f, parse_maths=true).

In terms of libraries to use I'm thinking that the scipy library for constants (these could also be coded by hand as there aren't that many according to the docs) and to parse the functions we use the sympy library.

@ZedThree
Copy link
Member

ZedThree commented Nov 7, 2024

Yes, I think we'd have to have it turned off by default.

This might get complicated. I think Stuart Morris has a C++ implementation of the EPOCH parser, might be worth contacting him to see if we can use it here?

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

3 participants