Skip to content

Commit

Permalink
Merge pull request #73 from Argonne-National-Laboratory/moose_fixes
Browse files Browse the repository at this point in the history
Moose fixes
  • Loading branch information
reverendbedford authored Jan 19, 2024
2 parents afd2af7 + d6b1ec9 commit 2bf2339
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 119 deletions.
95 changes: 43 additions & 52 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,46 @@
name: tests
name: run-deer-tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# We don't update deer all that often, but it is still of interest to know ASAP if a MOOSE update has broken deer
schedule:
- cron: '0 0 * * *'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
on: [push, pull_request]

jobs:
tests-linux:
runs-on: ubuntu-latest
strategy:
matrix:
btype: [opt, dbg]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup build system
run: |
sudo apt update
sudo apt install build-essential cmake libblas-dev liblapack-dev mpich libmpich-dev python3-dev
- name: Compile neml
run: |
cd neml
if [[ "${{ matrix.btype }}" == "opt" ]]; then type="Release"; elif [[ "${{ matrix.btype }}" == "dbg" ]]; then type="Debug"; fi
cmake -DCMAKE_BUILD_TYPE=$type .
make -j 2
- name: Compile extra MOOSE packages
env:
MOOSE_DIR: ${{github.workspace}}/moose
run: |
git clone https://github.com/idaholab/moose.git $MOOSE_DIR
cd $MOOSE_DIR/scripts
export MOOSE_JOBS=2
./update_and_rebuild_petsc.sh
./update_and_rebuild_libmesh.sh
- name: Compile code
env:
MOOSE_DIR: ${{github.workspace}}/moose
run: |
export MOOSE_DIR=$PWD/moose
make -j 2 METHOD=${{ matrix.btype }}
- name: Test code
env:
MOOSE_DIR: ${{github.workspace}}/moose
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:${{github.workspace}}/neml/lib
run: if [[ "${{ matrix.btype }}" == "opt" ]]; then ./run_tests --opt; elif [[ "${{ matrix.btype }}" == "dbg" ]]; then ./run_tests --dbg; fi
tests-linux:
name: Run tests on linux
runs-on: ubuntu-latest
strategy:
matrix:
btype: [opt, dbg]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup build system
run: |
sudo apt update
sudo apt install build-essential cmake libblas-dev liblapack-dev mpich libmpich-dev python3-dev
- name: Compile neml
run: |
cd neml
if [[ "${{ matrix.btype }}" == "opt" ]]; then type="Release"; elif [[ "${{ matrix.btype }}" == "dbg" ]]; then type="Debug"; fi
cmake -DCMAKE_BUILD_TYPE=$type -DUSE_OPENMP=OFF .
make -j 2
- name: Compile extra MOOSE packages
env:
MOOSE_DIR: ${{github.workspace}}/moose
run: |
git clone https://github.com/idaholab/moose.git $MOOSE_DIR
cd $MOOSE_DIR/scripts
export MOOSE_JOBS=2
./update_and_rebuild_petsc.sh
METHOD=${{matrix.btype}} ./update_and_rebuild_libmesh.sh
./update_and_rebuild_wasp.sh
- name: Compile code
env:
MOOSE_DIR: ${{github.workspace}}/moose
run: |
export MOOSE_DIR=$PWD/moose
make -j 2 METHOD=${{ matrix.btype }}
- name: Test code
env:
MOOSE_DIR: ${{github.workspace}}/moose
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:${{github.workspace}}/neml/lib
run: if [[ "${{ matrix.btype }}" == "opt" ]]; then ./run_tests --opt; elif [[ "${{ matrix.btype }}" == "dbg" ]]; then ./run_tests --dbg; fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ build
*.csv
*.previous_test_results.json
*~
*.yaml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ALL_MODULES := no
CHEMICAL_REACTIONS := no
CONTACT := yes
FLUID_PROPERTIES := no
HEAT_CONDUCTION := yes
HEAT_TRANSFER := yes
MISC := no
NAVIER_STOKES := no
PHASE_FIELD := no
Expand Down
3 changes: 1 addition & 2 deletions include/postprocessors/CZMAreaRatioPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ class CZMAreaRatioPostprocessor : public CZMAreaPostprocessor

CZMAreaRatioPostprocessor(const InputParameters & parameters);

protected:
virtual Real getValue() override;
virtual PostprocessorValue getValue() const override;
};
3 changes: 2 additions & 1 deletion include/postprocessors/CZMStrainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class CZMStrainComponent : public CZMAreaRatioPostprocessor

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual void finalize() override;
virtual PostprocessorValue getValue() const override;
virtual void threadJoin(const UserObject & y) override;

protected:
Expand Down
5 changes: 3 additions & 2 deletions include/postprocessors/ElementExtremeVectorMaterialProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class ElementExtremeVectorMaterialProperty : public ElementPostprocessor

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual PostprocessorValue getValue() const;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;

protected:
virtual void computeQpValue();
Expand All @@ -27,6 +28,6 @@ class ElementExtremeVectorMaterialProperty : public ElementPostprocessor
unsigned int _index;

ExtremeType _type;
Real _value;
PostprocessorValue _value;
unsigned int _qp;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MaterialTensorIntegralInterfaceScaledTempl : public InterfaceIntegralPostp
static InputParameters validParams();

MaterialTensorIntegralInterfaceScaledTempl(const InputParameters & parameters);
virtual Real getValue() override;
virtual PostprocessorValue getValue() const;

protected:
virtual Real computeQpIntegral();
Expand Down
2 changes: 1 addition & 1 deletion include/postprocessors/MaterialTensorIntegralScaled.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MaterialTensorIntegralScaledTempl : public MaterialTensorIntegralTempl<is_
static InputParameters validParams();

MaterialTensorIntegralScaledTempl(const InputParameters & parameters);
virtual Real getValue() override;
virtual PostprocessorValue getValue() const override;

protected:
const PostprocessorValue & _scaling_factor_PP;
Expand Down
2 changes: 1 addition & 1 deletion include/postprocessors/MultiplyPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MultiplyPostprocessor : public GeneralPostprocessor

virtual void initialize() override;
virtual void execute() override;
virtual PostprocessorValue getValue() override;
virtual PostprocessorValue getValue() const;

protected:
const PostprocessorValue & _value1;
Expand Down
4 changes: 2 additions & 2 deletions include/postprocessors/RankTwoTensorInvariantPostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RankTwoTensorInvariantPostprocessor : public GeneralPostprocessor
/// we don't need to override finalize because we are working with
/// postprocessors values. Therefore the values this PP will get, have already
/// be summed/averaged among processes/threads.
virtual Real getValue() override;
virtual PostprocessorValue getValue() const;

protected:
const PostprocessorName _rank_two_tensor_base_name;
Expand All @@ -44,7 +44,7 @@ class RankTwoTensorInvariantPostprocessor : public GeneralPostprocessor
std::vector<std::vector<const PostprocessorValue *>> _pps_values;

/// the calculated invariant value to be returned
Real _invariant;
PostprocessorValue _invariant;

/// the map between postprocessor names and tensorial components
const std::map<std::pair<int, int>, std::string> tensor_map = {{std::make_pair(0, 0), "xx"},
Expand Down
5 changes: 3 additions & 2 deletions include/postprocessors/SideExtremePostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class SideExtremePostprocessor : public SidePostprocessor

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual PostprocessorValue getValue() const;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;

protected:
unsigned int _qp;
Real _curr_value;
PostprocessorValue _curr_value;
const VariableValue & _u;
const ExtremeType _type;
};
4 changes: 2 additions & 2 deletions include/postprocessors/TimeDerivativePostprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class TimeDerivativePostprocessor : public GeneralPostprocessor

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual PostprocessorValue getValue() const;

protected:
/// cumulative sum of the post-processor value
Real _rate;
PostprocessorValue _rate;

/// current post-processor value
const PostprocessorValue & _pps_value;
Expand Down
2 changes: 1 addition & 1 deletion neml
Submodule neml updated 58 files
+31 −0 .clang-format
+2 −2 .github/workflows/package.yml
+17 −8 .github/workflows/test.yml
+2 −2 .github/workflows/test_packages.yml
+1 −0 .gitignore
+7 −1 CMakeLists.txt
+1 −0 doc/requirements.txt
+8 −6 doc/sphinx/conf.py
+1 −0 doc/sphinx/cp/polycrystal/taylor.rst
+171 −0 examples/cp/generalizedhucocks/generate_model.py
+102 −0 examples/cp/generalizedhucocks/just-aging.py
+206 −0 examples/cp/generalizedhucocks/model.xml
+153 −109 examples/cp/hucocks/generate_model.py
+176 −129 examples/cp/hucocks/model.xml
+3 −0 include/cp/batch.h
+246 −0 include/cp/generalizedhucocks.h
+3 −1 include/cp/polycrystal.h
+1 −0 include/damage.h
+7 −4 include/history.h
+4 −1 include/math/rotations.h
+1 −0 include/neml_interface.h
+2 −0 include/nemlerror.h
+6 −3 include/parse.h
+3 −0 neml/__init__.py
+68 −1 neml/cp/polefigures.py
+17 −7 neml/drivers.py
+4 −1 profiling/models.txt
+495 −0 profiling/reference.xml
+1 −1 pybind11
+1 −1 setup.py
+1 −0 src/CMakeLists.txt
+5 −3 src/cp/CMakeLists.txt
+28 −6 src/cp/batch.cxx
+838 −0 src/cp/generalizedhucocks.cxx
+116 −0 src/cp/generalizedhucocks_wrap.cxx
+450 −376 src/cp/hucocks.cxx
+39 −19 src/cp/polycrystal.cxx
+6 −1 src/cp/polycrystal_wrap.cxx
+19 −16 src/damage.cxx
+18 −20 src/general_flow.cxx
+18 −18 src/hardening.cxx
+13 −2 src/history.cxx
+28 −0 src/math/rotations.cxx
+2 −1 src/math/rotations_wrap.cxx
+2 −2 src/models.cxx
+0 −1 src/nemlerror.cxx
+24 −0 src/nemlerror_wrap.cxx
+10 −14 src/parse.cxx
+103 −101 src/visco_flow.cxx
+7 −2 src/walker.cxx
+449 −0 test/test_generalizedhucocks.py
+2 −2 test/test_nemlmath.py
+1 −1 test/test_parse.py
+1 −1 test/test_regression/regressiontools.py
+102 −0 test/test_regression/test_taylor/data.csv
+98 −0 test/test_regression/test_taylor/model.xml
+33 −0 util/neml2_verification/README.md
+101 −0 util/neml2_verification/run_neml2_test.py
7 changes: 4 additions & 3 deletions src/actions/CZMStrainAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ CZMStrainAction::validParams()

CZMStrainAction::CZMStrainAction(const InputParameters & params)
: Action(params),
_block(getParam<std::vector<SubdomainName>>("block")),
_boundary(getParam<std::vector<BoundaryName>>("boundary")),

_block(params.isParamValid("block") ? getParam<std::vector<SubdomainName>>("block")
: std::vector<SubdomainName>()),
_boundary(params.isParamValid("boundary") ? getParam<std::vector<BoundaryName>>("boundary")
: std::vector<BoundaryName>()),
_scaled(!getParam<PostprocessorName>("bulk_volume_PP").empty()),
_bulk_volume_PP(_scaled ? getParam<PostprocessorName>("bulk_volume_PP") : "czm_strain_V0"),
_area_ratio_PP("czm_area_ratio"),
Expand Down
9 changes: 5 additions & 4 deletions src/actions/RankTwoTensorIntegralAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ RankTwoTensorIntegralAction::RankTwoTensorIntegralAction(const InputParameters &
: Action(params),
_mp_names(getParam<std::vector<MaterialPropertyName>>("rank_two_tensor")),
_use_displaced_mesh(getParam<bool>("use_displaced_mesh")),
_block(getParam<std::vector<SubdomainName>>("block")),
_boundary(getParam<std::vector<BoundaryName>>("boundary")),

_block(params.isParamValid("block") ? getParam<std::vector<SubdomainName>>("block")
: std::vector<SubdomainName>()),
_boundary(params.isParamValid("boundary") ? getParam<std::vector<BoundaryName>>("boundary")
: std::vector<BoundaryName>()),
_scaled(isParamValid("scaling_factor_PP")),
_scaling_factor_PP(_scaled ? getParam<PostprocessorName>("scaling_factor_PP") : ""),
_PP_type(_boundary.size() == 0
_PP_type(!params.isParamValid("boundary")
? (_scaled ? "MaterialTensorIntegralScaled" : "MaterialTensorIntegral")
: "MaterialTensorIntegralInterfaceScaled"),
_base_out_name(getParam<std::vector<PostprocessorName>>("base_out_names"))
Expand Down
2 changes: 1 addition & 1 deletion src/auxkernels/EffectiveStressAux.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ EffectiveStressAux::validParams()
params.addClassDescription("Compute an effective stress");
params.addParam<MooseEnum>(
"effective_stress_type", EffectiveStressTools::scalarOptions(), "Type of scalar output");
params.addParam<std::vector<Real>>("params_vector", "Vector of effective stress parameters");
params.addParam<std::vector<Real>>("params_vector", {}, "Vector of effective stress parameters");
return params;
}

Expand Down
5 changes: 3 additions & 2 deletions src/auxkernels/IPFColoring.C
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ std::vector<Point>
project_ipf(std::vector<Real> q, Point sd, std::string crystal_sym, std::string sample_sym)
{
// Setup sample direction
neml::Vector d({sd(0), sd(1), sd(2)});
std::vector<Real> temp = {sd(0), sd(1), sd(2)};
neml::Vector d(&temp[0]);
d.normalize();

// Setup orientation
neml::Orientation qa(q);
neml::Orientation qa(&q[0]);
neml::Orientation qo = qa.inverse(); // The following assumes a passive rotation

// Get crystal and sample symmetry operations
Expand Down
2 changes: 1 addition & 1 deletion src/materials/EffectiveStressInterfaceMaterial.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EffectiveStressInterfaceMaterial::validParams()
params.addParam<MooseEnum>("interface_value_type",
InterfaceValueTools::InterfaceAverageOptions(),
"Type of scalar output");
params.addParam<std::vector<Real>>("params_vector", "Vector of effective stress parameters");
params.addParam<std::vector<Real>>("params_vector", {}, "Vector of effective stress parameters");
params.addRequiredParam<MaterialPropertyName>("effective_stress_mp_name",
"the name of the calcualte effective stress");
params.addParam<bool>("stateful", false, "If true make the material property stateful");
Expand Down
2 changes: 1 addition & 1 deletion src/materials/EffectiveStressMaterial.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ EffectiveStressMaterial::validParams()
params.addRequiredParam<MooseEnum>("effective_stress_type",
EffectiveStressTools::scalarOptions(),
"Type of effective stress to be computed");
params.addParam<std::vector<Real>>("params_vector", "Vector of effective stress parameters");
params.addParam<std::vector<Real>>("params_vector", {}, "Vector of effective stress parameters");
params.addRequiredParam<MaterialPropertyName>("effective_stress_mp_name",
"The name of the new material_property");
params.addParam<bool>("stateful", false, "If true make the material property stateful");
Expand Down
7 changes: 3 additions & 4 deletions src/postprocessors/CZMAreaRatioPosptocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ CZMAreaRatioPostprocessor::CZMAreaRatioPostprocessor(const InputParameters & par
{
}

Real
CZMAreaRatioPostprocessor::getValue()
PostprocessorValue
CZMAreaRatioPostprocessor::getValue() const
{
_integral_value = CZMAreaPostprocessor::getValue() / _interface_primary_area;
return _integral_value;
return CZMAreaPostprocessor::getValue() / _interface_primary_area;
}
17 changes: 9 additions & 8 deletions src/postprocessors/CZMStrainComponent.C
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ CZMStrainComponent::initialize()
_normalized_strain_component = 0;
}

Real
CZMStrainComponent::getValue()
PostprocessorValue
CZMStrainComponent::getValue() const
{
_integral_value = CZMAreaRatioPostprocessor::getValue();
gatherSum(_normalized_strain_component);

_normalized_strain_component =
_normalized_strain_component / (_initial_bulk_volume_pp * _integral_value);
return _normalized_strain_component /
(_initial_bulk_volume_pp * CZMAreaRatioPostprocessor::getValue());
}

return _normalized_strain_component;
void
CZMStrainComponent::finalize()
{
gatherSum(_normalized_strain_component);
}

void
Expand Down
12 changes: 8 additions & 4 deletions src/postprocessors/ElementExtremeVectorMaterialProperty.C
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ ElementExtremeVectorMaterialProperty::computeQpValue()
}
}

Real
ElementExtremeVectorMaterialProperty::getValue()
PostprocessorValue
ElementExtremeVectorMaterialProperty::getValue() const
{
return _value;
}

void
ElementExtremeVectorMaterialProperty::finalize()
{
switch (_type)
{
Expand All @@ -78,8 +84,6 @@ ElementExtremeVectorMaterialProperty::getValue()
gatherMin(_value);
break;
}

return _value;
}

void
Expand Down
10 changes: 4 additions & 6 deletions src/postprocessors/MaterialTensorIntegralInterfaceScaled.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ MaterialTensorIntegralInterfaceScaledTempl<is_ad>::computeQpIntegral()
}

template <bool is_ad>
Real
MaterialTensorIntegralInterfaceScaledTempl<is_ad>::getValue()
PostprocessorValue
MaterialTensorIntegralInterfaceScaledTempl<is_ad>::getValue() const
{
_integral_value = InterfaceIntegralPostprocessor::getValue();
if (_scaling_factor_PP)
_integral_value /= *_scaling_factor_PP;

return _integral_value;
return InterfaceIntegralPostprocessor::getValue() / *_scaling_factor_PP;
return InterfaceIntegralPostprocessor::getValue();
}

template class MaterialTensorIntegralInterfaceScaledTempl<false>;
Expand Down
Loading

0 comments on commit 2bf2339

Please sign in to comment.