SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
polyCoeff.cpp
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: March 19, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21#include "mfem.hpp"
22
23#include "polyCoeff.h"
24
25namespace serif {
26namespace polytrope {
27namespace polycoeff{
28 double nonlinearSourceCoeff(const mfem::Vector &x)
29 {
30 return 1;
31 // double r = x(0)*x(0) + x(1)*x(1) + x(2)*x(2);
32 // return std::pow(r, 2);
33 }
34
35 void diffusionCoeff(const mfem::Vector &x, mfem::Vector &v)
36 {
37 v.SetSize(3);
38 v = -1;
39 // double r = x(0)*x(0) + x(1)*x(1) + x(2)*x(2);
40 // v = -std::pow(r, 2);
41 }
42
43 //PERF: One area of future optimization might be turning these into matrix operations since they are
44 //PERF: fundamentally just the dot product of [a b c ...] * [n^0 n^1 n^2 ...]
45 double x1(const double n)
46 {
47 double r = 0;
48 for (int i = 0; i < x1InterpCoeff::numTerms; i++) {
49 r += x1InterpCoeff::coeff[i] * std::pow(n, x1InterpCoeff::power[i]);
50 }
51 return r;
52 }
53
54 double thetaSurfaceFlux(const double n) {
55 double surfaceFlux = 0;
56 for (int i = 0; i < dThetaInterpCoeff::numTerms; i++) {
57 surfaceFlux += dThetaInterpCoeff::coeff[i] * std::pow(n, dThetaInterpCoeff::power[i]);
58 }
59 return surfaceFlux;
60 }
61
62} // namespace polycoeff
63} // namespace polytrope
64} // namespace serif
double thetaSurfaceFlux(const double n)
Definition polyCoeff.cpp:54
double nonlinearSourceCoeff(const mfem::Vector &x)
Computes the xi coefficient function.
Definition polyCoeff.cpp:28
double x1(const double n)
Definition polyCoeff.cpp:45
void diffusionCoeff(const mfem::Vector &x, mfem::Vector &v)
Computes the vector xi coefficient function.
Definition polyCoeff.cpp:35
static constexpr double coeff[51]
Definition polyCoeff.h:59