Commit 90d2a402 authored by frey_m's avatar frey_m
Browse files

AMR: fixes the issue

parent dce80585
......@@ -20,15 +20,16 @@ AmrBoxLib::AmrBoxLib(const AmrDomain_t& domain,
const AmrIntArray_t& nGridPts,
int maxLevel,
AmrPartBunch* bunch_p)
: AmrObject(),
amrex::AmrMesh(&domain, maxLevel, nGridPts, 0 /* cartesian */),
bunch_mp(bunch_p),
layout_mp(static_cast<AmrLayout_t*>(&bunch_p->getLayout())),
rho_m(maxLevel + 1),
phi_m(maxLevel + 1),
efield_m(maxLevel + 1),
meshScaling_m(Vector_t(1.0, 1.0, 1.0)),
isFirstTagging_m(maxLevel + 1, true)
: AmrObject()
, amrex::AmrMesh(&domain, maxLevel, nGridPts, 0 /* cartesian */)
, bunch_mp(bunch_p)
, layout_mp(static_cast<AmrLayout_t*>(&bunch_p->getLayout()))
, rho_m(maxLevel + 1)
, phi_m(maxLevel + 1)
, efield_m(maxLevel + 1)
, meshScaling_m(Vector_t(1.0, 1.0, 1.0))
, isFirstTagging_m(maxLevel + 1, true)
, isPoissonSolved_m(false)
{
/*
* The layout needs to know how many levels we can make.
......@@ -534,6 +535,8 @@ void AmrBoxLib::computeSelfFields_cycl(int bin) {
ytWriter.writeBunch(bunch_mp, time, scalefactor);
}
isPoissonSolved_m = true;
}
......@@ -830,7 +833,7 @@ void AmrBoxLib::tagForPotentialStrength_m(int lev, TagBoxArray_t& tags,
* where the value of the potential is higher than 75 percent of the maximum potential
* value of this level.
*/
if ( !phi_m[lev]->ok() || this->isFirstTagging_m[lev] ) {
if ( !isPoissonSolved_m || !phi_m[lev]->ok() || this->isFirstTagging_m[lev] ) {
*gmsg << level2 << "* Level " << lev << ": We need to perform "
<< "charge tagging in the first time step" << endl;
this->tagForChargeDensity_m(lev, tags, time, ngrow);
......@@ -883,7 +886,7 @@ void AmrBoxLib::tagForEfield_m(int lev, TagBoxArray_t& tags,
* where the value of the efield is higher than 75 percent of the maximum efield
* value of this level.
*/
if ( !efield_m[lev][0]->ok() || this->isFirstTagging_m[lev] ) {
if ( !isPoissonSolved_m || !efield_m[lev][0]->ok() || this->isFirstTagging_m[lev] ) {
*gmsg << level2 << "* Level " << lev << ": We need to perform "
<< "charge tagging in the first time step" << endl;
this->tagForChargeDensity_m(lev, tags, time, ngrow);
......
......@@ -368,6 +368,8 @@ private:
// only used in case of potential and efield tagging
std::vector<bool> isFirstTagging_m;
bool isPoissonSolved_m;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment