refactor(sphere.msh): increased base resolution of spherical mesh

This commit is contained in:
2025-02-24 12:38:47 -05:00
parent de5c84f668
commit dfb65c1082
7 changed files with 16 additions and 6 deletions

Binary file not shown.

View File

@@ -31,8 +31,8 @@ TEST_F(meshIOTest, IsLoaded) {
TEST_F(meshIOTest, GetMesh) { TEST_F(meshIOTest, GetMesh) {
MeshIO meshIO(EXAMPLE_FILENAME); MeshIO meshIO(EXAMPLE_FILENAME);
mfem::Mesh& mesh = meshIO.GetMesh(); mfem::Mesh& mesh = meshIO.GetMesh();
EXPECT_EQ(mesh.GetNE(), 670); EXPECT_EQ(mesh.GetNE(), 18351);
EXPECT_EQ(mesh.GetNV(), 201); EXPECT_EQ(mesh.GetNV(), 3768);
double volume = ComputeMeshVolume(mesh); double volume = ComputeMeshVolume(mesh);
EXPECT_DOUBLE_EQ(volume, 3.9357596288315868); EXPECT_DOUBLE_EQ(volume, 4.160516453529322);
} }

View File

@@ -11,7 +11,7 @@ foreach test_file : test_sources
test_exe = executable( test_exe = executable(
exe_name, exe_name,
test_file, test_file,
dependencies: [gtest_dep, polysolver_dep, probe_dep, quill_dep], dependencies: [gtest_dep, polysolver_dep, probe_dep, quill_dep, config_dep],
install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly
) )

View File

@@ -5,6 +5,9 @@
#include "polySolver.h" #include "polySolver.h"
#include "probe.h" #include "probe.h"
#include "config.h"
std::string CONFIG_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
class polyTest : public ::testing::Test {}; class polyTest : public ::testing::Test {};
@@ -13,13 +16,16 @@ TEST_F(polyTest, DefaultConstructor) {
} }
TEST_F(polyTest, Solve) { TEST_F(polyTest, Solve) {
Config& config = Config::getInstance();
config.loadConfig(CONFIG_FILENAME);
PolySolver polytrope(1.5, 1); PolySolver polytrope(1.5, 1);
EXPECT_NO_THROW(polytrope.solve()); EXPECT_NO_THROW(polytrope.solve());
Probe::LogManager& logManager = Probe::LogManager::getInstance(); Probe::LogManager& logManager = Probe::LogManager::getInstance();
quill::Logger* logger = logManager.newFileLogger("polyTest.log", "polyTest"); quill::Logger* logger = logManager.newFileLogger("polyTest.log", "polyTest");
LOG_INFO(logger, "Solving polytrope with n = 1.5, gamma = 1"); LOG_INFO(logger, "Solving polytrope with n = 1.5");
mfem::Mesh& mesh = polytrope.getMesh(); mfem::Mesh& mesh = polytrope.getMesh();
mfem::GridFunction& solution = polytrope.getSolution(); mfem::GridFunction& solution = polytrope.getSolution();
Probe::glVisView(solution, mesh, "Polytrope solution");
// Get the mesh radius // Get the mesh radius
double radius = Probe::getMeshRadius(mesh); double radius = Probe::getMeshRadius(mesh);

4
tests/testsConfig.yaml Normal file
View File

@@ -0,0 +1,4 @@
Probe:
GLVis:
Host: "10.17.1.5"
Port: 19916

View File

@@ -6,7 +6,7 @@ import argparse
def generate_spherical_mesh(radius=1, meshSize=0.1): def generate_spherical_mesh(radius=1, meshSize=0.1):
with pygmsh.geo.Geometry() as geo: with pygmsh.geo.Geometry() as geo:
# Create a spherical (ball) geometry centered at (0,0,0) # Create a spherical (ball) geometry centered at (0,0,0)
sphere = geo.add_ball([0, 0, 0], radius) sphere = geo.add_ball([0, 0, 0], radius, mesh_size=0.1)
# Generate a 2D mesh (i.e. surface mesh) of the sphere # Generate a 2D mesh (i.e. surface mesh) of the sphere
myMesh = geo.generate_mesh(dim=3) myMesh = geo.generate_mesh(dim=3)
return myMesh return myMesh

Binary file not shown.