amrex icon indicating copy to clipboard operation
amrex copied to clipboard

MFIter::allow_multiple_mfiters' failed

Open wuxf99 opened this issue 4 years ago • 8 comments

0::Assertion `depth == 1 || MFIter::allow_multiple_mfiters' failed, file "/home/wuxf/amrex/Src/Base/AMReX_MFIter.cpp", line 254, Msg: "Nested or multiple active MFIters is not supported by default. This can be changed by calling MFIter::allowMultipleMFIters(true)". !!! SIGABRT

Any comments about how to fix it?

wuxf99 avatar Jan 21 '21 22:01 wuxf99

This is usually a bug in the user's code. The assertion is there to prevent common bugs like below

for (MFIter mfi(...) ....) {
     for (MFIter ....) {}; // or a function that contains MFIter loop
}

The error message has already provided a way to get around it if the pattern above is not a bug for you.

WeiqunZhang avatar Jan 21 '21 23:01 WeiqunZhang

I see, thanks. I don't think my code has a bug. This assertion caused the crash of my code. When I added MFIter::allowMultipleMFIters(true) before the assertion, it works well.

wuxf99 avatar Jan 22 '21 00:01 wuxf99

I am curious and would like to understand how our users are using it. Do you mind show us some code snippets?

WeiqunZhang avatar Jan 22 '21 00:01 WeiqunZhang

I used the AMReX to configure the latest FLASH (FLASHX).

wuxf99 avatar Jan 22 '21 18:01 wuxf99

I see. There is a Fortan wrapper, amrex_mfiter_allow_multiple in amrex_multifab_module.

WeiqunZhang avatar Jan 22 '21 18:01 WeiqunZhang

@wuxf99 I think this can be closed?

kweide avatar Apr 27 '21 18:04 kweide

Yes.

Thanks, Xingfu

On Apr 27, 2021, at 1:37 PM, Klaus @.***> wrote:

 @wuxf99 I think this can be closed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

wuxf99 avatar Apr 27 '21 19:04 wuxf99

Hi, I had the same error message and wanted to know what caused it as I could not find obvious programming errors.

It turned out that I've used phi.setVal(0.0) and MultiFab::Copy(...) inside the mfiter loop. Moving these out of the loop solved the issue.

Hope this helps others. Nils

nw236 avatar Feb 11 '22 11:02 nw236