From d6268831c75604f29d718d01253786a368e923d0 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Tue, 26 Apr 2016 23:07:07 -0400 Subject: [PATCH 1/4] Allow plotting without settings.xml --- src/input_xml.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 295422533..474c59d18 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -38,8 +38,8 @@ contains subroutine read_input_xml() - call read_settings_xml() if (run_mode /= MODE_PLOTTING) then + call read_settings_xml() if (run_CE) then call read_ce_cross_sections_xml() else From e204952c369cc7181fbc74842956e991f84c5953 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Tue, 26 Apr 2016 23:26:16 -0400 Subject: [PATCH 2/4] Alow string shortcut to Material.add_element --- openmc/material.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmc/material.py b/openmc/material.py index c6030a8e6..17283d4dd 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -387,7 +387,7 @@ class Material(object): Parameters ---------- - element : openmc.Element + element : openmc.Element or str Element to add percent : float Atom or weight percent @@ -401,7 +401,7 @@ class Material(object): 'macroscopic data-set has already been added'.format(self._id) raise ValueError(msg) - if not isinstance(element, openmc.Element): + if not isinstance(element, (openmc.Element, str)): msg = 'Unable to add an Element to Material ID="{0}" with a ' \ 'non-Element value "{1}"'.format(self._id, element) raise ValueError(msg) From 37e8f455d8116d675fe1f514d9ee95eeb26373ab Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Wed, 27 Apr 2016 10:47:06 -0400 Subject: [PATCH 3/4] Allow plotting with or without settings.xml --- src/input_xml.F90 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 474c59d18..90c703d27 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -38,8 +38,8 @@ contains subroutine read_input_xml() + call read_settings_xml() if (run_mode /= MODE_PLOTTING) then - call read_settings_xml() if (run_CE) then call read_ce_cross_sections_xml() else @@ -92,18 +92,22 @@ contains type(NodeList), pointer :: node_scat_list => null() type(NodeList), pointer :: node_source_list => null() - ! Display output message - call write_message("Reading settings XML file...", 5) - ! Check if settings.xml exists filename = trim(path_input) // "settings.xml" inquire(FILE=filename, EXIST=file_exists) if (.not. file_exists) then - call fatal_error("Settings XML file '" // trim(filename) // "' does not & - &exist! In order to run OpenMC, you first need a set of input files;& - & at a minimum, this includes settings.xml, geometry.xml, and & - &materials.xml. Please consult the user's guide at & - &http://mit-crpg.github.io/openmc for further information.") + if (run_mode /= MODE_PLOTTING) then + call fatal_error("Settings XML file '" // trim(filename) // "' does & + ¬ exist! In order to run OpenMC, you first need a set of input & + &files; at a minimum, this includes settings.xml, geometry.xml, & + &and materials.xml. Please consult the user's guide at & + &http://mit-crpg.github.io/openmc for further information.") + else + ! The settings.xml file is optional if we just want to make a plot. + return + end if + else + call write_message("Reading settings XML file...", 5) end if ! Parse settings.xml file From 76b2b65ab8e7233bfbc49663b9792c41edfc69bc Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Wed, 27 Apr 2016 18:13:32 -0400 Subject: [PATCH 4/4] Use basestring instead of str --- openmc/material.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmc/material.py b/openmc/material.py index 17283d4dd..97c7cedca 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -281,7 +281,7 @@ class Material(object): 'macroscopic data-set has already been added'.format(self._id) raise ValueError(msg) - if not isinstance(nuclide, (openmc.Nuclide, str)): + if not isinstance(nuclide, (openmc.Nuclide, basestring)): msg = 'Unable to add a Nuclide to Material ID="{0}" with a ' \ 'non-Nuclide value "{1}"'.format(self._id, nuclide) raise ValueError(msg) @@ -401,7 +401,7 @@ class Material(object): 'macroscopic data-set has already been added'.format(self._id) raise ValueError(msg) - if not isinstance(element, (openmc.Element, str)): + if not isinstance(element, (openmc.Element, basestring)): msg = 'Unable to add an Element to Material ID="{0}" with a ' \ 'non-Element value "{1}"'.format(self._id, element) raise ValueError(msg)