feat(poly): added skeleton of polytrope model
the polytrope module will be used as an initial guess to the solver. A skeleton of this has been imported from https://github.com/tboudreaux/FEMPolytrope This module will need major updates still to handle 3D, proper boundary conditions, and to incorporate it with the rest of our meshing scheme
This commit is contained in:
23
src/poly/coeff/meson.build
Normal file
23
src/poly/coeff/meson.build
Normal file
@@ -0,0 +1,23 @@
|
||||
polyCoeff_sources = files(
|
||||
'private/coeff.cpp'
|
||||
)
|
||||
|
||||
polyCoeff_headers = files(
|
||||
'public/coeff.h'
|
||||
)
|
||||
|
||||
libPolyCoeff = static_library('polyCoeff',
|
||||
polyCoeff_sources,
|
||||
include_directories : include_directories('.'),
|
||||
cpp_args: ['-fvisibility=default'],
|
||||
dependencies: [mfem_dep],
|
||||
install: true
|
||||
)
|
||||
|
||||
|
||||
polyCoeff_dep = declare_dependency(
|
||||
include_directories : include_directories('.'),
|
||||
link_with : libPolyCoeff,
|
||||
sources : polyCoeff_sources,
|
||||
dependencies : [mfem_dep]
|
||||
)
|
||||
18
src/poly/coeff/private/polyCoeff.cpp
Normal file
18
src/poly/coeff/private/polyCoeff.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "mfem.hpp"
|
||||
#include <cmath>
|
||||
|
||||
#include "coeff.h"
|
||||
|
||||
double xi_coeff_func(const mfem::Vector &x) {
|
||||
return std::pow(x(0), 2);
|
||||
}
|
||||
|
||||
void vec_xi_coeff_func(const mfem::Vector &x, mfem::Vector &v) {
|
||||
v.SetSize(1);
|
||||
v[0] = -std::pow(x(0), 2);
|
||||
}
|
||||
|
||||
double theta_initial_guess(const mfem::Vector &x, double root) {
|
||||
double xi = x[0];
|
||||
return 1-std::pow(xi/root, 2);
|
||||
}
|
||||
8
src/poly/coeff/public/polyCoeff.h
Normal file
8
src/poly/coeff/public/polyCoeff.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "mfem.hpp"
|
||||
#include <cmath>
|
||||
|
||||
double xi_coeff_func(const mfem::Vector &x);
|
||||
|
||||
void vec_xi_coeff_func(const mfem::Vector &x, mfem::Vector &v);
|
||||
|
||||
double theta_initial_guess(const mfem::Vector &x, double root);
|
||||
Reference in New Issue
Block a user