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

Generated by: LCOV version 1.14