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 "CHSplitChemicalPotential.h" 11 : 12 : registerMooseObject("PhaseFieldApp", CHSplitChemicalPotential); 13 : 14 : InputParameters 15 23 : CHSplitChemicalPotential::validParams() 16 : { 17 23 : InputParameters params = Kernel::validParams(); 18 23 : params.addClassDescription("Chemical potential kernel in Split Cahn-Hilliard that solves " 19 : "chemical potential in a weak form"); 20 46 : params.addRequiredParam<MaterialPropertyName>("chemical_potential_prop", 21 : "Chemical potential property name"); 22 46 : params.addRequiredCoupledVar("c", "Concentration"); 23 23 : return params; 24 0 : } 25 : 26 12 : CHSplitChemicalPotential::CHSplitChemicalPotential(const InputParameters & parameters) 27 : : DerivativeMaterialInterface<Kernel>(parameters), 28 24 : _mu_prop_name(getParam<MaterialPropertyName>("chemical_potential_prop")), 29 12 : _chemical_potential(getMaterialProperty<Real>(_mu_prop_name)), 30 12 : _dchemical_potential_dc( 31 24 : getMaterialPropertyDerivative<Real>(_mu_prop_name, coupledName("c", 0))), 32 24 : _c_var(coupled("c")) 33 : { 34 12 : } 35 : 36 : Real 37 1417600 : CHSplitChemicalPotential::computeQpResidual() 38 : { 39 1417600 : return _test[_i][_qp] * (_u[_qp] - _chemical_potential[_qp]); 40 : } 41 : 42 : Real 43 1299200 : CHSplitChemicalPotential::computeQpJacobian() 44 : { 45 1299200 : return _test[_i][_qp] * _phi[_j][_qp]; 46 : } 47 : 48 : Real 49 1299200 : CHSplitChemicalPotential::computeQpOffDiagJacobian(unsigned int jvar) 50 : { 51 1299200 : if (jvar == _c_var) 52 1299200 : return -_test[_i][_qp] * _dchemical_potential_dc[_qp] * _phi[_j][_qp]; 53 : else 54 : return 0.0; 55 : }