-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEML integration #60
Merged
Merged
NEML integration #60
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a6ff42f
Added linkage to NEML through ComputeNEMLStress and ComputeThermalExp…
reverendbedford 206a62c
NEML integration
bwspenc 3665c71
Rename NEML interface classes
bwspenc 74905b1
Updates to re-named NEML objects ref #59
bwspenc 7811cda
Makefile modifications to fix build issues ref #59
bwspenc 716c41f
Makefile and doc changes for switch to RapidXML
bwspenc 72dc574
Update NEML to version that uses RapidXML
bwspenc d62c698
Avoid invalid pointer when there is no history data ref #59
bwspenc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ temp_print_trace.* | |
*.poly | ||
*.mpx | ||
*.btr | ||
*.xml | ||
*.gmv | ||
*.plt | ||
*.slh | ||
|
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,4 @@ | ||
[submodule "contrib/neml"] | ||
path = contrib/neml | ||
url = ../../Argonne-National-Laboratory/neml.git | ||
ignore = untracked |
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 @@ | ||
include $(BLACKBEAR_DIR)/contrib/neml.mk |
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,33 @@ | ||
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_includes := $(neml_DIR)/src | ||
neml_dep_includes := -I$(neml_DIR)/rapidxml | ||
|
||
$(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_LDFLAGS) $(EXTERNAL_FLAGS) -rpath $(neml_DIR) | ||
@$(libmesh_LIBTOOL) --mode=install --quiet install -c $(neml_LIB) $(neml_DIR) | ||
|
||
$(neml_DIR)/src/%.$(obj-suffix) : $(neml_DIR)/src/%.cxx | ||
@echo "Compiling C++ (in "$(METHOD)" mode) "$<"..." | ||
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=compile --quiet \ | ||
$(libmesh_CXX) $(libmesh_CPPFLAGS) $(ADDITIONAL_CPPFLAGS) $(libmesh_CXXFLAGS) $(neml_dep_includes) $(app_INCLUDES) $(libmesh_INCLUDE) -w -DHAVE_CONFIG_H -MMD -MP -MF [email protected] -MT $@ -c $< -o $@ | ||
|
||
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 |
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,32 @@ | ||
# NEML Stress | ||
|
||
!syntax description /Materials/NEMLStress | ||
|
||
# Stress Calculator Based on NEML Constitutive Models | ||
|
||
This material model provides an interface to the constitutive models for structural materials provided by the [Nuclear Engineering Material model Library (NEML)](https://github.com/Argonne-National-Laboratory/neml) developed by Argonne National Laboratory. This is a general interface to all of the models provided by that library, which are documented in detail in the [NEML documentation](https://neml.readthedocs.io/en/stable/). | ||
|
||
NEML permits the definition of complex material constitutive models, the details of which are defined in an XML file that is independent of the MOOSE input file. The required inputs for this model on the MOOSE side simply provide the location of the XML file, which contains a database of potentially multiple material models, and the name of the model within that database to be used. This model computes the stress, elasticity tensor, and material Jacobian. | ||
|
||
Using this model requires that the NEML source code is present, and that the prerequisite libraries are available. NEML is provided as a submodule in BlackBear under the directory `blackbear/contrib/neml`. The up-to-date version of the NEML submodule is obtained using: | ||
``` | ||
git submodule init | ||
git submodule update | ||
``` | ||
in the `blackbear` directory. | ||
|
||
NEML is compiled using the MOOSE build system, so no separate compilation step is required to build the library. However, NEML has dependencies on the BOOST library that is not present in the default MOOSE environment. | ||
|
||
To build with BOOST, one must simply load the `boost` module provided with MOOSE: | ||
``` | ||
module load advanced_modules boost | ||
``` | ||
and add the `--with-boost` option to the `update_and_rebuild_libmesh.sh` script when compiling libMesh to instruct it to use the full BOOST instalation provided by the `boost` module, rather than the subset of BOOST that is distributed with libmesh. | ||
|
||
!syntax parameters /Materials/NEMLStress | ||
|
||
!syntax inputs /Materials/NEMLStress | ||
|
||
!syntax children /Materials/NEMLStress | ||
|
||
!bibtex bibliography |
17 changes: 17 additions & 0 deletions
17
doc/content/source/materials/NEMLThermalExpansionEigenstrain.md
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,17 @@ | ||
# NEML Thermal Expansion Eigenstrain | ||
|
||
!syntax description /Materials/NEMLThermalExpansionEigenstrain | ||
|
||
# Thermal Eigenstrain Obtained from NEML | ||
|
||
This material model provides an interface to use the [Nuclear Engineering Material model Library (NEML)](https://github.com/Argonne-National-Laboratory/neml) developed by Argonne National Laboratory to provide thermal expansion eigenstrains. This model would typically be used together with the [NEMLStress](NEMLStress.md) model, the documentation of which provides more details on integration with that library. | ||
|
||
NEML permits the definition of complex material constitutive models, the details of which are defined in an XML file that is independent of the MOOSE input file. The required inputs for this model on the MOOSE side simply provide the location of the XML file, which contains a database of potentially multiple material models, and the name of the model within that database to be used. This model computes the eigenstrain induced by thermal expansion. | ||
|
||
!syntax parameters /Materials/NEMLThermalExpansionEigenstrain | ||
|
||
!syntax inputs /Materials/NEMLThermalExpansionEigenstrain | ||
|
||
!syntax children /Materials/NEMLThermalExpansionEigenstrain | ||
|
||
!bibtex bibliography |
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,92 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* BlackBear */ | ||
/* */ | ||
/* (c) 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef NEMLSTRESS_H | ||
dschwen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define NEMLSTRESS_H | ||
|
||
#include "ComputeStressBase.h" | ||
|
||
#include "neml_interface.h" | ||
|
||
class NEMLStress; | ||
|
||
template <> | ||
InputParameters validParams<NEMLStress>(); | ||
|
||
class NEMLStress : public ComputeStressBase | ||
{ | ||
public: | ||
NEMLStress(const InputParameters & parameters); | ||
|
||
virtual void computeQpStress() override; | ||
virtual void initQpStatefulProperties() override; | ||
|
||
protected: | ||
/// File name of the NEML XML database | ||
FileName _fname; | ||
/// Model name in NEML XML database | ||
std::string _mname; | ||
/// NEML model | ||
std::unique_ptr<neml::NEMLModel> _model; | ||
/// History variables used by NEML model | ||
///@{ | ||
MaterialProperty<std::vector<Real>> & _hist; | ||
const MaterialProperty<std::vector<Real>> & _hist_old; | ||
///@} | ||
/// Old mechanical strain | ||
const MaterialProperty<RankTwoTensor> & _mechanical_strain_old; | ||
/// Old stress | ||
const MaterialProperty<RankTwoTensor> & _stress_old; | ||
/// Strain energy | ||
///@{ | ||
MaterialProperty<Real> & _energy; | ||
const MaterialProperty<Real> & _energy_old; | ||
///@} | ||
/// Dissipation | ||
///@{ | ||
MaterialProperty<Real> & _dissipation; | ||
const MaterialProperty<Real> & _dissipation_old; | ||
///@} | ||
/// Coupled temperature variable (defaults to zero if not specified) | ||
///@{ | ||
const VariableValue & _temperature; | ||
const VariableValue & _temperature_old; | ||
///@} | ||
/// Inelastic strain tensor | ||
MaterialProperty<RankTwoTensor> & _inelastic_strain; | ||
|
||
/** | ||
* Translates a RankTwoTensor object to a NEML tensor stored in a vector | ||
* format. | ||
* @param in RankTwoTensor to be translated | ||
* @param out NEML vector output | ||
**/ | ||
void RankTwoTensorToNeml(const RankTwoTensor & in, double * const out); | ||
|
||
/** | ||
* Translates a NEML tensor stored in vector format to a RankTwoTensor. | ||
* @param in NEML vector to be translated | ||
* @param out RankTwoTensor output | ||
**/ | ||
void NemlToRankTwoTensor(const double * const in, RankTwoTensor & out); | ||
|
||
/** | ||
* Translates a NEML elasticity tensor to a RankFourTensor. | ||
* @param in NEML elasticity tensor to be translated | ||
* @param out RankFourTensor output | ||
**/ | ||
void NemlToRankFourTensor(const double * const in, RankFourTensor & out); | ||
}; | ||
|
||
#endif // NEMLSTRESS_H |
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,58 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* BlackBear */ | ||
/* */ | ||
/* (c) 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef NEMLTHERMALEXPANSIONEIGENSTRAIN_H | ||
#define NEMLTHERMALEXPANSIONEIGENSTRAIN_H | ||
|
||
#include "ComputeThermalExpansionEigenstrainBase.h" | ||
|
||
#include "neml_interface.h" | ||
|
||
class NEMLThermalExpansionEigenstrain; | ||
|
||
template <> | ||
InputParameters validParams<NEMLThermalExpansionEigenstrain>(); | ||
|
||
/** | ||
* NEMLThermalExpansionEigenstrain computes the thermal expansion | ||
* strain from the instantaneous CTE provided by a NEML model | ||
*/ | ||
class NEMLThermalExpansionEigenstrain : public ComputeThermalExpansionEigenstrainBase | ||
{ | ||
public: | ||
NEMLThermalExpansionEigenstrain(const InputParameters & parameters); | ||
virtual void initQpStatefulProperties() override; | ||
|
||
protected: | ||
virtual void computeThermalStrain(Real & thermal_strain, Real & instantaneous_cte) override; | ||
|
||
protected: | ||
/// File name of the NEML XML database | ||
FileName _fname; | ||
/// Model name in NEML XML database | ||
std::string _mname; | ||
/// NEML model | ||
std::unique_ptr<neml::NEMLModel> _model; | ||
|
||
/// Thermal strain | ||
///@{ | ||
MaterialProperty<Real> & _tstrain; | ||
const MaterialProperty<Real> & _tstrain_old; | ||
///@} | ||
|
||
/// Old state of the coupled temperature | ||
const VariableValue & _temperature_old; | ||
}; | ||
|
||
#endif // NEMLTHERMALEXPANSIONEIGENSTRAIN_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a remote URL? This looks like you added a local repo as a submodule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing it this way gets it through either ssh or https, using whatever protocol you used to clone the repository. I think this is how we grab the libmesh submodule in moose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works because they’re both hosted on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, cool. I guess I learned something new: Submodule urls can be relative to the superproject’s default remote repository (the remote of the remote-tracking branch of the current branch!)
https://git-scm.com/docs/git-submodule