Closed ztdepztdep closed 2 months ago
First, you need to make sure phi_old does not contain NaNs. In the AmrCore example, we do not initialize phi_old because it is not needed. But if you want to save phi_old in plotfiles, you need to initialize phi_old every time you remake an old level or creating a new level from scratch.
The modification to PlotFileMF will not work even if phi_old has no NaNs. The returned vector must have the size of finest_level+1
, not 2*(finiest_level+1)
, because it is expected to have one MulitFab per level. There are two approaches you can take. You can put phi_new and phi_old in the same MultiFab. Or you can create a temporary 2 components MultiFab for plotfiles. For example, https://github.com/AMReX-Codes/amrex/blob/2a3955a5f5aac1aef6e6e72687f182331e049c39/Tests/LinearSolvers/ABecLaplacian_C/MyTestPlotfile.cpp#L31.
In the amrcore exaples, I want to add the phi_old to the output file. In the "PlotFileMF()" function, i add the following line, but it seems doesn't work. the "phi_old" variable take nan values in visit.