feat(poly): interpolating polynomial to find polytrope surface

Instead of treating the polytrope as a free boundary problem I have defined an interpolating polynominal, accurate to within 0.01 percent over n=[0,5) which is used to set the size of the domain for a given n
This commit is contained in:
2025-03-18 10:15:51 -04:00
parent ea0ff2a702
commit 8dcdf92414
4 changed files with 35 additions and 18 deletions

View File

@@ -1,11 +1,12 @@
#include <gtest/gtest.h>
#include<numbers>
#include <iostream>
#include "quill/LogMacros.h"
#include "mfem.hpp"
#include "polySolver.h"
#include "polyCoeff.h"
#include "probe.h"
#include "config.h"
#include "meshIO.h"
@@ -23,14 +24,16 @@ TEST_F(polyTest, Solve) {
LOG_INFO(logger, "Starting polytrope solve test 1...");
config.loadConfig(CONFIG_FILENAME);
double polyRadius = config.get<double>("Tests:Poly:Radius", std::numbers::pi);
double polytropicIndex = config.get<double>("Tests:Poly:Index", 1);
double polyRadius = polycoeff::x1(polytropicIndex);
std::cout << "Polytropic index: " << polytropicIndex << std::endl;
std::cout << "Polytropic radius: " << polyRadius << std::endl;
LOG_INFO(logger, "Solving polytrope with n = {:0.2f}", polytropicIndex);
MeshIO meshIO(SPHERICAL_MESH, polyRadius);
mfem::Mesh& mesh = meshIO.GetMesh();
double radius = Probe::getMeshRadius(mesh);
LOG_INFO(logger, "Mesh radius: {}", radius);
LOG_INFO(logger, "Mesh radius: {:0.4f} (target={:0.4f})", radius, polyRadius);
double polytropicIndex = config.get<double>("Tests:Poly:Index", 1);
LOG_INFO(logger, "Solving polytrope with n = {:0.2f}", polytropicIndex);
PolySolver polytrope(polytropicIndex, 1, mesh);
LOG_INFO(logger, "Solving polytrope...");