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

graceful error/warning when plot variable name is undefined #3

Open
bezmi opened this issue Nov 9, 2021 · 1 comment
Open

graceful error/warning when plot variable name is undefined #3

bezmi opened this issue Nov 9, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bezmi
Copy link
Contributor

bezmi commented Nov 9, 2021

I've noticed some weirdness when defining plot['variables'] in an inputs file:

plot={
    variables={
        'charge-electron',
        'blah',
    },
    functions={},
}

We ask for a variable 'blah' that doesn't exist. Note that it is not in the {variable}-{state_name} syntax. In this case, MFP::getPlotData() will create an empty box in dat_arrays for this variable name and pass it to all of the states with the State::get_state_values() function.

None of the states will touch this box, as its name does not contain any state names. The empty box gets passed to amrex when writing the plotfile, which tries to calculate the minimum and maximum values in the box. Since the values in the box are all undefined, this function will crash randomly.

I think that we should rework how we handle the parsing of the plot variables. MFP_global should parse the variable names and store them linked to their respective states via an index. This will also allow graceful errors/warning messages when a non-existent variable is requested for plotting.

@bezmi bezmi added the bug Something isn't working label Nov 9, 2021
@darylbond
Copy link
Contributor

this fix sounds good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants