-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Cardinal an optional dependency of FENIX
- Loading branch information
1 parent
ffa88f9
commit c41ae36
Showing
5 changed files
with
155 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 | ||
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 | ||
|
||
# Cardinal dependency libraries | ||
ADDITIONAL_LIBS := -L$(CARDINAL_DIR)/lib $(CC_LINKER_SLFLAG)$(CARDINAL_DIR)/lib \ | ||
-L$(OPENMC_LIBDIR) -lopenmc -lhdf5_hl -ldagmc -lMOAB \ | ||
$(CC_LINKER_SLFLAG)$(OPENMC_LIBDIR) | ||
libmesh_CXXFLAGS += -DENABLE_CARDINAL | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
define n | ||
|
||
|
||
endef | ||
|
||
# Set default value for Cardinal | ||
CARDINAL_DIR ?= $(CURDIR)/cardinal | ||
|
||
# Check for CARDINAL_CONTENT within CARDINAL_DIR. This will cause Cardinal (and contribs) | ||
# to either be built or skipped within the configure_cardinal.mk file. | ||
CARDINAL_CONTENT := $(shell ls $(CARDINAL_DIR) 2> /dev/null) | ||
|
||
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.") | ||
else | ||
$(info FENIX is using Cardinal from $(CARDINAL_DIR)) | ||
ENABLE_CARDINAL := yes | ||
endif | ||
|
||
ifeq ($(ENABLE_CARDINAL), yes) | ||
# Cardinal contrib variables | ||
CARDINAL_CONTRIB_DIR := $(CARDINAL_DIR)/contrib | ||
CARDINAL_CONTRIB_INSTALL_DIR ?= $(CARDINAL_DIR)/install | ||
OPENMC_INSTALL_DIR := $(CARDINAL_CONTRIB_INSTALL_DIR) | ||
OPENMC_LIBDIR := $(OPENMC_INSTALL_DIR)/lib | ||
OPENMC_BUILDDIR := $(CARDINAL_DIR)/build/openmc | ||
OPENMC_INSTALL_DIR := $(CARDINAL_CONTRIB_INSTALL_DIR) | ||
OPENMC_INCLUDES := -I$(OPENMC_INSTALL_DIR)/include | ||
OPENMC_LIBDIR := $(OPENMC_INSTALL_DIR)/lib | ||
OPENMC_LIB := $(OPENMC_LIBDIR)/libopenmc.so | ||
|
||
PETSC_DIR ?= $(MOOSE_DIR)/petsc | ||
PETSC_ARCH ?= arch-moose | ||
LIBMESH_DIR ?= $(MOOSE_DIR)/libmesh/installed/ | ||
|
||
# This is the Eigen3 location on CIVET. If you are using MOOSE's conda environment, | ||
# you don't need to set these variables, because conda sets them for you. The only | ||
# scenario where you might need to manually set these is if you're not using the | ||
# conda environment. You will get a compile error about FindEigen3.cmake if you | ||
# do indeed need to set these. | ||
EIGEN3_DIR ?= $(LIBMESH_DIR)/include | ||
Eigen3_DIR ?= $(EIGEN3_DIR) | ||
|
||
# If HDF5_DIR is set, use those settings to link HDF5 to OpenMC. | ||
# Otherwise, use the PETSc location, as the self-built HDF5 libraries will be housed within. | ||
ifeq ($(HDF5_DIR),) | ||
HDF5_DIR := $(PETSC_DIR) | ||
export HDF5_DIR | ||
endif | ||
|
||
# HDF5_ROOT is used in makefiles for the Cardinal third-party dependencies. | ||
# Set it using HDF5_DIR | ||
HDF5_ROOT := $(HDF5_DIR) | ||
export HDF5_ROOT | ||
|
||
HDF5_INCLUDE_DIR ?= $(HDF5_DIR)/include | ||
HDF5_LIBDIR ?= $(HDF5_DIR)/lib | ||
# This is used in $(FRAMEWORK_DIR)/build.mk | ||
HDF5_INCLUDES := -I$(HDF5_INCLUDE_DIR) -I$(HDF5_DIR)/include | ||
|
||
# BUILD_TYPE will be passed to CMake via CMAKE_BUILD_TYPE | ||
ifeq ($(METHOD),dbg) | ||
BUILD_TYPE := Debug | ||
else | ||
BUILD_TYPE := Release | ||
endif | ||
|
||
DAGMC_BUILDDIR := $(CARDINAL_DIR)/build/DAGMC | ||
DAGMC_INSTALL_DIR := $(CARDINAL_CONTRIB_INSTALL_DIR) | ||
|
||
MOAB_BUILDDIR := $(CARDINAL_DIR)/build/moab | ||
MOAB_INSTALL_DIR := $(CARDINAL_CONTRIB_INSTALL_DIR) | ||
|
||
# Set default values for all third party dependencies | ||
OPENMC_DIR ?= $(CARDINAL_CONTRIB_DIR)/openmc | ||
DAGMC_DIR ?= $(CARDINAL_CONTRIB_DIR)/DAGMC | ||
MOAB_DIR ?= $(CARDINAL_CONTRIB_DIR)/moab | ||
|
||
# Use compiler info discovered by PETSC | ||
ifeq ($(PETSC_ARCH),) | ||
include $(PETSC_DIR)/$(PETSC_ARCH)/lib/petsc/conf/petscvariables | ||
else | ||
include $(PETSC_DIR)/lib/petsc/conf/petscvariables | ||
endif | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ifeq ($(ENABLE_CARDINAL),yes) | ||
# Cardinal contrib flags used in app.mk targets | ||
CARDINAL_EXTERNAL_FLAGS := -L$(CARDINAL_DIR)/lib $(CC_LINKER_SLFLAG)$(CARDINAL_DIR)/lib $(BLASLAPACK_LIB) $(PETSC_EXTERNAL_LIB_BASIC) -L$(OPENMC_LIBDIR) -L$(HDF5_LIBDIR) -lopenmc -ldagmc -lMOAB $(CC_LINKER_SLFLAG)$(OPENMC_LIBDIR) $(CC_LINKER_SLFLAG)$(HDF5_LIBDIR) | ||
|
||
# EXTERNAL_FLAGS is used in rules for app.mk | ||
$(app_LIB): EXTERNAL_FLAGS := $(CARDINAL_EXTERNAL_FLAGS) | ||
$(app_test_LIB): EXTERNAL_FLAGS := $(CARDINAL_EXTERNAL_FLAGS) | ||
$(app_EXEC): EXTERNAL_FLAGS := $(CARDINAL_EXTERNAL_FLAGS) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters