Skip to content

Commit

Permalink
NEML integration
Browse files Browse the repository at this point in the history
Add NEML as a submodule
Add Makefile to build NEML using the MOOSE build system
Fix issues with NEML tests and make them run only if NEML is compiled in
  • Loading branch information
bwspenc committed Feb 6, 2019
1 parent a6ff42f commit 206a62c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "contrib/neml"]
path = contrib/neml
url = ../../Argonne-National-Laboratory/neml.git
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ POROUS_FLOW := no

include $(MOOSE_DIR)/modules/modules.mk
###############################################################################

ifdef NEML
ADDITIONAL_INCLUDES := -I$(NEML)/src
ADDITIONAL_LIBS := -L$(NEML)/lib -lneml
endif

##############################################################################
BLACKBEAR_DIR := $(CURDIR)
#include $(BLACKBEAR_DIR)/contrib/neml.mk

# dep apps
APPLICATION_DIR := $(CURDIR)
Expand All @@ -61,3 +56,4 @@ include $(FRAMEWORK_DIR)/app.mk

###############################################################################
# Additional special case targets should be added here
#include $(BLACKBEAR_DIR)/contrib/neml.mk
1 change: 1 addition & 0 deletions blackbear.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(BLACKBEAR_DIR)/contrib/neml.mk
1 change: 1 addition & 0 deletions contrib/neml
Submodule neml added at 2fe283
42 changes: 42 additions & 0 deletions contrib/neml.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ifeq ($(shell pkg-config libxml++-2.6 && echo go),go)

neml_DIR := $(BLACKBEAR_DIR)/contrib/neml

ifneq ($(wildcard $(neml_DIR)/CMakeLists.txt),)

#Exclude all the files with _wrap in the name because they are drivers for testing
#that are not needed and have additional dependencies.
neml_srcfiles := $(shell find $(neml_DIR)/src -name "*.cxx" | grep -v _wrap)
neml_objects += $(patsubst %.cxx,%.$(obj-suffix),$(neml_srcfiles))
neml_LIB := $(neml_DIR)/libneml-$(METHOD).la
neml_deps := $(patsubst %.cxx,%.$(obj-suffix).d,$(neml_srcfiles))
neml_includes := $(neml_DIR)/src

$(APPLICATION_DIR)/lib/libblackbear-$(METHOD).la: $(neml_LIB)

$(neml_LIB): $(neml_objects)
@echo "Linking Library "$@"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link --quiet \
$(libmesh_CC) $(libmesh_CFLAGS) -o $@ $(neml_objects) $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) -rpath $(neml_DIR)
@$(libmesh_LIBTOOL) --mode=install --quiet install -c $(neml_LIB) $(neml_DIR)

%.$(obj-suffix) : %.cxx
@echo "Compiling C++ (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_CXX) $(libmesh_CPPFLAGS) $(ADDITIONAL_CPPFLAGS) $(libmesh_CXXFLAGS) $(app_INCLUDES) $(libmesh_INCLUDE) -w -DHAVE_CONFIG_H -MMD -MP -MF $@.d -MT $@ -c $< -o $@

ADDITIONAL_INCLUDES += $(shell pkg-config libxml++-2.6 --cflags)
ADDITIONAL_LIBS += $(shell pkg-config libxml++-2.6 --libs)
ADDITIONAL_INCLUDES += -I$(neml_includes)
ADDITIONAL_LIBS += -L$(neml_DIR) -lneml-$(METHOD)
ADDITIONAL_CPPFLAGS += -DNEML_ENABLED

else
$(info WARNING: Not building with NEML because contrib/neml submodule is not present)
$(info See https://github.com/Argonne-National-Laboratory/neml/blob/dev/INSTALL.md)
endif

else
$(info WARNING: Not building with NEML because libxml++ was not found.)
$(info See https://github.com/Argonne-National-Laboratory/neml/blob/dev/INSTALL.md)
endif
2 changes: 2 additions & 0 deletions src/materials/ComputeNEMLStress.C
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef NEML_ENABLED
#include "ComputeNEMLStress.h"

registerMooseObject("BlackBearApp", ComputeNEMLStress);
Expand Down Expand Up @@ -185,3 +186,4 @@ void neml_tangent(const double * const in, RankFourTensor & out)
}
}
}
#endif //NEML_ENABLED
2 changes: 2 additions & 0 deletions src/materials/ComputeThermalExpansionEigenstrainNEML.C
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef NEML_ENABLED
#include "ComputeThermalExpansionEigenstrainNEML.h"
#include <string>

Expand Down Expand Up @@ -46,3 +47,4 @@ void ComputeThermalExpansionEigenstrainNEML::initQpStatefulProperties()
ComputeThermalExpansionEigenstrainBase::initQpStatefulProperties();
_tstrain[_qp] = 0.0;
}
#endif //NEML_ENABLED
2 changes: 2 additions & 0 deletions test/tests/neml_complex/tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
type = 'CSVDiff'
input = 'inelastic.i'
csvdiff = 'inelastic_out.csv'
abs_zero = 1e-8
required_objects = ComputeNEMLStress
[../]
[]
2 changes: 2 additions & 0 deletions test/tests/neml_simple/tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
type = 'CSVDiff'
input = 'le_stress.i'
csvdiff = 'le_stress_out.csv'
required_objects = ComputeNEMLStress
[../]
[./neml_linear_elastic_thermal]
type = 'CSVDiff'
input = 'le_stress_thermal.i'
csvdiff = 'le_stress_thermal_out.csv'
required_objects = 'ComputeNEMLStress ComputeThermalExpansionEigenstrainNEML'
[../]
[]

0 comments on commit 206a62c

Please sign in to comment.