Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "ComputeHomogenizedLagrangianStrain.h" 11 : 12 : registerMooseObject("SolidMechanicsApp", ComputeHomogenizedLagrangianStrain); 13 : 14 : InputParameters 15 664 : ComputeHomogenizedLagrangianStrain::validParams() 16 : { 17 664 : InputParameters params = HomogenizationInterface<Material>::validParams(); 18 664 : params.addClassDescription("Calculate eigenstrain-like contribution from the homogenization " 19 : "strain used to satisfy the homogenization constraints."); 20 1328 : params.addParam<std::string>("base_name", "Material property base name"); 21 1328 : params.addParam<MaterialPropertyName>("homogenization_gradient_name", 22 : "homogenization_gradient", 23 : "Name of the constant gradient field"); 24 1328 : params.addRequiredCoupledVar("macro_gradient", 25 : "Scalar field defining the " 26 : "macro gradient"); 27 664 : return params; 28 0 : } 29 : 30 498 : ComputeHomogenizedLagrangianStrain::ComputeHomogenizedLagrangianStrain( 31 498 : const InputParameters & parameters) 32 : : HomogenizationInterface<Material>(parameters), 33 498 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 34 498 : _macro_gradient(coupledScalarValue("macro_gradient")), 35 498 : _homogenization_contribution( 36 996 : declareProperty<RankTwoTensor>(_base_name + "homogenization_gradient_name")) 37 : { 38 498 : } 39 : 40 : void 41 25081984 : ComputeHomogenizedLagrangianStrain::computeQpProperties() 42 : { 43 25081984 : _homogenization_contribution[_qp].zero(); 44 : unsigned int count = 0; 45 206644800 : for (const auto & [indices, constraint] : cmap()) 46 : { 47 181562816 : const auto [i, j] = indices; 48 181562816 : _homogenization_contribution[_qp](i, j) = _macro_gradient[count++]; 49 : } 50 25081984 : }