www.mooseframework.org
PorousFlowPlasticHeatEnergy.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 
9 
10 // MOOSE includes
11 #include "MooseMesh.h"
12 #include "MooseVariable.h"
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<PlasticHeatEnergy>();
19  params.addParam<bool>("strain_at_nearest_qp",
20  false,
21  "When calculating nodal porosity that depends on strain, use the strain at "
22  "the nearest quadpoint. This adds a small extra computational burden, and "
23  "is not necessary for simulations involving only linear lagrange elements. "
24  " If you set this to true, you will also want to set the same parameter to "
25  "true for related Kernels and Materials");
26  params.addRequiredParam<UserObjectName>(
27  "PorousFlowDictator", "The UserObject that holds the list of Porous-Flow variable names.");
28  params.addClassDescription(
29  "Plastic heat energy density source = (1 - porosity) * coeff * stress * plastic_strain_rate");
30  return params;
31 }
32 
34  : PlasticHeatEnergy(parameters),
35  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
36  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
37  _nearest_qp(_strain_at_nearest_qp
38  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
39  : nullptr),
40  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
41  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
42  _dporosity_dgradvar(
43  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar"))
44 {
45 }
46 
47 Real
49 {
50  return (1.0 - _porosity[_i]) * PlasticHeatEnergy::computeQpResidual();
51 }
52 
53 Real
55 {
56  return computeQpOffDiagJacobian(_var.number());
57 }
58 
59 Real
61 {
64  return 0.0;
65 
66  const Real res_no_porosity = PlasticHeatEnergy::computeQpResidual();
67  const Real jac_no_porosity = PlasticHeatEnergy::computeQpOffDiagJacobian(jvar);
68 
69  const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
70  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
71 
72  Real jac = (1.0 - _porosity[_i]) * jac_no_porosity -
73  _dporosity_dgradvar[_i][pvar] * _grad_phi[_j][nearest_qp] * res_no_porosity;
74  if (_i != _j)
75  return jac;
76 
77  return jac - _dporosity_dvar[_i][pvar] * res_no_porosity;
78 }
const MaterialProperty< Real > & _porosity
porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps ...
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpResidual() override
const bool _strain_at_nearest_qp
whether the porosity uses the volumetric strain at the closest quadpoint
Provides a heat source from plastic deformation: coeff * stress * plastic_strain_rate.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
virtual Real computeQpJacobian() override
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow variable) - these derivatives will be wrt variables at the nodes ...
PorousFlowPlasticHeatEnergy(const InputParameters &parameters)
InputParameters validParams< PorousFlowPlasticHeatEnergy >()
virtual Real computeQpResidual() override
InputParameters validParams< PlasticHeatEnergy >()
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
bool notPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is not a porous flow variabe
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad porous-flow variable) - remember these derivatives will be wrt grad(vars) at qps ...
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
the PorousFlow variable number