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

Error in DerivedVariable Definition with curl Function in derived_merged Branch #55

Open
hxu65 opened this issue Feb 23, 2024 · 0 comments

Comments

@hxu65
Copy link
Collaborator

hxu65 commented Feb 23, 2024

Description:
When executing the gray_scott simulation using the hermes_derived engine or bp5_derived engine in the derived_merged branch, the program terminates unexpectedly due to a std::out_of_range exception. This issue arises specifically when using the curl function in the Adios2 repo "source/adios2/toolkit/derived/parser/lexer.l".

ADIOS2 DefineDerivedVariable definition:

#ifdef ADIOS2_HAVE_DERIVED_VARIABLE
VariableDerived IO::DefineDerivedVariable(const std::string &name, const std::string &expression,
                                          const DerivedVarType varType)
{
    helper::CheckForNullptr(m_IO,
                            "for variable name " + name + ", in call to IO::DefineDerivedVariable");

    return VariableDerived(&m_IO->DefineDerivedVariable(name, expression, varType));
}

we run adios with derived quantities defined like this:

auto PDFU = io.DefineDerivedVariable("derive/pdfU",
                                             "x:U \n"
                                             "curl(10, x)",
                                             adios2::DerivedVarType::StoreData);
auto PDFV = io.DefineDerivedVariable("derive/pdfV",
                                             "x:V \n"
                                             "curl(10, x)",
                                             adios2::DerivedVarType::StoreData);

Steps to Reproduce:
Checkout the derived_merged branch.
Run the gray_scott simulation with either the hermes_derived or bp5_derived engine.
Observe the program termination and error message:

terminate called after throwing an instance of 'std::out_of_range'
what(): map::at

The error occurs at: writer.cpp#L101, when defining DerivedVariable with curl(10,x).

Expected Behavior:
The program should execute without errors, allowing DerivedVariable definitions with the curl function.

Actual Behavior:
The program terminates with a std::out_of_range exception when a DerivedVariable is defined using the curl function.

Environment Details:
ADIOS2: ADIOS2@master with derived enable in spack
Hermes: Hermes@master
Branch: derived_merged
Engines: hermes_derived, bp5_derived
File/Code Reference: writer.cpp#L101

Potential Solution/Workaround:

  1. Modify the DerivedVariable definition to use the magnitude function instead of curl bypasses the issue, suggesting the problem lies with the curl function handling. Example workaround:
auto PDFU = io.DefineDerivedVariable("pdfU",
                                     "x:U \n"
                                     "magnitude(x)",
                                     adios2::DerivedVarType::StoreData);
auto PDFV = io.DefineDerivedVariable("pdfV",
                                     "x:V \n"
                                     "magnitude(x)",
                                     adios2::DerivedVarType::StoreData);
  1. add function definition in adios2 repo: /source/adios2/toolkit/derived/Function.h
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

1 participant