Skip to content

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

@bezmi

Description

@bezmi

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions