LCOV - code coverage report
Current view: top level - src/kernels - ACGrGrPolyLinearizedInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 36 40 90.0 %
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 "ACGrGrPolyLinearizedInterface.h"
      11             : 
      12             : #include "libmesh/utility.h"
      13             : 
      14             : registerMooseObject("PhaseFieldApp", ACGrGrPolyLinearizedInterface);
      15             : 
      16             : InputParameters
      17         391 : ACGrGrPolyLinearizedInterface::validParams()
      18             : {
      19         391 :   InputParameters params = ACGrGrPoly::validParams();
      20         391 :   params.addClassDescription(
      21             :       "Grain growth model Allen-Cahn Kernel with linearized interface variable transformation");
      22         782 :   params.addRequiredParam<MaterialPropertyName>(
      23             :       "this_op", "The material property defining the order parameter for this variable");
      24         782 :   params.addRequiredParam<std::vector<MaterialPropertyName>>(
      25             :       "other_ops", "List of properties defining the order parameters for the variables in v");
      26         391 :   return params;
      27           0 : }
      28             : 
      29         204 : ACGrGrPolyLinearizedInterface::ACGrGrPolyLinearizedInterface(const InputParameters & parameters)
      30             :   : ACGrGrPoly(parameters),
      31         408 :     _other_op_names(getParam<std::vector<MaterialPropertyName>>("other_ops")),
      32         204 :     _num_ops(_other_op_names.size()),
      33         408 :     _gamma(getMaterialProperty<Real>("gamma_asymm")),
      34         408 :     _op(getMaterialProperty<Real>("this_op")),
      35         204 :     _dopdphi(getMaterialPropertyDerivative<Real>("this_op", _var.name())),
      36         204 :     _opj(_num_ops),
      37         408 :     _dopjdarg(_num_ops)
      38             : {
      39         204 :   if (_num_ops != _op_num)
      40           0 :     mooseError(
      41             :         "In ACGrGrPolyLinearizedInterface, number of coupled variables in v must match number of "
      42             :         "coupled materials in other_ops");
      43             : 
      44             :   // Iterate over all coupled order parameters
      45        1164 :   for (unsigned int i = 0; i < _op_num; ++i)
      46             :   {
      47         960 :     _opj[i] = &getMaterialPropertyByName<Real>(_other_op_names[i]);
      48         960 :     _dopjdarg[i] = &getMaterialPropertyDerivative<Real>(_other_op_names[i], i);
      49             :   }
      50         204 : }
      51             : 
      52             : Real
      53   103803200 : ACGrGrPolyLinearizedInterface::assignThisOp()
      54             : {
      55   103803200 :   return _op[_qp];
      56             : }
      57             : 
      58             : std::vector<Real>
      59   103803200 : ACGrGrPolyLinearizedInterface::assignOtherOps()
      60             : {
      61   103803200 :   std::vector<Real> other_ops(_op_num);
      62   700758400 :   for (unsigned int i = 0; i < _op_num; ++i)
      63   596955200 :     other_ops[i] = (*_opj[i])[_qp];
      64             : 
      65   103803200 :   return other_ops;
      66             : }
      67             : 
      68             : Real
      69    74132800 : ACGrGrPolyLinearizedInterface::computeDFDOP(PFFunctionType type)
      70             : {
      71    74132800 :   switch (type)
      72             :   {
      73    52779200 :     case Residual:
      74    52779200 :       return ACGrGrPoly::computeDFDOP(type);
      75             : 
      76    21353600 :     case Jacobian:
      77    21353600 :       return ACGrGrPoly::computeDFDOP(type) * _dopdphi[_qp];
      78             : 
      79           0 :     default:
      80           0 :       mooseError("Invalid type passed in");
      81             :   }
      82             : }
      83             : 
      84             : Real
      85    29670400 : ACGrGrPolyLinearizedInterface::computeQpOffDiagJacobian(unsigned int jvar)
      86             : {
      87             : 
      88    67302400 :   for (unsigned int i = 0; i < _op_num; ++i)
      89    67302400 :     if (jvar == _vals_var[i])
      90    29670400 :       return ACGrGrPoly::computeQpOffDiagJacobian(jvar) * (*_dopjdarg[i])[_qp];
      91             : 
      92             :   return 0.0;
      93             : }

Generated by: LCOV version 1.14