diff options
author | 2017-06-01 10:11:02 -0700 | |
---|---|---|
committer | 2017-06-01 10:11:02 -0700 | |
commit | 4b2ae8c64704c110ae6bacf817b22f089b07bfdd (patch) | |
tree | 5512b2a3f5cc76ab023c9ee809f378c030bb3d66 | |
parent | 5cf1cb42426cc94d178a8c96434aabd7c06c858e (diff) | |
download | WarpX-4b2ae8c64704c110ae6bacf817b22f089b07bfdd.tar.gz WarpX-4b2ae8c64704c110ae6bacf817b22f089b07bfdd.tar.zst WarpX-4b2ae8c64704c110ae6bacf817b22f089b07bfdd.zip |
tagging using new parameters
-rw-r--r-- | Source/WarpX.H | 4 | ||||
-rw-r--r-- | Source/WarpX.cpp | 8 | ||||
-rw-r--r-- | Source/WarpXTagging.cpp | 19 |
3 files changed, 18 insertions, 13 deletions
diff --git a/Source/WarpX.H b/Source/WarpX.H index e7238ef34..a295b513b 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -12,6 +12,7 @@ #include <AMReX_AmrCore.H> #include <AMReX_BLProfiler.H> #include <AMReX_Print.H> +#include <AMReX_RealVect.H> #include <ParticleContainer.H> #include <WarpXPML.H> @@ -259,6 +260,9 @@ private: bool plot_crsepatch = false; bool plot_raw_fields = false; + amrex::RealVect fine_tag_lo; + amrex::RealVect fine_tag_hi; + bool is_synchronized = true; }; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 03006e630..251c65a15 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -207,6 +207,14 @@ WarpX::ReadParameters () pp.query("plot_finepatch", plot_finepatch); pp.query("plot_crsepatch", plot_crsepatch); } + + if (maxLevel() > 0) { + Array<Real> lo, hi; + pp.getarr("fine_tag_lo", lo); + pp.getarr("fine_tag_hi", hi); + fine_tag_lo = RealVect{lo}; + fine_tag_hi = RealVect{hi}; + } } { diff --git a/Source/WarpXTagging.cpp b/Source/WarpXTagging.cpp index bef4b3a8b..5ac4229ef 100644 --- a/Source/WarpXTagging.cpp +++ b/Source/WarpXTagging.cpp @@ -9,13 +9,8 @@ using namespace amrex; void WarpX::ErrorEst (int lev, TagBoxArray& tags, Real time, int /*ngrow*/) { - const auto& gm = Geom(lev); - const Box& domain = gm.Domain(); - const IntVect& sz = domain.size(); - IntVect ctr = sz / 2; - - // for testing, let's tag a sphere with a radius of - const Real R = 0.025*std::min({D_DECL(sz[0],sz[1],sz[2])}); + const Real* problo = Geometry::ProbLo(); + const Real* dx = Geom(lev).CellSize(); for (MFIter mfi(tags); mfi.isValid(); ++mfi) { @@ -24,12 +19,10 @@ WarpX::ErrorEst (int lev, TagBoxArray& tags, Real time, int /*ngrow*/) for (BoxIterator bi(bx); bi.ok(); ++bi) { const IntVect& cell = bi(); - Real rsq = 0.0; - for (int idim=0; idim<BL_SPACEDIM; ++idim) { - Real d = cell[idim]-ctr[idim]+0.5; - rsq += d*d; - } - if (rsq < R*R) { + RealVect pos {AMREX_D_DECL((cell[0]+0.5)*dx[0]+problo[0], + (cell[1]+0.5)*dx[1]+problo[1], + (cell[2]+0.5)*dx[2]+problo[2])}; + if (pos > fine_tag_lo && pos < fine_tag_hi) { fab(cell) = TagBox::SET; } } |