Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Source/CAMR.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include "prob_parm.H"

enum StateType { State_Type = 0,
Source_Type,
Work_Estimate_Type,
NUM_STATE_TYPE };

// Create storage for all source terms.
Expand Down Expand Up @@ -133,10 +131,6 @@ public:
// previously exist
void init () override;

// Initialize EB geometry for finest_level and level grids for
// other levels for the Amr class to do timed load balances.
int WorkEstType () override { return Work_Estimate_Type; }

// Proceed with next timestep?
int okToContinue () override;

Expand Down
66 changes: 39 additions & 27 deletions Source/Utils/BCfill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ struct PCHypFillExtDir
void operator()(
const amrex::IntVect& iv,
amrex::Array4<amrex::Real> const& dest,
const int /*dcomp*/,
const int /*numcomp*/,
const int dcomp,
const int numcomp,
amrex::GeometryData const& geomdata,
const amrex::Real time,
const amrex::BCRec* bcr,
const int /*bcomp*/,
const int /*orig_comp*/) const
const int orig_comp) const
{
const int* domlo = geomdata.Domain().loVect();
const int* domhi = geomdata.Domain().hiVect();
Expand All @@ -38,76 +38,88 @@ struct PCHypFillExtDir

const int* bc = bcr->data();

// We may be asked to fill only a subset of the state -- FillPatch of a
// single derived component, for instance -- so we must write only
// components [dcomp, dcomp+numcomp) of dest, which correspond to state
// components [orig_comp, orig_comp+numcomp).
AMREX_ASSERT(dcomp + numcomp <= dest.nComp());
AMREX_ASSERT(orig_comp + numcomp <= NVAR);

// Note that on a partial fill the entries of s_int outside the range being
// filled are left at zero, since we have no way to read them here. That is
// exact as long as bcnormal treats the components independently, which is
// true of every problem setup in Exec; a state-coupled bcnormal would need
// the full state.
amrex::Real s_int[NVAR] = {0.0};
amrex::Real s_ext[NVAR] = {0.0};

// xlo and xhi
int idir = 0;
if ((bc[idir] == amrex::BCType::ext_dir) && (iv[idir] < domlo[idir])) {
amrex::IntVect loc(AMREX_D_DECL(domlo[idir], iv[1], iv[2]));
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(loc, n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(loc, dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, +1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
} else if (
(bc[idir + AMREX_SPACEDIM] == amrex::BCType::ext_dir) &&
(iv[idir] > domhi[idir])) {
amrex::IntVect loc(AMREX_D_DECL(domhi[idir], iv[1], iv[2]));
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(loc, n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(loc, dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, -1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
}
#if AMREX_SPACEDIM > 1
// ylo and yhi
idir = 1;
if ((bc[idir] == amrex::BCType::ext_dir) && (iv[idir] < domlo[idir])) {
amrex::IntVect loc(AMREX_D_DECL(iv[0], domlo[idir], iv[2]));
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(loc, n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(loc, dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, +1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
} else if (
(bc[idir + AMREX_SPACEDIM] == amrex::BCType::ext_dir) &&
(iv[idir] > domhi[idir])) {
amrex::IntVect loc(AMREX_D_DECL(iv[0], domhi[idir], iv[2]));
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(loc, n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(loc, dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, -1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
}
#if AMREX_SPACEDIM == 3
// zlo and zhi
idir = 2;
if ((bc[idir] == amrex::BCType::ext_dir) && (iv[idir] < domlo[idir])) {
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(iv[0], iv[1], domlo[idir], n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(iv[0], iv[1], domlo[idir], dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, +1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
} else if (
(bc[idir + AMREX_SPACEDIM] == amrex::BCType::ext_dir) &&
(iv[idir] > domhi[idir])) {
for (int n = 0; n < NVAR; n++) {
s_int[n] = dest(iv[0], iv[1], domhi[idir], n);
for (int n = 0; n < numcomp; n++) {
s_int[orig_comp + n] = dest(iv[0], iv[1], domhi[idir], dcomp + n);
}
bcnormal(x, s_int, s_ext, idir, -1, time, geomdata, *lprobparm);
for (int n = 0; n < NVAR; n++) {
dest(iv, n) = s_ext[n];
for (int n = 0; n < numcomp; n++) {
dest(iv, dcomp + n) = s_ext[orig_comp + n];
}
}
#endif
Expand Down
25 changes: 24 additions & 1 deletion Source/Utils/CAMR_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ CAMR::error_setup()
int num_val = ppr.countval("vorticity_greater");
Vector<Real> value(num_val);
ppr.getarr("vorticity_greater",value,0,num_val);
const std::string field="mag_vort";
const std::string field="magvort";
errtags.push_back(AMRErrorTag(value,AMRErrorTag::VORT,field,info));
}
else if (ppr.countval("adjacent_difference_greater")) {
Expand Down Expand Up @@ -112,6 +112,29 @@ CAMR::error_setup()
}
}

//
// Every tag's field must be something derive() can actually produce, i.e.
// either a state variable or a registered derived quantity. Checking here
// turns a typo in field_name -- or a mismatch with a derive name -- into a
// clear message at setup rather than an "unknown variable" abort deep in
// AmrLevel::derive at the first regrid. This runs at the end of
// variableSetUp, so desc_lst and derive_lst are already populated.
//
for (int i=0; i<errtags.size(); ++i)
{
const std::string& field = errtags[i].Field();
if (field.empty()) { continue; } // box-only or user-function tags

int state_indx, ncomp;
if ( !isStateVariable(field, state_indx, ncomp) &&
!derive_lst.canDerive(field) )
{
Abort("CAMR::error_setup: refinement indicator asks to tag on \""
+ field + "\", which is neither a state variable nor a "
"registered derived quantity");
}
}

//
// For hard-coded error estimation function, that would go in
// CAMR::errorEst()
Expand Down
6 changes: 0 additions & 6 deletions Source/Utils/CAMR_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ CAMR::setPlotVariables()

amrex::ParmParse pp("CAMR");

bool plot_cost = true;
pp.query("plot_cost", plot_cost);
if (plot_cost) {
amrex::Amr::addDerivePlotVar("WorkEstimate");
}

bool plot_rhoy = false;
pp.query("plot_rhoy", plot_rhoy);
if (plot_rhoy) {
Expand Down
Loading