From c96063ac9263468cdcc56ec61762420d5a18f896 Mon Sep 17 00:00:00 2001 From: "Icenhour, Casey Tyler" Date: Thu, 29 Aug 2024 13:45:09 -0600 Subject: [PATCH] Make TMAP8 optional Refs #52 This aligns with the status of Cardinal, which was also made optional in #53 --- Makefile | 59 ++++++++------------- config/build_cardinal.mk | 37 ------------- config/build_deps.mk | 50 +++++++++++++++++ config/check_deps.mk | 16 +++++- config/dep_modules.mk | 27 ++++++++++ doc/content/getting_started/installation.md | 12 +++++ src/base/FenixApp.C | 8 +++ 7 files changed, 134 insertions(+), 75 deletions(-) delete mode 100644 config/build_cardinal.mk create mode 100644 config/build_deps.mk create mode 100644 config/dep_modules.mk diff --git a/Makefile b/Makefile index 29def370..0f6260cc 100644 --- a/Makefile +++ b/Makefile @@ -34,19 +34,10 @@ else endif FRAMEWORK_DIR := $(MOOSE_DIR)/framework -# Use the TMAP8 submodule if it exists and TMAP8_DIR is not set -# If it doesn't exist, and TMAP8_DIR is not set, then look for it adjacent to the application -TMAP8_SUBMODULE := $(CURDIR)/tmap8 -ifneq ($(wildcard $(TMAP8_SUBMODULE)/Makefile),) - TMAP8_DIR ?= $(TMAP8_SUBMODULE) -else - TMAP8_DIR ?= $(shell dirname `pwd`)/tmap8 -endif - # Check for optional dependencies and, if found, configure for building. include config/check_deps.mk -# ENABLE_CARDINAL = yes by default, but is set to "no" automatically if Cardinal is not found via CARDINAL_DIR. +# ENABLE_CARDINAL = yes by default, but is set to "no" automatically if Cardinal is not found via CARDINAL_DIR. ifeq ($(ENABLE_CARDINAL),yes) include config/configure_cardinal.mk endif @@ -56,53 +47,49 @@ include $(FRAMEWORK_DIR)/build.mk include $(FRAMEWORK_DIR)/moose.mk ################################## MODULES #################################### -# To use certain physics included with MOOSE, set variables below to -# yes as needed. Or set ALL_MODULES to yes to turn on everything (overrides -# other set variables). +# The default MOOSE modules used with FENIX are activated below. To turn on more +# modules, set their respective variables to yes. One can also set ALL_MODULES +# to yes to turn on everything (overrides other set variables). +# +# Additional modules may be turned on by optional dependencies - please +# reference config/dep_modules.mk to review those that might be available +# in your installation configuration. ALL_MODULES := no -CHEMICAL_REACTIONS := yes +CHEMICAL_REACTIONS := no CONTACT := no ELECTROMAGNETICS := yes EXTERNAL_PETSC_SOLVER := no -FLUID_PROPERTIES := yes +FLUID_PROPERTIES := no FSI := no FUNCTIONAL_EXPANSION_TOOLS := no GEOCHEMISTRY := no -HEAT_TRANSFER := yes +HEAT_TRANSFER := no LEVEL_SET := no -MISC := yes -NAVIER_STOKES := yes +MISC := no +NAVIER_STOKES := no OPTIMIZATION := no PERIDYNAMICS := no -PHASE_FIELD := yes +PHASE_FIELD := no POROUS_FLOW := no RAY_TRACING := yes -REACTOR := yes -RDG := yes +REACTOR := no +RDG := no RICHARDS := no -SCALAR_TRANSPORT := yes -SOLID_MECHANICS := yes -SOLID_PROPERTIES := yes STOCHASTIC_TOOLS := yes -THERMAL_HYDRAULICS := yes +THERMAL_HYDRAULICS := no +TENSOR_MECHANICS := no XFEM := no +# Enable modules required by optional dependencies +include config/dep_modules.mk + include $(MOOSE_DIR)/modules/modules.mk ############################################################################### -# TMAP8 -APPLICATION_DIR := $(TMAP8_DIR) -APPLICATION_NAME := tmap8 -BUILD_EXEC := no -GEN_REVISION := no -include $(FRAMEWORK_DIR)/app.mk - -# Cardinal -ifeq ($(ENABLE_CARDINAL),yes) - include config/build_cardinal.mk -endif +# Build optional dependencies +include config/build_deps.mk # FENIX APPLICATION_DIR := $(CURDIR) diff --git a/config/build_cardinal.mk b/config/build_cardinal.mk deleted file mode 100644 index 26064ad3..00000000 --- a/config/build_cardinal.mk +++ /dev/null @@ -1,37 +0,0 @@ -# Add OpenMC flags -ADDITIONAL_CPPFLAGS += $(HDF5_INCLUDES) $(OPENMC_INCLUDES) -libmesh_CXXFLAGS += -DENABLE_OPENMC_COUPLING - -# Add DagMC flags (-DDAGMC is used in OpenMC) -libmesh_CXXFLAGS += -DENABLE_DAGMC -DDAGMC - -# Configure and build MOAB, DagMC, and then OpenMC -include $(CARDINAL_DIR)/config/moab.mk -include $(CARDINAL_DIR)/config/dagmc.mk - -# autoconf-archive puts some arguments (e.g. -std=c++17) into the compiler -# variable rather than the compiler flags variable. -# -# cmake allows this, but wants any compiler arguments to be -# semicolon-separated, not space-separated -# libmesh_CC, etc., were defined in build.mk -space := $(subst ,, ) -LIBMESH_CC_LIST := $(subst $(space),;,$(libmesh_CC)) -LIBMESH_CXX_LIST := $(subst $(space),;,$(libmesh_CXX)) -LIBMESH_F90_LIST := $(subst $(space),;,$(libmesh_F90)) - -ENABLE_DAGMC := ON -include $(CARDINAL_DIR)/config/openmc.mk - -# Cardinal -libmesh_CXXFLAGS += -DENABLE_CARDINAL -APPLICATION_DIR := $(CARDINAL_DIR) -APPLICATION_NAME := cardinal -BUILD_EXEC := no -GEN_REVISION := yes -include $(FRAMEWORK_DIR)/app.mk - -# app_objects are defined in moose.mk and built according to the rules in build.mk -# We need to build these first so we get include dirs -$(app_objects): build_moab build_dagmc build_openmc -$(test_objects): build_moab build_dagmc build_openmc diff --git a/config/build_deps.mk b/config/build_deps.mk new file mode 100644 index 00000000..29d8af17 --- /dev/null +++ b/config/build_deps.mk @@ -0,0 +1,50 @@ +# TMAP8 +ifeq ($(ENABLE_TMAP8),yes) + libmesh_CXXFLAGS += -DENABLE_TMAP8 + APPLICATION_DIR := $(TMAP8_DIR) + APPLICATION_NAME := tmap8 + BUILD_EXEC := no + GEN_REVISION := no + include $(FRAMEWORK_DIR)/app.mk +endif + +# Cardinal +ifeq ($(ENABLE_CARDINAL),yes) + # Add OpenMC flags + ADDITIONAL_CPPFLAGS += $(HDF5_INCLUDES) $(OPENMC_INCLUDES) + libmesh_CXXFLAGS += -DENABLE_OPENMC_COUPLING + + # Add DagMC flags (-DDAGMC is used in OpenMC) + libmesh_CXXFLAGS += -DENABLE_DAGMC -DDAGMC + + # Configure and build MOAB, DagMC, and then OpenMC + include $(CARDINAL_DIR)/config/moab.mk + include $(CARDINAL_DIR)/config/dagmc.mk + + # autoconf-archive puts some arguments (e.g. -std=c++17) into the compiler + # variable rather than the compiler flags variable. + # + # cmake allows this, but wants any compiler arguments to be + # semicolon-separated, not space-separated + # libmesh_CC, etc., were defined in build.mk + space := $(subst ,, ) + LIBMESH_CC_LIST := $(subst $(space),;,$(libmesh_CC)) + LIBMESH_CXX_LIST := $(subst $(space),;,$(libmesh_CXX)) + LIBMESH_F90_LIST := $(subst $(space),;,$(libmesh_F90)) + + ENABLE_DAGMC := ON + include $(CARDINAL_DIR)/config/openmc.mk + + # Cardinal + libmesh_CXXFLAGS += -DENABLE_CARDINAL + APPLICATION_DIR := $(CARDINAL_DIR) + APPLICATION_NAME := cardinal + BUILD_EXEC := no + GEN_REVISION := yes + include $(FRAMEWORK_DIR)/app.mk + + # app_objects are defined in moose.mk and built according to the rules in build.mk + # We need to build these first so we get include dirs + $(app_objects): build_moab build_dagmc build_openmc + $(test_objects): build_moab build_dagmc build_openmc +endif diff --git a/config/check_deps.mk b/config/check_deps.mk index a117d86a..e695b023 100644 --- a/config/check_deps.mk +++ b/config/check_deps.mk @@ -3,13 +3,25 @@ define n endef -# Set default values for Cardinal location and ENABLE_CARDINAL. +# Set default values for dependency locations, or use user-defined environment variable +TMAP8_DIR ?= $(CURDIR)/tmap8 CARDINAL_DIR ?= $(CURDIR)/cardinal + +# Set defaults for optional dependencies +ENABLE_TMAP8 := yes ENABLE_CARDINAL := yes -# Check for CARDINAL_CONTENT within CARDINAL_DIR. +# Check for content within dependency directories +TMAP8_CONTENT := $(shell ls $(TMAP8_DIR) 2> /dev/null) CARDINAL_CONTENT := $(shell ls $(CARDINAL_DIR) 2> /dev/null) +ifeq ($(TMAP8_CONTENT),) + $(warning $n"TMAP8 does not seem to be available. If usage of TMAP8 is desired within FENIX, make sure that either the submodule is checked out$nor that TMAP8_DIR points to a location with the TMAP8 source. $n$nIn the meantime, FENIX will be built without TMAP8.") + ENABLE_TMAP8 := no +else + $(info FENIX is using TMAP8 from $(TMAP8_DIR)) +endif + ifeq ($(CARDINAL_CONTENT),) $(warning $n"Cardinal does not seem to be available. If usage of Cardinal is desired within FENIX, make sure that either the submodule is checked out$nor that CARDINAL_DIR points to a location with the Cardinal source. $n$nIn the meantime, FENIX will be built without Cardinal.") ENABLE_CARDINAL := no diff --git a/config/dep_modules.mk b/config/dep_modules.mk new file mode 100644 index 00000000..ef789dd0 --- /dev/null +++ b/config/dep_modules.mk @@ -0,0 +1,27 @@ +# TMAP8 +ifeq ($(ENABLE_TMAP8),yes) + CHEMICAL_REACTIONS := yes + FLUID_PROPERTIES := yes + HEAT_TRANSFER := yes + MISC := yes + NAVIER_STOKES := yes + PHASE_FIELD := yes + RAY_TRACING := yes + RDG := yes + SCALAR_TRANSPORT := yes + SOLID_PROPERTIES := yes + SOLID_MECHANICS := yes + THERMAL_HYDRAULICS := yes +endif + +# Cardinal +ifeq ($(ENABLE_CARDINAL),yes) + FLUID_PROPERTIES := yes + HEAT_TRANSFER := yes + NAVIER_STOKES := yes + REACTOR := yes + SOLID_PROPERTIES := yes + STOCHASTIC_TOOLS := yes + SOLID_MECHANICS := yes + THERMAL_HYDRAULICS := yes +endif diff --git a/doc/content/getting_started/installation.md b/doc/content/getting_started/installation.md index 3bd01517..7a258b8b 100644 --- a/doc/content/getting_started/installation.md +++ b/doc/content/getting_started/installation.md @@ -101,6 +101,12 @@ The copies of MOOSE, TMAP8, and Cardinal provided with FENIX have been fully tes FENIX version, and is guaranteed to work with all current FENIX tests. !alert-end! +!alert! tip title=Disabling TMAP8 +TMAP8 is an optional dependency of FENIX and can be disabled to speed up build times, if TMAP8 +capabilities are not needed. This can be done by simply not downloading the TMAP8 submodule +(i.e., not performing the `git submodule update --init tmap8` command above.) +!alert-end! + !alert! tip title=Disabling Cardinal Cardinal is an optional dependency of FENIX and can be disabled to speed up build times, if Cardinal capabilities are not needed. This can be done by simply not downloading the Cardinal submodule @@ -190,6 +196,12 @@ git submodule update --recursive contrib/DAGMC git submodule update contrib/moab ``` +!alert! tip title=Disabling TMAP8 +TMAP8 is an optional dependency of FENIX and can be disabled to speed up build times, if TMAP8 +capabilities are not needed. This can be done by simply not downloading the TMAP8 submodule +(i.e., not performing the `git submodule update tmap8` command above.) +!alert-end! + !alert! tip title=Disabling Cardinal Cardinal is an optional dependency of FENIX and can be disabled to speed up build times, if Cardinal capabilities are not needed. This can be done by simply not downloading the Cardinal submodule diff --git a/src/base/FenixApp.C b/src/base/FenixApp.C index f1a8c296..0de123af 100644 --- a/src/base/FenixApp.C +++ b/src/base/FenixApp.C @@ -20,7 +20,10 @@ #include "MooseSyntax.h" // contribs +#ifdef ENABLE_TMAP8 #include "TMAP8App.h" +#endif + #ifdef ENABLE_CARDINAL #include "CardinalApp.h" #endif @@ -48,7 +51,9 @@ FenixApp::registerAll(Factory & f, ActionFactory & af, Syntax & s) Registry::registerObjectsTo(f, {"FenixApp"}); Registry::registerActionsTo(af, {"FenixApp"}); +#ifdef ENABLE_TMAP8 TMAP8App::registerAll(f, af, s); +#endif #ifdef ENABLE_CARDINAL CardinalApp::registerAll(f, af, s); @@ -62,7 +67,10 @@ FenixApp::registerApps() { registerApp(FenixApp); ModulesApp::registerApps(); + +#ifdef ENABLE_TMAP8 TMAP8App::registerApps(); +#endif #ifdef ENABLE_CARDINAL CardinalApp::registerApps();