Skip to content

Commit

Permalink
update SAM and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilnovak committed Jun 6, 2024
1 parent 6496f7c commit 136d86d
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 209 deletions.
123 changes: 11 additions & 112 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Optional environment variables:
#
# To control where various third-party dependencies are. You don't need to set
# any of these unless you want to use non-submodule third-party dependencies.
# To control where various third-party dependencies are.
# NOTE: If you change any of these partway through a build, you will need to
# clear out the build/ and install/ directories to be sure the proper build
# flags are used.
Expand Down Expand Up @@ -53,6 +52,7 @@ OCCA_OPENCL_ENABLED=0
# Whether to enable AMGX in Nek (only available for Nvidia GPU)
AMGX_ENABLED=0

# If user forgot to set OCCA_CUDA_ENABLED for AMGX, turn it on for them
ifeq ($(AMGX_ENABLED),1)
ifeq ($(OCCA_CUDA_ENABLED),0)
$(info Turning on CUDA backend because AMGX was requested)
Expand All @@ -71,21 +71,10 @@ 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_DIR)/petsc
PETSC_ARCH ?= arch-moose
LIBMESH_DIR ?= $(MOOSE_DIR)/libmesh/installed/
CONTRIB_INSTALL_DIR ?= $(CARDINAL_DIR)/install
GRIFFIN_DIR ?= $(CONTRIB_DIR)/griffin
BISON_DIR ?= $(CONTRIB_DIR)/bison
SAM_DIR ?= $(CONTRIB_DIR)/SAM
SOCKEYE_DIR ?= $(CONTRIB_DIR)/sockeye
SODIUM_DIR ?= $(CONTRIB_DIR)/sodium
POTASSIUM_DIR ?= $(CONTRIB_DIR)/potassium
IAPWS95_DIR ?= $(CONTRIB_DIR)/iapws95

# 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
Expand All @@ -105,11 +94,6 @@ endif
HDF5_INCLUDE_DIR ?= $(HDF5_ROOT)/include
HDF5_LIBDIR ?= $(HDF5_ROOT)/lib

# Check that NEKRS_HOME is set to the correct location
ifeq ($(ENABLE_NEK), yes)
include config/check_nekrs.mk
endif

ALL_MODULES := no

# you may opt to enable additional modules by listing them here; any modules required
Expand All @@ -123,10 +107,11 @@ STOCHASTIC_TOOLS := yes
SOLID_MECHANICS := yes
THERMAL_HYDRAULICS := yes

# Perform various checks on the dependencies
# Configure the optional dependencies (NekRS, OpenMC, submodules, etc.)
include config/check_deps.mk
include config/check_modules.mk

# Report what MOOSE modules are being used
include config/check_modules.mk

# BUILD_TYPE will be passed to CMake via CMAKE_BUILD_TYPE
ifeq ($(METHOD),dbg)
Expand Down Expand Up @@ -218,97 +203,11 @@ include $(FRAMEWORK_DIR)/moose.mk

include $(MOOSE_DIR)/modules/modules.mk

# Griffin submodule
ifneq ($(GRIFFIN_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_GRIFFIN_COUPLING

APPLICATION_DIR := $(GRIFFIN_DIR)/isoxml
APPLICATION_NAME := isoxml
include $(FRAMEWORK_DIR)/app.mk
#ADDITIONAL_DEPEND_LIBS += $(CURDIR)/isoxml/lib/libisoxml-$(METHOD).la

APPLICATION_DIR := $(GRIFFIN_DIR)/xs_generation
APPLICATION_NAME := mcc3
include $(APPLICATION_DIR)/mcc3.dep
include $(FRAMEWORK_DIR)/app.mk

APPLICATION_DIR := $(GRIFFIN_DIR)/radiation_transport
APPLICATION_NAME := radiation_transport
include $(FRAMEWORK_DIR)/app.mk

APPLICATION_DIR := $(GRIFFIN_DIR)
APPLICATION_NAME := griffin
include $(FRAMEWORK_DIR)/app.mk
endif

# Bison submodule
ifneq ($(BISON_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_BISON_COUPLING
APPLICATION_DIR := $(BISON_DIR)
APPLICATION_NAME := bison
include $(FRAMEWORK_DIR)/app.mk
endif

# SAM submodule
ifneq ($(SAM_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_SAM_COUPLING
APPLICATION_DIR := $(SAM_DIR)
APPLICATION_NAME := sam
SOLID_MECHANICS := yes
include $(FRAMEWORK_DIR)/app.mk
endif

# Sockeye submodule
ifneq ($(SOCKEYE_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_SOCKEYE_COUPLING
APPLICATION_DIR := $(SOCKEYE_DIR)
APPLICATION_NAME := sockeye
include $(FRAMEWORK_DIR)/app.mk
endif

# sodium submodule
ifneq ($(SODIUM_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_SODIUM
APPLICATION_DIR := $(SODIUM_DIR)
APPLICATION_NAME := sodium
include $(FRAMEWORK_DIR)/app.mk
include $(SODIUM_DIR)/libSodiumProperties.mk
endif

# potassium submodule
ifneq ($(POTASSIUM_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_POTASSIUM
APPLICATION_DIR := $(POTASSIUM_DIR)
APPLICATION_NAME := potassium
include $(FRAMEWORK_DIR)/app.mk
include $(POTASSIUM_DIR)/libPotassiumProperties.mk
endif

# iapws95 submodule
ifneq ($(IAPWS95_CONTENT),)
libmesh_CXXFLAGS += -DENABLE_IAPWS95
APPLICATION_DIR := $(IAPWS95_DIR)
APPLICATION_NAME := iapws95
include $(FRAMEWORK_DIR)/app.mk
include $(IAPWS95_DIR)/libSBTL.mk
endif

ifeq ($(ENABLE_NEK), yes)
ADDITIONAL_CPPFLAGS += $(NEKRS_INCLUDES)
libmesh_CXXFLAGS += -DENABLE_NEK_COUPLING
endif

ifeq ($(ENABLE_OPENMC), yes)
ADDITIONAL_CPPFLAGS += $(HDF5_INCLUDES) $(OPENMC_INCLUDES)
libmesh_CXXFLAGS += -DENABLE_OPENMC_COUPLING
endif

ifeq ($(ENABLE_DAGMC), yes)
libmesh_CXXFLAGS += -DENABLE_DAGMC
# ======================================================================================
# Third-Party Dependencies
# ======================================================================================

# this flag is used in OpenMC
libmesh_CXXFLAGS += -DDAGMC
endif
include config/add_flags.mk

# ======================================================================================
# External apps
Expand Down Expand Up @@ -395,7 +294,7 @@ ifeq ($(ENABLE_OPENMC), yes)
ADDITIONAL_LIBS += $(CC_LINKER_SLFLAG)$(OPENMC_LIBDIR)
endif

# Determin if we need libpng and where using pkg-config (if available)
# Determine if we need libpng and where using pkg-config (if available)
LIBPNG_FLAGS ?= $(shell pkg-config --libs libpng 2>/dev/null)
ifneq (,$(findstring -lpng, $(LIBPNG_FLAGS)))
ADDITIONAL_LIBS += $(LIBPNG_FLAGS)
Expand Down Expand Up @@ -427,7 +326,7 @@ ifeq ($(ENABLE_OPENMC), yes)
CARDINAL_EXTERNAL_FLAGS += $(CC_LINKER_SLFLAG)$(OPENMC_LIBDIR) \
$(CC_LINKER_SLFLAG)$(HDF5_LIBDIR)
endif
#

# EXTERNAL_FLAGS are for rules in app.mk
$(app_LIB): EXTERNAL_FLAGS := $(CARDINAL_EXTERNAL_FLAGS)
$(app_test_LIB): EXTERNAL_FLAGS := $(CARDINAL_EXTERNAL_FLAGS)
Expand Down
66 changes: 36 additions & 30 deletions config/check_deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ define n

endef

# First, we can find which optional dependencies we have been pulled in
# Set default values for all third party dependencies
NEKRS_DIR ?= $(CONTRIB_DIR)/nekRS
OPENMC_DIR ?= $(CONTRIB_DIR)/openmc
DAGMC_DIR ?= $(CONTRIB_DIR)/DAGMC
MOAB_DIR ?= $(CONTRIB_DIR)/moab
GRIFFIN_DIR ?= $(CONTRIB_DIR)/griffin
BISON_DIR ?= $(CONTRIB_DIR)/bison
SAM_DIR ?= $(CONTRIB_DIR)/SAM
SOCKEYE_DIR ?= $(CONTRIB_DIR)/sockeye
SODIUM_DIR ?= $(CONTRIB_DIR)/sodium
POTASSIUM_DIR ?= $(CONTRIB_DIR)/potassium
IAPWS95_DIR ?= $(CONTRIB_DIR)/iapws95

# Then, we can find which optional dependencies we have been pulled in
# by seeing if those directories are empty or not
MOOSE_CONTENT := $(shell ls $(MOOSE_DIR) 2> /dev/null)
NEKRS_CONTENT := $(shell ls $(NEKRS_DIR) 2> /dev/null)
OPENMC_CONTENT := $(shell ls $(OPENMC_DIR) 2> /dev/null)
Expand All @@ -17,11 +31,6 @@ SODIUM_CONTENT := $(shell ls $(SODIUM_DIR) 2> /dev/null)
POTASSIUM_CONTENT := $(shell ls $(POTASSIUM_DIR) 2> /dev/null)
IAPWS95_CONTENT := $(shell ls $(IAPWS95_DIR) 2> /dev/null)

ifeq ($(ENABLE_OPENMC), yes)
# HDF5 is only needed to be linked if using OpenMC
$(info Cardinal is using HDF5 from $(HDF5_ROOT))
endif

# convert ENABLE_NEK, ENABLE_OPENMC, and ENABLE_DAGMC to consistent truthy value
ifeq ($(ENABLE_OPENMC),$(filter $(ENABLE_OPENMC), true yes on 1 TRUE YES ON))
ENABLE_OPENMC := yes
Expand All @@ -33,16 +42,21 @@ ifeq ($(ENABLE_DAGMC),$(filter $(ENABLE_DAGMC), true yes on 1 TRUE YES ON))
ENABLE_DAGMC := yes
endif

# Check that NEKRS_HOME is set to the correct location
ifeq ($(ENABLE_NEK), yes)
include config/check_nekrs.mk
endif

ifeq ($(ENABLE_OPENMC), yes)
# HDF5 is only needed to be linked if using OpenMC
$(info Cardinal is using HDF5 from $(HDF5_ROOT))
else
ifeq ($(ENABLE_DAGMC), yes)
$(info Ignoring ENABLE_DAGMC because OpenMC is not enabled.)
ENABLE_DAGMC := no
endif
endif



ifeq ($(MOOSE_CONTENT),)
$(error $n"MOOSE framework does not seem to be available. Make sure that either the submodule is checked out$nor that MOOSE_DIR points to a location with the MOOSE source.$n$nTo fetch the MOOSE submodule, use ./scripts/get-dependencies.sh")
else
Expand Down Expand Up @@ -103,8 +117,6 @@ ifeq ($(ENABLE_DAGMC), yes)
endif
endif



ifneq ($(SAM_CONTENT),)
$(info Cardinal is using SAM from $(SAM_DIR))
endif
Expand All @@ -124,6 +136,18 @@ ifneq ($(BISON_CONTENT),)
SOLID_MECHANICS := yes
THERMAL_HYDRAULICS := yes
XFEM := yes

# We can check that if it looks like we're going to build Bison, that
# all of its dependencies are there
ifeq ($(IAPWS95_CONTENT),)
$(error $n"IAPWS95 dependency for Bison does not seem to be available. Make sure that either the submodule is checked out$nor that IAPWS95_DIR points to a location with the IAPWS95 source.$n$nTo fetch the IAPWS95 submodule, use 'git submodule update --init contrib/iapws95'")
else
ifeq ($(SOCKEYE_CONTENT),)
# don't print location info for IAPWS twice, if we are building with both
# Sockeye and Bison (since both require IAPWS)
$(info Cardinal is using water from $(IAPWS95_DIR))
endif
endif
endif

ifneq ($(GRIFFIN_CONTENT),)
Expand Down Expand Up @@ -155,13 +179,9 @@ ifneq ($(SOCKEYE_CONTENT),)
SOLID_PROPERTIES := yes
STOCHASTIC_TOOLS := yes
THERMAL_HYDRAULICS := yes
endif



# We can check that if it looks like we're going to build Sockeye, that
# all of its dependencies are there
ifneq ($(SOCKEYE_CONTENT),)
# We can check that if it looks like we're going to build Sockeye, that
# all of its dependencies are there
ifeq ($(SODIUM_CONTENT),)
$(error $n"Sodium dependency for Sockeye does not seem to be available. Make sure that either the submodule is checked out$nor that SODIUM_DIR points to a location with the sodium source.$n$nTo fetch the sodium submodule, use 'git submodule update --init contrib/sodium'")
else
Expand All @@ -179,20 +199,6 @@ ifneq ($(SOCKEYE_CONTENT),)
endif
endif

# We can check that if it looks like we're going to build Bison, that
# all of its dependencies are there
ifneq ($(BISON_CONTENT),)
ifeq ($(IAPWS95_CONTENT),)
$(error $n"IAPWS95 dependency for Bison does not seem to be available. Make sure that either the submodule is checked out$nor that IAPWS95_DIR points to a location with the IAPWS95 source.$n$nTo fetch the IAPWS95 submodule, use 'git submodule update --init contrib/iapws95'")
else
ifeq ($(SOCKEYE_CONTENT),)
# don't print location info for IAPWS twice, if we are building with both
# Sockeye and Bison (since both require IAPWS)
$(info Cardinal is using water from $(IAPWS95_DIR))
endif
endif
endif

# Cannot currently build with both SAM and Sockeye due to a conflict in THM.
# Someone might just build with THM (and not Sockeye), so we check both to be explicit.
ifneq ($(SOCKEYE_CONTENT),)
Expand Down
2 changes: 1 addition & 1 deletion contrib/SAM
Submodule SAM updated from 85c551 to 0cf7af
55 changes: 21 additions & 34 deletions test/tests/sam_coupling/sam_master/cardinal_sub.i
Original file line number Diff line number Diff line change
@@ -1,46 +1,33 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 3
ny = 3
[sphere]
type = FileMeshGenerator
file = ../../neutronics/meshes/sphere.e
[]
[]

[Variables]
[./u]
[../]
[Problem]
type = FEProblem
solve = false
[]

[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[AuxVariables]
[g]
family = MONOMIAL
order = CONSTANT
[]
[]

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = 'left'
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = 'right'
value = 1
[../]
[AuxKernels]
[grid]
type = CartesianGrid
variable = g
nx = 4
ny = 4
nz = 4
[]
[]

[Executioner]
type = Transient
num_steps = 1
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
nl_abs_tol = 1e-10
num_steps = 2
[]

[Outputs]
exodus = true
[]

6 changes: 3 additions & 3 deletions test/tests/sam_coupling/sam_master/sam_master.i
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
[../]

[./outlet]
type = PressureOutlet
type = PBTDV
input = 'pipe1(out) ' # Name of the connected components and the end type
eos = eos # The equation-of-state
p_bc = '1.0e5' # Pressure boundary condition
Expand Down Expand Up @@ -99,8 +99,8 @@
l_max_its = 100 # Number of linear iterations for each Krylov solve

start_time = 0.0 # Physical time at the beginning of the simulation
num_steps = 20 # Max. simulation time steps
end_time = 10. # Max. physical time at the end of the simulation
num_steps = 20 # Max. simulation time steps
end_time = 10. # Max. physical time at the end of the simulation

[./Quadrature]
type = TRAP # Using trapezoid integration rule
Expand Down
Loading

0 comments on commit 136d86d

Please sign in to comment.