https://mooseframework.inl.gov
PorousFlowHeatMassTransfer.C
Go to the documentation of this file.
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 
11 
12 #include "MooseVariable.h"
13 
15 
18 {
20 
21  params.addClassDescription(
22  "Calculate heat or mass transfer from a coupled variable v to the variable u. "
23  "No mass lumping is performed here.");
24  params.addRequiredCoupledVar(
25  "v", "The variable which is tranfsered to u using a transfer coefficient");
26  params.addCoupledVar("transfer_coefficient",
27  1.0,
28  "Transfer coefficient for heat or mass transferred between variables");
29 
30  return params;
31 }
32 
34  : Kernel(parameters),
35  _v_var(coupled("v")),
36  _v(coupledValue("v")),
37  _coef_var(coupledValue("transfer_coefficient"))
38 {
39 }
40 
41 Real
43 {
44  return _coef_var[_qp] * (_u[_qp] - _v[_qp]) * _test[_i][_qp];
45 }
46 
47 Real
49 {
50  return jac(_var.number());
51 }
52 
53 Real
55 {
56  return jac(jvar);
57 }
58 
59 Real
60 PorousFlowHeatMassTransfer::jac(unsigned int jvar) const
61 {
62  if (jvar == _var.number())
63  return _coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
64  else if (jvar == _v_var)
65  return -_coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
66  return 0.0;
67 }
static InputParameters validParams()
MooseVariable & _var
unsigned int number() const
PorousFlowHeatMassTransfer(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const VariableTestValue & _test
registerMooseObject("PorousFlowApp", PorousFlowHeatMassTransfer)
unsigned int _i
virtual Real jac(unsigned int jvar) const
static InputParameters validParams()
virtual Real computeQpJacobian() override
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeQpResidual() override
void addClassDescription(const std::string &doc_string)
const VariablePhiValue & _phi
const VariableValue & _u
unsigned int _qp
Calculate heat or mass transfer from a coupled variable to u.