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

No final output files #2608

Closed
AMReX-Fusion opened this issue Jan 31, 2022 · 2 comments · Fixed by #2609
Closed

No final output files #2608

AMReX-Fusion opened this issue Jan 31, 2022 · 2 comments · Fixed by #2609

Comments

@AMReX-Fusion
Copy link

Hello,

I am trying a simple Sedov test on my Ubuntu in Windows Subsystem for Linux (WSL) and Castro doesn't want to produce proper output files. It creates only temporary output files:

drwxrwxrwx 1 ondrej ondrej 512 Jan 31 15:08 sedov_1d_sph_chk00000.temp
drwxrwxrwx 1 ondrej ondrej 512 Jan 31 15:09 sedov_1d_sph_chk00119.temp
drwxrwxrwx 1 ondrej ondrej 512 Jan 31 15:08 sedov_1d_sph_plt00000.temp
drwxrwxrwx 1 ondrej ondrej 512 Jan 31 15:09 sedov_1d_sph_plt00119.temp

I digged a bit into the AMReX code and found the following.
In "AMReX_Amr.cpp" around line 1044 the code the "std::rename(pltfileTemp.c_str(),pltfile.c_str())" returns -1, that is "Error: Permission denied".
Do you have an idea what can go wrong?

On one forum I found that this can happen when a previously opened file was opened but not closed.
Can this be an issue?
https://stackoverflow.com/questions/11840611/permission-denied-for-rename-function-in-c-on-windows/13383026

Thanks

@AMReX-Fusion
Copy link
Author

AMReX-Fusion commented Jan 31, 2022

Actually I found the culprit.

I am not sure if this was intended, but currently the HeaderFile of the output directory opened on line 987 is not closed before "std::rename(xxx,yyy)" is called. Since this file resides in the "_plt" folder, it effectively blocks the renaming of the folder.

I suggest to close it on line 1039:

HeaderFile.close()

The same case is with the "_chk" output folders. So there are actually errors on two places.

https://stackoverflow.com/questions/24509989/rename-function-doesnt-work-using-c

@WeiqunZhang
Copy link
Member

Thanks for reporting this and finding the culprit!

WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this issue Jan 31, 2022
The file stream for the header must be closed before the parent directory
can be renamed.

Closes AMReX-Codes#2608
WeiqunZhang added a commit that referenced this issue Jan 31, 2022
The file stream for the header must be closed before the parent directory
can be renamed.

Closes #2608
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

Successfully merging a pull request may close this issue.

2 participants