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 "FunctionDiffusion.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", FunctionDiffusion); 14 : 15 : InputParameters 16 14603 : FunctionDiffusion::validParams() 17 : { 18 14603 : InputParameters params = Diffusion::validParams(); 19 14603 : params.addClassDescription("Diffusion with a function coefficient."); 20 14603 : params.addParam<FunctionName>("function", 1.0, "Function multiplier for diffusion term."); 21 14603 : params.addCoupledVar("v", 22 : "Coupled concentration variable for kernel to operate on; if this " 23 : "is not specified, the kernel's nonlinear variable will be used as " 24 : "usual"); 25 14603 : return params; 26 0 : } 27 : 28 176 : FunctionDiffusion::FunctionDiffusion(const InputParameters & parameters) 29 : : Diffusion(parameters), 30 176 : _function(getFunction("function")), 31 176 : _grad_v(isCoupled("v") ? coupledGradient("v") : _grad_u), 32 176 : _v_var(isCoupled("v") ? getVar("v", 0) : nullptr), 33 352 : _grad_v_phi(isCoupled("v") ? _v_var->gradPhi() : _grad_phi) 34 : { 35 176 : } 36 : 37 : Real 38 2642592 : FunctionDiffusion::computeQpResidual() 39 : { 40 2642592 : return _function.value(_t, _q_point[_qp]) * _grad_v[_qp] * _grad_test[_i][_qp]; 41 : } 42 : 43 : Real 44 9339728 : FunctionDiffusion::computeQpJacobian() 45 : { 46 9339728 : return _function.value(_t, _q_point[_qp]) * _grad_v_phi[_j][_qp] * _grad_test[_i][_qp]; 47 : }