LCOV - code coverage report
Current view: top level - src/kernels - AsymptoticExpansionHomogenizationKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 24 24 100.0 %
Date: 2025-09-04 07:57:23 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "AsymptoticExpansionHomogenizationKernel.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", AsymptoticExpansionHomogenizationKernel);
      13             : 
      14             : InputParameters
      15         168 : AsymptoticExpansionHomogenizationKernel::validParams()
      16             : {
      17         168 :   InputParameters params = Kernel::validParams();
      18         168 :   params.addClassDescription("Kernel for asymptotic expansion homogenization for elasticity");
      19         336 :   params.addRequiredRangeCheckedParam<unsigned int>("component",
      20             :                                                     "component >= 0 & component < 3",
      21             :                                                     "An integer corresponding to the direction "
      22             :                                                     "the variable this kernel acts in. (0 for x, "
      23             :                                                     "1 for y, 2 for z)");
      24         336 :   MooseEnum column("xx yy zz yz xz xy");
      25         336 :   params.addRequiredParam<MooseEnum>("column",
      26             :                                      column,
      27             :                                      "The column of the material matrix this kernel acts in. "
      28             :                                      "(xx, yy, zz, yz, xz, or xy)");
      29             : 
      30         336 :   params.addParam<std::string>("base_name",
      31             :                                "Optional parameter that allows the user to define "
      32             :                                "multiple mechanics material systems on the same "
      33             :                                "block, i.e. for multiple phases");
      34             : 
      35         168 :   return params;
      36         168 : }
      37             : 
      38          84 : AsymptoticExpansionHomogenizationKernel::AsymptoticExpansionHomogenizationKernel(
      39          84 :     const InputParameters & parameters)
      40             :   : Kernel(parameters),
      41             : 
      42         252 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      43         168 :     _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_base_name + "elasticity_tensor")),
      44         168 :     _component(getParam<unsigned int>("component")),
      45         168 :     _column(getParam<MooseEnum>("column")),
      46          84 :     _k_index({{0, 1, 2, 1, 0, 0}}),
      47          84 :     _l_index({{0, 1, 2, 2, 2, 1}}),
      48          84 :     _k(_k_index[_column]),
      49          84 :     _l(_l_index[_column])
      50             : {
      51          84 : }
      52             : 
      53             : Real
      54     3391488 : AsymptoticExpansionHomogenizationKernel::computeQpResidual()
      55             : {
      56             :   Real value = 0;
      57             : 
      58    13565952 :   for (unsigned j = 0; j < 3; j++)
      59    10174464 :     value += _grad_test[_i][_qp](j) * _elasticity_tensor[_qp](_component, j, _k, _l);
      60             : 
      61     3391488 :   return value;
      62             : }

Generated by: LCOV version 1.14