Skip to content

Commit

Permalink
Revert error estimation regression for eigenvalue solves from c4bbffb
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangrimberg committed Feb 1, 2024
1 parent e86da12 commit 95dbe4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions palace/drivers/eigensolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ EigenSolver::Solve(const std::vector<std::unique_ptr<Mesh>> &mesh) const
}
SaveMetadata(*ksp);

// Calculate and record the error indicators and postprocess the results.
BlockTimer bt2(Timer::POSTPRO);
Mpi::Print("Computing solution error estimates and postprocessing computed modes\n\n");
// Calculate and record the error indicators.
Mpi::Print("Computing solution error estimates\n\n");
CurlFluxErrorEstimator<ComplexVector> estimator(
spaceop.GetMaterialOp(), spaceop.GetNDSpace(), iodata.solver.linear.estimator_tol,
iodata.solver.linear.estimator_max_it, 0);
Expand All @@ -281,6 +280,14 @@ EigenSolver::Solve(const std::vector<std::unique_ptr<Mesh>> &mesh) const
eigen->SetBMat(*KM);
eigen->RescaleEigenvectors(num_conv);
}
for (int i = 0; i < iodata.solver.eigenmode.n; i++)
{
eigen->GetEigenvector(i, E);
estimator.AddErrorIndicator(E, indicator);
}

// Postprocess the results.
BlockTimer bt2(Timer::POSTPRO);
for (int i = 0; i < num_conv; i++)
{
// Get the eigenvalue and relative error.
Expand All @@ -301,11 +308,6 @@ EigenSolver::Solve(const std::vector<std::unique_ptr<Mesh>> &mesh) const
// Compute B = -1/(iω) ∇ x E on the true dofs, and set the internal GridFunctions in
// PostOperator for all postprocessing operations.
eigen->GetEigenvector(i, E);
if (i < iodata.solver.eigenmode.n)
{
// Only consider the desired number of modes for the error indicator.
estimator.AddErrorIndicator(E, indicator);
}
Curl.Mult(E.Real(), B.Real());
Curl.Mult(E.Imag(), B.Imag());
B *= -1.0 / (1i * omega);
Expand Down
2 changes: 1 addition & 1 deletion test/examples/ref/cavity/impedance/error-indicators.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Norm, Minimum, Maximum, Mean
+9.719333717e-04, +2.308437043e-05, +1.479269298e-04, +1.078490659e-04
+1.786937592e-03, +1.175148951e-04, +3.263378876e-04, +2.040337637e-04
2 changes: 1 addition & 1 deletion test/examples/ref/cavity/pec/error-indicators.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Norm, Minimum, Maximum, Mean
+9.719345476e-04, +2.308434728e-05, +1.479271253e-04, +1.078491905e-04
+1.786988674e-03, +1.174739359e-04, +3.265272460e-04, +2.040325933e-04

0 comments on commit 95dbe4d

Please sign in to comment.