amrex
amrex copied to clipboard
Extruding 2-d checkpoint data to 3-d
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.
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.
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()
?
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?
@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
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.
@WeiqunZhang Thanks. So basically I compile in 3D but using generic, dimension agnostic readers inside the script. Is that correct?
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.
@WeiqunZhang thanks. Could you point me to the exact function that does the readimg?
PlotFileData::get() in AMReX_PlotFileUtil.H
thanks! @drummerdoc
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