-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheos_mvsr.cpp
More file actions
71 lines (56 loc) · 1.94 KB
/
eos_mvsr.cpp
File metadata and controls
71 lines (56 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
-------------------------------------------------------------------
Copyright (C) 2018-2024, Andrew W. Steiner
This is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
O2scl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------
*/
#include <iostream>
#include <string>
#include <o2scl/hdf_io.h>
#include <o2scl/hdf_eos_io.h>
#include <o2scl/nstar_cold.h>
#include <o2scl/eos_had_skyrme.h>
using namespace std;
using namespace o2scl;
using namespace o2scl_const;
using namespace o2scl_hdf;
int main(void) {
cout.setf(ios::scientific);
// Skyrme EOS NRAPR for core
eos_had_skyrme sk;
skyrme_load(sk,"NRAPR");
// Neutron star structure (default crust)
nstar_cold nc;
nc.set_eos(sk);
nc.calc_eos();
nc.calc_nstar();
// Get full EOS including crust in 1/fm^4 units
table_units<> teos;
teos.line_of_names("ed pr");
teos.line_of_units("1/fm^4 1/fm^4");
for(double pr=8.0e-4;pr<1.0e1;pr*=1.2) {
double ed, nb;
nc.def_eos_tov.get_eden_user(pr,ed,nb);
double line[2]={ed,pr};
teos.line_of_data(2,line);
}
// Remove rows beyond maximum mass
shared_ptr<table_units<> > tmvsr=nc.get_tov_results();
tmvsr->set_nlines(tmvsr->lookup("gm",tmvsr->max("gm"))+1);
// Output the table(s) to file(s)
hdf_file hf;
hf.open_or_create("eos_mvsr.o2");
hdf_output(hf,*nc.get_tov_results(),"mvsr");
hdf_output(hf,teos,"eos");
hf.close();
return 0;
}