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