-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTutorial.py
57 lines (48 loc) · 2.72 KB
/
Tutorial.py
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
from Utilities.EOSCreator import EOSCreator
from Utilities.EOSCreator import FindCrustalTransDensity
from Utilities.EOSCreator import NuclearEOSFactory
from Utilities.BetaEquilibrium import BetaEquilibrium
from TidalLove import TidalLoveWrapper as wrapper
import Utilities.SkyrmeEOS as sky
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
EOSType = 'EOS2Poly'
SkyrmeBeforeBetaEqualibrium = NuclearEOSFactory(EOSType, {'t0': -1771.37, 't1': 322.432, 't2': -80.6445,
't31': 12219, 't32': 0, 't33': 0, 'x0': 0.266859,
'x1': -0.461021, 'x2': 1.18713, 'x31': 0.23156,
'x32': 0, 'x33': 0, 'sigma1': 0.333333, 'sigma2': 0,
'sigma3': 0, 'rho0': 0.159282694})
SkyrmeAfterBetaEqualibrium, _, _, _, _ = BetaEquilibrium(SkyrmeBeforeBetaEqualibrium, np.linspace(0.01, 10., 100))
#density = np.linspace(0.1, 3, 100)*0.16
#plt.plot(density, SkyrmeAfterBetaEqualibrium.GetPressure(density))
#plt.show()
# density at which green transition to blue
crustEndDensity = FindCrustalTransDensity(SkyrmeBeforeBetaEqualibrium)
# density at which yellow transition to green
connectStartDensity = crustEndDensity*0.3
creator = EOSCreator()
crustEOS = creator.ConstructCrust('Constraints/EOSCrustOutput.dat', CrustSmooth=0.)
creator.InsertEOS(crustEOS, connectStartDensity)
#creator.InsertConnection(crustEndDensity)
creator.InsertEOS(lambda prev_density, prev_eos, next_density, next_eos:
sky.PseudoEOS.MatchBothEnds(prev_density,
prev_eos,
next_density,
next_eos), crustEndDensity)
creator.InsertEOS(SkyrmeAfterBetaEqualibrium, 3*SkyrmeBeforeBetaEqualibrium.rho0)
creator.InsertEOS(lambda prev_density, prev_eos, next_density, next_eos:
sky.ConstSpeed.MatchBothEnds(prev_density,
prev_eos,
next_density,
next_eos), 30)
#creator.InsertEOS(lambda prev_density, prev_eos, next_density, next_eos:
# sky.PolyTrope(prev_density, prev_eos.GetEnergy(prev_density),
# prev_eos.GetPressure(prev_density), 7*0.16, PressureHigh),
# 100)
eosFinal = creator.Build()
with wrapper.TidalLoveWrapper(eosFinal) as tidal_love:
result = tidal_love.FindMass(1.4)
print(result.ToDict())
result = tidal_love.FindMaxMass()
print(result.ToDict())