Beispiel #1
0
 def test_assignment_8(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -metric 'gDD' (4D)
             \gamma_{ij} = g_{ij}
         """)), {'gUU', 'gdet', 'epsilonUUUU', 'gDD', 'gammaDD'})
     self.assertEqual(
         str(gammaDD),
         '[[gDD11, gDD12, gDD13], [gDD12, gDD22, gDD23], [gDD13, gDD23, gDD33]]'
     )
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -nosym 'TUU' (3D)
             % vardef 'vD' (2D)
             % keydef index i (2D)
             w^\mu = T^{\mu i} v_i
         """)), {'TUU', 'vD', 'wU'})
     self.assertEqual(
         str(wU),
         '[TUU01*vD0 + TUU02*vD1, TUU11*vD0 + TUU12*vD1, TUU21*vD0 + TUU22*vD1]'
     )
 def test_example_BSSN():
     import NRPy_param_funcs as par, reference_metric as rfm, BSSN.BSSN_RHSs as Brhs
     Parser.clear_namespace()
     parse(r"""
         % define deltaDD (3D), sym01 hDD (3D), sym01 aDD (3D), vetU (3D)
         % parse \hat{\gamma}_{ij} = \delta_{ij}
         % assign symbolic <H> gammahatDD
         % parse \bar{\gamma}_{ij} = h_{ij} + \hat{\gamma}_{ij}
         % assign numeric hDD, aDD, vetU, gammabarDD
         % assign metric gammahatDD, gammabarDD
         % srepl "\bar{A}" -> "a", "\beta" -> "\text{vet}"
         % parse \bar{A}^i_j = \bar{\gamma}^{ik} \bar{A}_{kj}
         \begin{align}
             % define basis [x, y, z]
             %% parse \partial_k \bar{\gamma}_{ij} = \vphantom{upwind} \partial_k h_{ij} + \partial_k \hat{\gamma}_{ij}
             % srepl "\text{vet}^<1> \partial_<1>" -> "\text{vet}^<1> \vphantom{upwind} \partial_<1>" %% (inside Lie derivative expansion)
             % srepl "\bar{D}_k \text{vet}^k" -> "(\partial_k \text{vet}^k + \frac{\text{vet}^k \vphantom{symbolic} \partial_k \text{gammabardet}}{2 \text{gammabardet}})"
             % srepl "\partial_t \bar{\gamma}" -> "\text{h_rhs}"
             \partial_t \bar{\gamma}_{ij} &= \mathcal{L}_\beta \bar{\gamma}_{ij}
                 + \frac{2}{3} \bar{\gamma}_{ij} \left(\alpha \bar{A}^k{}_k - \bar{D}_k \beta^k\right) - 2 \alpha \bar{A}_{ij}
             % srepl "K" -> "\text{trK}", "\phi" -> "\text{cf}", "\partial_t \text{cf}" -> "\text{cf_rhs}"
             \partial_t \phi &= \mathcal{L}_\beta \phi - \frac{1}{3} \phi \left(\bar{D}_k \beta^k - \alpha K \right)
         \end{align}
     """)
     par.set_parval_from_str('reference_metric::CoordSystem', 'Cartesian')
     rfm.reference_metric()
     Brhs.BSSN_RHSs()
     assert_equal({
         'h_rhsDD': h_rhsDD,
         'cf_rhs': cf_rhs
     }, {
         'h_rhsDD': Brhs.h_rhsDD,
         'cf_rhs': Brhs.cf_rhs
     })
Beispiel #3
0
 def test_metric_inverse(self):
     # TODO: simplify -> assert_equal
     for DIM in range(2, 5):
         Parser.clear_namespace()
         parse(r"""
             % vardef -metric 'gDD' ({DIM}D)
             \delta^a_c = g^{{ab}} g_{{bc}}
         """.format(DIM=DIM))
         # for i in range(DIM):
         #     for j in range(DIM):
         #         if i == j:
         #             assert_equal(deltaUD[i][j], 1)
         #         else:
         #             assert_equal(deltaUD[i][j], 0)
         kronecker = simplify(Matrix(deltaUD))
         self.assertEqual(
             True,
             all((simplify(kronecker[i, j]) == 1 if i ==
                  j else simplify(kronecker[i, j]) == 0 for j in range(DIM))
                 for i in range(DIM)))
     for DIM in range(2, 5):
         Parser.clear_namespace()
         parse(r"""
             % vardef -metric 'gUU' ({DIM}D)
             \delta^a_c = g^{{ab}} g_{{bc}}
         """.format(DIM=DIM))
         kronecker = simplify(Matrix(deltaUD))
         self.assertEqual(
             True,
             all((simplify(kronecker[i, j]) == 1 if i ==
                  j else simplify(kronecker[i, j]) == 0 for j in range(DIM))
                 for i in range(DIM)))
 def test_assignment_7(self):
     Parser.clear_namespace()
     parse(r"""
         % define basis [\theta, \phi]
         % define const r, deltaDD (2D)
         % define index [a-z] (2D)
         % parse g_{\mu\nu} = \delta_{\mu\nu}
         \begin{align*}
             g_{0 0} &= r^{{2}} \\
             g_{1 1} &= r^{{2}} \sin^2(\theta)
         \end{align*}
         % assign metric gDD
         \begin{align*}
             R^\alpha_{\beta\mu\nu} &= \partial_\mu \Gamma^\alpha_{\beta\nu} - \partial_\nu \Gamma^\alpha_{\beta\mu} + \Gamma^\alpha_{\mu\gamma}\Gamma^\gamma_{\beta\nu} - \Gamma^\alpha_{\nu\sigma}\Gamma^\sigma_{\beta\mu} \\
             R_{\alpha\beta\mu\nu} &= g_{\alpha a} R^a_{\beta\mu\nu} \\
             R_{\beta\nu} &= R^\alpha_{\beta\alpha\nu} \\
             R &= g^{\beta\nu} R_{\beta\nu}
         \end{align*}
     """)
     self.assertEqual(str(GammaUDD[0][1][1]), '-sin(theta)*cos(theta)')
     self.assertEqual(0, simplify(GammaUDD[1][0][1] - GammaUDD[1][1][0]))
     self.assertEqual(str(GammaUDD[1][0][1]), 'cos(theta)/sin(theta)')
     self.assertEqual(
         0,
         simplify(RDDDD[0][1][0][1] - (-RDDDD[0][1][1][0]) +
                  (-RDDDD[1][0][0][1]) - RDDDD[1][0][1][0]))
     self.assertEqual(str(RDDDD[0][1][0][1]), 'r**2*sin(theta)**2')
     self.assertEqual(RDD[0][0], 1)
     self.assertEqual(str(RDD[1][1]), 'sin(theta)**2')
     self.assertEqual(0, simplify(RDD[0][1] - RDD[1][0]))
     self.assertEqual(RDD[0][1], 0)
     self.assertEqual(str(R), '2/r**2')
 def test_example_1(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define nosym hUD (4D)
             h = h^\mu{}_\mu
         """)), {'hUD', 'h'})
     self.assertEqual(str(h), 'hUD00 + hUD11 + hUD22 + hUD33')
Beispiel #6
0
 def test_assignment_1(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define vU (2D), wU (2D);
             T^{ab}_c = \vphantom{_d} \partial_c (v^a w^b)
         """)), {'vU', 'wU', 'vU_dD', 'wU_dD', 'TUUD'})
     self.assertEqual(str(TUUD[0][0][0]), 'vU0*wU_dD00 + vU_dD00*wU0')
Beispiel #7
0
 def test_assignment_1(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -numeric 'vU' (2D), 'wU' (2D)
             % keydef index [a-z] (2D)
             T^{ab}_c = \partial_c (v^a w^b)
         """)), {'vU', 'wU', 'vU_dD', 'wU_dD', 'TUUD'})
     self.assertEqual(str(TUUD[0][0][0]), 'vU0*wU_dD00 + vU_dD00*wU0')
Beispiel #8
0
 def test_assignment_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define vU (2D), const w;
             T^a_c = \vphantom{_d} \partial_c (v^a w)
         """)), {'vU', 'w', 'vU_dD', 'TUD'})
     self.assertEqual(str(TUD),
                      '[[vU_dD00*w, vU_dD01*w], [vU_dD10*w, vU_dD11*w]]')
Beispiel #9
0
 def test_assignment_3(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define metric gDD (4D), vU (4D);
             T^{\mu\nu} = \vphantom{_d} \nabla^\nu v^\mu
         """)), {
                 'gUU', 'gdet', 'gDD', 'vU', 'vU_dD', 'gDD_dD', 'GammaUDD',
                 'vU_cdD', 'vU_cdU', 'TUU'
             })
Beispiel #10
0
 def test_example_4_1(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define anti01 FUU (4D), metric gDD (4D), const k;
             J^\mu = (4\pi k)^{-1} \vphantom{_d} \nabla_\nu F^{\mu\nu}
         """)), {
                 'FUU', 'gUU', 'gdet', 'gDD', 'k', 'FUU_dD', 'gDD_dD',
                 'GammaUDD', 'FUU_cdD', 'JU'
             })
 def test_example_4_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define anti01 FUU (4D), metric ghatDD (4D), const k
             J^\mu = (4\pi k)^{-1} \vphantom{numeric} \hat{\nabla}_\nu F^{\mu\nu}
         """)), {
                 'FUU', 'ghatUU', 'ghatDD', 'FUU_dD', 'ghatDD_dD',
                 'GammahatUDD', 'FUU_cdhatD', 'JU'
             })
 def test_example_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define metric gUU (3D), vD (3D)
             v^\mu = g^{\mu\nu} v_\nu
         """)), {'gDD', 'gUU', 'vD', 'vU'})
     self.assertEqual(
         str(vU),
         '[gUU00*vD0 + gUU01*vD1 + gUU02*vD2, gUU01*vD0 + gUU11*vD1 + gUU12*vD2, gUU02*vD0 + gUU12*vD1 + gUU22*vD2]'
     )
 def test_example_3(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define epsilonDDD (3D)
             % define vU (3D), wU (3D)
             u_i = \epsilon_{ijk} v^j w^k
         """)), {'epsilonDDD', 'vU', 'wU', 'uD'})
     self.assertEqual(
         str(uD),
         '[vU1*wU2 - vU2*wU1, -vU0*wU2 + vU2*wU0, vU0*wU1 - vU1*wU0]')
 def test_assignment_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define vU (2D), const w
             % assign numeric vU
             % define index [a-z] (2D)
             T^a_c = \partial_c (v^a w)
         """)), {'vU', 'vU_dD', 'TUD'})
     self.assertEqual(str(TUD),
                      '[[vU_dD00*w, vU_dD01*w], [vU_dD10*w, vU_dD11*w]]')
Beispiel #15
0
 def test_assignment_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -const 'w'
             % vardef -numeric 'vU' (2D)
             % keydef index [a-z] (2D)
             T^a_c = \partial_c (v^a w)
         """)), {'vU', 'vU_dD', 'TUD'})
     self.assertEqual(str(TUD),
                      '[[vU_dD00*w, vU_dD01*w], [vU_dD10*w, vU_dD11*w]]')
Beispiel #16
0
 def test_example_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -metric 'gUU' (3D)
             % vardef 'vD' (3D)
             v^\mu = g^{\mu\nu} v_\nu
         """)), {'gDD', 'gdet', 'epsilonDDD', 'gUU', 'vD', 'vU'})
     self.assertEqual(
         str(vU),
         '[gUU00*vD0 + gUU01*vD1 + gUU02*vD2, gUU01*vD0 + gUU11*vD1 + gUU12*vD2, gUU02*vD0 + gUU12*vD1 + gUU22*vD2]'
     )
 def test_assignment_3(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define metric gDD (4D), vU (4D)
             % assign numeric gDD, vU
             % define index [a-z] (4D)
             T^{ab} = \nabla^b v^a
         """)), {
                 'gUU', 'gDD', 'vU', 'vU_dD', 'gDD_dD', 'GammaUDD',
                 'vU_cdD', 'vU_cdU', 'TUU'
             })
Beispiel #18
0
 def test_assignment_4(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define basis [x, y], deriv _d;
             % define vD (2D);
             v_0 = x^{{2}} + 2x;
             v_1 = y\sqrt{x};
             T_{\mu\nu} = (\partial_\nu v_\mu)\,\partial^2_x v_0
         """)), {'vD', 'x', 'y', 'vD_dD', 'TDD'})
     self.assertEqual(str(TDD),
                      '[[2*vD_dD00, 2*vD_dD01], [2*vD_dD10, 2*vD_dD11]]')
Beispiel #19
0
 def test_example_4_2(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -anti01 'FUU' (4D)
             % vardef -metric 'ghatDD' (4D)
             % vardef -const 'k'
             J^\mu = (4\pi k)^{-1} \vphantom{numeric} \hat{\nabla}_\nu F^{\mu\nu}
         """)), {
                 'FUU', 'ghatUU', 'ghatdet', 'epsilonUUUU', 'ghatDD',
                 'FUU_dD', 'ghatDD_dD', 'GammahatUDD', 'FUU_cdhatD', 'JU'
             })
Beispiel #20
0
 def test_assignment_3(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % vardef -numeric -metric 'gDD' (4D)
             % vardef -numeric 'vU' (4D)
             % keydef index [a-z] (4D)
             T^{ab} = \nabla^b v^a
         """)), {
                 'gUU', 'gdet', 'epsilonUUUU', 'gDD', 'vU', 'vU_dD',
                 'gDD_dD', 'GammaUDD', 'vU_cdD', 'vU_cdU', 'TUU'
             })
Beispiel #21
0
 def test_expression_5(self):
     Parser.clear_namespace()
     parse(r"""
         % vardef -numeric -metric 'gDD' (4D)
         % vardef -numeric 'vU' (4D)
         T^\mu_b = \nabla_b v^\mu
     """)
     tensor = Parser._namespace['vU_cdD']
     function = Parser._namespace['vU_cdD'].equation[0]
     self.assertEqual(
         Parser._generate_covdrv(tensor, function, 'a'),
         r'\nabla_a \nabla_b v^\mu = \partial_a (\nabla_b v^\mu) + \text{Gamma}^\mu_{c a} (\nabla_b v^c) - \text{Gamma}^c_{b a} (\nabla_c v^\mu)'
     )
 def test_assignment_6(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
                 % define vD (2D), uD (2D), wD (2D)
                 % define index [a-z] (2D)
                 T_{abc} = \vphantom{numeric} ((v_a + u_a)_{,b} - w_{a,b})_{,c}
         """)), {
                 'vD', 'uD', 'wD', 'TDDD', 'uD_dD', 'vD_dD', 'wD_dD',
                 'wD_dDD', 'uD_dDD', 'vD_dDD'
             })
     self.assertEqual(str(TDDD[0][0][0]),
                      'uD_dDD000 + vD_dDD000 - wD_dDD000')
 def test_srepl_macro(self):
     Parser.clear_namespace()
     parse(r"""
         % srepl "<1>'" -> "\text{<1>prime}"
         % srepl "\text{<1..>}_<2>" -> "\text{(<1..>)<2>}"
         % srepl "<1>_{<2>}" -> "<1>_<2>", "<1>_<2>" -> "\text{<1>_<2>}"
         % srepl "\text{(<1..>)<2>}" -> "\text{<1..>_<2>}"
         % srepl "<1>^{<2>}" -> "<1>^<2>", "<1>^<2>" -> "<1>^{{<2>}}"
     """)
     expr = r"x_n^4 + x'_n \exp(x_n y_n^2)"
     self.assertEqual(str(parse_expr(expr)),
                      "x_n**4 + xprime_n*exp(x_n*y_n**2)")
     Parser.clear_namespace()
     parse(r""" % srepl "<1>'^{<2..>}" -> "\text{<1>prime}" """)
     expr = r"v'^{label}"
     self.assertEqual(str(parse_expr(expr)), "vprime")
Beispiel #24
0
 def test_assignment_4(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % keydef basis [x, y]
             % vardef 'uD' (2D), 'wD' (2D)
             % keydef index [a-z] (2D)
             u_0 = x^{{2}} + 2x \\
             u_1 = y\sqrt{x} \\
             v_a = u_a + w_a \\
             % assign -numeric 'wD', 'vD'
             T_{ab} = \partial^2_x v_0 (\partial_b v_a)
         """)), {'uD', 'wD', 'vD', 'vD_dD', 'wD_dD', 'TDD'})
     self.assertEqual(
         str(TDD),
         '[[2*wD_dD00 + 4*x + 4, 2*wD_dD01], [2*wD_dD10 + y/sqrt(x), 2*wD_dD11 + 2*sqrt(x)]]'
     )
 def test_assignment_5(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define basis [x, y]
             % define uD (2D), wD (2D)
             % assign symbolic <H> uD
             % define index [a-z] (2D)
             u_0 = x^{{2}} + 2x \\
             u_1 = y\sqrt{x} \\
             v_a = u_a + w_a \\
             T_{ab} = \partial^2_x v_0 (\vphantom{numeric} \partial_b v_a)
         """)), {'uD', 'wD', 'vD', 'vD_dD', 'wD_dD', 'TDD'})
     self.assertEqual(
         str(TDD),
         '[[2*wD_dD00 + 4*x + 4, 2*wD_dD01], [2*wD_dD10 + y/sqrt(x), 2*wD_dD11 + 2*sqrt(x)]]'
     )
 def test_example_5_1(self):
     Parser.clear_namespace()
     parse(r"""
         % define deltaDD (4D)
         % define const G, const M
         % parse g_{\mu\nu} = \delta_{\mu\nu}
         \begin{align}
             g_{0 0} &= -\left(1 - \frac{2GM}{r}\right) \\
             g_{1 1} &=  \left(1 - \frac{2GM}{r}\right)^{-1} \\
             g_{2 2} &= r^{{2}} \\
             g_{3 3} &= r^{{2}} \sin^2\theta
         \end{align}
         % assign metric gDD
     """)
     self.assertEqual(str(gDD[0][0]), '2*G*M/r - 1')
     self.assertEqual(str(gDD[1][1]), '1/(-2*G*M/r + 1)')
     self.assertEqual(str(gDD[2][2]), 'r**2')
     self.assertEqual(str(gDD[3][3]), 'r**2*sin(theta)**2')
     self.assertEqual(str(gdet),
                      'r**4*(2*G*M/r - 1)*sin(theta)**2/(-2*G*M/r + 1)')
 def test_assignment_8(self):
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define metric gDD (4D)
             \gamma_{ij} = g_{ij}
         """)), {'gUU', 'gDD', 'gammaDD'})
     self.assertEqual(
         str(gammaDD),
         '[[gDD11, gDD12, gDD13], [gDD12, gDD22, gDD23], [gDD13, gDD23, gDD33]]'
     )
     Parser.clear_namespace()
     self.assertEqual(
         set(
             parse(r"""
             % define nosym TUU (3D), vD (2D)
             % define index i (2D)
             w^\mu = T^{\mu i} v_i
         """)), {'TUU', 'vD', 'wU'})
     self.assertEqual(
         str(wU),
         '[TUU01*vD0 + TUU02*vD1, TUU11*vD0 + TUU12*vD1, TUU21*vD0 + TUU22*vD1]'
     )
Beispiel #28
0
    def test_example_BSSN():
        import NRPy_param_funcs as par, reference_metric as rfm
        import BSSN.BSSN_RHSs as Brhs, BSSN.BSSN_quantities as Bq
        Parser.clear_namespace()
        parse(r"""
            % keydef basis [x, y, z]
            % ignore "\\%", "\qquad"
            % vardef 'deltaDD', 'vetU', 'lambdaU'
            % vardef -numeric -sym01 'hDD', 'aDD', 'RbarDD'
            % assign -numeric 'cf', 'alpha', 'trK', 'vetU', 'lambdaU'
            % parse \hat{\gamma}_{ij} = \delta_{ij}
            % assign -symbolic <H> -metric 'gammahatDD'
            % parse \bar{\gamma}_{ij} = h_{ij} + \hat{\gamma}_{ij}
            % assign -numeric -metric 'gammabarDD'
            \begin{align}
                %% replace LaTeX variable(s) with BSSN variable(s)
                % srepl "\bar{A}" -> "\text{a}", "\beta" -> "\text{vet}", "K" -> "\text{trK}", "\bar{\Lambda}" -> "\text{lambda}"
                % srepl "e^{{-4\phi}}" -> "\text{cf}^{{2}}"
                % srepl "\partial_t \phi = <1..> \\" -> "\text{cf_rhs} = -2 \text{cf} (<1..>) \\"
                % srepl -global "\partial_<1> \phi"         -> "\partial_<1> \text{cf} \frac{-1}{2 \text{cf}}"
                % srepl -global "\partial_<1> \text{phi}"   -> "\partial_<1> \text{cf} \frac{-1}{2 \text{cf}}"
                % srepl -global "\partial_<1> (\text{phi})" -> "\partial_<1> \text{cf} \frac{-1}{2 \text{cf}}"

                %% upwind pattern inside Lie derivative expansion
                % srepl -global "\text{vet}^<1> \partial_<1>" -> "\text{vet}^<1> \vphantom{upwind} \partial_<1>"

                %% enforce metric constraint gammabardet == gammahatdet
                % srepl -global "\bar{D}^i \bar{D}_k \text{vet}^k" -> "(\bar{D}^i \partial_k \text{vet}^k)"
                % srepl -global "\bar{D}_k \text{vet}^k" -> "(\partial_k \text{vet}^k + \frac{\partial_k \text{gammahatdet} \text{vet}^k}{2 \text{gammahatdet}})"

                % parse \bar{A}^i_j = \bar{\gamma}^{ik} \bar{A}_{kj}
                % srepl "\partial_t \bar{\gamma}" -> "\text{h_rhs}"
                \partial_t \bar{\gamma}_{ij} &= \mathcal{L}_\beta \bar{\gamma}_{ij}
                    + \frac{2}{3} \bar{\gamma}_{ij} \left(\alpha \bar{A}^k{}_k - \bar{D}_k \beta^k\right)
                    - 2 \alpha \bar{A}_{ij} \\

                \partial_t \phi &= \mathcal{L}_\beta \phi
                    + \frac{1}{6} \left(\bar{D}_k \beta^k - \alpha K \right) \\

                % parse \bar{A}^{ij} = \bar{\gamma}^{ik} \bar{\gamma}^{jl} \bar{A}_{kl}
                % srepl "\partial_t \text{trK}" -> "\text{trK_rhs}"
                \partial_t K &= \mathcal{L}_\beta K
                    + \frac{1}{3} \alpha K^{{2}}
                    + \alpha \bar{A}_{ij} \bar{A}^{ij}
                    - e^{{-4\phi}} \left(\bar{D}_i \bar{D}^i \alpha + 2 \bar{D}^i \alpha \bar{D}_i \phi\right) \\

                % parse \Pi^k_{ij} = \bar{\Gamma}^k_{ij} - \hat{\Gamma}^k_{ij}
                % parse \Pi_{ijk}  = \bar{\gamma}_{il} \Pi^l_{jk}
                % parse \Pi^k = \bar{\gamma}^{ij} \Pi^k_{ij}
                % srepl "\partial_t \text{lambda}" -> "\text{Lambdabar_rhs}"
                \partial_t \bar{\Lambda}^i &= \mathcal{L}_\beta \bar{\Lambda}^i + \bar{\gamma}^{jk} \hat{D}_j \hat{D}_k \beta^i
                    + \frac{2}{3} \Pi^i \bar{D}_k \beta^k + \frac{1}{3} \bar{D}^i \bar{D}_k \beta^k \\%
                    &\qquad- 2 \bar{A}^{ij} (\partial_j \alpha - 6 \alpha \partial_j \phi)
                    + 2 \alpha \bar{A}^{jk} \Pi^i_{jk} - \frac{4}{3} \alpha \bar{\gamma}^{ij} \partial_j K \\

                X_{ij} &= -2 \alpha \bar{D}_i \bar{D}_j \phi + 4 \alpha \bar{D}_i \phi \bar{D}_j \phi
                    + 2 \bar{D}_i \alpha \bar{D}_j \phi + 2 \bar{D}_j \alpha \bar{D}_i \phi
                    - \bar{D}_i \bar{D}_j \alpha + \alpha \bar{R}_{ij} \\
                \hat{X}_{ij} &= X_{ij} - \frac{1}{3} \bar{\gamma}_{ij} \bar{\gamma}^{kl} X_{kl} \\
                % srepl "\partial_t \text{a}" -> "\text{a_rhs}"
                \partial_t \bar{A}_{ij} &= \mathcal{L}_\beta \bar{A}_{ij}
                    - \frac{2}{3} \bar{A}_{ij} \bar{D}_k \beta^k
                    - 2 \alpha \bar{A}_{ik} \bar{A}^k_j
                    + \alpha \bar{A}_{ij} K
                    + e^{{-4\phi}} \hat{X}_{ij} \\

                \bar{R}_{ij} &= -\frac{1}{2} \bar{\gamma}^{kl} \hat{D}_k \hat{D}_l \bar{\gamma}_{ij}
                    + \frac{1}{2} (\bar{\gamma}_{ki} \hat{D}_j \bar{\Lambda}^k + \bar{\gamma}_{kj} \hat{D}_i \bar{\Lambda}^k)
                    + \frac{1}{2} \Pi^k (\Pi_{ijk} + \Pi_{jik}) \\%
                    &\qquad+ \bar{\gamma}^{kl} (\Pi^m_{ki} \Pi_{jml} + \Pi^m_{kj} \Pi_{iml} + \Pi^m_{ik} \Pi_{mjl}) 
            \end{align}
        """)
        par.set_parval_from_str('reference_metric::CoordSystem', 'Cartesian')
        par.set_parval_from_str('BSSN.BSSN_quantities::LeaveRicciSymbolic',
                                'True')
        rfm.reference_metric()
        Brhs.BSSN_RHSs()
        par.set_parval_from_str('BSSN.BSSN_quantities::LeaveRicciSymbolic',
                                'False')
        Bq.RicciBar__gammabarDD_dHatD__DGammaUDD__DGammaU()
        assert_equal(
            {
                'h_rhsDD': h_rhsDD,
                'cf_rhs': cf_rhs,
                'trK_rhs': trK_rhs,
                'Lambdabar_rhsU': Lambdabar_rhsU,
                'a_rhsDD': a_rhsDD,
                'RbarDD': RbarDD
            }, {
                'h_rhsDD': Brhs.h_rhsDD,
                'cf_rhs': Brhs.cf_rhs,
                'trK_rhs': Brhs.trK_rhs,
                'Lambdabar_rhsU': Brhs.Lambdabar_rhsU,
                'a_rhsDD': Brhs.a_rhsDD,
                'RbarDD': Bq.RbarDD
            })