diff --git a/.gitignore b/.gitignore index a9f548a..1224cdc 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,9 @@ pip-wheel-metadata # VS Code .vscode +# Emacs - projectile +TAGS + # default pytest cache directory */.pytest_cache .pytest_cache/ diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..0f83864 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/einsteinpy.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/einsteinpy.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/einsteinpy" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/einsteinpy" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/src/riccipy/__init__.py b/src/riccipy/__init__.py index 589f1e6..ad9e71c 100644 --- a/src/riccipy/__init__.py +++ b/src/riccipy/__init__.py @@ -1,5 +1,4 @@ """ -======= RicciPy ======= @@ -8,5 +7,5 @@ """ __version__ = "0.1.dev0" -from .metric import Metric, SpacetimeMetric +from .metric import Metric, SpacetimeMetric, load_metric from .tensor import Index, Tensor, expand_tensor, indices diff --git a/src/riccipy/metric.py b/src/riccipy/metric.py index 904bae6..1cf68ba 100644 --- a/src/riccipy/metric.py +++ b/src/riccipy/metric.py @@ -1,4 +1,5 @@ from collections import namedtuple +from pathlib import Path from sympy import Array, Pow, Rational, S, ones, tensorproduct, zeros from sympy.tensor.tensor import TensorIndexType @@ -256,3 +257,11 @@ def signature(self): sig = sign * ones(1, self.dim) sig[0] *= -1 return tuple(sig) + + +def load_metric(symbol, name): + base = Path(__file__).parent + var = dict(globals(), **locals()) + with open(base / "metrics" / (name + ".py"), "r") as file: + exec(file.read(), var) + return SpacetimeMetric(symbol, var["coords"], var["metric"], timelike=False) diff --git a/src/riccipy/metrics/anti_de_sitter_1.py b/src/riccipy/metrics/anti_de_sitter_1.py new file mode 100644 index 0000000..e3d2ce0 --- /dev/null +++ b/src/riccipy/metrics/anti_de_sitter_1.py @@ -0,0 +1,16 @@ +""" +Anti-de Sitter space +Hawking and Ellis (5.9) p131 +""" +from sympy import cos, diag, sin, sinh, symbols + +coords = symbols("t chi theta phi", real=True) +variables = () +functions = () +t, ch, th, ph = coords +metric = diag( + -1, + cos(t) ** 2, + cos(t) ** 2 * sinh(ch) ** 2, + cos(t) ** 2 * sinh(ch) ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/anti_de_sitter_2.py b/src/riccipy/metrics/anti_de_sitter_2.py new file mode 100644 index 0000000..e103688 --- /dev/null +++ b/src/riccipy/metrics/anti_de_sitter_2.py @@ -0,0 +1,11 @@ +""" +Static form of Anti-de Sitter space +Hawking and Ellis (5.9) p131 +""" +from sympy import cosh, diag, sin, sinh, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = () +t, r, th, ph = coords +metric = diag(-cosh(r) ** 2, 1, sinh(r) ** 2, sinh(r) ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/bayin.py b/src/riccipy/metrics/bayin.py new file mode 100644 index 0000000..dc63bfa --- /dev/null +++ b/src/riccipy/metrics/bayin.py @@ -0,0 +1,18 @@ +""" +Bayin's spherically symmetric static perfect fluid solution II +Bayin, Phys. Rev. D, v18, p2745-2751, (1978) +""" +from sympy import Rational, asin, sin, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("w_0 C_0 C_1", constant=True) +functions = () +t, r, th, ph = coords +w0, C0, C1 = variables +metric = zeros(4) +metric[0, 0] = -C0 ** 2 * exp( + -asin((-2 * r ** 2 + C1) / (C1 ** 2 + 4 * w0 ** 2) ** (Rational(1, 2))) +) +metric[1, 1] = w0 ** 2 / (-r ** 4 + C1 * r ** 2 + w0 ** 2) +metric[2, 2] = r ** 2 +metric[3, 3] = r ** 2 * sin(th) ** 2 diff --git a/src/riccipy/metrics/beckers_sinzinkayo_demaret_1.py b/src/riccipy/metrics/beckers_sinzinkayo_demaret_1.py new file mode 100644 index 0000000..9801b3e --- /dev/null +++ b/src/riccipy/metrics/beckers_sinzinkayo_demaret_1.py @@ -0,0 +1,13 @@ +""" +Beckers, Sinzinkayo, and Demaret solution +Beckers et al., Phys. Rev. D, v30, p1846, (1984) +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("k d m", constant=True) +functions = () +t, x, y, z = coords +k, d, m = variables +expr = (k * x + d) ** (2 * m) +metric = diag(-expr, expr, expr, expr) diff --git a/src/riccipy/metrics/beckers_sinzinkayo_demaret_2.py b/src/riccipy/metrics/beckers_sinzinkayo_demaret_2.py new file mode 100644 index 0000000..dcc9ab4 --- /dev/null +++ b/src/riccipy/metrics/beckers_sinzinkayo_demaret_2.py @@ -0,0 +1,13 @@ +""" +Beckers, Sinzinkayo, and Demaret solution +Beckers et al., Phys. Rev. D, v30, p1846, (1984) +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("m", constant=True) +functions = () +t, x, y, z = coords +m = variables +expr = x ** (2 * m) +metric = diag(-expr, expr, expr, expr) diff --git a/src/riccipy/metrics/bertotti_robinson_1.py b/src/riccipy/metrics/bertotti_robinson_1.py new file mode 100644 index 0000000..4b6d946 --- /dev/null +++ b/src/riccipy/metrics/bertotti_robinson_1.py @@ -0,0 +1,14 @@ +""" +The Bertotti-Robinson solution +Bertotti, Phys. Rev., v116, p1331, (1959) +Bertotti, Commun. Math. Phys., v5, p257, (1967) +Robinson, Commun. Math. Phys., v9, p161, (1968) +Stephani (10.16) p120 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-(1 + z ** 2), 1 - y ** 2, 1 / (1 - y ** 2), 1 / (1 + z ** 2)) diff --git a/src/riccipy/metrics/bertotti_robinson_2.py b/src/riccipy/metrics/bertotti_robinson_2.py new file mode 100644 index 0000000..2b66bcd --- /dev/null +++ b/src/riccipy/metrics/bertotti_robinson_2.py @@ -0,0 +1,15 @@ +""" +The Bertotti-Robinson solution +Bertotti, Phys. Rev., v116, p1331, (1959) +Lovelock, Commun. Math. Phys., v5, p257, (1967) +Dolan, Commun. Math. Phys., v9, p161, (1968) +Stephani (10.18) p121 +""" +from sympy import diag, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("q", constant=True) +functions = () +t, r, th, ph = coords +q = variables +metric = diag(-q ** 2 / r ** 2, q ** 2 / r ** 2, q ** 2, q ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/bertotti_robinson_3.py b/src/riccipy/metrics/bertotti_robinson_3.py new file mode 100644 index 0000000..3f55e8d --- /dev/null +++ b/src/riccipy/metrics/bertotti_robinson_3.py @@ -0,0 +1,15 @@ +""" +The Bertotti-Robinson solution +Bertotti, Phys. Rev., v116, p1331, (1959) +Lovelock, Commun. Math. Phys., v5, p257, (1967) +Dolan, Commun. Math. Phys., v9, p161, (1968) +Stephani (10.19) p120 +""" +from sympy import diag, sin, sinh, symbols + +coords = symbols("t x theta phi", real=True) +variables = symbols("k", constant=True) +functions = () +t, x, th, ph = coords +k = variables +metric = diag(-k ** 2 * sinh(x) ** 2, k ** 2, k ** 2, k ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/bertotti_robinson_4.py b/src/riccipy/metrics/bertotti_robinson_4.py new file mode 100644 index 0000000..3eec009 --- /dev/null +++ b/src/riccipy/metrics/bertotti_robinson_4.py @@ -0,0 +1,15 @@ +""" +The Bertotti-Robinson solution +Bertotti, Phys. Rev., v116, p1331, (1959) +Lovelock, Commun. Math. Phys., v5, p257, (1967) +Dolan, Commun. Math. Phys., v9, p161, (1968) +Stephani (32.95) p372 +""" +from sympy import cos, diag, symbols + +coords = symbols("t z x y", real=True) +variables = symbols("omega", constant=True) +functions = () +t, x, y, z = coords +om = variables +metric = diag(-1, 1, cos(om * x) ** 2, cos(om * t) ** 2) diff --git a/src/riccipy/metrics/bianchi_1.py b/src/riccipy/metrics/bianchi_1.py new file mode 100644 index 0000000..3bfdc2e --- /dev/null +++ b/src/riccipy/metrics/bianchi_1.py @@ -0,0 +1,11 @@ +""" +General metric from Bianchi II automorphisms +""" +from sympy import Function, diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = symbols("alpha", cls=Function) +t, x, y, z = coords +al = functions +metric = diag(1, exp(-2 * al(t)), exp(al(t)), exp(al(t))) diff --git a/src/riccipy/metrics/bianchi_2.py b/src/riccipy/metrics/bianchi_2.py new file mode 100644 index 0000000..5b102e1 --- /dev/null +++ b/src/riccipy/metrics/bianchi_2.py @@ -0,0 +1,11 @@ +""" +General metric from Bianchi IV automorphisms +""" +from sympy import Function, diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = symbols("alpha beta gamma", cls=Function) +t, x, y, z = coords +al, be, ga = functions +metric = diag(1, exp(al(t)), exp(be(t)), exp(ga(t))) diff --git a/src/riccipy/metrics/bondi_1.py b/src/riccipy/metrics/bondi_1.py new file mode 100644 index 0000000..bb272b6 --- /dev/null +++ b/src/riccipy/metrics/bondi_1.py @@ -0,0 +1,13 @@ +""" +Spherical Bondi metric in advanced (ingoing) coordinates +Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964) +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = () +functions = symbols("C M", cls=Function) +r, v, th, ph = coords +C, M = functions +metric = diag(0, -C(r, v) ** 2 * (1 - 2 * M(r, v) / r), r ** 2, r ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = C(r, v) diff --git a/src/riccipy/metrics/bondi_2.py b/src/riccipy/metrics/bondi_2.py new file mode 100644 index 0000000..2b45e60 --- /dev/null +++ b/src/riccipy/metrics/bondi_2.py @@ -0,0 +1,13 @@ +""" +Spherical Bondi metric in advanced (ingoing) coordinates +Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964) +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = () +functions = symbols("C M", cls=Function) +r, v, th, ph = coords +C, M = functions +metric = diag(0, -C(t, v) ** 2 * (1 - 2 * M(t, v) / t), t ** 2, t ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = -C(r, v) diff --git a/src/riccipy/metrics/bondi_3.py b/src/riccipy/metrics/bondi_3.py new file mode 100644 index 0000000..26d911f --- /dev/null +++ b/src/riccipy/metrics/bondi_3.py @@ -0,0 +1,24 @@ +""" +The Bondi metric +Bondi, Proc. Roy. Soc. Lond. A, v269, p21, (1962) +""" +from sympy import Function, exp, sin, symbols, zeros + +coords = symbols("r u theta phi", real=True) +variables = () +functions = symbols("Q U V gamma", cls=Function) +r, u, th, ph = coords +Q, U, V, ga = functions +metric = zeros(4) +metric[1, 1] = ( + -exp(2 * Q(r, u, th) + 2 * ga(r, u, th)) + * ( + V(r, u, th) * exp(-2 * ga(r, u, th)) + - exp(-2 * Q(r, u, th)) * U(r, u, th) ** 2 * r ** 3 + ) + / r +) +metric[2, 2] = r ** 2 * exp(2 * ga(r, u, th)) +metric[3, 3] = r ** 2 * exp(-2 * ga(r, u, th)) * sin(th) ** 2 +metric[0, 1] = metric[1, 0] = -exp(2 * Q(r, u, th)) +metric[1, 2] = metric[2, 1] = -U(r, u, th) * r ** 2 * exp(2 * ga(r, u, th)) diff --git a/src/riccipy/metrics/boost_1.py b/src/riccipy/metrics/boost_1.py new file mode 100644 index 0000000..8b90a7b --- /dev/null +++ b/src/riccipy/metrics/boost_1.py @@ -0,0 +1,12 @@ +""" +Metric with G4 on T3 and boost isotropy (flat case, k=0) +Stephani (11.16) p128 +""" +from sympy import Function, diag, symbols + +coords = symbols("t x y w", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, x, y, w = coords +al, be = functions +metric = diag(-be(w) ** 2 * y ** 2, al(w) ** 2, be(w) ** 2, 1) diff --git a/src/riccipy/metrics/boost_2.py b/src/riccipy/metrics/boost_2.py new file mode 100644 index 0000000..870e3b3 --- /dev/null +++ b/src/riccipy/metrics/boost_2.py @@ -0,0 +1,12 @@ +""" +Metric with G4 on T3 and boost isotropy (flat case k=1) +Stephani (11.16) p128 +""" +from sympy import Function, diag, symbols + +coords = symbols("t x y w", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, x, y, w = coords +al, be = functions +metric = diag(-be(w) ** 2 * sinh(y) ** 2, al(w) ** 2, be(w) ** 2, 1) diff --git a/src/riccipy/metrics/boost_3.py b/src/riccipy/metrics/boost_3.py new file mode 100644 index 0000000..f5ef587 --- /dev/null +++ b/src/riccipy/metrics/boost_3.py @@ -0,0 +1,12 @@ +""" +Metric with G4 on T3 and boost isotropy (flat case k=1) +Stephani (11.16) p128 +""" +from sympy import Function, diag, symbols + +coords = symbols("t x y w", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, x, y, w = coords +al, be = functions +metric = diag(-be(w) ** 2 * sin(y) ** 2, al(w) ** 2, be(w) ** 2, 1) diff --git a/src/riccipy/metrics/buchdahl_land.py b/src/riccipy/metrics/buchdahl_land.py new file mode 100644 index 0000000..8d9f245 --- /dev/null +++ b/src/riccipy/metrics/buchdahl_land.py @@ -0,0 +1,19 @@ +""" +Buchdahl and Land's static spherically symmetric stiff perfect fluid with rhob=2 +Tolman, Phys. Rev., v55, p363-373, (1939) +Buchdahl et al., J. Austr. Math. Soc., v8, p6-16, (1968) +Ibanez et al., J. Math. Phys., v23, p1363-1364, (1982) +Stephani (11.16) p128 +""" +from sympy import Rational, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = () +t, r, th, ph = coords +metric = diag( + -Rational(2, 3) * r ** 2, + 1 / (Rational(1, 2) - r ** 2 / 3), + r ** 2, + r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/cmetric.py b/src/riccipy/metrics/cmetric.py new file mode 100644 index 0000000..4e1a3c4 --- /dev/null +++ b/src/riccipy/metrics/cmetric.py @@ -0,0 +1,17 @@ +""" +The C-metric +Stephani (Table 16.2) p188 +""" +from sympy import Function, diag, symbols + +coords = symbols("t x y phi", real=True) +variables = () +functions = symbols("f h", cls=Function) +t, x, y, ph = coords +f, h = functions +metric = diag( + -h(y) / (x + y) ** 2, + 1 / ((x + y) ** 2 * f(x)), + 1 / ((x + y) ** 2 * h(y)), + f(x) / (x + y) ** 2, +) diff --git a/src/riccipy/metrics/cross_const_curvature_1.py b/src/riccipy/metrics/cross_const_curvature_1.py new file mode 100644 index 0000000..df826b6 --- /dev/null +++ b/src/riccipy/metrics/cross_const_curvature_1.py @@ -0,0 +1,12 @@ +""" +Cross product of two 2-dimensional subspaces of constant curvature +Stephani (10.8) p118 +""" +from sympy import diag, sin, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("A B", constant=True) +functions = () +t, x, y, z = coords +A, B = variables +metric = diag(-B ** 2 * sin(z) ** 2, A ** 2, A ** 2 * sin(x) ** 2, B ** 2) diff --git a/src/riccipy/metrics/cross_const_curvature_2.py b/src/riccipy/metrics/cross_const_curvature_2.py new file mode 100644 index 0000000..74106d6 --- /dev/null +++ b/src/riccipy/metrics/cross_const_curvature_2.py @@ -0,0 +1,12 @@ +""" +Cross product of two 2-dimensional subspaces of constant curvature +Stephani (10.8) p118 +""" +from sympy import diag, sin, sinh, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("A B", constant=True) +functions = () +t, x, y, z = coords +A, B = variables +metric = diag(-B ** 2 * sin(z) ** 2, A ** 2, A ** 2 * sinh(x) ** 2, B ** 2) diff --git a/src/riccipy/metrics/cross_const_curvature_3.py b/src/riccipy/metrics/cross_const_curvature_3.py new file mode 100644 index 0000000..eba7fd0 --- /dev/null +++ b/src/riccipy/metrics/cross_const_curvature_3.py @@ -0,0 +1,12 @@ +""" +Cross product of two 2-dimensional subspaces of constant curvature +Stephani (10.8) p118 +""" +from sympy import diag, sin, sinh, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("A B", constant=True) +functions = () +t, x, y, z = coords +A, B = variables +metric = diag(-B ** 2 * sinh(z) ** 2, A ** 2, A ** 2 * sin(x) ** 2, B ** 2) diff --git a/src/riccipy/metrics/cross_const_curvature_4.py b/src/riccipy/metrics/cross_const_curvature_4.py new file mode 100644 index 0000000..2926ef5 --- /dev/null +++ b/src/riccipy/metrics/cross_const_curvature_4.py @@ -0,0 +1,12 @@ +""" +Cross product of two 2-dimensional subspaces of constant curvature +Stephani (10.8) p118 +""" +from sympy import diag, sinh, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("A B", constant=True) +functions = () +t, x, y, z = coords +A, B = variables +metric = diag(-B ** 2 * sinh(z) ** 2, A ** 2, A ** 2 * sinh(x) ** 2, B ** 2) diff --git a/src/riccipy/metrics/datta_1.py b/src/riccipy/metrics/datta_1.py new file mode 100644 index 0000000..fa944ef --- /dev/null +++ b/src/riccipy/metrics/datta_1.py @@ -0,0 +1,13 @@ +""" +Datta's Einstein-Maxwell solution +Datta, Nuovo Cim., v36, p109 +Stephani (11.60) p137 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("a b", constant=True) +functions = () +t, x, y, z = coords +a, b = variables +metric = diag(-1 / (b / t - a / t ** 2), b / t - a / t ** 2, t ** 2, t ** 2) diff --git a/src/riccipy/metrics/datta_2.py b/src/riccipy/metrics/datta_2.py new file mode 100644 index 0000000..5783aa9 --- /dev/null +++ b/src/riccipy/metrics/datta_2.py @@ -0,0 +1,15 @@ +""" +Datta's Einstein-Maxwell solution +Stephani (11.62) p137 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("C_1 C_2 mu", constant=True) +functions = () +t, x, y, z = coords +C1, C2, mu = variables +expr = (C1 * t ** mu + C2 / t ** mu) ** 2 +metric = diag( + -expr * t ** (2 * mu ** 2), 1 / expr, expr * t ** (2 * mu ** 2), t ** 2 * expr +) diff --git a/src/riccipy/metrics/davidson.py b/src/riccipy/metrics/davidson.py new file mode 100644 index 0000000..b74c15d --- /dev/null +++ b/src/riccipy/metrics/davidson.py @@ -0,0 +1,17 @@ +""" +Davidson's cylindrically symmetric radiation perfect fluid universe +Davidson, J. Math. Phys., v32, p1560, (1991) +""" +from sympy import Rational, diag, symbols + +coords = symbols("t r z phi", real=True) +variables = () +functions = () +t, r, z, phi = coords +expr = (1 + r ** 2) ** Rational(2, 5) +metric = diag( + -expr ** 3, + t ** Rational(4, 3) * expr, + t ** Rational(-2, 3) / expr, + t ** Rational(4, 3) * r ** 2 / expr, +) diff --git a/src/riccipy/metrics/de_sitter_1.py b/src/riccipy/metrics/de_sitter_1.py new file mode 100644 index 0000000..11f9084 --- /dev/null +++ b/src/riccipy/metrics/de_sitter_1.py @@ -0,0 +1,13 @@ +""" +de Sitter space +Hawking and Ellis p125 +""" +from sympy import cosh, diag, sin, symbols + +coords = symbols("t chi theta phi", real=True) +variables = symbols("alpha", constant=True) +functions = () +t, ch, th, ph = coords +al = variables +expr = al ** 2 * cosh(t / al) ** 2 +metric = diag(-1, expr, expr * sin(ch) ** 2, expr * sin(ch) ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/de_sitter_2.py b/src/riccipy/metrics/de_sitter_2.py new file mode 100644 index 0000000..96ad513 --- /dev/null +++ b/src/riccipy/metrics/de_sitter_2.py @@ -0,0 +1,13 @@ +""" +de Sitter space +Hawking and Ellis p125 +""" +from sympy import diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("alpha", constant=True) +functions = () +t, x, y, z = coords +al = variables +expr = exp(2 * t / al) +metric = diag(-1, expr, expr, expr) diff --git a/src/riccipy/metrics/de_sitter_3.py b/src/riccipy/metrics/de_sitter_3.py new file mode 100644 index 0000000..1272440 --- /dev/null +++ b/src/riccipy/metrics/de_sitter_3.py @@ -0,0 +1,12 @@ +""" +de Sitter space with a non-zero cosmological constant +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("Lambda", constant=True) +functions = () +t, r, th, ph = coords +La = variables +expr = 1 - La * r ** 2 / 3 +metric = diag(-expr, 1 / expr, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/domain_wall.py b/src/riccipy/metrics/domain_wall.py new file mode 100644 index 0000000..61e3f04 --- /dev/null +++ b/src/riccipy/metrics/domain_wall.py @@ -0,0 +1,13 @@ +""" +Metric for spacetime with domain wall +""" +from sympy import diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = (symbols("k", constant=True),) +functions = () +t, x, y, z = coords +k = variables +expr1 = (1 - k * z) ** 2 +expr2 = exp(2 * k * t) +metric = diag(-expr1, expr1 * expr2, expr1 * expr2, 1) diff --git a/src/riccipy/metrics/dunn_tupper.py b/src/riccipy/metrics/dunn_tupper.py new file mode 100644 index 0000000..adfccf9 --- /dev/null +++ b/src/riccipy/metrics/dunn_tupper.py @@ -0,0 +1,15 @@ +""" +Dunn and Tupper's G3VI0 perfect fluid solution +""" +from sympy import diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("b", constant=True) +functions = () +t, x, y, z = coords +metric = diag( + -1, + 4 * t ** 2 / (-b * (1 + b)), + t ** (-2 * b) * exp(-4 * x), + t ** (-2 * b) * exp(4 * x), +) diff --git a/src/riccipy/metrics/durgapal_1.py b/src/riccipy/metrics/durgapal_1.py new file mode 100644 index 0000000..5eda1fa --- /dev/null +++ b/src/riccipy/metrics/durgapal_1.py @@ -0,0 +1,21 @@ +""" +Durgapal's static spherically symmetric perfect fluid with n=3 +Durgapal, J. Phys. A, v15, p2637-2644, (1982) +""" +from sympy import sin, sqrt, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("A C K", constant=True) +functions = () +t, r, th, ph = coords +A, C, K = variables +metric = zeros(4) +metric[0, 0] = -A ** 2 * (1 + C * r ** 2) ** 3 +metric[1, 1] = ( + 2 + * (1 + C * r ** 2) + * sqrt(1 + 4 * C * r ** 2) + / ((2 - C * r ** 2) * sqrt(1 + 4 * C * r ** 2) + 2 * K * C * r ** 2) +) +metric[2, 2] = r ** 2 +metric[3, 3] = r ** 2 * sin(th) ** 2 diff --git a/src/riccipy/metrics/durgapal_2.py b/src/riccipy/metrics/durgapal_2.py new file mode 100644 index 0000000..298941a --- /dev/null +++ b/src/riccipy/metrics/durgapal_2.py @@ -0,0 +1,24 @@ +""" +Durgapal's static spherically symmetric perfect fluid with n=4 +Durgapal, J. Phys. A, v15, p2637-2644, (1982) +""" +from sympy import Rational, sin, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("A C K", constant=True) +functions = () +t, r, th, ph = coords +A, C, K = variables +metric = zeros(4) +metric[0, 0] = -A ** 2 * (1 + C * r ** 2) ** 4 +metric[1, 1] = ( + 7 + * (1 + C * r ** 2) ** 2 + * (1 + 5 * C * r ** 2) ** Rational(2, 5) + / ( + (7 - 10 * C * r ** 2 - C ** 2 * r ** 4) * (1 + 5 * C * r ** 2) ** Rational(2, 5) + + 7 * K * C * r ** 2 + ) +) +metric[2, 2] = r ** 2 +metric[3, 3] = r ** 2 * sin(th) ** 2 diff --git a/src/riccipy/metrics/durgapal_3.py b/src/riccipy/metrics/durgapal_3.py new file mode 100644 index 0000000..1639a8d --- /dev/null +++ b/src/riccipy/metrics/durgapal_3.py @@ -0,0 +1,20 @@ +""" +Durgapal's static spherically symmetric perfect fluid with n=5 +Durgapal, J. Phys. A, v15, p2637-2644, (1982) +""" +from sympy import Rational, sin, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("A C K", constant=True) +functions = () +t, r, th, ph = coords +A, C, K = variables +metric = zeros(4) +metric[0, 0] = -A ** 2 * (1 + C * r ** 2) ** 5 +metric[1, 1] = (1 + C * r ** 2) ** 3 / ( + 1 + - C * r ** 2 * (309 + 54 * C * r ** 2 + 8 * C ** 2 * r ** 4) / 112 + + K * C * r ** 2 / (1 + 6 * C * r ** 2) ** Rational(1, 3) +) +metric[2, 2] = r ** 2 +metric[3, 3] = r ** 2 * sin(th) ** 2 diff --git a/src/riccipy/metrics/durgapal_fuloria.py b/src/riccipy/metrics/durgapal_fuloria.py new file mode 100644 index 0000000..2529d61 --- /dev/null +++ b/src/riccipy/metrics/durgapal_fuloria.py @@ -0,0 +1,18 @@ +""" +Durgapal and Fuloria's static spherically symmetric perfect fluid +Durgapal et al., Gen. Rel. Grav., v17, p671-681, (1985) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("B C", constant=True) +functions = () +t, r, th, ph = coords +B, C = variables +expr = 1 + C * r ** 2 +metric = diag( + -B * expr ** 4, + 7 * expr ** 2 / (-expr ** 2 - 8 * expr + 16), + r ** 2, + r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/einstein_1.py b/src/riccipy/metrics/einstein_1.py new file mode 100644 index 0000000..3961bd7 --- /dev/null +++ b/src/riccipy/metrics/einstein_1.py @@ -0,0 +1,13 @@ +""" +Einstein's static universe. Cartesian coordinates +Stephani (10.23a) p122 +""" +from sympy import diag, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("K", constant=True) +functions = () +t, x, y, z = coords +K = variables +expr = 1 / (1 + sqrt(x ** 2 + y ** 2 + z ** 2) / (4 * K ** 2)) ** 2 +metric = diag(-1, expr, expr, expr) diff --git a/src/riccipy/metrics/einstein_2.py b/src/riccipy/metrics/einstein_2.py new file mode 100644 index 0000000..1e65541 --- /dev/null +++ b/src/riccipy/metrics/einstein_2.py @@ -0,0 +1,12 @@ +""" +Einstein's static universe. Polar coordinates +Stephani (10.23b) p122 +""" +from sympy import diag, sin, symbols + +coords = symbols("t chi theta phi", real=True) +variables = symbols("Lambda", constant=True) +functions = () +t, ch, th, ph = coords +La = variables +metric = diag(-1 / La, 1 / La, sin(ch) ** 2 / La, sin(ch) ** 2 * sin(th) ** 2 / La) diff --git a/src/riccipy/metrics/einstein_3.py b/src/riccipy/metrics/einstein_3.py new file mode 100644 index 0000000..440680a --- /dev/null +++ b/src/riccipy/metrics/einstein_3.py @@ -0,0 +1,12 @@ +""" +Einstein's static universe. Curvature coordinates +Stephani (10.23c) p122 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("Lambda", constant=True) +functions = () +t, r, th, ph = coords +La = variables +metric = diag(-1, 1 / (1 - La * r ** 2), r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/einstein_maxwell_1.py b/src/riccipy/metrics/einstein_maxwell_1.py new file mode 100644 index 0000000..ef4d4c6 --- /dev/null +++ b/src/riccipy/metrics/einstein_maxwell_1.py @@ -0,0 +1,14 @@ +""" +Static cylindrically symmetric Einstein-Maxwell field (i) angular magnetic field (caused by an axial current) +Stephani (20.9a) p221 +""" +from sympy import cosh, diag, log, symbols + +coords = symbols("t rho z phi", real=True) +variables = symbols("a b m", constant=True) +functions = () +t, rh, z, ph = coords +a, b, m = variables +expr1 = cosh(log(a * rh ** m)) ** 2 +expr2 = rh ** (2 * m ** 2) * b ** 2 * expr1 +metric = diag(-expr2, expr2, 1 / (b ** 2 * expr1), rh ** 2 * b ** 2 * expr1) diff --git a/src/riccipy/metrics/einstein_maxwell_2.py b/src/riccipy/metrics/einstein_maxwell_2.py new file mode 100644 index 0000000..1575bac --- /dev/null +++ b/src/riccipy/metrics/einstein_maxwell_2.py @@ -0,0 +1,14 @@ +""" +Static cylindrically symmetric Einstein-Maxwell field (ii) longitudinal magnetic field (caused by an angular current) +Stephani (20.9b) p221 +""" +from sympy import cosh, diag, log, symbols + +coords = symbols("t rho z phi", real=True) +variables = symbols("a b m", constant=True) +functions = () +t, rh, z, ph = coords +a, b, m = variables +expr1 = cosh(log(a * rh ** m)) ** 2 +expr2 = rh ** (2 * m ** 2) * b ** 2 * expr1 +metric = diag(-expr2, expr2, rh ** 2 * b ** 2 * expr1, 1 / (b ** 2 * expr1)) diff --git a/src/riccipy/metrics/einstein_maxwell_3.py b/src/riccipy/metrics/einstein_maxwell_3.py new file mode 100644 index 0000000..ff2417e --- /dev/null +++ b/src/riccipy/metrics/einstein_maxwell_3.py @@ -0,0 +1,14 @@ +""" +Static cylindrically symmetric Einstein-Maxwell field (iii) radial electric field (caused by an axial charge distribution) +Stephani (20.9c) p221 +""" +from sympy import cosh, diag, log, symbols + +coords = symbols("t rho z phi", real=True) +variables = symbols("a b m", constant=True) +functions = () +t, rh, z, ph = coords +a, b, m = variables +expr1 = cosh(log(a * rh ** m)) ** 2 +expr2 = rh ** (2 * m ** 2) * b ** 2 * expr1 +metric = diag(-1 / (b ** 2 * expr1), expr2, expr2, rh ** 2 * b ** 2 * expr1) diff --git a/src/riccipy/metrics/ellis_maccallum_1.py b/src/riccipy/metrics/ellis_maccallum_1.py new file mode 100644 index 0000000..f0a246b --- /dev/null +++ b/src/riccipy/metrics/ellis_maccallum_1.py @@ -0,0 +1,14 @@ +""" +Ellis and MacCallum's G3VIo dust solution +Ellis et al., Commun. Math. Phys., v12, p108, (1969) +Dunn et al., Astrophys. J., v204, p322, (1976) +Evans, Mon. Not. R. Ast. Soc., v183, p727, (1978) +Stephani (12.25) p150 +""" +from sympy import diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-1, 16 * t ** 2, t * exp(-4 * x), t * exp(4 * x)) diff --git a/src/riccipy/metrics/ellis_maccallum_2.py b/src/riccipy/metrics/ellis_maccallum_2.py new file mode 100644 index 0000000..964cff0 --- /dev/null +++ b/src/riccipy/metrics/ellis_maccallum_2.py @@ -0,0 +1,18 @@ +""" +Ellis and MacCallum Bianchi VIo vacuum solution +Ellis et al., Commun. Math. Phys., v12, p108, (1969) +Stephani (11.56) p136 +""" +from sympy import diag, exp, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("n", constant=True) +functions = () +t, x, y, z = coords +n = variables +metric = diag( + -sqrt(t) * exp(n ** 2 * t ** 2), + sqrt(t) * exp(n ** 2 * t ** 2), + t * exp(2 * n * x), + t * exp(-2 * n * x), +) diff --git a/src/riccipy/metrics/faulkes.py b/src/riccipy/metrics/faulkes.py new file mode 100644 index 0000000..bd8619c --- /dev/null +++ b/src/riccipy/metrics/faulkes.py @@ -0,0 +1,16 @@ +""" +Faulkes' non-static spherically symmetric perfect fluid solution +Faulkes, Prog. Theor. Phys., v42, p1139-1142, (1969) +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("k", constant=True) +functions = symbols("E", cls=Function) +t, r, th, ph = coords +k = variables +E = functions +expr = (E(t) - (r / (2 * k))) ** 2 +metric = diag( + -E(t) ** 2 / expr, expr ** 2, expr ** 2 * r ** 2, expr ** 2 * r ** 2 * sin(th) ** 2 +) diff --git a/src/riccipy/metrics/godel.py b/src/riccipy/metrics/godel.py new file mode 100644 index 0000000..b73c90d --- /dev/null +++ b/src/riccipy/metrics/godel.py @@ -0,0 +1,14 @@ +""" +Godel metric +Rev. Mod. Phys., v21, p447, (1949) +Stephani (10.25) 122 +""" +from sympy import Rational, diag, exp, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("omega", constant=True) +functions = () +t, x, y, z = coords +om = variables +metric = diag(-1, 1, -Rational(1, 2) * exp(2 * sqrt(2) * om * x), 1) +metric[0, 2] = metric[2, 0] = -exp(sqrt(2) * om * x) diff --git a/src/riccipy/metrics/godfrey.py b/src/riccipy/metrics/godfrey.py new file mode 100644 index 0000000..f9ece85 --- /dev/null +++ b/src/riccipy/metrics/godfrey.py @@ -0,0 +1,14 @@ +""" +A vacuum metric admitting a nontrivial homothety which is non-null, not hypersurface-orthogonal, and whose homothetic bivector is null +Godfrey, Gen. Rel. Grav., v3, p3, (1972) +McIntosh, Gen. Rel. Grav., v7, p199-213, (1976) +""" +from sympy import diag, exp, symbols + +coords = symbols("t r z phi", real=True) +variables = symbols("a C") +functions = () +t, r, z, ph = coords +a, C = variables +expr = r ** (2 * a * (a - 1)) * exp(2 * (2 * a * z - z - r ** 2 / 2 + C)) +metric = diag(-r ** (2 * a) * exp(2 * z), expr, expr, r ** (2 * (1 - a)) / exp(2 * z)) diff --git a/src/riccipy/metrics/gott.py b/src/riccipy/metrics/gott.py new file mode 100644 index 0000000..a9f9bd1 --- /dev/null +++ b/src/riccipy/metrics/gott.py @@ -0,0 +1,12 @@ +""" +Gott's interior solution for a cosmic string. +Gott, Astrophys. J., v288, p422-427, (1985) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r phi z", real=True) +variables = symbols("r_0", constant=True) +functions = () +t, r, ph, z = coords +r0 = variables +metric = diag(-1, 1, r0 ** 2 * sin(r / r0) ** 2, 1) diff --git a/src/riccipy/metrics/griffiths.py b/src/riccipy/metrics/griffiths.py new file mode 100644 index 0000000..cef856d --- /dev/null +++ b/src/riccipy/metrics/griffiths.py @@ -0,0 +1,28 @@ +""" +Griffiths' metric +Griffiths, Math. Proc. Camb. Phil. Soc., v77, p559, (1975) +""" +from sympy import Rational, symbols, zeros + +coords = symbols("u v x y", real=True) +variables = symbols("a", constant=True) +functions = () +u, v, x, y = coords +a = variables +metric = zeros(4) +metric[2, 2] = ( + Rational(3, 2) + + 4 * a ** 2 * v * u + + 6 * a ** 2 * v ** 2 + + 6 * a ** 2 * u ** 2 + + 4 * a ** 2 * y * u + + 2 * a ** 2 * y ** 2 + + 4 * a ** 2 * v * y +) +metric[3, 3] = -Rational(1, 2) +metric[0, 1] = metric[1, 0] = -1 +metric[0, 2] = metric[2, 0] = -a * (2 * v - y) +metric[0, 3] = metric[3, 0] = -1 +metric[1, 2] = metric[2, 1] = -a * (2 * u - y) +metric[1, 3] = metric[3, 1] = -1 +metric[2, 3] = metric[3, 2] = a * (v + u + 2 * y) diff --git a/src/riccipy/metrics/harrison_1.py b/src/riccipy/metrics/harrison_1.py new file mode 100644 index 0000000..9bb6c2d --- /dev/null +++ b/src/riccipy/metrics/harrison_1.py @@ -0,0 +1,18 @@ +""" +Harrison III-12(b). Petrov type I +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import Rational, cosh, symbols, zeros + +coords = symbols("x_0:4", real=True) +variables = symbols("a", constant=True) +functions = () +x0, x1, x2, x3 = coords +a = variables +expr = x1 ** 2 * cosh(x3) ** Rational(3, 2) +metric = zeros(4) +metric[0, 0] = x0 ** Rational(3, 2) * expr +metric[1, 1] = a ** 2 * x0 ** 3 * x1 * cosh(x3) ** 3 +metric[2, 2] = 1 / (x0 * x1 * cosh(x3)) +metric[3, 3] = x0 ** Rational(7, 2) * expr diff --git a/src/riccipy/metrics/harrison_2.py b/src/riccipy/metrics/harrison_2.py new file mode 100644 index 0000000..3ade494 --- /dev/null +++ b/src/riccipy/metrics/harrison_2.py @@ -0,0 +1,17 @@ +""" +Harrison III-3 Petrov type D, Kinnersley class IV.B (C=0) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import Rational, diag, sin, sqrt, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -x1 * sin(x3), + 1 / (sqrt(x1 * sin(x3))), + x1 * sin(x3), + x1 ** Rational(3, 2) / sqrt(sin(x3)), +) diff --git a/src/riccipy/metrics/harrison_3.py b/src/riccipy/metrics/harrison_3.py new file mode 100644 index 0000000..459b293 --- /dev/null +++ b/src/riccipy/metrics/harrison_3.py @@ -0,0 +1,17 @@ +""" +Harrison III-7(a) Petrov type D, Kinnersley class IV.B (C=1/2) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import diag, sinh, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -1 / (1 - x3 ** 2) ** 2, + sinh(2 * x0) ** 2 / (1 - x3 ** 2) ** 2, + x3 ** 2, + 1 / (1 - x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/harrison_4.py b/src/riccipy/metrics/harrison_4.py new file mode 100644 index 0000000..0c3c0e4 --- /dev/null +++ b/src/riccipy/metrics/harrison_4.py @@ -0,0 +1,17 @@ +""" +Harrison III-7(b) Petrov type D, Kinnersley class IV.B (C=1/2) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import cosh, diag, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -1 / (1 - x3 ** 2) ** 2, + cosh(2 * x0) ** 2 / (1 - x3 ** 2) ** 2, + x3 ** 2, + 1 / (1 - x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/harrison_5.py b/src/riccipy/metrics/harrison_5.py new file mode 100644 index 0000000..bf8b61f --- /dev/null +++ b/src/riccipy/metrics/harrison_5.py @@ -0,0 +1,17 @@ +""" +Harrison III-7(a) Petrov type D, Kinnersley class IV.B (C=1/2) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import diag, exp, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -1 / (1 - x3 ** 2) ** 2, + exp(4 * x0) ** 2 / (1 - x3 ** 2) ** 2, + x3 ** 2, + 1 / (1 - x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/harrison_6.py b/src/riccipy/metrics/harrison_6.py new file mode 100644 index 0000000..36375f9 --- /dev/null +++ b/src/riccipy/metrics/harrison_6.py @@ -0,0 +1,17 @@ +""" +Harrison III-9(a) Petrov type D, Kinnersley class II.B (a=l=0) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import diag, sinh, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -x3 ** 2, + sinh(2 * x2) ** 2 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/harrison_7.py b/src/riccipy/metrics/harrison_7.py new file mode 100644 index 0000000..ad590e7 --- /dev/null +++ b/src/riccipy/metrics/harrison_7.py @@ -0,0 +1,17 @@ +""" +Harrison III-9(b) Petrov type D, Kinnersley class II.C (a=l=0) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import cosh, diag, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -x3 ** 2, + cosh(2 * x2) ** 2 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/harrison_8.py b/src/riccipy/metrics/harrison_8.py new file mode 100644 index 0000000..ada06c1 --- /dev/null +++ b/src/riccipy/metrics/harrison_8.py @@ -0,0 +1,17 @@ +""" +Harrison III-9(c) Petrov type D, Kinnersley class II.D (a=l=0) +Harrison, Phys. Rev., v116, p1285, (1959) +d'Inverno et al., J. Math. Phys., v12, p1258, (1971) +""" +from sympy import diag, exp, symbols + +coords = symbols("x_0:4", real=True) +variables = () +functions = () +x0, x1, x2, x3 = coords +metric = diag( + -x3 ** 2, + exp(4 * x2) ** 2 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 2, + 1 / (1 + x3 ** 2) ** 4, +) diff --git a/src/riccipy/metrics/heintzmann.py b/src/riccipy/metrics/heintzmann.py new file mode 100644 index 0000000..10fb742 --- /dev/null +++ b/src/riccipy/metrics/heintzmann.py @@ -0,0 +1,14 @@ +""" +Heintzmann's static spherically symmetric perfect fluid solution +Heintzmann, Z. Phys., v228, p489-493, (1969) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A a K", constant=True) +functions = () +t, r, th, ph = coords +A, a, K = variables +metric = diag( + -A ** 2 * (1 + a * r ** 2) ** 3, (1 + a * r ** 2) / K, r ** 2, r ** 2 * sin(th) ** 2 +) diff --git a/src/riccipy/metrics/kasner_1.py b/src/riccipy/metrics/kasner_1.py new file mode 100644 index 0000000..246d6f2 --- /dev/null +++ b/src/riccipy/metrics/kasner_1.py @@ -0,0 +1,10 @@ +""" +Kasner power-law vacuum solution. Axisymmetric case +""" +from sympy import Rational, diag, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-1, t ** Rational(4, 3), t ** Rational(4, 3), t ** Rational(-2, 3)) diff --git a/src/riccipy/metrics/kasner_2.py b/src/riccipy/metrics/kasner_2.py new file mode 100644 index 0000000..f8e318b --- /dev/null +++ b/src/riccipy/metrics/kasner_2.py @@ -0,0 +1,10 @@ +""" +Kasner power-law vacuum solution. Axisymmetric flat case +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-1, t ** 2, 1, 1) diff --git a/src/riccipy/metrics/kerr_1.py b/src/riccipy/metrics/kerr_1.py new file mode 100644 index 0000000..2240849 --- /dev/null +++ b/src/riccipy/metrics/kerr_1.py @@ -0,0 +1,29 @@ +""" +Kerr metric in Cartesian coordinates +Allen, Gen. Rel. Grav., v26, p21, (1994) +""" +from sympy import symbols, zeros + +coords = symbols("t x y z", real=True) +variables = symbols("a M", constant=True) +functions = () +t, x, y, z = coords +a, M = variables +expr = x ** 2 + a ** 2 * y ** 2 +metric = zeros(4) +metric[0, 0] = -(a ** 2 * y ** 2 + x ** 2 - 2 * M * x) / expr +metric[1, 1] = expr / (x ** 2 - 2 * M * x + a ** 2) +metric[2, 2] = -expr / (y ** 2 - 1) +metric[3, 3] = ( + -( + x ** 4 + + x ** 2 * a ** 2 + + 2 * a ** 2 * M * x + + a ** 2 * y ** 2 * x ** 2 + - 2 * a * y ** 2 * M * x + + a ** 4 * y ** 2 + ) + * (y ** 2 - 1) + / expr +) +metric[0, 3] = metric[3, 0] = 2 * a * M * x * (y ** 2 - 1) / expr diff --git a/src/riccipy/metrics/kerr_2.py b/src/riccipy/metrics/kerr_2.py new file mode 100644 index 0000000..d4aca01 --- /dev/null +++ b/src/riccipy/metrics/kerr_2.py @@ -0,0 +1,30 @@ +""" +Kerr metric in Boyer Lindquist coordinates +Boyer, J. Math. Phys., v8, p265, (1967) +Stephani (18.25) p205 +""" +from sympy import cos, sin, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("a M", constant=True) +functions = () +t, r, th, ph = coords +a, M = variables +expr = a ** 2 * cos(th) ** 2 + r ** 2 +metric = zeros(4) +metric[0, 0] = -(a ** 2 - sin(th) ** 2 * a ** 2 + r ** 2 - 2 * M * r) / expr +metric[1, 1] = expr / (r ** 2 - 2 * M * r + a ** 2) +metric[2, 2] = expr +metric[3, 3] = ( + ( + -a ** 4 * sin(th) ** 2 + + a ** 4 + + 2 * r ** 2 * a ** 2 + - a ** 2 * sin(th) ** 2 * r ** 2 + + 2 * a ** 2 * sin(th) ** 2 * M * r + + r ** 4 + ) + * sin(th) ** 2 + / expr +) +metric[0, 3] = metric[3, 0] = -2 * M * r * a * sin(th) ** 2 / expr diff --git a/src/riccipy/metrics/kerr_3.py b/src/riccipy/metrics/kerr_3.py new file mode 100644 index 0000000..c925534 --- /dev/null +++ b/src/riccipy/metrics/kerr_3.py @@ -0,0 +1,29 @@ +""" +Kerr metric in outgoing Eddington Finkelstein form +""" +from sympy import cos, sin, symbols, zeros + +coords = symbols("u r theta phi", real=True) +variables = symbols("a M", constant=True) +functions = () +u, r, th, ph = coords +a, M = variables +expr = r ** 2 + a ** 2 * cos(th) ** 2 +metric = zeros(4) +metric[0, 0] = -(a ** 2 - sin(th) ** 2 * a ** 2 + r ** 2 - 2 * M * r) / expr +metric[2, 2] = expr +metric[3, 3] = ( + sin(th) ** 2 + * ( + 2 * a ** 2 * M * r * sin(th) ** 2 + + a ** 4 + - a ** 4 * sin(th) ** 2 + + 2 * r ** 2 * a ** 2 + - a ** 2 * sin(th) ** 2 * r ** 2 + + r ** 4 + ) + / expr +) +metric[0, 1] = metric[1, 0] = -1 +metric[0, 3] = metric[3, 0] = -2 * a * sin(th) ** 2 * M * r / expr +metric[1, 3] = metric[3, 1] = a * sin(th) ** 2 diff --git a/src/riccipy/metrics/kerr_newman_1.py b/src/riccipy/metrics/kerr_newman_1.py new file mode 100644 index 0000000..822eeaa --- /dev/null +++ b/src/riccipy/metrics/kerr_newman_1.py @@ -0,0 +1,31 @@ +""" +Kerr metric in Cartesian coordinates +Allen, Gen. Rel. Grav., v26, p21, (1994) +""" +from sympy import symbols, zeros + +coords = symbols("t x y z", real=True) +variables = symbols("a M Q", constant=True) +functions = () +t, x, y, z = coords +a, M, Q = variables +expr = x ** 2 + a ** 2 * y ** 2 +metric = zeros(4) +metric[0, 0] = -(a ** 2 * y ** 2 + x ** 2 - 2 * M * x + Q ** 2) / expr +metric[1, 1] = expr / (x ** 2 - 2 * M * x + a ** 2 + Q ** 2) +metric[2, 2] = -expr / (x ** 2 - 1) +metric[3, 3] = ( + -( + x ** 4 + + x ** 2 * a ** 2 + + 2 * a ** 2 * M * x + - a ** 2 * Q ** 2 + + a ** 2 * y ** 2 * x ** 2 + - 2 * a ** 2 * y ** 2 * M * x + + a ** 4 * y ** 2 + + a ** 2 * y ** 2 * Q ** 2 + ) + * (y ** 2 - 1) + / expr +) +metric[0, 3] = metric[3, 0] = a * (2 * M * x - Q ** 2) * (y ** 2 - 1) / expr diff --git a/src/riccipy/metrics/kerr_newman_2.py b/src/riccipy/metrics/kerr_newman_2.py new file mode 100644 index 0000000..e4f4e8e --- /dev/null +++ b/src/riccipy/metrics/kerr_newman_2.py @@ -0,0 +1,33 @@ +""" +Kerr metric in Boyer Lindquist coordinates +Newman, J. Math. Phys., v6, p918, (1965) +Stephani (19.19) p213 +""" +from sympy import cos, sin, symbols, zeros + +coords = symbols("t r theta phi", real=True) +variables = symbols("a M Q", constant=True) +functions = () +t, r, th, ph = coords +a, M, Q = variables +expr = a ** 2 * cos(th) ** 2 + r ** 2 +metric = zeros(4) +metric[0, 0] = -(a ** 2 - sin(th) ** 2 * a ** 2 + r ** 2 - (2 * M * r - Q ** 2)) / expr +metric[1, 1] = expr / (r ** 2 - 2 * M * r + Q ** 2 + a ** 2) +metric[2, 2] = expr +metric[3, 3] = ( + ( + -a ** 4 * sin(th) ** 2 + + a ** 4 + + 2 * r ** 2 * a ** 2 + - a ** 2 * sin(th) ** 2 * r ** 2 + + 2 * a ** 2 * sin(th) ** 2 * M * r + - a ** 2 * sin(th) ** 2 * Q ** 2 + + r ** 4 + ) + * sin(th) ** 2 + / expr +) +metric[0, 3] = metric[3, 0] = ( + -(2 * a * sin(th) ** 2 * M * r - a * sin(th) ** 2 * Q ** 2) / expr +) diff --git a/src/riccipy/metrics/klein.py b/src/riccipy/metrics/klein.py new file mode 100644 index 0000000..c8bd8a9 --- /dev/null +++ b/src/riccipy/metrics/klein.py @@ -0,0 +1,11 @@ +""" +Klein's static spherically symmetric radiation perfect fluid solution +""" +from sympy import Rational, diag, sin, sqrt, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("p_0", constant=True) +functions = () +t, r, th, ph = coords +p0 = variables +metric = diag(-sqrt(7 * p0) * r, Rational(7, 4), r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/kottler.py b/src/riccipy/metrics/kottler.py new file mode 100644 index 0000000..e6d51a2 --- /dev/null +++ b/src/riccipy/metrics/kottler.py @@ -0,0 +1,12 @@ +""" +Kottler's generalization of the Schwarzschild metric with non-zero cosmological constant. Aka Schwarzschild-de Sitter. +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M Lambda", constant=True) +functions = () +t, r, th, ph = coords +M, La = variables +expr = 1 - 2 * M / r - La * r ** 2 / 3 +metric = diag(-expr, 1 / expr, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/koutras_mcintosh.py b/src/riccipy/metrics/koutras_mcintosh.py new file mode 100644 index 0000000..b54a3c5 --- /dev/null +++ b/src/riccipy/metrics/koutras_mcintosh.py @@ -0,0 +1,18 @@ +""" +Koutras-McIntosh metric (no symmetries or invariants) +Koutras et al., Class. Quantum Grav., v13, pL47, (1996) +""" +from sympy import Function, symbols, zeros + +coords = symbols("w u x y", real=True) +variables = symbols("a b", constant=True) +functions = symbols("f", cls=Function) +w, u, x, y = coords +a, b = variables +f = functions +metric = zeros(4) +metric[1, 1] = -(2 * f(u) * (a * x + b) * (x ** 2 + y ** 2) - a ** 2 * w ** 2) +metric[2, 2] = 1 +metric[3, 3] = 1 +metric[0, 1] = metric[1, 0] = -(a * x + b) +metric[1, 2] = metric[2, 1] = a * w diff --git a/src/riccipy/metrics/kowalczynski_plebanski.py b/src/riccipy/metrics/kowalczynski_plebanski.py new file mode 100644 index 0000000..96239dc --- /dev/null +++ b/src/riccipy/metrics/kowalczynski_plebanski.py @@ -0,0 +1,17 @@ +""" +Kowalczynski and Plebanski metric +Kowalczynski et al., Int. J. Theor. Phys., v16, p371, (1977) +Stephani (27.57) p297 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("a b c d", constant=True) +functions = () +t, x, y, z = coords +a, b, c, d = variables +expr1 = a * z ** 2 + b +expr2 = -2 * d ** 2 * x ** 2 + c * x - a +metric = diag( + -2 * expr1 / x ** 2, 2 / (expr2 * x ** 4), 2 * expr2, 2 / (expr1 * x ** 2) +) diff --git a/src/riccipy/metrics/levi_civita_1.py b/src/riccipy/metrics/levi_civita_1.py new file mode 100644 index 0000000..a155462 --- /dev/null +++ b/src/riccipy/metrics/levi_civita_1.py @@ -0,0 +1,12 @@ +""" +Levi-Civita solution, Class AI. Aka the exterior Schwarzschild metric. +Stephani (Table 16.2) p188 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, r, th, ph = coords +M = variables +metric = diag(-(1 - 2 * M / r), 1 / (1 - 2 * M / r), r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/levi_civita_2.py b/src/riccipy/metrics/levi_civita_2.py new file mode 100644 index 0000000..bc2ac5f --- /dev/null +++ b/src/riccipy/metrics/levi_civita_2.py @@ -0,0 +1,12 @@ +""" +Levi-Civita solution, Class AII +Stephani (Table 16.2) p188 +""" +from sympy import diag, sinh, symbols + +coords = symbols("t z r phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, z, r, ph = coords +M = variables +metric = diag(-(2 * M / z - 1), 1 / (2 * M / z - 1), z ** 2, z ** 2 * sinh(r) ** 2) diff --git a/src/riccipy/metrics/levi_civita_3.py b/src/riccipy/metrics/levi_civita_3.py new file mode 100644 index 0000000..4790001 --- /dev/null +++ b/src/riccipy/metrics/levi_civita_3.py @@ -0,0 +1,11 @@ +""" +Levi-Civita solution, Class AIII +Stephani (Table 16.2) p188 +""" +from sympy import diag, symbols + +coords = symbols("t z r phi", real=True) +variables = () +functions = () +t, z, r, ph = coords +metric = diag(-1 / z, z, z ** 2, z ** 2 * r ** 2) diff --git a/src/riccipy/metrics/levi_civita_4.py b/src/riccipy/metrics/levi_civita_4.py new file mode 100644 index 0000000..046df6b --- /dev/null +++ b/src/riccipy/metrics/levi_civita_4.py @@ -0,0 +1,12 @@ +""" +Levi-Civita solution, Class BI +Stephani (Table 16.2) p188 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, r, th, ph = coords +M = variables +metric = diag(-r ** 2 * sin(th) ** 2, 1 / (1 - 2 * M / r), r ** 2, 1 - 2 * M / r) diff --git a/src/riccipy/metrics/levi_civita_5.py b/src/riccipy/metrics/levi_civita_5.py new file mode 100644 index 0000000..246a465 --- /dev/null +++ b/src/riccipy/metrics/levi_civita_5.py @@ -0,0 +1,12 @@ +""" +Levi-Civita solution, Class BII +Stephani (Table 16.2) p188 +""" +from sympy import diag, sinh, symbols + +coords = symbols("t z r phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, z, r, ph = coords +M = variables +metric = diag(-z ** 2 * sinh(r) ** 2, 1 / (2 * M / z - 1), z ** 2, 2 * M / z - 1) diff --git a/src/riccipy/metrics/levi_civita_6.py b/src/riccipy/metrics/levi_civita_6.py new file mode 100644 index 0000000..2d9365a --- /dev/null +++ b/src/riccipy/metrics/levi_civita_6.py @@ -0,0 +1,11 @@ +""" +Levi-Civita solution, Class BIII +Stephani (Table 16.2) p188 +""" +from sympy import diag, symbols + +coords = symbols("t z r phi", real=True) +variables = () +functions = () +t, z, r, ph = coords +metric = diag(-r ** 2 * z ** 2, z, z ** 2, 1 / z) diff --git a/src/riccipy/metrics/levi_civita_7.py b/src/riccipy/metrics/levi_civita_7.py new file mode 100644 index 0000000..0a8b35c --- /dev/null +++ b/src/riccipy/metrics/levi_civita_7.py @@ -0,0 +1,11 @@ +""" +Levi-Civita static vacuum solution. Special case m=2, Petrov D +Stephani (20.8) p221 +""" +from sympy import diag, symbols + +coords = symbols("t rho z phi", real=True) +variables = () +functions = () +t, rh, z, ph = coords +metric = diag(-rh ** 4, rh ** 4, rh ** 4, 1 / rh ** 2) diff --git a/src/riccipy/metrics/levi_civita_8.py b/src/riccipy/metrics/levi_civita_8.py new file mode 100644 index 0000000..4564b3b --- /dev/null +++ b/src/riccipy/metrics/levi_civita_8.py @@ -0,0 +1,17 @@ +""" +Levi-Civita static vacuum solution +Stephani (20.8) p221 +""" +from sympy import diag, symbols + +coords = symbols("t rho z phi", real=True) +variables = symbols("m", constant=True) +functions = () +t, rh, z, ph = coords +m = variables +metric = diag( + -rh ** (2 * m), + rh ** (2 * (m ** 2 - m)), + rh ** (2 * (m ** 2 - m)), + rh ** (2 * (1 - m)), +) diff --git a/src/riccipy/metrics/lewis_papapetrou.py b/src/riccipy/metrics/lewis_papapetrou.py new file mode 100644 index 0000000..287aab1 --- /dev/null +++ b/src/riccipy/metrics/lewis_papapetrou.py @@ -0,0 +1,18 @@ +""" +Lewis Papapetrou metric +Ernst, Phys. Rev., v167, p1175, (1968) +""" +from sympy import Function, Rational, exp, symbols, zeros + +coords = symbols("t x y z", real=True) +variables = () +functions = symbols("k r s w", cls=Function) +t, x, y, z = coords +k, r, s, w = functions +metric = zeros(4) +metric[0, 0] = -exp(2 * s(x, y)) +metric[3, 3] = (exp(-s(x, y)) * r(x, y) - w(x, y) * exp(s(x, y))) * ( + exp(-s(x, y)) * r(x, y) + w(x, y) * exp(s(x, y)) +) +metric[0, 3] = metric[3, 0] = -w(x, y) * exp(2 * s(x, y)) +metric[1, 2] = metric[2, 1] = Rational(1, 2) * exp(2 * k(x, y) - 2 * s(x, y)) diff --git a/src/riccipy/metrics/lrs.py b/src/riccipy/metrics/lrs.py new file mode 100644 index 0000000..14324c2 --- /dev/null +++ b/src/riccipy/metrics/lrs.py @@ -0,0 +1,12 @@ +""" +LRS stiff perfect fluid cosmological solution with G4 on S3 +Stephani (12.11) p146 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("k", constant=True) +functions = () +t, x, y, z = coords +k = variables +metric = diag(-1, t ** (2 / k), t ** (1 - 1 / k), t ** (1 - 1 / k)) diff --git a/src/riccipy/metrics/mclenaghan_tariq_tupper.py b/src/riccipy/metrics/mclenaghan_tariq_tupper.py new file mode 100644 index 0000000..a14710b --- /dev/null +++ b/src/riccipy/metrics/mclenaghan_tariq_tupper.py @@ -0,0 +1,14 @@ +""" +McLenaghan Tariq Tupper metric +McLenaghan, J. Math. Phys., v16, p11, (1975) +Tupper, Gen. Rel. Grav., v7, p479, (1976) +Stephani (10.21) p121 +""" +from sympy import diag, symbols + +coords = symbols("t x y phi", real=True) +variables = symbols("a", constant=True) +functions = () +t, x, y, ph = coords +metric = diag(-1, a ** 2 / x ** 2, a ** 2 / x ** 2, x ** 2 - 4 * y ** 2) +metric[0, 3] = metric[3, 0] = 2 * y diff --git a/src/riccipy/metrics/mcvittie.py b/src/riccipy/metrics/mcvittie.py new file mode 100644 index 0000000..1016b87 --- /dev/null +++ b/src/riccipy/metrics/mcvittie.py @@ -0,0 +1,13 @@ +""" +McVittie's plane Einstein-Maxwell field with Lambda=0 +McVittie, Prog. Roy. Soc. Lond., v124, p366, (1929) +Stephani (13.26) p158 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("M Q", constant=True) +functions = () +t, x, y, z = coords +M, Q = variables +metric = diag(-(M / z + Q ** 2 / z ** 2), z ** 2, z ** 2, 1 / (M / z + Q ** 2 / z ** 2)) diff --git a/src/riccipy/metrics/melvin.py b/src/riccipy/metrics/melvin.py new file mode 100644 index 0000000..0d6ef9c --- /dev/null +++ b/src/riccipy/metrics/melvin.py @@ -0,0 +1,15 @@ +""" +Melvin's magnetic universe +Bonnor, Prog. Roy. Soc. Lond., vA67, p225, (1954) +Melvin, Phys. Lett., v8, p65, (1964) +Stephani (20.10) p222 +""" +from sympy import diag, symbols + +coords = symbols("t rho z phi", real=True) +variables = symbols("B_0", constant=True) +functions = () +t, rh, z, ph = coords +B0 = variables +expr = (1 + B0 ** 2 * rh ** 2 / 4) ** 2 +metric = diag(-expr, expr, expr, rh ** 2 / expr) diff --git a/src/riccipy/metrics/minkowski_1.py b/src/riccipy/metrics/minkowski_1.py new file mode 100644 index 0000000..93f8348 --- /dev/null +++ b/src/riccipy/metrics/minkowski_1.py @@ -0,0 +1,9 @@ +""" +Minkowski space in Cartesian coordinates +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +metric = diag(-1, 1, 1, 1) diff --git a/src/riccipy/metrics/minkowski_2.py b/src/riccipy/metrics/minkowski_2.py new file mode 100644 index 0000000..1619cad --- /dev/null +++ b/src/riccipy/metrics/minkowski_2.py @@ -0,0 +1,10 @@ +""" +Minkowski space in polar coordinates +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = () +t, r, th, ph = coords +metric = diag(-1, 1, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/minkowski_3.py b/src/riccipy/metrics/minkowski_3.py new file mode 100644 index 0000000..cbd56bd --- /dev/null +++ b/src/riccipy/metrics/minkowski_3.py @@ -0,0 +1,14 @@ +""" +Minkowski space in null coordinates +""" +from sympy import Rational, sin, symbols, zeros + +coords = symbols("u v theta phi", real=True) +variables = symbols("a b", constant=True) +functions = () +u, v, th, ph = coords +a, b = variables +metric = zeros(4) +metric[2, 2] = (a * u - Rational(1, 2) * v / a + c) ** 2 +metric[3, 3] = (a * u - Rational(1, 2) * v / a + c) ** 2 * sin(th) ** 2 +metric[0, 1] = metric[1, 0] = -1 diff --git a/src/riccipy/metrics/nariai.py b/src/riccipy/metrics/nariai.py new file mode 100644 index 0000000..dfca266 --- /dev/null +++ b/src/riccipy/metrics/nariai.py @@ -0,0 +1,15 @@ +""" +Nariai vacuum metric +Nariai, Sci. Rep. Tohoku Univ., v35, p62, (1951) +""" +from sympy import Function, cos, diag, log, sin, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("lambda", constant=True) +functions = symbols("a b", cls=Function) +t, x, y, z = coords +la = variables +a, b = functions +expr1 = x ** 2 + y ** 2 + z ** 2 +expr2 = a(t) * cos(log(sqrt(expr1) / la)) + b(t) * sin(log(sqrt(expr1) / la)) +metric = diag(-expr2, la ** 2 / expr1, la ** 2 / expr1, la ** 2 / expr1) diff --git a/src/riccipy/metrics/novotny_horsky.py b/src/riccipy/metrics/novotny_horsky.py new file mode 100644 index 0000000..70a0443 --- /dev/null +++ b/src/riccipy/metrics/novotny_horsky.py @@ -0,0 +1,17 @@ +""" +Novotny and Horsky plane symmetric vacuum metric +Novotny et al., Can. J. Phys., v24, p718, (1974) +""" +from sympy import Rational, cos, diag, sin, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("a", constant=True) +functions = () +t, x, y, z = coords +a = variables +metric = diag( + -cos(z) / sin(z) ** Rational(2, 3), + sin(z) ** Rational(4, 3), + sin(z) ** Rational(4, 3), + 1 / a ** 2, +) diff --git a/src/riccipy/metrics/pant_sah.py b/src/riccipy/metrics/pant_sah.py new file mode 100644 index 0000000..7f5c065 --- /dev/null +++ b/src/riccipy/metrics/pant_sah.py @@ -0,0 +1,12 @@ +""" +Pant and Sah charged static spherically symmetric solution +Pant et al., J. Math. Phys., v20, p2537-2539, (1979) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A n", constant=True) +functions = () +t, r, th, ph = coords +A, n = variables +metric = diag(-A * r ** (2 * n), n ** 2 + 1, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/plane_symmetric.py b/src/riccipy/metrics/plane_symmetric.py new file mode 100644 index 0000000..4c96f59 --- /dev/null +++ b/src/riccipy/metrics/plane_symmetric.py @@ -0,0 +1,12 @@ +""" +Bianchi I plane symmetric model +Stephani (13.49) p162 +""" +from sympy import Function, diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, x, y, z = coords +al, be = functions +metric = diag(-1, exp(2 * be(t)), exp(2 * be(t)), exp(2 * al(t))) diff --git a/src/riccipy/metrics/reissner_nordstrom_1.py b/src/riccipy/metrics/reissner_nordstrom_1.py new file mode 100644 index 0000000..bb5141a --- /dev/null +++ b/src/riccipy/metrics/reissner_nordstrom_1.py @@ -0,0 +1,14 @@ +""" +Reissner-Nordstrom spherically symmetric electro-vacuum solution +Reissner, Ann. Phys., v50, p106, (1916) +Stephani (13.21) p158 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M Q", constant=True) +functions = () +t, r, th, ph = coords +M, Q = variables +expr = 1 - 2 * M / r + Q ** 2 / r ** 2 +metric = diag(-expr, 1 / expr, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/reissner_nordstrom_2.py b/src/riccipy/metrics/reissner_nordstrom_2.py new file mode 100644 index 0000000..843437f --- /dev/null +++ b/src/riccipy/metrics/reissner_nordstrom_2.py @@ -0,0 +1,14 @@ +""" +Reissner-Nordstrom spherically symmetric electro-vacuum solution with non-zero cosmological constant +Reissner, Ann. Phys., v50, p106, (1916) +Stephani (Table 13.1) p157 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M Q Lambda", constant=True) +functions = () +t, r, th, ph = coords +M, Q, La = variables +expr = 1 - 2 * M / r + Q ** 2 / r ** 2 - La * r ** 2 / 3 +metric = diag(-expr, 1 / expr, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/robertson_walker_1.py b/src/riccipy/metrics/robertson_walker_1.py new file mode 100644 index 0000000..e658039 --- /dev/null +++ b/src/riccipy/metrics/robertson_walker_1.py @@ -0,0 +1,16 @@ +""" +Closed Friedman-Robertson-Walker metric. Perfect fluid +Robertson, Astrophys. J., v82, p284, (1935) +Robertson, Astrophys. J., v83, p137, (1936) +Stephani (10.9) p118 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = symbols("a", cls=Function) +t, r, th, ph = coords +a = functions +metric = diag( + -1, a(t) ** 2, a(t) ** 2 * sin(r) ** 2, a(t) ** 2 * sin(r) ** 2 * sin(th) ** 2 +) diff --git a/src/riccipy/metrics/robertson_walker_2.py b/src/riccipy/metrics/robertson_walker_2.py new file mode 100644 index 0000000..ddf119e --- /dev/null +++ b/src/riccipy/metrics/robertson_walker_2.py @@ -0,0 +1,14 @@ +""" +Spatially flat Friedman-Robertson-Walker metric. Perfect fluid +Robertson, Astrophys. J., v82, p284, (1935) +Robertson, Astrophys. J., v83, p137, (1936) +Stephani (10.9) p118 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = symbols("a", cls=Function) +t, r, th, ph = coords +a = functions +metric = diag(-1, a(t) ** 2, a(t) ** 2 * r ** 2, a(t) ** 2 * r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/robertson_walker_3.py b/src/riccipy/metrics/robertson_walker_3.py new file mode 100644 index 0000000..09aa667 --- /dev/null +++ b/src/riccipy/metrics/robertson_walker_3.py @@ -0,0 +1,15 @@ +""" +Closed Friedman-Robertson-Walker metric. Dust +Landau-Lifshitz (112.4), (112.9), (112.10) +Stephani (12.3a) p122 +Hawking and Ellis ch5.3 +""" +from sympy import cos, diag, sin, symbols + +coords = symbols("nu chi theta phi", real=True) +variables = symbols("A_0", constant=True) +functions = () +nu, ch, th, ph = coords +A0 = variables +expr = A0 ** 2 * (1 - cos(nu)) ** 2 +metric = diag(-expr, expr, expr * sin(ch) ** 2, expr * sin(ch) ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/schwarzschild_1.py b/src/riccipy/metrics/schwarzschild_1.py new file mode 100644 index 0000000..002d030 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_1.py @@ -0,0 +1,13 @@ +""" +Schwarzschild exterior metric in curvature coordinates +Schwarzschild, Sitz. Preuss. Akad. Wiss., p189, (1916) +Stephani (13.19) p157 +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, r, th, ph = coords +M = variables +metric = diag(-(1 - 2 * M / r), 1 / (1 - 2 * M / r), r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/schwarzschild_2.py b/src/riccipy/metrics/schwarzschild_2.py new file mode 100644 index 0000000..adc6a3e --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_2.py @@ -0,0 +1,15 @@ +""" +Schwarzschild metric in outgoing Eddington-Finkelstein coordinates +Eddington, Nature, v113, p192, (1924) +Finkelstein, Phys. Rev., v110, p965, (1958) +Stephani (13.23) p158 +""" +from sympy import diag, sin, symbols + +coords = symbols("r u theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +r, u, th, ph = coords +M = variables +metric = diag(0, -(1 - 2 * M / r), r ** 2, r ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = -1 diff --git a/src/riccipy/metrics/schwarzschild_3.py b/src/riccipy/metrics/schwarzschild_3.py new file mode 100644 index 0000000..29c2c25 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_3.py @@ -0,0 +1,15 @@ +""" +Schwarzschild metric in ingoing Eddington-Finkelstein coordinates +Eddington, Nature, v113, p192, (1924) +Finkelstein, Phys. Rev., v110, p965, (1958) +Stephani (13.23) p158 +""" +from sympy import diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +r, v, th, ph = coords +M = variables +metric = diag(0, -(1 - 2 * M / r), r ** 2, r ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = 1 diff --git a/src/riccipy/metrics/schwarzschild_4.py b/src/riccipy/metrics/schwarzschild_4.py new file mode 100644 index 0000000..6f45bf4 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_4.py @@ -0,0 +1,17 @@ +""" +Schwarzschild exterior metric in isotropic coordinates +""" +from sympy import Rational, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, r, th, ph = coords +M = variables +expr = (1 + Rational(1, 2) * M / r) ** 4 +metric = diag( + -(1 - Rational(1, 2) * M / r) ** 2 / (1 + Rational(1, 2) * M / r) ** 2, + expr, + expr * r ** 2, + expr * r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/schwarzschild_5.py b/src/riccipy/metrics/schwarzschild_5.py new file mode 100644 index 0000000..ba81001 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_5.py @@ -0,0 +1,18 @@ +""" +Schwarzschild exterior metric in Cartesian isotropic coordinates +""" +from sympy import Rational, diag, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("M", constant=True) +functions = () +t, x, y, z = coords +M = variables +expr1 = sqrt(x ** 2 + y ** 2 + z ** 2) +expr2 = (1 + Rational(1, 2) * M / expr1) ** 4 +metric = diag( + -(1 - Rational(1, 2) * M / expr1) ** 2 / (1 + Rational(1, 2) * M / expr1) ** 2, + expr2, + expr2, + expr2, +) diff --git a/src/riccipy/metrics/schwarzschild_6.py b/src/riccipy/metrics/schwarzschild_6.py new file mode 100644 index 0000000..1787fd4 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_6.py @@ -0,0 +1,15 @@ +""" +Schwarzschild exterior metric in Israel coordinates +""" +from sympy import Rational, diag, sin, symbols + +coords = symbols("u w theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +u, w, th, ph = coords +M = variables +expr = 2 * M + Rational(1, 4) * u * w / M +metric = diag( + Rational(1, 2) * w ** 2 / (M * expr), 0, expr ** 2, expr ** 2 * sin(th) ** 2 +) +metric[0, 1] = metric[1, 0] = 1 diff --git a/src/riccipy/metrics/schwarzschild_7.py b/src/riccipy/metrics/schwarzschild_7.py new file mode 100644 index 0000000..c404355 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_7.py @@ -0,0 +1,17 @@ +""" +Schwarzschild metric as the rho->0 limit of Tolman-Bondi dust +""" +from sympy import Rational, diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("M", constant=True) +functions = () +t, r, th, ph = coords +M = variables +expr = M * (r - t) ** 2 +metric = diag( + -1, + Rational(4, 9) * M / expr ** Rational(1, 3), + expr ** Rational(2, 3), + expr ** Rational(2, 3) * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/schwarzschild_8.py b/src/riccipy/metrics/schwarzschild_8.py new file mode 100644 index 0000000..f219dd8 --- /dev/null +++ b/src/riccipy/metrics/schwarzschild_8.py @@ -0,0 +1,16 @@ +""" +Schwarzschild interior solution in curvature coordinates +""" +from sympy import diag, sin, sqrt, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A B R", constant=True) +functions = () +t, r, th, ph = coords +A, B, R = variables +metric = diag( + -(A - B * sqrt(1 - r ** 2 / R ** 2)) ** 2, + 1 / (1 - r ** 2 / R ** 2), + r ** 2, + r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/static_spherical_1.py b/src/riccipy/metrics/static_spherical_1.py new file mode 100644 index 0000000..35109ed --- /dev/null +++ b/src/riccipy/metrics/static_spherical_1.py @@ -0,0 +1,12 @@ +""" +General static, spherically symmetric metric in curvature coordinates +Stephani (14.1) p163 +""" +from sympy import Function, diag, exp, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, r, th, ph = coords +al, be = functions +metric = diag(-exp(2 * al(r)), exp(2 * be(r)), r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/static_spherical_2.py b/src/riccipy/metrics/static_spherical_2.py new file mode 100644 index 0000000..afa8c5e --- /dev/null +++ b/src/riccipy/metrics/static_spherical_2.py @@ -0,0 +1,17 @@ +""" +General static, spherically symmetric metric in curvature coordinates +Stephani (14.1) p163 +""" +from sympy import Function, diag, exp, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = () +functions = symbols("alpha beta", cls=Function) +t, r, th, ph = coords +al, be = functions +metric = diag( + -exp(2 * al(r)), + exp(2 * be(r)), + exp(2 * be(r)) * r ** 2, + exp(2 * be(r)) * r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/szekeres_1.py b/src/riccipy/metrics/szekeres_1.py new file mode 100644 index 0000000..13fe54a --- /dev/null +++ b/src/riccipy/metrics/szekeres_1.py @@ -0,0 +1,13 @@ +""" +Szekeres solution for a special stiff perfect fluid +Szekeres, Commun. Math. Phys., v41, p55, (1975) +""" +from sympy import cos, diag, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag( + -x ** 6, x ** 4 * cos(2 * t) ** 2, x ** 2 / cos(2 * t), x ** 2 / cos(2 * t) +) diff --git a/src/riccipy/metrics/szekeres_2.py b/src/riccipy/metrics/szekeres_2.py new file mode 100644 index 0000000..fd8931d --- /dev/null +++ b/src/riccipy/metrics/szekeres_2.py @@ -0,0 +1,16 @@ +""" +Szekeres solution for a special stiff perfect fluid in Abelian type coordinates +Szekeres, Commun. Math. Phys., v41, p55, (1975) +""" +from sympy import cosh, diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag( + -exp(6 * x) / cosh(2 * t) ** 2, + exp(6 * x) / cosh(2 * t) ** 2, + exp(2 * x) * cosh(2 * t), + exp(2 * x) * cosh(2 * t), +) diff --git a/src/riccipy/metrics/tariq_tupper.py b/src/riccipy/metrics/tariq_tupper.py new file mode 100644 index 0000000..d06ee36 --- /dev/null +++ b/src/riccipy/metrics/tariq_tupper.py @@ -0,0 +1,12 @@ +""" +Tariq and Tupper metric admitting a G3VIo on S3 +Tariq et al., Gen. Rel. Grav., v6, p345, (1975) +Stephani (11.64) p138 +""" +from sympy import diag, exp, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-1, 4 * t ** 2 / 3, t / exp(2 * x), t * exp(2 * x)) diff --git a/src/riccipy/metrics/taub_1.py b/src/riccipy/metrics/taub_1.py new file mode 100644 index 0000000..e64c42b --- /dev/null +++ b/src/riccipy/metrics/taub_1.py @@ -0,0 +1,13 @@ +""" +Taub metric for plane symmetric, static perfect fluid. +Taub, Phys. Rev., v103, p454, (1956) +Stephani (13.44) p161 +""" +from sympy import diag, symbols + +coords = symbols("t x y z", real=True) +variables = symbols("mu", constant=True) +functions = () +t, x, y, z = coords +mu = variables +metric = diag(-(z - 3) ** 2, z ** 2, z ** 2, 3 / (mu * z ** 2)) diff --git a/src/riccipy/metrics/taub_2.py b/src/riccipy/metrics/taub_2.py new file mode 100644 index 0000000..4b6a6c1 --- /dev/null +++ b/src/riccipy/metrics/taub_2.py @@ -0,0 +1,11 @@ +""" +Taub's plane symmetric vacuum solution +Taub, Ann. Math., v53, p473, (1951) +""" +from sympy import diag, sqrt, symbols + +coords = symbols("t x y z", real=True) +variables = () +functions = () +t, x, y, z = coords +metric = diag(-1 / sqrt(z), z, z, 1 / sqrt(z)) diff --git a/src/riccipy/metrics/tolman_1.py b/src/riccipy/metrics/tolman_1.py new file mode 100644 index 0000000..628a1d9 --- /dev/null +++ b/src/riccipy/metrics/tolman_1.py @@ -0,0 +1,17 @@ +""" +Tolman's type IV solution +Tolman, Phys. Rev., v55, p363-373, (1939) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A B R", constant=True) +functions = () +t, r, th, ph = coords +A, B, R = variables +metric = diag( + -B ** 2 * (1 + r ** 2 / A ** 2), + (1 + 2 * r ** 2 / A ** 2) / ((1 + r ** 2 / A ** 2) * (1 - r ** 2 / R ** 2)), + r ** 2, + r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/tolman_2.py b/src/riccipy/metrics/tolman_2.py new file mode 100644 index 0000000..c9920ab --- /dev/null +++ b/src/riccipy/metrics/tolman_2.py @@ -0,0 +1,17 @@ +""" +Tolman's type VI solution +Tolman, Phys. Rev., v55, p363-373, (1939) +""" +from sympy import diag, sin, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A B n", constant=True) +functions = () +t, r, th, ph = coords +A, B, n = variables +metric = diag( + -(A * r ** (1 - n) - B * r ** (1 + n)) ** 2, + 2 - n ** 2, + r ** 2, + r ** 2 * sin(th) ** 2, +) diff --git a/src/riccipy/metrics/tolman_3.py b/src/riccipy/metrics/tolman_3.py new file mode 100644 index 0000000..63a8b91 --- /dev/null +++ b/src/riccipy/metrics/tolman_3.py @@ -0,0 +1,18 @@ +""" +Tolman's type VII static spherically symmetric perfect fluid solution +Tolman, Phys. Rev., v55, p363-373, (1939) +""" +from sympy import Rational, diag, log, sin, sqrt, symbols + +coords = symbols("t r theta phi", real=True) +variables = symbols("A B C R", constant=True) +functions = () +t, r, th, ph = coords +A, B, C, R = variables +expr1 = 1 - r ** 2 / R ** 2 + 4 * r ** 4 / A ** 4 +expr2 = sin( + log( + sqrt((sqrt(expr1) + 2 * r ** 2 / A ** 2 - Rational(1, 4) * A ** 2 / R ** 2) / C) + ) +) +metric = diag(-B ** 2 * expr2 ** 2, 1 / expr1, r ** 2, r ** 2 * sin(th) ** 2) diff --git a/src/riccipy/metrics/vaidya_1.py b/src/riccipy/metrics/vaidya_1.py new file mode 100644 index 0000000..d86d769 --- /dev/null +++ b/src/riccipy/metrics/vaidya_1.py @@ -0,0 +1,13 @@ +""" +Vaidya metric in outgoing Eddington-Finkelstein coordinates +Stephani (13.20) p158 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = () +functions = symbols("M", cls=Function) +r, v, th, ph = coords +M = functions +metric = diag(0, -(1 - 2 * M(v) / r), r ** 2, r ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = -1 diff --git a/src/riccipy/metrics/vaidya_2.py b/src/riccipy/metrics/vaidya_2.py new file mode 100644 index 0000000..d42df77 --- /dev/null +++ b/src/riccipy/metrics/vaidya_2.py @@ -0,0 +1,13 @@ +""" +Vaidya metric in ingoing Eddington-Finkelstein coordinates +Stephani (13.20) p158 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = () +functions = symbols("M", cls=Function) +r, v, th, ph = coords +M = functions +metric = diag(0, -(1 - 2 * M(v) / r), r ** 2, r ** 2 * sin(th) ** 2) +metric[0, 1] = metric[1, 0] = 1 diff --git a/src/riccipy/metrics/vaidya_3.py b/src/riccipy/metrics/vaidya_3.py new file mode 100644 index 0000000..c631414 --- /dev/null +++ b/src/riccipy/metrics/vaidya_3.py @@ -0,0 +1,15 @@ +""" +Vaidya metric with non-zero cosmological constant in outgoing Eddington-Finkelstein coordinates +Stephani (13.20) p158 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = symbols("Lambda", constant=True) +functions = symbols("M", cls=Function) +r, v, th, ph = coords +M = functions +metric = diag( + 0, -(1 - 2 * M(v) / r - Lambda * r ** 2 / 3), r ** 2, r ** 2 * sin(th) ** 2 +) +metric[0, 1] = metric[1, 0] = -1 diff --git a/src/riccipy/metrics/vaidya_4.py b/src/riccipy/metrics/vaidya_4.py new file mode 100644 index 0000000..404f366 --- /dev/null +++ b/src/riccipy/metrics/vaidya_4.py @@ -0,0 +1,15 @@ +""" +Vaidya metric with non-zero cosmological constant in ingoing Eddington-Finkelstein coordinates +Stephani (13.20) p158 +""" +from sympy import Function, diag, sin, symbols + +coords = symbols("r v theta phi", real=True) +variables = symbols("Lambda", constant=True) +functions = symbols("M", cls=Function) +r, v, th, ph = coords +M = functions +metric = diag( + 0, -(1 - 2 * M(v) / r - Lambda * r ** 2 / 3), r ** 2, r ** 2 * sin(th) ** 2 +) +metric[0, 1] = metric[1, 0] = 1 diff --git a/src/riccipy/tests/test_metric.py b/src/riccipy/tests/test_metric.py index 0e243bd..f87675c 100644 --- a/src/riccipy/tests/test_metric.py +++ b/src/riccipy/tests/test_metric.py @@ -1,8 +1,7 @@ -from sympy import Expr, diag, eye, sin, symbols, tensorproduct, zeros - from riccipy.metric import * from riccipy.partial import * from riccipy.tensor import * +from sympy import Expr, diag, eye, sin, symbols, tensorproduct, zeros def _generate_schwarzschild(): diff --git a/src/riccipy/tests/test_partial.py b/src/riccipy/tests/test_partial.py index 6b1402b..31b2149 100644 --- a/src/riccipy/tests/test_partial.py +++ b/src/riccipy/tests/test_partial.py @@ -1,8 +1,7 @@ -from sympy import diag, sin, symbols - from riccipy.metric import * from riccipy.partial import * from riccipy.tensor import * +from sympy import diag, sin, symbols def _generate_schwarzschild(): diff --git a/src/riccipy/tests/test_tensor.py b/src/riccipy/tests/test_tensor.py index ab68c7e..27623e4 100644 --- a/src/riccipy/tests/test_tensor.py +++ b/src/riccipy/tests/test_tensor.py @@ -1,8 +1,7 @@ -from sympy import Array, diag, eye, simplify, sin, symbols -from sympy.tensor.tensor import TensExpr, TensMul - from riccipy.metric import * from riccipy.tensor import * +from sympy import Array, diag, eye, simplify, sin, symbols +from sympy.tensor.tensor import TensExpr, TensMul def _generate_simple(): diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..43fc3f0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,73 @@ +[tox] +description = list of environments againts tox runs the tests +envlist = + clean, + check, + docs, + py35, + py36 + py37 + pypy, + pypy3 + +[testenv] +basepython = + pypy: {env:PYTHON:pypy} + pypy3: {env:PYTHON:pypy3} + py35: {env:PYTHON:python3.5} + {py36,docs}: {env:PYTHON:python3.6} + py37: {env:PYTHON:python3.7} + {clean,check,reformat}: {env:PYTHON:python3} +setenv = + PYTHONPATH={toxinidir}/tests + PYTHONUNBUFFERED=yes +passenv = + * +usedevelop = false +deps = + pytest-cov + ipywidgets +skip_install = false +commands = + {posargs:pytest --cov --cov-report=term-missing -vv src/einsteinpy/tests} + + +[testenv:check] +description = this environments checks for flake8, black, isort and einsteinpy code style +deps = + black + docutils + isort + flake8 + mypy + pygments +skip_install = true +commands = + python setup.py check --strict --metadata --restructuredtext + flake8 src setup.py + isort --check-only --diff --recursive --project einsteinpy --section-default THIRDPARTY src setup.py + black --check src setup.py + mypy --ignore-missing-imports --check-untyped-defs --no-strict-optional src + + +[testenv:reformat] +description = reformats the code using black and isort +deps = + black + isort +skip_install = true +commands = + isort --recursive --project einsteinpy --section-default THIRDPARTY src setup.py + black src setup.py + + +[testenv:docs] +description = invoke sphinx-build to build the HTML docs +extras = docs +whitelist_externals = sphinx-build +commands = sphinx-build -d "{toxworkdir}/docs_doctree" docs/source "{toxworkdir}/docs_out" --color -W -bhtml + +[testenv:clean] +commands = coverage erase +skip_install = true +deps = coverage