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 14524 : FunctionDiffusion::validParams() 17 : { 18 14524 : InputParameters params = Diffusion::validParams(); 19 14524 : params.addClassDescription("Diffusion with a function coefficient."); 20 14524 : params.addParam<FunctionName>("function", 1.0, "Function multiplier for diffusion term."); 21 14524 : 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 14524 : return params; 26 0 : } 27 : 28 135 : FunctionDiffusion::FunctionDiffusion(const InputParameters & parameters) 29 : : Diffusion(parameters), 30 135 : _function(getFunction("function")), 31 135 : _grad_v(isCoupled("v") ? coupledGradient("v") : _grad_u), 32 135 : _v_var(isCoupled("v") ? getVar("v", 0) : nullptr), 33 270 : _grad_v_phi(isCoupled("v") ? _v_var->gradPhi() : _grad_phi) 34 : { 35 135 : } 36 : 37 : Real 38 2491440 : FunctionDiffusion::computeQpResidual() 39 : { 40 2491440 : return _function.value(_t, _q_point[_qp]) * _grad_v[_qp] * _grad_test[_i][_qp]; 41 : } 42 : 43 : Real 44 8937280 : FunctionDiffusion::computeQpJacobian() 45 : { 46 8937280 : return _function.value(_t, _q_point[_qp]) * _grad_v_phi[_j][_qp] * _grad_test[_i][_qp]; 47 : }