LCOV - code coverage report
Current view: top level - src/kernels - KKSACBulkBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 25 26 96.2 %
Date: 2025-09-04 07:55:36 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 "KKSACBulkBase.h"
      11             : 
      12             : InputParameters
      13         371 : KKSACBulkBase::validParams()
      14             : {
      15         371 :   InputParameters params = ACBulk<Real>::validParams();
      16         371 :   params.addClassDescription("KKS model kernel for the Bulk Allen-Cahn. This operates on the order "
      17             :                              "parameter 'eta' as the non-linear variable");
      18         742 :   params.addRequiredParam<MaterialPropertyName>(
      19             :       "fa_name",
      20             :       "Base name of the free energy function F (f_base in the corresponding KKSBaseMaterial)");
      21         742 :   params.addParam<MaterialPropertyName>(
      22             :       "h_name", "h", "Base name for the switching function h(eta)");
      23         371 :   return params;
      24           0 : }
      25             : 
      26         195 : KKSACBulkBase::KKSACBulkBase(const InputParameters & parameters)
      27             :   : ACBulk<Real>(parameters),
      28             :     // number of coupled variables (ca, args_a[])
      29         195 :     _eta_name(_var.name()),
      30         390 :     _prop_Fa(getMaterialProperty<Real>("fa_name")),
      31         195 :     _prop_dFa(getMaterialPropertyDerivative<Real>("fa_name", _eta_name)),
      32         195 :     _prop_dh(getMaterialPropertyDerivative<Real>("h_name", _eta_name)),
      33         390 :     _prop_d2h(getMaterialPropertyDerivative<Real>("h_name", _eta_name, _eta_name))
      34             : {
      35             :   // reserve space for derivatives
      36         195 :   _derivatives_Fa.resize(_n_args);
      37         195 :   _derivatives_Fb.resize(_n_args);
      38         195 :   _grad_args.resize(_n_args);
      39             : 
      40             :   // Iterate over all coupled variables
      41         621 :   for (unsigned int i = 0; i < _n_args; ++i)
      42             :   {
      43             :     // get the first derivatives of Fa and Fb material property
      44         426 :     _derivatives_Fa[i] = &getMaterialPropertyDerivative<Real>("fa_name", i);
      45         426 :     _derivatives_Fb[i] = &getMaterialPropertyDerivative<Real>("fb_name", i);
      46             : 
      47             :     // get the gradient
      48         426 :     _grad_args[i] = &(_coupled_standard_moose_vars[i]->gradSln());
      49             :   }
      50         195 : }
      51             : 
      52             : void
      53         132 : KKSACBulkBase::initialSetup()
      54             : {
      55         132 :   ACBulk<Real>::initialSetup();
      56         396 :   validateNonlinearCoupling<Real>("fa_name");
      57         264 :   validateNonlinearCoupling<Real>("fb_name");
      58         132 : }

Generated by: LCOV version 1.14