Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AHFpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastiano Bernuzzi
AHFpy
Commits
65ab9b2a
Commit
65ab9b2a
authored
2 years ago
by
bernuzzi
Browse files
Options
Downloads
Patches
Plain Diff
Added a class for nonspinning puncture data
parent
58c2c9dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AHFpy/Puncture.py
+95
-0
95 additions, 0 deletions
AHFpy/Puncture.py
with
95 additions
and
0 deletions
AHFpy/Puncture.py
0 → 100644
+
95
−
0
View file @
65ab9b2a
import
os.path
import
numpy
as
np
import
h5py
from
AHFpy.data
import
ab_indexes
,
ij_indexes
from
AHFpy.data
import
write_h5_dset
import
matplotlib.pyplot
as
plt
class
Puncture
():
"""
Puncture data in Cartesian coordinates
"""
def
__init__
(
self
,
M
=
1.
,
# Mass parameter
x
=
np
.
arange
(
-
5
+
0.125
/
2
,
5
,
0.25
/
2
),
# better staggered!
y
=
np
.
arange
(
-
5
+
0.125
/
2
,
5
,
0.25
/
2
),
z
=
np
.
arange
(
-
5
+
0.125
/
2
,
5
,
0.25
/
2
)):
self
.
M
=
M
self
.
x
=
x
self
.
y
=
y
self
.
z
=
z
self
.
grid
=
None
self
.
grid
=
self
.
CartGrid
()
def
CartGrid
(
self
):
"""
Cartesian mesh grid
"""
#if not self.grid == None:
# return self.grid
return
np
.
array
(
np
.
meshgrid
(
self
.
x
,
self
.
y
,
self
.
z
,
indexing
=
"
ij
"
))
def
Psi4
(
self
):
"""
Conformal factor
"""
x
,
y
,
z
=
self
.
CartGrid
()
r
=
np
.
sqrt
(
x
**
2
+
y
**
2
+
z
**
2
)
return
(
1
+
0.5
*
self
.
M
/
r
)
**
4
def
FlatMetric
(
self
):
"""
Minkowski metric (-,+,+,+)
"""
g
=
{}
for
(
a
,
b
)
in
ab_indexes
:
g
[(
a
,
b
)]
=
+
1
if
a
==
b
else
0.
g
[(
0
,
0
)]
=
-
1
return
g
def
Metric
(
self
):
"""
Metric $g_{ab}$
"""
eta
=
self
.
FlatMetric
()
Psi4
=
self
.
Psi4
()
g
=
{}
for
(
a
,
b
)
in
ab_indexes
:
g
[(
a
,
b
)]
=
Psi4
*
eta
[(
a
,
b
)]
return
g
def
ExtrinsicCurvature
(
self
):
"""
Extrinsic cuvrvature $K_{ij}$
"""
K
=
{}
for
(
i
,
j
)
in
ij_indexes
:
K
[(
i
,
j
)]
=
0.
return
K
def
Output
(
self
,
fname
):
"""
Write HDF5 data
"""
g
=
self
.
Metric
()
K
=
self
.
ExtrinsicCurvature
()
points
=
self
.
x
,
self
.
y
,
self
.
z
return
write_h5_dset
(
fname
,
time
=
0
,
points
=
points
,
g
=
g
,
K
=
K
)
if
__name__
==
"
__main__
"
:
dfile
=
"
puncture.h5
"
p
=
Puncture
()
p
.
Output
(
dfile
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment