Пример #1
0
def BrillLindquist(ComputeADMGlobalsOnly=False,
                   include_NRPy_basic_defines_and_pickle=False):
    # Step 2: Setting up Brill-Lindquist initial data

    # Step 2.a: Set spatial dimension (must be 3 for BSSN)
    DIM = 3
    par.set_parval_from_str("grid::DIM", DIM)

    global Cartxyz, gammaCartDD, KCartDD, alphaCart, betaCartU, BCartU
    Cartxyz = ixp.declarerank1("Cartxyz")

    # Step 2.b: Set psi, the conformal factor:
    psi = sp.sympify(1)
    psi += BH1_mass / (2 * sp.sqrt((Cartxyz[0] - BH1_posn_x)**2 +
                                   (Cartxyz[1] - BH1_posn_y)**2 +
                                   (Cartxyz[2] - BH1_posn_z)**2))
    psi += BH2_mass / (2 * sp.sqrt((Cartxyz[0] - BH2_posn_x)**2 +
                                   (Cartxyz[1] - BH2_posn_y)**2 +
                                   (Cartxyz[2] - BH2_posn_z)**2))

    # Step 2.c: Set all needed ADM variables in Cartesian coordinates
    gammaCartDD = ixp.zerorank2()
    KCartDD = ixp.zerorank2()  # K_{ij} = 0 for these initial data
    for i in range(DIM):
        gammaCartDD[i][i] = psi**4

    alphaCart = 1 / psi**2
    betaCartU = ixp.zerorank1(
    )  # We generally choose \beta^i = 0 for these initial data
    BCartU = ixp.zerorank1(
    )  # We generally choose B^i = 0 for these initial data

    if ComputeADMGlobalsOnly == True:
        return

    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Cartesian",Cartxyz,
                                                                    gammaCartDD,KCartDD,alphaCart,betaCartU,BCartU)

    import BSSN.BSSN_ID_function_string as bIDf
    # Generates initial_data() C function & stores to outC_function_dict["initial_data"]
    bIDf.BSSN_ID_function_string(
        cf,
        hDD,
        lambdaU,
        aDD,
        trK,
        alpha,
        vetU,
        betU,
        include_NRPy_basic_defines=include_NRPy_basic_defines_and_pickle)
    if include_NRPy_basic_defines_and_pickle:
        return pickle_NRPy_env()
Пример #2
0
def BrillLindquist(ComputeADMGlobalsOnly=False):
    global Cartxyz, gammaCartDD, KCartDD, alphaCart, betaCartU, BCartU

    # Step 2: Setting up Brill-Lindquist initial data
    thismodule = "Brill-Lindquist"
    BH1_posn_x, BH1_posn_y, BH1_posn_z = par.Cparameters(
        "REAL", thismodule, ["BH1_posn_x", "BH1_posn_y", "BH1_posn_z"])
    BH1_mass = par.Cparameters("REAL", thismodule, ["BH1_mass"])
    BH2_posn_x, BH2_posn_y, BH2_posn_z = par.Cparameters(
        "REAL", thismodule, ["BH2_posn_x", "BH2_posn_y", "BH2_posn_z"])
    BH2_mass = par.Cparameters("REAL", thismodule, ["BH2_mass"])

    # Step 2.a: Set spatial dimension (must be 3 for BSSN)
    DIM = 3
    par.set_parval_from_str("grid::DIM", DIM)

    global Cartxyz, gammaCartDD, KCartDD, alphaCart, betaCartU, BCartU
    Cartxyz = ixp.declarerank1("Cartxyz")

    # Step 2.b: Set psi, the conformal factor:
    psi = sp.sympify(1)
    psi += BH1_mass / (2 * sp.sqrt((Cartxyz[0] - BH1_posn_x)**2 +
                                   (Cartxyz[1] - BH1_posn_y)**2 +
                                   (Cartxyz[2] - BH1_posn_z)**2))
    psi += BH2_mass / (2 * sp.sqrt((Cartxyz[0] - BH2_posn_x)**2 +
                                   (Cartxyz[1] - BH2_posn_y)**2 +
                                   (Cartxyz[2] - BH2_posn_z)**2))

    # Step 2.c: Set all needed ADM variables in Cartesian coordinates
    gammaCartDD = ixp.zerorank2()
    KCartDD = ixp.zerorank2()  # K_{ij} = 0 for these initial data
    for i in range(DIM):
        gammaCartDD[i][i] = psi**4

    alphaCart = 1 / psi**2
    betaCartU = ixp.zerorank1(
    )  # We generally choose \beta^i = 0 for these initial data
    BCartU = ixp.zerorank1(
    )  # We generally choose B^i = 0 for these initial data

    if ComputeADMGlobalsOnly == True:
        return

    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Cartesian",Cartxyz,
                                                                    gammaCartDD,KCartDD,alphaCart,betaCartU,BCartU)

    global returnfunction
    returnfunction = bIDf.BSSN_ID_function_string(cf, hDD, lambdaU, aDD, trK,
                                                  alpha, vetU, betU)
Пример #3
0
    def test_BL_ID(self):
        cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
                                                 AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Cartesian", bl.Cartxyz, bl.gammaCartDD, 
                                                                                                             bl.KCartDD, bl.alphaCart, bl.betaCartU, bl.BCartU)
        everything = cf+alpha+trK
        for i in range(3):
            everything += lambdaU[i]+vetU[i]+betU[i]
            for j in range(i,3):
                everything += hDD[i][j] + aDD[i][j]
        md5sum = "empty"
        if sys.version_info[0]==2:
            md5sum = hashlib.md5(str(everything)).hexdigest()
        elif sys.version_info[0]==3:
            md5sum = hashlib.md5(str(everything).encode('utf-8')).hexdigest()

        #print(md5sum)
        self.assertEqual(md5sum, 'eb6f859a0016fc1679c45af662ea32ef')
Пример #4
0
def StaticTrumpet(ComputeADMGlobalsOnly = False):
    global Sph_r_th_ph,r,th,ph, gammaSphDD, KSphDD, alphaSph, betaSphU, BSphU
    
    # All gridfunctions will be written in terms of spherical coordinates (r, th, ph):
    r,th,ph = sp.symbols('r th ph', real=True)

    # Step 0: Set spatial dimension (must be 3 for BSSN)
    DIM = 3
    par.set_parval_from_str("grid::DIM",DIM)

    # Step 1: Set psi, the conformal factor:

    # Auxiliary variables:
    psi0 = sp.symbols('psi0', real=True)
    
    # *** The StaticTrumpet conformal factor ***
    # Dennison and Baumgarte (2014) Eq. 13
    # https://arxiv.org/pdf/1403.5484.pdf
    
    # psi = sqrt{1 + M/r }
    psi0 = sp.sqrt(1 + M/r)
    
    # *** The physical spatial metric in spherical basis ***
    # Set the upper-triangle of the matrix...
    # Eq. 15
    # gamma_{ij} = psi^4 * eta_{ij}
    # eta_00 = 1, eta_11 = r^2, eta_22 = r^2 * sin^2 (theta) 
    gammaSphDD = ixp.zerorank2()
    gammaSphDD[0][0] = psi0**4
    gammaSphDD[1][1] = psi0**4 * r**2
    gammaSphDD[2][2] = psi0**4 * r**2*sp.sin(th)**2
    # ... then apply symmetries to get the other components
    
    # *** The physical trace-free extrinsic curvature in spherical basis ***
    # Set the upper-triangle of the matrix...

    # Eq.19 and 20
    KSphDD = ixp.zerorank2()

    # K_{rr} = M / r^2
    KSphDD[0][0] = -M / r**2

    # K_{theta theta} = K_{phi phi} / sin^2 theta = M
    KSphDD[1][1] = M

    KSphDD[2][2] = M * sp.sin(th)**2
    # ... then apply symmetries to get the other components
    
    # Lapse function and shift vector
    # Eq. 15
    # alpha = r / (r+M)
    alphaSph = r / (r + M)

    betaSphU = ixp.zerorank1() 
    # beta^r = Mr / (r + M)^2
    betaSphU[0] = M*r / (r + M)**2
    
    BSphU    = ixp.zerorank1()

    if ComputeADMGlobalsOnly == True:
        return
    
    # Validated against original SENR: 
    #print(sp.mathematica_code(gammaSphDD[1][1]))

    Sph_r_th_ph = [r,th,ph]
    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Spherical", Sph_r_th_ph, 
                                                                    gammaSphDD,KSphDD,alphaSph,betaSphU,BSphU)

    import BSSN.BSSN_ID_function_string as bIDf
    global returnfunction
    returnfunction = bIDf.BSSN_ID_function_string(cf, hDD, lambdaU, aDD, trK, alpha, vetU, betU)
Пример #5
0
def ShiftedKerrSchild(ComputeADMGlobalsOnly = False):
    global Sph_r_th_ph,r,th,ph, rho2, gammaSphDD, KSphDD, alphaSph, betaSphU, BSphU
    
    # All gridfunctions will be written in terms of spherical coordinates (r, th, ph):
    r,th,ph = sp.symbols('r th ph', real=True)

    thismodule = "ShiftedKerrSchild"

    DIM = 3
    par.set_parval_from_str("grid::DIM",DIM)

    # Input parameters:
    M, a, r0 = par.Cparameters("REAL", thismodule, ["M", "a", "r0"])

    # Auxiliary variables:
    rho2 = sp.symbols('rho2', real=True)
    
    # r_{KS} = r + r0
    rKS = r+r0

    # rho^2 = rKS^2 + a^2*cos^2(theta)
    rho2 = rKS*rKS + a*a*sp.cos(th)**2

    # alpha = 1/sqrt{1 + M*rKS/rho^2}
    alphaSph = 1/(sp.sqrt(1 + 2*M*rKS/rho2))

    # Initialize the shift vector, \beta^i, to zero.
    betaSphU = ixp.zerorank1()
    # beta^r = alpha^2*2Mr/rho^2
    betaSphU[0] = alphaSph*alphaSph*2*M*rKS/rho2

    # Time derivative of shift vector beta^i, B^i, is zero.
    BSphU = ixp.zerorank1()

    # Initialize \gamma_{ij} to zero.
    gammaSphDD = ixp.zerorank2()

    # gammaDD{rKS rKS} = 1 +2M*rKS/rho^2
    gammaSphDD[0][0] = 1 + 2*M*rKS/rho2

    # gammaDD{rKS phi} = -a*gammaDD{r r}*sin^2(theta)
    gammaSphDD[0][2] = gammaSphDD[2][0] = -a*gammaSphDD[0][0]*sp.sin(th)**2

    # gammaDD{theta theta} = rho^2
    gammaSphDD[1][1] = rho2

    # gammaDD{phi phi} = (rKS^2 + a^2 + 2Mr/rho^2*a^2*sin^2(theta))*sin^2(theta)
    gammaSphDD[2][2] = (rKS*rKS + a*a + 2*M*rKS*a*a*sp.sin(th)**2/rho2)*sp.sin(th)**2
    
    # *** Define Useful Quantities A, B, D ***
    # A = (a^2*cos^2(2theta) + a^2 + 2r^2)
    A = (a*a*sp.cos(2*th) + a*a + 2*rKS*rKS)

    # B = A + 4M*rKS
    B = A + 4*M*rKS

    # D = \sqrt(2M*rKS/(a^2cos^2(theta) + rKS^2) + 1)
    D = sp.sqrt(2*M*rKS/(a*a*sp.cos(th)**2 + rKS*rKS) + 1)
                
    
    # *** The extrinsic curvature in spherical polar coordinates ***

    # Establish the 3x3 zero-matrix
    KSphDD = ixp.zerorank2()

    # *** Fill in the nonzero components ***
    # *** This will create an upper-triangular matrix ***
    # K_{r r} = D(A+2Mr)/(A^2*B)[4M(a^2*cos(2theta) + a^2 - 2r^2)]
    KSphDD[0][0] = D*(A+2*M*rKS)/(A*A*B)*(4*M*(a*a*sp.cos(2*th)+a*a-2*rKS*rKS))

    # K_{r theta} = D/(AB)[8a^2*Mr*sin(theta)cos(theta)]
    KSphDD[0][1] = KSphDD[1][0] = D/(A*B)*(8*a*a*M*rKS*sp.sin(th)*sp.cos(th))

    # K_{r phi} = D/A^2[-2aMsin^2(theta)(a^2cos(2theta)+a^2-2r^2)]
    KSphDD[0][2] = KSphDD[2][0] =  D/(A*A)*(-2*a*M*sp.sin(th)**2*(a*a*sp.cos(2*th)+a*a-2*rKS*rKS))

    # K_{theta theta} = D/B[4Mr^2]
    KSphDD[1][1] = D/B*(4*M*rKS*rKS)

    # K_{theta phi} = D/(AB)*(-8*a^3*Mr*sin^3(theta)cos(theta))
    KSphDD[1][2] = KSphDD[2][1] = D/(A*B)*(-8*a**3*M*rKS*sp.sin(th)**3*sp.cos(th))

    # K_{phi phi} = D/(A^2*B)[2Mr*sin^2(theta)(a^4(M+3r)
    #   +4a^2r^2(2r-M)+4a^2r*cos(2theta)(a^2+r(M+2r))+8r^5)]
    KSphDD[2][2] = D/(A*A*B)*(2*M*rKS*sp.sin(th)**2*(a**4*(rKS-M)*sp.cos(4*th)\
                            + a**4*(M+3*rKS)+4*a*a*rKS*rKS*(2*rKS-M)\
                            + 4*a*a*rKS*sp.cos(2*th)*(a*a + rKS*(M + 2*rKS)) + 8*rKS**5))          
    
    
    if ComputeADMGlobalsOnly == True:
        return
    
    # Validated against original SENR: 
    #print(sp.mathematica_code(gammaSphDD[1][1]))

    Sph_r_th_ph = [r,th,ph]
    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Spherical", Sph_r_th_ph, 
                                                                    gammaSphDD,KSphDD,alphaSph,betaSphU,BSphU)

    global returnfunction
    returnfunction = bIDf.BSSN_ID_function_string(cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU)
Пример #6
0
def UIUCBlackHole(ComputeADMGlobalsOnly=False,
                  include_NRPy_basic_defines_and_pickle=False):
    global Sph_r_th_ph, r, th, ph, gammaSphDD, KSphDD, alphaSph, betaSphU, BSphU

    # All gridfunctions will be written in terms of spherical coordinates (r, th, ph):
    r, th, ph = sp.symbols('r th ph', real=True)

    # Step 0: Set spatial dimension (must be 3 for BSSN)
    DIM = 3
    par.set_parval_from_str("grid::DIM", DIM)

    # Step 1: Set psi, the conformal factor:
    # Spin per unit mass
    a = M * chi

    # Defined under equation 1 in Liu, Etienne, & Shapiro (2009) https://arxiv.org/pdf/1001.4077.pdf
    # Boyer - Lindquist outer horizon
    rp = M + sp.sqrt(M**2 - a**2)
    # Boyer - Lindquist inner horizon
    rm = M - sp.sqrt(M**2 - a**2)

    # Boyer - Lindquist radius in terms of UIUC radius
    # Eq. 11
    # r_{BL} = r * ( 1 + r_+ / 4r )^2
    rBL = r * (1 + rp / (4 * r))**2

    # Expressions found below Eq. 2
    # Sigma = r_{BL}^2 + a^2 cos^2 theta
    SIG = rBL**2 + a**2 * sp.cos(th)**2

    # Delta = r_{BL}^2 - 2Mr_{BL} + a^2
    DEL = rBL**2 - 2 * M * rBL + a**2

    # A = (r_{BL}^2 + a^2)^2 - Delta a^2 sin^2 theta
    AA = (rBL**2 + a**2)**2 - DEL * a**2 * sp.sin(th)**2

    # *** The ADM 3-metric in spherical basis ***
    gammaSphDD = ixp.zerorank2()
    # Declare the nonzero components of the 3-metric
    # (Eq. 13 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf):

    # ds^2 = Sigma (r + r_+/4)^2 / ( r^3 (r_{BL} - r_- ) * dr^2 +
    # Sigma d theta^2  +  (A sin^2 theta) / Sigma  *  d\phi^2

    gammaSphDD[0][0] = ((SIG * (r + rp / 4)**2) / (r**3 * (rBL - rm)))
    gammaSphDD[1][1] = SIG
    gammaSphDD[2][2] = AA / SIG * sp.sin(th)**2

    # *** The physical trace-free extrinsic curvature in spherical basis ***
    # Nonzero components of the extrinsic curvature K, given by
    # Eq. 14 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf:
    KSphDD = ixp.zerorank2()

    # K_{r phi} = K_{phi r} = (Ma sin^2 theta) / (Sigma sqrt{A Sigma}) *
    #     [3r^4_{BL} + 2a^2 r^2_{BL} - a^4 - a^2 (r^2_{BL} - a^2) sin^2 theta] *
    #     (1 + r_+ / 4r) (1 / sqrt{r(r_{BL} - r_-)})

    KSphDD[0][2] = KSphDD[2][0] = (M*a*sp.sin(th)**2)/(SIG*sp.sqrt(AA*SIG))*\
                    (3*rBL**4 + 2*a**2*rBL**2 - a**4- a**2*(rBL**2 - a**2)*\
                     sp.sin(th)**2)*(1 + rp/(4*r))*1/sp.sqrt(r*(rBL - rm))

    # Components of the extrinsic curvature K, given by
    # Eq. 15 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf:

    # K_{theta phi} = K_{phi theta} = -(2a^3 Mr_{BL} cos theta sin^3 theta) /
    #         (Sigma sqrt{A Sigma}) x (r - r_+ / 4) sqrt{(r_{BL} - r_-) / r }

    KSphDD[1][2] = KSphDD[2][1] = -((2*a**3*M*rBL*sp.cos(th)*sp.sin(th)**3)/ \
                    (SIG*sp.sqrt(AA*SIG)))*(r - rp/4)*sp.sqrt((rBL - rm)/r)

    alphaSph = sp.sympify(
        1
    )  # We generally choose alpha = 1/psi**2 (psi = BSSN conformal factor) for these initial data
    betaSphU = ixp.zerorank1(
    )  # We generally choose \beta^i = 0 for these initial data
    BSphU = ixp.zerorank1(
    )  # We generally choose B^i = 0 for these initial data

    if ComputeADMGlobalsOnly:
        return

    # Validated against original SENR: KSphDD[0][2], KSphDD[1][2], gammaSphDD[2][2], gammaSphDD[0][0], gammaSphDD[1][1]
    #print(sp.mathematica_code(gammaSphDD[1][1]))

    Sph_r_th_ph = [r, th, ph]
    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Spherical", Sph_r_th_ph,
                                                                    gammaSphDD,KSphDD,alphaSph,betaSphU,BSphU)

    # Let's choose alpha = 1/psi**2 (psi = BSSN conformal factor) for these initial data,
    # where psi = exp(phi); chi = 1/psi**4; W = 1/psi**2
    if par.parval_from_str("EvolvedConformalFactor_cf") == "phi":
        alpha = sp.exp(-2 * cf)
    elif par.parval_from_str("EvolvedConformalFactor_cf") == "chi":
        alpha = sp.sqrt(cf)
    elif par.parval_from_str("EvolvedConformalFactor_cf") == "W":
        alpha = cf
    else:
        print("Error EvolvedConformalFactor_cf type = \"" +
              par.parval_from_str("EvolvedConformalFactor_cf") + "\" unknown.")
        sys.exit(1)

    import BSSN.BSSN_ID_function_string as bIDf
    # Generates initial_data() C function & stores to outC_function_dict["initial_data"]
    bIDf.BSSN_ID_function_string(
        cf,
        hDD,
        lambdaU,
        aDD,
        trK,
        alpha,
        vetU,
        betU,
        include_NRPy_basic_defines=include_NRPy_basic_defines_and_pickle)
    if include_NRPy_basic_defines_and_pickle:
        return pickle_NRPy_env()
Пример #7
0
def UIUCBlackHole(ComputeADMGlobalsOnly=False):
    global Sph_r_th_ph, r, th, ph, gammaSphDD, KSphDD, alphaSph, betaSphU, BSphU

    # All gridfunctions will be written in terms of spherical coordinates (r, th, ph):
    r, th, ph = sp.symbols('r th ph', real=True)

    thismodule = "UIUCBlackHole"

    # Step 0: Set spatial dimension (must be 3 for BSSN)
    DIM = 3
    par.set_parval_from_str("grid::DIM", DIM)

    # Step 1: Set psi, the conformal factor:

    # The UIUC initial data represent a Kerr black hole with mass M
    #  and dimensionless spin chi in UIUC quasi-isotropic coordinates,
    #   see https://arxiv.org/abs/1001.4077
    # Input parameters:
    M, chi = par.Cparameters("REAL", thismodule, ["M", "chi"])

    # Auxiliary variables:
    a, rp, rm, rBL, SIG, DEL, AA = sp.symbols('a rp rm rBL SIG DEL AA',
                                              real=True)
    # Spin per unit mass
    a = M * chi

    # Defined under equation 1 in Liu, Etienne, & Shapiro (2009) https://arxiv.org/pdf/1001.4077.pdf
    # Boyer - Lindquist outer horizon
    rp = M + sp.sqrt(M**2 - a**2)
    # Boyer - Lindquist inner horizon
    rm = M - sp.sqrt(M**2 - a**2)

    # Boyer - Lindquist radius in terms of UIUC radius
    # Eq. 11
    # r_{BL} = r * ( 1 + r_+ / 4r )^2
    rBL = r * (1 + rp / (4 * r))**2

    # Expressions found below Eq. 2
    # Sigma = r_{BL}^2 + a^2 cos^2 theta
    SIG = rBL**2 + a**2 * sp.cos(th)**2

    # Delta = r_{BL}^2 - 2Mr_{BL} + a^2
    DEL = rBL**2 - 2 * M * rBL + a**2

    # A = (r_{BL}^2 + a^2)^2 - Delta a^2 sin^2 theta
    AA = (rBL**2 + a**2)**2 - DEL * a**2 * sp.sin(th)**2

    # *** The ADM 3-metric in spherical basis ***
    gammaSphDD = ixp.zerorank2()
    # Declare the nonzero components of the 3-metric
    # (Eq. 13 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf):

    # ds^2 = Sigma (r + r_+/4)^2 / ( r^3 (r_{BL} - r_- ) * dr^2 +
    # Sigma d theta^2  +  (A sin^2 theta) / Sigma  *  d\phi^2

    gammaSphDD[0][0] = ((SIG * (r + rp / 4)**2) / (r**3 * (rBL - rm)))
    gammaSphDD[1][1] = SIG
    gammaSphDD[2][2] = AA / SIG * sp.sin(th)**2

    # *** The physical trace-free extrinsic curvature in spherical basis ***
    # Nonzero components of the extrinsic curvature K, given by
    # Eq. 14 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf:
    KSphDD = ixp.zerorank2()

    # K_{r phi} = K_{phi r} = (Ma sin^2 theta) / (Sigma sqrt{A Sigma}) *
    #     [3r^4_{BL} + 2a^2 r^2_{BL} - a^4 - a^2 (r^2_{BL} - a^2) sin^2 theta] *
    #     (1 + r_+ / 4r) (1 / sqrt{r(r_{BL} - r_-)})

    KSphDD[0][2] = KSphDD[2][0] = (M*a*sp.sin(th)**2)/(SIG*sp.sqrt(AA*SIG))*\
                    (3*rBL**4 + 2*a**2*rBL**2 - a**4- a**2*(rBL**2 - a**2)*\
                     sp.sin(th)**2)*(1 + rp/(4*r))*1/sp.sqrt(r*(rBL - rm))

    # Components of the extrinsic curvature K, given by
    # Eq. 15 of Liu, Etienne, & Shapiro, https://arxiv.org/pdf/1001.4077.pdf:

    # K_{theta phi} = K_{phi theta} = -(2a^3 Mr_{BL} cos theta sin^3 theta) /
    #         (Sigma sqrt{A Sigma}) x (r - r_+ / 4) sqrt{(r_{BL} - r_-) / r }

    KSphDD[1][2] = KSphDD[2][1] = -((2*a**3*M*rBL*sp.cos(th)*sp.sin(th)**3)/ \
                    (SIG*sp.sqrt(AA*SIG)))*(r - rp/4)*sp.sqrt((rBL - rm)/r)

    alphaSph = sp.sympify(
        1
    )  # We generally choose alpha = 1/psi**2 (psi = BSSN conformal factor) for these initial data
    betaSphU = ixp.zerorank1(
    )  # We generally choose \beta^i = 0 for these initial data
    BSphU = ixp.zerorank1(
    )  # We generally choose B^i = 0 for these initial data

    if ComputeADMGlobalsOnly == True:
        return

    # Validated against original SENR: KSphDD[0][2], KSphDD[1][2], gammaSphDD[2][2], gammaSphDD[0][0], gammaSphDD[1][1]
    #print(sp.mathematica_code(gammaSphDD[1][1]))

    Sph_r_th_ph = [r, th, ph]
    cf,hDD,lambdaU,aDD,trK,alpha,vetU,betU = \
        AtoB.Convert_Spherical_or_Cartesian_ADM_to_BSSN_curvilinear("Spherical", Sph_r_th_ph,
                                                                    gammaSphDD,KSphDD,alphaSph,betaSphU,BSphU)

    global returnfunction
    returnfunction = bIDf.BSSN_ID_function_string(cf, hDD, lambdaU, aDD, trK,
                                                  alpha, vetU, betU)