forked from idaholab/moose
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proof of concept action (idaholab#26053)
- Loading branch information
Showing
19 changed files
with
951 additions
and
10 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
78 changes: 78 additions & 0 deletions
78
framework/include/interfaces/InterpolatedStatefulMaterialPropertyInterface.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,78 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
// Standard includes | ||
#include <string> | ||
|
||
// MOOSE includes | ||
#include "MooseTypes.h" | ||
#include "Material.h" | ||
|
||
// Forward Declarations | ||
class FEProblemBase; | ||
class InputParameters; | ||
class PostprocessorName; | ||
class MooseObject; | ||
|
||
/** | ||
* Interface class for classes which interact with Postprocessors. | ||
* Provides the getPostprocessorValueXYZ() and related interfaces. | ||
*/ | ||
class InterpolatedStatefulMaterialPropertyInterface | ||
{ | ||
public: | ||
InterpolatedStatefulMaterialPropertyInterface(MooseObject * moose_object); | ||
|
||
template <typename U> | ||
const MaterialProperty<U> & getInterpolatedMaterialPropertyOld(const std::string & name); | ||
template <typename U> | ||
const MaterialProperty<U> & getInterpolatedMaterialPropertyOldByName(const std::string & name); | ||
|
||
protected: | ||
const std::string _pomps_prefix; | ||
|
||
MooseObject * _moose_object; | ||
MaterialPropertyInterface * _material_property_interface; | ||
Material * _material; | ||
}; | ||
|
||
InterpolatedStatefulMaterialPropertyInterface::InterpolatedStatefulMaterialPropertyInterface( | ||
MooseObject * moose_object) | ||
: _pomps_prefix("_pomps_"), | ||
_moose_object(moose_object), | ||
_material_property_interface(dynamic_cast<MaterialPropertyInterface *>(moose_object)), | ||
_material(dynamic_cast<Material *>(moose_object)) | ||
{ | ||
if (!_material_property_interface && !_material) | ||
mooseError("InterpolatedStatefulMaterialPropertyInterface can only be used from a class that " | ||
"either derives from Material or MaterialPropertyInterface"); | ||
} | ||
|
||
template <typename U> | ||
const MaterialProperty<U> & | ||
InterpolatedStatefulMaterialPropertyInterface::getInterpolatedMaterialPropertyOld( | ||
const std::string & name) | ||
{ | ||
return getInterpolatedMaterialPropertyOldByName<U>( | ||
_material->getParam<MaterialPropertyName>(name)); | ||
} | ||
|
||
template <typename U> | ||
const MaterialProperty<U> & | ||
InterpolatedStatefulMaterialPropertyInterface::getInterpolatedMaterialPropertyOldByName( | ||
const std::string & name) | ||
{ | ||
if (_material) | ||
return _material->getMaterialPropertyByName<U>(_pomps_prefix + "mat_" + name); | ||
else | ||
return _material_property_interface->getMaterialPropertyOldByName<U>(_pomps_prefix + "mat_" + | ||
name); | ||
} |
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
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
66 changes: 66 additions & 0 deletions
66
modules/tensor_mechanics/include/actions/ProjectedStatefulMaterialStorageAction.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,66 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "Action.h" | ||
#include "libmesh/fe_type.h" | ||
|
||
/** | ||
* Set up AuxKernels and AxVariables for projected material property storage (PoMPS). | ||
*/ | ||
class ProjectedStatefulMaterialStorageAction : public Action | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
ProjectedStatefulMaterialStorageAction(const InputParameters & parameters); | ||
|
||
virtual void act() override; | ||
|
||
protected: | ||
/** | ||
* Perform setup for a single scalar component of the material property prop_name, and gather the | ||
* names of teh AuxVariables used to represent each component in `vars`. | ||
*/ | ||
void processComponent(const std::string & prop_name, | ||
std::vector<unsigned int> idx, | ||
std::vector<VariableName> & vars, | ||
bool is_ad); | ||
|
||
/** | ||
* Add the material object to obtain the interpolated old state (for use with | ||
* InterpolatedStatefulMaterialPropertyInterface) | ||
*/ | ||
void addMaterial(const std::string & prop_type, | ||
const std::string & prop_name, | ||
std::vector<VariableName> & vars); | ||
|
||
enum class PropertyType | ||
{ | ||
REAL, | ||
REALVECTORVALUE, | ||
RANKTWOTENSOR, | ||
RANKFOURTENSOR | ||
}; | ||
typedef std::pair<PropertyType, bool> PropertyInfo; | ||
|
||
/** | ||
* Return the property type and whether to use AD or not. If no property with a supported type is | ||
* found, throw an error. | ||
*/ | ||
PropertyInfo checkProperty(const std::string & prop_name); | ||
|
||
const std::vector<MaterialPropertyName> & _prop_names; | ||
|
||
const MooseEnum _order; | ||
FEType _fe_type; | ||
const std::string _var_type; | ||
const std::string _pomps_prefix; | ||
}; |
37 changes: 37 additions & 0 deletions
37
modules/tensor_mechanics/include/auxkernels/ProjectedStatefulMaterialAux.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,37 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "AuxKernel.h" | ||
#include "IndexableProperty.h" | ||
|
||
template <bool is_ad> | ||
class ProjectedStatefulMaterialAuxTempl : public AuxKernel | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
ProjectedStatefulMaterialAuxTempl(const InputParameters & parameters); | ||
|
||
virtual void initialSetup() override; | ||
virtual void subdomainSetup() override; | ||
|
||
protected: | ||
virtual Real computeValue() override; | ||
|
||
const IndexableProperty<AuxKernel, is_ad> _prop; | ||
const SubdomainID & _current_subdomain_id; | ||
|
||
std::set<MaterialBase *> _all_materials; | ||
std::vector<MaterialBase *> _active_materials; | ||
}; | ||
|
||
typedef ProjectedStatefulMaterialAuxTempl<false> ProjectedStatefulMaterialAux; | ||
typedef ProjectedStatefulMaterialAuxTempl<true> ADProjectedStatefulMaterialAux; |
50 changes: 50 additions & 0 deletions
50
modules/tensor_mechanics/include/materials/InterpolatedStatefulMaterial.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,50 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "Material.h" | ||
#include "RankTwoTensorForward.h" | ||
#include "RankFourTensorForward.h" | ||
|
||
/** | ||
* PowerLawSoftening is a smeared crack softening model that | ||
* uses a power law equation to soften the tensile response. | ||
* It is for use with ComputeSmearedCrackingStress. | ||
*/ | ||
class InterpolatedStatefulMaterial : public Material | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
InterpolatedStatefulMaterial(const InputParameters & parameters); | ||
|
||
virtual void computeQpProperties() override; | ||
|
||
protected: | ||
/// Old state | ||
const std::vector<const VariableValue *> _old_state; | ||
|
||
/// emitted property name | ||
const MaterialPropertyName _prop_name; | ||
|
||
/// Property type | ||
enum class PropType | ||
{ | ||
REAL, | ||
REALVECTORVALUE, | ||
RANKTWOTENSOR, | ||
RANKFOURTENSOR | ||
} _prop_type; | ||
|
||
MaterialProperty<Real> * _prop_real; | ||
MaterialProperty<RealVectorValue> * _prop_realvectorvalue; | ||
MaterialProperty<RankTwoTensor> * _prop_ranktwotensor; | ||
MaterialProperty<RankFourTensor> * _prop_rankfourtensor; | ||
}; |
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
35 changes: 35 additions & 0 deletions
35
modules/tensor_mechanics/include/userobjects/ProjectedStatefulMaterialNodalPatchRecovery.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,35 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
// MOOSE includes | ||
#include "NodalPatchRecoveryMaterialProperty.h" | ||
|
||
/** | ||
* Nodal patch recovery for material property components for projected stateful properties | ||
*/ | ||
class ProjectedStatefulMaterialNodalPatchRecovery : public NodalPatchRecoveryMaterialProperty | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
ProjectedStatefulMaterialNodalPatchRecovery(const InputParameters & parameters); | ||
|
||
virtual void initialSetup() override; | ||
virtual void subdomainSetup() override; | ||
|
||
protected: | ||
virtual Real computeValue() override; | ||
|
||
const SubdomainID & _current_subdomain_id; | ||
|
||
std::set<MaterialBase *> _all_materials; | ||
std::vector<MaterialBase *> _active_materials; | ||
}; |
Oops, something went wrong.