https://mooseframework.inl.gov
MatGradSquareCoupled.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 
10 #include "MatGradSquareCoupled.h"
11 
13 
16 {
18  params.addClassDescription("Gradient square of a coupled variable.");
19  params.addCoupledVar("elec_potential", "Electric potential");
20  params.addCoupledVar("args", "Vector of variable arguments to prefactor");
21  params.deprecateCoupledVar("args", "coupled_variables", "02/27/2024");
22  params.addParam<MaterialPropertyName>(
23  "prefactor",
24  "prefactor",
25  "Material property providing a prefactor of electric potential contribution");
26  return params;
27 }
28 
31  _grad_elec_potential(coupledGradient("elec_potential")),
32  _elec_potential_var(coupled("elec_potential")),
33  _prefactor(getMaterialProperty<Real>("prefactor")),
34  _dprefactor_dphi(getMaterialPropertyDerivative<Real>("prefactor", _var.name())),
35  _dprefactor_darg(_n_args)
36 {
37  for (unsigned int i = 0; i < _n_args; ++i)
38  _dprefactor_darg[i] = &getMaterialPropertyDerivative<Real>("prefactor", i);
39 }
40 
41 void
43 {
44  validateNonlinearCoupling<Real>("prefactor");
45 }
46 
47 Real
49 {
51 }
52 
53 Real
55 {
57  _phi[_j][_qp] * _test[_i][_qp];
58 }
59 
60 Real
62 {
63  const unsigned int cvar = mapJvarToCvar(jvar);
64 
65  if (jvar == _elec_potential_var)
66  return -2 * _prefactor[_qp] * _grad_elec_potential[_qp] * _grad_phi[_j][_qp] * _test[_i][_qp] -
68  _phi[_j][_qp] * _test[_i][_qp];
69 
71  _phi[_j][_qp] * _test[_i][_qp];
72 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
std::vector< const MaterialProperty< Real > * > _dprefactor_darg
const VariableGradient & _grad_elec_potential
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< Real > & _prefactor
virtual Real computeQpJacobian()
const std::string name
Definition: Setup.h:20
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
virtual Real computeQpResidual()
const unsigned int _elec_potential_var
const MaterialProperty< Real > & _dprefactor_dphi
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", MatGradSquareCoupled)
MatGradSquareCoupled(const InputParameters &parameters)