From f4c6bec9b11cdce57395d6e43a1ba65807def649 Mon Sep 17 00:00:00 2001 From: psharda Date: Fri, 12 Jan 2024 18:51:44 +0100 Subject: [PATCH] move phi declaration to initial conditions --- src/simulation.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/simulation.hpp b/src/simulation.hpp index 989527d26..c838785f8 100644 --- a/src/simulation.hpp +++ b/src/simulation.hpp @@ -577,6 +577,14 @@ template void AMRSimulation::setInitialCondition ReadCheckpointFile(); } + phi.resize(finest_level + 1); + const int nghost = 1; + const int ncomp = 1; + for (int lev = 0; lev <= finest_level; ++lev) { + phi[lev].define(grids[lev], dmap[lev], ncomp, nghost); + phi[lev].setVal(0); // set initial guess to zero + } + // abort if amrex.async_out=1, it is currently broken if (amrex::AsyncOut::UseAsyncOut()) { amrex::Print() << "[ERROR] [FATAL] AsyncOut is currently broken! If you want to " @@ -913,7 +921,6 @@ template void AMRSimulation::ellipticSolveAllLev } // solve Poisson equation with open b.c. using the method of James (1977) - phi.resize(finest_level + 1); amrex::Vector rhs(finest_level + 1); const int nghost = 1; const int ncomp = 1;