https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowPlasticHeatEnergy.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 "MooseMesh.h"
13#include "MooseVariable.h"
14
16
19{
21 params.addParam<bool>("strain_at_nearest_qp",
22 false,
23 "When calculating nodal porosity that depends on strain, use the strain at "
24 "the nearest quadpoint. This adds a small extra computational burden, and "
25 "is not necessary for simulations involving only linear lagrange elements. "
26 " If you set this to true, you will also want to set the same parameter to "
27 "true for related Kernels and Materials");
28 params.addRequiredParam<UserObjectName>(
29 "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
31 "Plastic heat energy density source = (1 - porosity) * coeff * stress * plastic_strain_rate");
32 return params;
33}
34
36 : PlasticHeatEnergy(parameters),
37 _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
38 _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
39 _nearest_qp(_strain_at_nearest_qp
40 ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
41 : nullptr),
42 _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
43 _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
44 _dporosity_dgradvar(
45 getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar"))
46{
47}
48
49Real
54
55Real
60
61Real
63{
64 // If the variable is not a PorousFlow variable, the Jacobian terms are 0
66 return 0.0;
67
68 const Real res_no_porosity = PlasticHeatEnergy::computeQpResidual();
69 const Real jac_no_porosity = PlasticHeatEnergy::computeQpOffDiagJacobian(jvar);
70
71 const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
72 const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
73
74 Real jac = (1.0 - _porosity[_i]) * jac_no_porosity -
75 _dporosity_dgradvar[_i][pvar] * _grad_phi[_j][nearest_qp] * res_no_porosity;
76 if (_i != _j)
77 return jac;
78
79 return jac - _dporosity_dvar[_i][pvar] * res_no_porosity;
80}
registerMooseObject("PorousFlowApp", PorousFlowPlasticHeatEnergy)
void ErrorVector unsigned int
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _j
unsigned int _i
MooseVariable & _var
const VariablePhiGradient & _grad_phi
unsigned int number() const
Provides a heat source from plastic deformation: coeff * stress * plastic_strain_rate.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpResidual() override
static InputParameters validParams()
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
Provides a heat source (J/m^3/s) from plastic deformation: (1 - porosity) * coeff * stress * plastic_...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps.
virtual Real computeQpResidual() override
PorousFlowPlasticHeatEnergy(const InputParameters &parameters)
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps
virtual Real computeQpJacobian() override
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes