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

NaN values encountered when trying to setup user-defined auxiliary variables #2982

Open
RemiLehe opened this issue Oct 23, 2024 · 2 comments

Comments

@RemiLehe
Copy link

RemiLehe commented Oct 23, 2024

First of all, thanks a lot for developing Castro ; the code is very useful to me!

I recently tried to use auxiliary variables (described in this page of the documentation, accessed with UFX, etc.). More specifically, I did a small test where I started from the 1D Sedov example and added an auxiliary variable that is supposed to mirror exactly eint_e(as a way to check that the variable behaves as expected): see changes in the commit below
RemiLehe@ccfd30f

However, when running this example, I get an error message:

amrex::Abort::0::State has NaNs in the rho_myenerg component::check_for_nan() !!!

Is this expected? Is there a way to work around this?

How to easily reproduce this issue

Clone my fork from Castro and switch to the branch test_aux_variables (this branch is identical to the current main branch of Castro, but with the additional commit listed above). Then run the 1d Sedov cylindrical test.

git clone https://github.com/RemiLehe/Castro
git submodule update --init
cd Castro/Exec/hydro_tests/Sedov
git checkout test_aux_variables
make DIM=1 -j 4
./Castro1d.gnu.MPI.ex inputs.1d.cyl
@yut23
Copy link
Collaborator

yut23 commented Oct 23, 2024

Thanks for the easy reproduction instructions, they help a lot!

My first step for debugging is always to build with DEBUG=TRUE and run with amrex.fpe_trap_{invalid,zero,overflow}=1. This adds runtime bounds checks, fills uninitialized arrays with NaNs, and makes any floating-point exceptions immediately trigger a crash. With those, the backtrace points to https://github.com/AMReX-Astro/Microphysics/blob/533f712d2d217ea4f4063f3a809eb16a839c9ef6/EOS/eos_composition.H#L73, which looks like division by zero. The problem is that your single species has Z=0, so sum is always zero.

If I set Z=1.0 in species.net, it makes it through the initialization. However, it still crashes at https://github.com/RemiLehe/Castro/blob/ccfd30fb9d6f236c493bc771305b8edc1fe7caea/Exec/hydro_tests/Sedov/problem_source.H#L36 with the error message amrex::Abort::0:: (-1,0,0,1) is out of bound (0:31,0:0,0:0,0:8) !!!, so it looks like state doesn't have any ghost cells. I'm not sure where this should be addressed myself, but one of the other developers should be able to help.

@RemiLehe
Copy link
Author

Great, thanks a lot!
Let me know if there is any additional test I can to do to help.

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

2 participants