LCOV - code coverage report
Current view: top level - src/kernels - AsymptoticExpansionHomogenizationKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 24 24 100.0 %
Date: 2025-07-25 05:00:39 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         144 : AsymptoticExpansionHomogenizationKernel::validParams()
      16             : {
      17         144 :   InputParameters params = Kernel::validParams();
      18         144 :   params.addClassDescription("Kernel for asymptotic expansion homogenization for elasticity");
      19         288 :   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         288 :   MooseEnum column("xx yy zz yz xz xy");
      25         288 :   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         288 :   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         144 :   return params;
      36         144 : }
      37             : 
      38          72 : AsymptoticExpansionHomogenizationKernel::AsymptoticExpansionHomogenizationKernel(
      39          72 :     const InputParameters & parameters)
      40             :   : Kernel(parameters),
      41             : 
      42         216 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      43         144 :     _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_base_name + "elasticity_tensor")),
      44         144 :     _component(getParam<unsigned int>("component")),
      45         144 :     _column(getParam<MooseEnum>("column")),
      46          72 :     _k_index({{0, 1, 2, 1, 0, 0}}),
      47          72 :     _l_index({{0, 1, 2, 2, 2, 1}}),
      48          72 :     _k(_k_index[_column]),
      49          72 :     _l(_l_index[_column])
      50             : {
      51          72 : }
      52             : 
      53             : Real
      54     2211840 : AsymptoticExpansionHomogenizationKernel::computeQpResidual()
      55             : {
      56             :   Real value = 0;
      57             : 
      58     8847360 :   for (unsigned j = 0; j < 3; j++)
      59     6635520 :     value += _grad_test[_i][_qp](j) * _elasticity_tensor[_qp](_component, j, _k, _l);
      60             : 
      61     2211840 :   return value;
      62             : }

Generated by: LCOV version 1.14