From 314ddc1220623e81865a5882ae44099931cb06cc Mon Sep 17 00:00:00 2001 From: aprilnovak Date: Wed, 5 Jul 2023 19:35:01 -0500 Subject: [PATCH 1/3] Add help message about properties --- src/base/OpenMCProblemBase.C | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/base/OpenMCProblemBase.C b/src/base/OpenMCProblemBase.C index 5008631f2..8f50800b9 100644 --- a/src/base/OpenMCProblemBase.C +++ b/src/base/OpenMCProblemBase.C @@ -377,7 +377,14 @@ OpenMCProblemBase::setCellTemperature(const int32_t & index, const cellInfo & cell_info) const { int err = openmc_cell_set_temperature(index, T, &instance, false); - catchOpenMCError(err, "set cell " + printCell(cell_info) + " to temperature " + Moose::stringify(T) + " (K)"); + if (err) + { + std::string descriptor = "set cell " + printCell(cell_info) + " to temperature " + Moose::stringify(T) + " (K)"; + mooseError("In attempting to ", descriptor, ", OpenMC reported:\n\n", + std::string(openmc_err_msg) + "\n\n" + + "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" + "use the initial temperature and density in the OpenMC XML files for OpenMC's first run"); + } } std::vector @@ -442,9 +449,16 @@ OpenMCProblemBase::setCellDensity(const Real & density, const cellInfo & cell_in int err = openmc_material_set_density( material_index, density * _density_conversion_factor, units); - catchOpenMCError(err, "set material with index " + + if (err) + { + std::string descriptor = "set material with index " + Moose::stringify(material_index) + " to density " + - Moose::stringify(density) + " (kg/m3)"); + Moose::stringify(density) + " (kg/m3)"; + mooseError("In attempting to ", descriptor, ", OpenMC reported:\n\n", + std::string(openmc_err_msg) + "\n\n" + + "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" + "use the initial temperature and density in the OpenMC XML files for OpenMC's first run"); + } } std::string From 90d636541d9bac993e09eae55635403dbdae64f7 Mon Sep 17 00:00:00 2001 From: aprilnovak Date: Fri, 7 Jul 2023 11:35:44 -0500 Subject: [PATCH 2/3] Clang format --- src/base/OpenMCProblemBase.C | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/base/OpenMCProblemBase.C b/src/base/OpenMCProblemBase.C index 8f50800b9..4b982d2c6 100644 --- a/src/base/OpenMCProblemBase.C +++ b/src/base/OpenMCProblemBase.C @@ -379,11 +379,16 @@ OpenMCProblemBase::setCellTemperature(const int32_t & index, int err = openmc_cell_set_temperature(index, T, &instance, false); if (err) { - std::string descriptor = "set cell " + printCell(cell_info) + " to temperature " + Moose::stringify(T) + " (K)"; - mooseError("In attempting to ", descriptor, ", OpenMC reported:\n\n", - std::string(openmc_err_msg) + "\n\n" + - "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" - "use the initial temperature and density in the OpenMC XML files for OpenMC's first run"); + std::string descriptor = + "set cell " + printCell(cell_info) + " to temperature " + Moose::stringify(T) + " (K)"; + mooseError( + "In attempting to ", + descriptor, + ", OpenMC reported:\n\n", + std::string(openmc_err_msg) + "\n\n" + + "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" + "use the initial temperature and density in the OpenMC XML files for OpenMC's first " + "run"); } } @@ -451,13 +456,16 @@ OpenMCProblemBase::setCellDensity(const Real & density, const cellInfo & cell_in if (err) { - std::string descriptor = "set material with index " + - Moose::stringify(material_index) + " to density " + - Moose::stringify(density) + " (kg/m3)"; - mooseError("In attempting to ", descriptor, ", OpenMC reported:\n\n", - std::string(openmc_err_msg) + "\n\n" + - "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" - "use the initial temperature and density in the OpenMC XML files for OpenMC's first run"); + std::string descriptor = "set material with index " + Moose::stringify(material_index) + + " to density " + Moose::stringify(density) + " (kg/m3)"; + mooseError( + "In attempting to ", + descriptor, + ", OpenMC reported:\n\n", + std::string(openmc_err_msg) + "\n\n" + + "If you are trying to debug a model setup, you can set 'initial_properties = xml' to\n" + "use the initial temperature and density in the OpenMC XML files for OpenMC's first " + "run"); } } From 348369dca4321fc74d47236eb077131bc30d2868 Mon Sep 17 00:00:00 2001 From: aprilnovak Date: Fri, 7 Jul 2023 17:15:57 -0500 Subject: [PATCH 3/3] Allow pointing to other MOOSE dir --- Makefile | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4c9f5771c..59b825a73 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ # any of these unless you want to use non-submodule third-party dependencies: # * CONTRIB_DIR : Dir with third-party dependencies (default: contrib) -# * MOOSE_SUBMODULE : Top-level MOOSE dir (default: $(CONTRIB_DIR)/moose) +# * MOOSE_DIR : Top-level MOOSE dir (default: $(CONTRIB_DIR)/moose) # * NEKRS_DIR : Top-level NekRS dir (default: $(CONTRIB_DIR)/nekRS) # * OPENMC_DIR : Top-level OpenMC dir (default: $(CONTRIB_DIR)/openmc) # * DAGMC_DIR : Top-level DagMC dir (default: $(CONTRIB_DIR)/DAGMC) @@ -32,7 +32,7 @@ # libraries from $(HDF5_ROOT)/lib. # * HDF5_INCLUDE_DIR : Top-level HDF5 header dir (default: $(HDF5_ROOT)/include) # * HDF5_LIBDIR : Top-level HDF5 lib dir (default: $(HDF5_ROOT)/lib) -# * PETSC_DIR : Top-level PETSc dir (default: $(MOOSE_SUBMODULE)/petsc) +# * PETSC_DIR : Top-level PETSc dir (default: $(MOOSE_DIR)/petsc) # * PETSC_ARCH : PETSc architecture (default: arch-moose) # ====================================================================================== @@ -47,14 +47,22 @@ ENABLE_DAGMC ?= no CARDINAL_DIR := $(abspath $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))) CONTRIB_DIR := $(CARDINAL_DIR)/contrib + +# Use the MOOSE submodule if it exists and MOOSE_DIR is not set MOOSE_SUBMODULE ?= $(CONTRIB_DIR)/moose +ifneq ($(wildcard $(MOOSE_SUBMODULE)/framework/Makefile),) + MOOSE_DIR ?= $(MOOSE_SUBMODULE) +else + MOOSE_DIR ?= $(shell dirname `pwd`)/moose +endif + NEKRS_DIR ?= $(CONTRIB_DIR)/nekRS OPENMC_DIR ?= $(CONTRIB_DIR)/openmc DAGMC_DIR ?= $(CONTRIB_DIR)/DAGMC MOAB_DIR ?= $(CONTRIB_DIR)/moab -PETSC_DIR ?= $(MOOSE_SUBMODULE)/petsc +PETSC_DIR ?= $(MOOSE_DIR)/petsc PETSC_ARCH ?= arch-moose -LIBMESH_DIR ?= $(MOOSE_SUBMODULE)/libmesh/installed/ +LIBMESH_DIR ?= $(MOOSE_DIR)/libmesh/installed/ CONTRIB_INSTALL_DIR ?= $(CARDINAL_DIR)/install BISON_DIR ?= $(CONTRIB_DIR)/bison SAM_DIR ?= $(CONTRIB_DIR)/SAM @@ -203,13 +211,6 @@ endif # MOOSE core objects # ====================================================================================== -# Use the MOOSE submodule if it exists and MOOSE_DIR is not set -ifneq ($(wildcard $(MOOSE_SUBMODULE)/framework/Makefile),) - MOOSE_DIR ?= $(MOOSE_SUBMODULE) -else - MOOSE_DIR ?= $(shell dirname `pwd`)/moose -endif - # framework FRAMEWORK_DIR := $(MOOSE_DIR)/framework include $(FRAMEWORK_DIR)/build.mk