-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol_file.py
72 lines (58 loc) · 2.16 KB
/
control_file.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# control_file.py
#
# Script using GR_Scalar library for numerical solutions to Einstein's field
# equations.
#
# Copyright (C) 2011 Mani Chandra <[email protected]>
#
# This program 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.
#
# This program 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 program. If not, see <http://www.gnu.org/licenses/>.
import numpy as np
import GRScalar
from scipy.interpolate import splrep, splev
import h5py
# Import parameters and initial data from the initial data file.
initial_data = h5py.File('initial_data.hdf5', 'r')
# Quantum length scale
alpha = initial_data['alpha'][:][0]
# Grid generation
u = initial_data['u'][:]
V = initial_data['V'][:]
Nu = u.size; Nv = V.size
print "Nu = ", Nu
print "Nv = ", Nv
# Parameters for dust shell
Mass = initial_data['classical_mass_V_axis'][:]
Mass_tck = splrep(V, Mass)
def source(V): return splev(V, Mass_tck, der=1)
# Data file name
data_file = "data.h5"
system = GRScalar.System(u, V,
alpha=alpha,
classical_source=source)
system.r[0, :] = initial_data['r_V_axis'][:]
system.f[0, :] = initial_data['f_V_axis'][:]
system.g[0, :] = initial_data['g_V_axis'][:]
system.sigma[0, :] = initial_data['sigma_V_axis'][:]
system.d[0, :] = initial_data['d_V_axis'][:]
system.w[0, :] = initial_data['w_V_axis'][:]
system.z[0, :] = initial_data['z_V_axis'][:]
system.r[:, 0] = initial_data['r_U_axis'][:]
system.f[:, 0] = initial_data['f_U_axis'][:]
system.g[:, 0] = initial_data['g_U_axis'][:]
system.sigma[:, 0] = initial_data['sigma_U_axis'][:]
system.d[:, 0] = initial_data['d_U_axis'][:]
system.w[:, 0] = initial_data['w_U_axis'][:]
system.z[:, 0] = initial_data['z_U_axis'][:]
system.integrate(data_dump_filename=data_file, r_break=5.)
system.save_data(data_file)