Skip to content

Commit

Permalink
make defaults consistent with older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Sep 25, 2024
1 parent f8413a4 commit 843a264
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion example/poisson_gmg/poisson_equation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ namespace poisson_package {
class PoissonEquation {
public:
bool do_flux_cor = false;
bool set_flux_boundary = false;

// Add tasks to calculate the result of the matrix A (which is implicitly defined by
// this class) being applied to x_t and store it in field out_t
template <class x_t, class out_t, class TL_t>
parthenon::TaskID Ax(TL_t &tl, parthenon::TaskID depends_on,
std::shared_ptr<parthenon::MeshData<Real>> &md) {
auto flux_res = tl.AddTask(depends_on, CalculateFluxes<x_t>, md);
flux_res = tl.AddTask(flux_res, SetFluxBoundaries<x_t>, md);
if (set_flux_boundary) {
flux_res = tl.AddTask(flux_res, SetFluxBoundaries<x_t>, md);
}
if (do_flux_cor && !(md->grid.type == parthenon::GridType::two_level_composite)) {
auto start_flxcor =
tl.AddTask(flux_res, parthenon::StartReceiveFluxCorrections, md);
Expand Down
6 changes: 2 additions & 4 deletions example/poisson_gmg/poisson_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,15 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
std::string solver = pin->GetOrAddString("poisson", "solver", "MG");
pkg->AddParam<>("solver", solver);

bool flux_correct = pin->GetOrAddBoolean("poisson", "flux_correct", false);
pkg->AddParam<>("flux_correct", flux_correct);

Real err_tol = pin->GetOrAddReal("poisson", "error_tolerance", 1.e-8);
pkg->AddParam<>("error_tolerance", err_tol);

bool use_exact_rhs = pin->GetOrAddBoolean("poisson", "use_exact_rhs", false);
pkg->AddParam<>("use_exact_rhs", use_exact_rhs);

PoissonEquation eq;
eq.do_flux_cor = flux_correct;
eq.do_flux_cor = pin->GetOrAddBoolean("poisson", "flux_correct", false);
eq.set_flux_boundary = pin->GetOrAddBoolean("poisson", "set_flux_boundary", false);

parthenon::solvers::MGParams mg_params(pin, "poisson/solver_params");
parthenon::solvers::MGSolver<u, rhs, PoissonEquation> mg_solver(pkg.get(), mg_params,
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/mg_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct MGParams {
std::string smoother = "SRJ2";
bool two_by_two_diagonal = false;
int max_coarsenings = std::numeric_limits<int>::max();
std::string prolongation = "Linear";
std::string prolongation = "OldLinear";

MGParams() = default;
MGParams(ParameterInput *pin, const std::string &input_block) {
Expand Down

0 comments on commit 843a264

Please sign in to comment.