LCOV - code coverage report
Current view: top level - src/kernels - ACGrGrPoly.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 36 39 92.3 %
Date: 2026-05-29 20:38:39 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        7496 : ACGrGrPoly::validParams()
      16             : {
      17        7496 :   InputParameters params = ACGrGrBase::validParams();
      18        7496 :   params.addClassDescription("Grain-Boundary model poly-crystalline interface Allen-Cahn Kernel");
      19        7496 :   return params;
      20           0 : }
      21             : 
      22        4043 : ACGrGrPoly::ACGrGrPoly(const InputParameters & parameters)
      23        8086 :   : ACGrGrBase(parameters), _gamma(getMaterialProperty<Real>("gamma_asymm"))
      24             : {
      25        4043 : }
      26             : 
      27             : Real
      28  1511630312 : ACGrGrPoly::assignThisOp()
      29             : {
      30  1511630312 :   return _u[_qp];
      31             : }
      32             : 
      33             : std::vector<Real>
      34  1511630312 : ACGrGrPoly::assignOtherOps()
      35             : {
      36  1511630312 :   std::vector<Real> other_ops(_op_num);
      37  9037407792 :   for (unsigned int i = 0; i < _op_num; ++i)
      38  7525777480 :     other_ops[i] = (*_vals[i])[_qp];
      39             : 
      40  1511630312 :   return other_ops;
      41             : }
      42             : 
      43             : Real
      44  1093517512 : ACGrGrPoly::computeDFDOP(PFFunctionType type)
      45             : {
      46             :   // assign op and other_ops
      47  1093517512 :   Real op = assignThisOp();
      48  1093517512 :   std::vector<Real> other_ops(_op_num);
      49  2187035024 :   other_ops = assignOtherOps();
      50             : 
      51             :   // Sum all other order parameters
      52             :   Real SumOPj = 0.0;
      53  7325696176 :   for (unsigned int i = 0; i < _op_num; ++i)
      54  6232178664 :     SumOPj += other_ops[i] * other_ops[i];
      55             : 
      56             :   // Calculate either the residual or Jacobian of the grain growth free energy
      57  1093517512 :   switch (type)
      58             :   {
      59   801599048 :     case Residual:
      60             :     {
      61   801599048 :       return _mu[_qp] * (op * op * op - op + 2.0 * _gamma[_qp] * op * SumOPj);
      62             :     }
      63             : 
      64   291918464 :     case Jacobian:
      65             :     {
      66   291918464 :       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  1093517512 : }
      73             : 
      74             : Real
      75   505574400 : ACGrGrPoly::computeQpOffDiagJacobian(unsigned int jvar)
      76             : {
      77             :   // assign op and other_ops
      78   505574400 :   Real op = assignThisOp();
      79   505574400 :   std::vector<Real> other_ops(_op_num);
      80  1011148800 :   other_ops = assignOtherOps();
      81             : 
      82  1150545408 :   for (unsigned int i = 0; i < _op_num; ++i)
      83  1150545408 :     if (jvar == _vals_var[i])
      84             :     {
      85             :       // Derivative of Sumopj
      86   505574400 :       const Real dSumOPj = 2.0 * other_ops[i] * _phi[_j][_qp];
      87   505574400 :       const Real dDFDOP = _mu[_qp] * 2.0 * _gamma[_qp] * op * dSumOPj;
      88             : 
      89   505574400 :       return _L[_qp] * _test[_i][_qp] * dDFDOP;
      90             :     }
      91             : 
      92             :   return 0.0;
      93   505574400 : }

Generated by: LCOV version 1.14