Skip to content

Commit

Permalink
Change to allow for partitioning of Nonconformal meshes.
Browse files Browse the repository at this point in the history
- The partitioning is done using the MeshPartitioner where possible, but for nonconformal
meshes will now use the standard ParMesh constructor.
- Change to use Mesh& where a parameter out value is not allowed to be invalidated
- Move #if 0 to behind constexpr false to ensure can continue to compile
  • Loading branch information
hughcars committed Aug 21, 2023
1 parent 7445bb5 commit 5e11633
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 142 deletions.
51 changes: 51 additions & 0 deletions palace/utils/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,61 @@ void RefinementData::SetUp(json &model)
}
}

auto adapt = refinement->find("Adaptation");
if (adapt != refinement->end())
{
MFEM_ABORT("Placeholder: Not currently supported!");

// Load Values
adaptation.tolerance = adapt->value("Tol", adaptation.tolerance);
adaptation.max_its = adapt->value("MaxIts", adaptation.max_its);
adaptation.min_its = adapt->value("MinIts", adaptation.min_its);
adaptation.update_fraction = adapt->value("UpdateFraction", adaptation.update_fraction);
adaptation.max_nc_levels = adapt->value("MaxNCLevels", adaptation.max_nc_levels);
adaptation.dof_limit = adapt->value("DOFLimit", adaptation.dof_limit);
adaptation.coarsening_fraction =
adapt->value("CoarseningFraction", adaptation.coarsening_fraction);
adaptation.save_step = adapt->value("SaveStep", adaptation.save_step);
adaptation.nonconformal = adapt->value("Nonconformal", adaptation.nonconformal);
adaptation.maximum_imbalance =
adapt->value("MaximumImbalance", adaptation.maximum_imbalance);

// Perform Checks
MFEM_VERIFY(adaptation.tolerance > 0, "\"Tol\" must be strictly positive");
MFEM_VERIFY(adaptation.max_its >= 0, "\"MaxIts\" must be non-negative");
MFEM_VERIFY(adaptation.min_its >= 0, "\"MinIts\" must be non-negative");
MFEM_VERIFY(adaptation.min_its <= adaptation.max_its,
"\"MinIts\" must be smaller than \"MaxIts\": " << adaptation.min_its << ","
<< adaptation.max_its);
MFEM_VERIFY(adaptation.update_fraction > 0 && adaptation.update_fraction < 1,
"\"UpdateFraction\" must be in (0,1)");
MFEM_VERIFY(adaptation.coarsening_fraction >= 0 && adaptation.coarsening_fraction < 1,
"\"CoarseningFraction\" must be in [0, 1)");
MFEM_VERIFY(adaptation.max_nc_levels >= 0, "\"MaxNCLevels\" must non-negative");
MFEM_VERIFY(adaptation.dof_limit >= 0, "\"DOFLimit\" must be non-negative");
MFEM_VERIFY(adaptation.save_step >= 0, "\"SaveStep\" must be non-negative");
MFEM_VERIFY(adaptation.maximum_imbalance >= 1,
"\"MaximumImbalance\" must be greater than or equal to 1");

// Cleanup
const auto fields = {
"Tol", "MaxIts", "MinIts", "UpdateFraction", "CoarseningFraction",
"MaxNCLevels", "DOFLimit", "SaveStep", "Nonconformal", "MaximumImbalance"};
for (const auto &f : fields)
{
adapt->erase(f);
}

MFEM_VERIFY(adapt->empty(),
"Found an unsupported configuration file keyword under \"Adaptation\"!\n"
<< adapt->dump(2));
}

// Cleanup
refinement->erase("UniformLevels");
refinement->erase("Boxes");
refinement->erase("Spheres");
refinement->erase("Adaptation");
MFEM_VERIFY(refinement->empty(),
"Found an unsupported configuration file keyword under \"Refinement\"!\n"
<< refinement->dump(2));
Expand Down
32 changes: 32 additions & 0 deletions palace/utils/configfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,43 @@ struct SphereRefinementData
std::vector<double> center = {};
};

// Stores data specifying the adaptive mesh refinement algorithm.
struct AdaptiveRefinementData
{
// Non-dimensional tolerance used to specify convergence of the AMR.
double tolerance = 1e-2;
// Maximum number of iterations to perform during the AMR.
int max_its = 0;
// Minimum number of iterations to perform during the AMR.
int min_its = 0;
// Dörfler update fraction. The set of marked elements is the minimum set
// that contains update_fraction of the total error.
double update_fraction = 0.4;
// Whether or not to perform coarsening during the AMR.
double coarsening_fraction = 0.0;
// Maximum difference in non-conformal refinements between two adjacent
// elements. Default = 0 implies there is no constraint on local non-conformity.
int max_nc_levels = 0;
// If a refinement results in a greater number of DOFs than this value, no
// future refinement will be allowed unless coarsening is allowed to occur.
int dof_limit = 0;
// Frequency with which to store the post processing results for a given
// adaptation, e.g. save_step = 3 means save every third adaptation.
int save_step = 0;
// Whether or not to perform nonconformal adaptation.
bool nonconformal = true;
// Maximum allowable ratio of number of elements across processors before
// rebalancing is performed.
double maximum_imbalance = 1.5;
};

struct RefinementData
{
public:
// Parallel uniform mesh refinement levels.
int uniform_ref_levels = 0;
// Adaptive refinement configuration data.
AdaptiveRefinementData adaptation;

private:
// Refinement data for mesh regions.
Expand Down
Loading

0 comments on commit 5e11633

Please sign in to comment.