Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "PolarPFMGradient.h" 10 : 11 : registerMooseObject("MagpieApp", PolarPFMGradient); 12 : 13 : InputParameters 14 36 : PolarPFMGradient::validParams() 15 : { 16 36 : InputParameters params = KernelValue::validParams(); 17 36 : params.addClassDescription("Gradient energy term in the polar phase field model"); 18 72 : params.addRequiredParam<MaterialPropertyName>( 19 : "F", "Material property of which the kernel variable derivative will be taken of"); 20 72 : params.addCoupledVar("v", "Coupled order parameter"); 21 36 : return params; 22 0 : } 23 : 24 20 : PolarPFMGradient::PolarPFMGradient(const InputParameters & parameters) 25 : : DerivativeMaterialInterface<KernelValue>(parameters), 26 20 : _grad_v(coupledGradient("v")), 27 20 : _v_name(getVar("v", 0)->name()), 28 20 : _v_var(coupled("v")), 29 20 : _dpropdu(getMaterialPropertyDerivative<Real>("F", _var.name())), 30 20 : _d2propdu2(getMaterialPropertyDerivative<Real>("F", _var.name(), _var.name())), 31 40 : _d2propdudv(getMaterialPropertyDerivative<Real>("F", _var.name(), _v_name)) 32 : { 33 20 : } 34 : 35 : Real 36 816000 : PolarPFMGradient::precomputeQpResidual() 37 : { 38 816000 : return 0.5 * _dpropdu[_qp] * _grad_v[_qp].norm_sq(); 39 : } 40 : 41 : Real 42 201600 : PolarPFMGradient::precomputeQpJacobian() 43 : { 44 201600 : return 0.5 * _d2propdu2[_qp] * _phi[_j][_qp] * _grad_v[_qp].norm_sq(); 45 : } 46 : 47 : Real 48 384000 : PolarPFMGradient::computeQpOffDiagJacobian(unsigned int jvar) 49 : { 50 384000 : if (jvar == _v_var) 51 288000 : return 0.5 * 52 288000 : (_d2propdudv[_qp] * _phi[_j][_qp] * _grad_v[_qp].norm_sq() + 53 288000 : _dpropdu[_qp] * 2.0 * _grad_v[_qp] * _grad_phi[_j][_qp]) * 54 288000 : _test[_i][_qp]; 55 : 56 : return 0.0; 57 : }