www.mooseframework.org
CoefDiffusion.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "CoefDiffusion.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addParam<Real>("coef", 0.0, "Diffusion coefficient");
15  params.addParam<FunctionName>("function",
16  "If provided, the diffusion coefficient will be coef + "
17  "this function. This is useful for temporally or "
18  "spatially varying diffusivities");
19  params.addClassDescription("Kernel for diffusion with diffusivity = coef + function");
20  return params;
21 }
22 
23 CoefDiffusion::CoefDiffusion(const InputParameters & parameters)
24  : Kernel(parameters),
25  _coef(getParam<Real>("coef")),
26  _func(parameters.isParamValid("function") ? &getFunction("function") : NULL)
27 {
28 }
29 
30 Real
32 {
33  Real diffusivity = _coef;
34 
35  if (_func)
36  diffusivity += _func->value(_t, _q_point[_qp]);
37 
38  return diffusivity * _grad_test[_i][_qp] * _grad_u[_qp];
39 }
40 
41 Real
43 {
44  Real diffusivity = _coef;
45 
46  if (_func)
47  diffusivity += _func->value(_t, _q_point[_qp]);
48 
49  return diffusivity * _grad_test[_i][_qp] * _grad_phi[_j][_qp];
50 }
CoefDiffusion(const InputParameters &parameters)
Definition: CoefDiffusion.C:23
virtual Real computeQpJacobian()
Definition: CoefDiffusion.C:42
virtual Real computeQpResidual()
Definition: CoefDiffusion.C:31
const Real _coef
Definition: CoefDiffusion.h:29
Function *const _func
Definition: CoefDiffusion.h:30
InputParameters validParams< CoefDiffusion >()
Definition: CoefDiffusion.C:11