https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16
17template <bool is_ad>
20{
22
24 "Calculate heat or mass transfer from a coupled variable v to the variable u. "
25 "No mass lumping is performed here.");
27 "v", "The variable which is tranfsered to u using a transfer coefficient");
28 params.addCoupledVar("transfer_coefficient",
29 1.0,
30 "Transfer coefficient for heat or mass transferred between variables");
31
32 return params;
33}
34
35template <bool is_ad>
37 const InputParameters & parameters)
38 : GenericKernel<is_ad>(parameters),
39 _v_var(coupled("v")),
40 _v(this->template coupledGenericValue<is_ad>("v")),
41 _coef_var(this->template coupledGenericValue<is_ad>("transfer_coefficient"))
42{
43}
44
45template <bool is_ad>
48{
49 return _coef_var[_qp] * (_u[_qp] - _v[_qp]) * _test[_i][_qp];
50}
51
52template <bool is_ad>
53Real
55{
56 return jac(_var.number());
57}
58
59template <bool is_ad>
60Real
62{
63 return jac(jvar);
64}
65
66template <bool is_ad>
67Real
69{
70 if constexpr (!is_ad)
71 {
72 if (jvar == _var.number())
73 return _coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
74 else if (jvar == _v_var)
75 return -_coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
76 return 0.0;
77 }
78 else
79 libmesh_ignore(jvar);
80 return 0.0;
81}
82
Moose::GenericType< Real, is_ad > GenericReal
registerMooseObject("PorousFlowApp", PorousFlowHeatMassTransfer)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
Calculate heat or mass transfer from a coupled variable to u.
PorousFlowHeatMassTransferTempl(const InputParameters &parameters)
virtual GenericReal< is_ad > computeQpResidual() override
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real jac(unsigned int jvar) const