diff --git a/docs/Examples/BbhInitialData/BbhInitialData.ipynb b/docs/Examples/BbhInitialData/BbhInitialData.ipynb index a1fdefe2ce6d..0cc51c74ab8b 100644 --- a/docs/Examples/BbhInitialData/BbhInitialData.ipynb +++ b/docs/Examples/BbhInitialData/BbhInitialData.ipynb @@ -65,8 +65,14 @@ "metadata": {}, "outputs": [], "source": [ - "SPECTRE_BUILD_DIR = \"/Users/nlf/Work/spectre/build-Default-Release\"\n", - "SPECTRE_HOME = \"/Users/nlf/Projects/spectre/develop\"" + "# Please define these environment variables \n", + "# if not defined or specify their path here\n", + "\n", + "# The source directory. \n", + "SPECTRE_SOURCE = os.getenv(\"SPECTRE_SOURCE\")\n", + "\n", + "# The directory containing compiled executables\n", + "SPECTRE_INSTALL = os.getenv(\"SPECTRE_INSTALL\")" ] }, { @@ -88,20 +94,31 @@ "source": [ "# Load example input file\n", "load_input_file_path = os.path.join(\n", - " SPECTRE_HOME, \"tests/InputFiles/Xcts/BinaryBlackHole.yaml\"\n", + " SPECTRE_SOURCE, \"tests/InputFiles/Xcts/BinaryBlackHole.yaml\"\n", ")\n", "yaml = YAML()\n", + "modified_input_file = []\n", + "\n", + "# Modify the input file\n", "with open(load_input_file_path, \"r\") as open_input_file:\n", - " input_file = yaml.load(open_input_file)\n", + " input_file = yaml.load_all(open_input_file)\n", + "\n", + " for section in input_file:\n", + " dsec = dict(section)\n", + " keys = dsec.keys()\n", + "\n", + " if \"Observers\" in keys:\n", + " dsec[\"Observers\"].update({\"VolumeFileName\": \"BbhVolume\"})\n", + " dsec[\"Observers\"].update({\"ReductionFileName\": \"BbhReductions\"})\n", + "\n", + " modified_input_file.append(dsec)\n", "\n", - "# Modify example input file\n", - "# - Set output file names\n", - "input_file[\"Observers\"][\"VolumeFileName\"] = \"BbhVolume\"\n", - "input_file[\"Observers\"][\"ReductionFileName\"] = \"BbhReductions\"\n", + " if \"DomainCreator\" in keys:\n", + " dsec[\"DomainCreator\"][\"BinaryCompactObject\"].pop(\"CubeScale\")\n", "\n", "# Write modified input file\n", "with open(\"Bbh.yaml\", \"w\") as open_input_file:\n", - " yaml.dump(input_file, open_input_file)" + " yaml.dump_all(modified_input_file, open_input_file)" ] }, { @@ -226,7 +243,7 @@ ], "source": [ "NUM_CORES = multiprocessing.cpu_count()\n", - "SOLVE_XCTS = os.path.join(SPECTRE_BUILD_DIR, \"bin/SolveXcts\")\n", + "SOLVE_XCTS = os.path.join(SPECTRE_INSTALL, \"bin/SolveXcts\")\n", "!{SOLVE_XCTS} --input-file Bbh.yaml +p {NUM_CORES}" ] },