-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28440 from dewenyushu/neml2_inverse_opt
Material inverse optimization using modular NEML2
- Loading branch information
Showing
51 changed files
with
1,539 additions
and
148 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
framework/doc/content/source/materials/GenericConstantSymmetricRankTwoTensor.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,20 @@ | ||
# GenericConstantSymmetricRankTwoTensor | ||
|
||
!syntax description /Materials/GenericConstantSymmetricRankTwoTensor | ||
|
||
## Overview | ||
|
||
`GenericConstantSymmetricRankTwoTensor` creates a `SymmetricRankTwoTensor` material property that use | ||
constant values to fill the tensor. The input of the constants follows the way how a `SymmetricRankTwoTensor` is filled. | ||
|
||
This object functions similarly to the [GenericConstantRankTwoTensor](GenericConstantRankTwoTensor.md), but it leverages the symmetry property of the tensor for more efficient computation. | ||
|
||
## Example Input File Syntax | ||
|
||
!listing test/tests/materials/generic_materials/generic_constant_rank_two_tensor.i block=Materials/tensor | ||
|
||
!syntax parameters /Materials/GenericConstantSymmetricRankTwoTensor | ||
|
||
!syntax inputs /Materials/GenericConstantSymmetricRankTwoTensor | ||
|
||
!syntax children /Materials/GenericConstantSymmetricRankTwoTensor |
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
35 changes: 35 additions & 0 deletions
35
framework/include/materials/GenericConstantSymmetricRankTwoTensor.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 | ||
|
||
#include "Material.h" | ||
#include "SymmetricRankTwoTensor.h" | ||
|
||
/** | ||
* Declares a constant material property of type RankTwoTensor. | ||
*/ | ||
template <bool is_ad> | ||
class GenericConstantSymmetricRankTwoTensorTempl : public Material | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
GenericConstantSymmetricRankTwoTensorTempl(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual void initQpStatefulProperties() override; | ||
virtual void computeQpProperties() override; | ||
|
||
SymmetricRankTwoTensor _tensor; | ||
GenericMaterialProperty<SymmetricRankTwoTensor, is_ad> & _prop; | ||
}; | ||
|
||
typedef GenericConstantSymmetricRankTwoTensorTempl<false> GenericConstantSymmetricRankTwoTensor; | ||
typedef GenericConstantSymmetricRankTwoTensorTempl<true> ADGenericConstantSymmetricRankTwoTensor; |
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
55 changes: 55 additions & 0 deletions
55
framework/src/materials/GenericConstantSymmetricRankTwoTensor.C
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,55 @@ | ||
//* 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 | ||
|
||
#include "GenericConstantSymmetricRankTwoTensor.h" | ||
|
||
registerMooseObject("MooseApp", GenericConstantSymmetricRankTwoTensor); | ||
registerMooseObject("MooseApp", ADGenericConstantSymmetricRankTwoTensor); | ||
|
||
template <bool is_ad> | ||
InputParameters | ||
GenericConstantSymmetricRankTwoTensorTempl<is_ad>::validParams() | ||
{ | ||
InputParameters params = Material::validParams(); | ||
params.addClassDescription( | ||
"Object for declaring a constant symmetric rank two tensor as a material property."); | ||
params.addRequiredParam<std::vector<Real>>( | ||
"tensor_values", "Vector of values defining the constant rank two tensor"); | ||
params.addRequiredParam<MaterialPropertyName>( | ||
"tensor_name", "Name of the tensor material property to be created"); | ||
params.set<MooseEnum>("constant_on") = "SUBDOMAIN"; | ||
return params; | ||
} | ||
|
||
template <bool is_ad> | ||
GenericConstantSymmetricRankTwoTensorTempl<is_ad>::GenericConstantSymmetricRankTwoTensorTempl( | ||
const InputParameters & parameters) | ||
: Material(parameters), | ||
_prop(declareGenericProperty<SymmetricRankTwoTensor, is_ad>( | ||
getParam<MaterialPropertyName>("tensor_name"))) | ||
{ | ||
_tensor.fillFromInputVector(getParam<std::vector<Real>>("tensor_values")); | ||
} | ||
|
||
template <bool is_ad> | ||
void | ||
GenericConstantSymmetricRankTwoTensorTempl<is_ad>::initQpStatefulProperties() | ||
{ | ||
GenericConstantSymmetricRankTwoTensorTempl<is_ad>::computeQpProperties(); | ||
} | ||
|
||
template <bool is_ad> | ||
void | ||
GenericConstantSymmetricRankTwoTensorTempl<is_ad>::computeQpProperties() | ||
{ | ||
_prop[_qp] = _tensor; | ||
} | ||
|
||
template class GenericConstantSymmetricRankTwoTensorTempl<false>; | ||
template class GenericConstantSymmetricRankTwoTensorTempl<true>; |
4 changes: 0 additions & 4 deletions
4
...ned/test/tests/optimization/invOpt_elasticity/gold/main_out_OptimizationReporter_0001.csv
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...timization/invOpt_elasticity/elasticity.i → ...on/invOpt_elasticity_modular/elasticity.i
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
[Models] | ||
[adjoint_elasticity_model] | ||
type = LinearIsotropicElasticity | ||
youngs_modulus = 7.5 | ||
poisson_ratio = 0.25 | ||
youngs_modulus = 5.0 | ||
poisson_ratio = 0.3 | ||
strain = 'forces/E' | ||
[] | ||
[forward_elasticity_model] | ||
type = LinearIsotropicElasticity | ||
youngs_modulus = 7.5 | ||
poisson_ratio = 0.25 | ||
youngs_modulus = 5.0 | ||
poisson_ratio = 0.3 | ||
strain = 'forces/E' | ||
[] | ||
[] |
Oops, something went wrong.