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

Extruding 2-d checkpoint data to 3-d #2331

Closed
RSuryaNarayan opened this issue Sep 15, 2021 · 11 comments
Closed

Extruding 2-d checkpoint data to 3-d #2331

RSuryaNarayan opened this issue Sep 15, 2021 · 11 comments

Comments

@RSuryaNarayan
Copy link

Hello everyone,

Is there a way to read a 2-D checkpoint and convert it into a 3-D checkpoint by extruding it uniformly along the third direction?

Thanks a lot.

@WeiqunZhang
Copy link
Member

Could you be more specific about the format of your checkpoint files? The 2D MultiFab data written with 2D VisMF::Write can be read with 3D `VisMF::Read. The result will be a 3D MulitFab with one cell and zero ghost cells in the z-direction. One can then write a function to extend the data to 3d. We will show you how to do this later. But the first thing it to read the data.

@RSuryaNarayan
Copy link
Author

Hello, a follow up on this. If I were to do this on a plotfile instead (i.e. take a 2-D plotfile and just convert it to 3D with one cell along the third direction), could I still use VisMF::Read()?

@drummerdoc
Copy link
Member

The plot files are read with VisMF::Read, or you can manually read them directly. There are several pieces of data in the plot file Header (ascii) files that are 2D specific, so to read a 2D plot file with a code compiled for 3D, you'd have to manually edit the corresponding fields in the Header.

Your question here is a little ill-formed though. Can you rephrase?

@RSuryaNarayan
Copy link
Author

RSuryaNarayan commented Sep 13, 2022

@drummerdoc basically I'm looking for a standalone AMReX script that takes in 2D plotfile data and just extrudes it to 3D (with only 1 cell along the third direction). Specifically, I'd be using Pele plotfiles.

Basically trying to hack my way through to circumvent the 2D specific problem that arises when I try to run AmrDeriveSpectrum

@WeiqunZhang
Copy link
Member

You can read a 2d plotfile with PlotFileData in an executable compiled for 3d. The class in AMReX_PlotFileUtil.H. Once you have the data and meta-data in memory, you can write out a true 3d plotfile if you want.

@RSuryaNarayan
Copy link
Author

@WeiqunZhang Thanks. So basically I compile in 3D but using generic, dimension agnostic readers inside the script. Is that correct?

@WeiqunZhang
Copy link
Member

WeiqunZhang commented Sep 13, 2022

Right. The reader is dimension agnostic if it's compiled in 3d. If the reader is compiled in 2d, it won't read 3d data.

@RSuryaNarayan
Copy link
Author

@WeiqunZhang thanks. Could you point me to the exact function that does the readimg?

@drummerdoc
Copy link
Member

PlotFileData::get() in AMReX_PlotFileUtil.H

@RSuryaNarayan
Copy link
Author

thanks! @drummerdoc

@RSuryaNarayan
Copy link
Author

RSuryaNarayan commented Sep 14, 2022

Thanks for the inputs @drummerdoc and @WeiqunZhang I finally wrote some code that works. Posting it for the benefit of other users: https://github.com/RSuryaNarayan/AMReX-Pseduo3D which does the job

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

3 participants