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 464 : ComputeHomogenizedLagrangianStrain::validParams() 16 : { 17 464 : InputParameters params = HomogenizationInterface<Material>::validParams(); 18 464 : params.addClassDescription("Calculate eigenstrain-like contribution from the homogenization " 19 : "strain used to satisfy the homogenization constraints."); 20 928 : params.addParam<std::string>("base_name", "Material property base name"); 21 928 : params.addParam<MaterialPropertyName>("homogenization_gradient_name", 22 : "homogenization_gradient", 23 : "Name of the constant gradient field"); 24 928 : params.addRequiredCoupledVar("macro_gradient", 25 : "Scalar field defining the " 26 : "macro gradient"); 27 464 : return params; 28 0 : } 29 : 30 348 : ComputeHomogenizedLagrangianStrain::ComputeHomogenizedLagrangianStrain( 31 348 : const InputParameters & parameters) 32 : : HomogenizationInterface<Material>(parameters), 33 348 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 34 348 : _macro_gradient(coupledScalarValue("macro_gradient")), 35 348 : _homogenization_contribution( 36 696 : declareProperty<RankTwoTensor>(_base_name + "homogenization_gradient_name")) 37 : { 38 348 : } 39 : 40 : void 41 12931124 : ComputeHomogenizedLagrangianStrain::computeQpProperties() 42 : { 43 12931124 : _homogenization_contribution[_qp].zero(); 44 : unsigned int count = 0; 45 106471720 : for (const auto & [indices, constraint] : cmap()) 46 : { 47 93540596 : const auto [i, j] = indices; 48 93540596 : _homogenization_contribution[_qp](i, j) = _macro_gradient[count++]; 49 : } 50 12931124 : }