feat(poly): started work on penalty term in variational form
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "mfem.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "polySolver.h"
|
||||
#include "polyMFEMUtils.h"
|
||||
@@ -75,6 +76,12 @@ PolySolver::PolySolver(double n, double order, mfem::Mesh& mesh_)
|
||||
nonlinearForm(std::make_unique<mfem::NonlinearForm>(feSpace.get())),
|
||||
u(std::make_unique<mfem::GridFunction>(feSpace.get())) {
|
||||
|
||||
// --- Check the polytropic index ---
|
||||
if (n > 4.99 || n < 0.0) {
|
||||
LOG_ERROR(logger, "The polytropic index n must be less than 5.0 and greater than 0.0. Currently it is {}", n);
|
||||
throw std::runtime_error("The polytropic index n must be less than 5.0 and greater than 0.0. Currently it is " + std::to_string(n));
|
||||
}
|
||||
|
||||
diffusionCoeff = std::make_unique<mfem::VectorFunctionCoefficient>(mesh.SpaceDimension(), polycoeff::diffusionCoeff);
|
||||
nonlinearSourceCoeff = std::make_unique<mfem::FunctionCoefficient>(polycoeff::nonlinearSourceCoeff);
|
||||
|
||||
@@ -103,11 +110,18 @@ void PolySolver::solve(){
|
||||
mfem::FunctionCoefficient initCoeff (
|
||||
[this](const mfem::Vector &x) {
|
||||
double r = x.Norml2();
|
||||
double theta = laneEmden::thetaSerieseExpansion(r, n, 10);
|
||||
double theta = laneEmden::thetaSerieseExpansion(r, n, 12);
|
||||
return theta;
|
||||
// double radius = Probe::getMeshRadius(mesh);
|
||||
// double u = 1/radius;
|
||||
|
||||
// return -std::pow((u*r), 2)+1.0;
|
||||
}
|
||||
);
|
||||
u->ProjectCoefficient(initCoeff);
|
||||
if (config.get<bool>("Poly:Solver:ViewInitialGuess", false)) {
|
||||
Probe::glVisView(*u, mesh, "initialGuess");
|
||||
}
|
||||
// mfem::DenseMatrix centerPoint(mesh.SpaceDimension(), 7);
|
||||
mfem::DenseMatrix centerPoint(mesh.SpaceDimension(), 1);
|
||||
centerPoint(0, 0) = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user