fix(poly): working to resolve overshoot mode

This commit is contained in:
2025-06-10 12:49:31 -04:00
parent f65db72bce
commit 76d6d3d1cf
5 changed files with 87 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
#include "utilities.h"
#include "mfem.hpp"
#include <memory>
namespace serif::utilities {
mfem::SparseMatrix build_reduced_matrix(
@@ -100,4 +101,32 @@ namespace serif::utilities {
v.SetSubVector(highlightDofs, 1.0); // Set the highlighted dofs to 1.0
return v;
}
mfem::GridFunction compute_curl(mfem::GridFunction& phi_gf) {
mfem::Mesh* mesh = phi_gf.FESpace()->GetMesh();
const int dim = mesh->Dimension();
// Match the polynomial order of the original RT space for consistency.
const int order = phi_gf.FESpace()->GetOrder(0);
mfem::Vector curl_mag_vec;
for (int ne = 0; ne < mesh->GetNE(); ++ne) {
if (mesh->GetElementType(ne) != mfem::Element::TRIANGLE &&
mesh->GetElementType(ne) != mfem::Element::QUADRILATERAL &&
mesh->GetElementType(ne) != mfem::Element::TETRAHEDRON &&
mesh->GetElementType(ne) != mfem::Element::HEXAHEDRON) {
throw std::invalid_argument("Mesh element type not supported for curl computation.");
}
mfem::IsoparametricTransformation T;
mesh->GetElementTransformation(ne, &T);
phi_gf.GetCurl(T, curl_mag_vec);
std::cout << "HERE" << std::endl;
}
mfem::L2_FECollection fac(order, dim);
mfem::FiniteElementSpace fs(mesh, &fac);
mfem::GridFunction curl_gf(&fs);
curl_gf = 0.0;
return curl_gf;
}
}