LCOV - code coverage report
Current view: top level - src/kernels - ACGrGrPoly.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 36 39 92.3 %
Date: 2025-09-04 07:55:36 Functions: 6 6 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 "ACGrGrPoly.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", ACGrGrPoly);
      13             : 
      14             : InputParameters
      15       10516 : ACGrGrPoly::validParams()
      16             : {
      17       10516 :   InputParameters params = ACGrGrBase::validParams();
      18       10516 :   params.addClassDescription("Grain-Boundary model poly-crystalline interface Allen-Cahn Kernel");
      19       10516 :   return params;
      20           0 : }
      21             : 
      22        5551 : ACGrGrPoly::ACGrGrPoly(const InputParameters & parameters)
      23       11102 :   : ACGrGrBase(parameters), _gamma(getMaterialProperty<Real>("gamma_asymm"))
      24             : {
      25        5551 : }
      26             : 
      27             : Real
      28  1796275112 : ACGrGrPoly::assignThisOp()
      29             : {
      30  1796275112 :   return _u[_qp];
      31             : }
      32             : 
      33             : std::vector<Real>
      34  1796275112 : ACGrGrPoly::assignOtherOps()
      35             : {
      36  1796275112 :   std::vector<Real> other_ops(_op_num);
      37 10797420768 :   for (unsigned int i = 0; i < _op_num; ++i)
      38  9001145656 :     other_ops[i] = (*_vals[i])[_qp];
      39             : 
      40  1796275112 :   return other_ops;
      41             : }
      42             : 
      43             : Real
      44  1305261032 : ACGrGrPoly::computeDFDOP(PFFunctionType type)
      45             : {
      46             :   // assign op and other_ops
      47  1305261032 :   Real op = assignThisOp();
      48  1305261032 :   std::vector<Real> other_ops(_op_num);
      49  2610522064 :   other_ops = assignOtherOps();
      50             : 
      51             :   // Sum all other order parameters
      52             :   Real SumOPj = 0.0;
      53  8800455264 :   for (unsigned int i = 0; i < _op_num; ++i)
      54  7495194232 :     SumOPj += other_ops[i] * other_ops[i];
      55             : 
      56             :   // Calculate either the residual or Jacobian of the grain growth free energy
      57  1305261032 :   switch (type)
      58             :   {
      59   957006120 :     case Residual:
      60             :     {
      61   957006120 :       return _mu[_qp] * (op * op * op - op + 2.0 * _gamma[_qp] * op * SumOPj);
      62             :     }
      63             : 
      64   348254912 :     case Jacobian:
      65             :     {
      66   348254912 :       return _mu[_qp] * (_phi[_j][_qp] * (3.0 * op * op - 1.0 + 2.0 * _gamma[_qp] * SumOPj));
      67             :     }
      68             : 
      69           0 :     default:
      70           0 :       mooseError("Invalid type passed in");
      71             :   }
      72  1305261032 : }
      73             : 
      74             : Real
      75   594817280 : ACGrGrPoly::computeQpOffDiagJacobian(unsigned int jvar)
      76             : {
      77             :   // assign op and other_ops
      78   594817280 :   Real op = assignThisOp();
      79   594817280 :   std::vector<Real> other_ops(_op_num);
      80  1189634560 :   other_ops = assignOtherOps();
      81             : 
      82  1348861952 :   for (unsigned int i = 0; i < _op_num; ++i)
      83  1348861952 :     if (jvar == _vals_var[i])
      84             :     {
      85             :       // Derivative of Sumopj
      86   594817280 :       const Real dSumOPj = 2.0 * other_ops[i] * _phi[_j][_qp];
      87   594817280 :       const Real dDFDOP = _mu[_qp] * 2.0 * _gamma[_qp] * op * dSumOPj;
      88             : 
      89   594817280 :       return _L[_qp] * _test[_i][_qp] * dDFDOP;
      90             :     }
      91             : 
      92             :   return 0.0;
      93   594817280 : }

Generated by: LCOV version 1.14