https://mooseframework.inl.gov
ACGrGrPolyLinearizedInterface.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 "libmesh/utility.h"
13 
15 
18 {
20  params.addClassDescription(
21  "Grain growth model Allen-Cahn Kernel with linearized interface variable transformation");
22  params.addRequiredParam<MaterialPropertyName>(
23  "this_op", "The material property defining the order parameter for this variable");
24  params.addRequiredParam<std::vector<MaterialPropertyName>>(
25  "other_ops", "List of properties defining the order parameters for the variables in v");
26  return params;
27 }
28 
30  : ACGrGrPoly(parameters),
31  _other_op_names(getParam<std::vector<MaterialPropertyName>>("other_ops")),
32  _num_ops(_other_op_names.size()),
33  _gamma(getMaterialProperty<Real>("gamma_asymm")),
34  _op(getMaterialProperty<Real>("this_op")),
35  _dopdphi(getMaterialPropertyDerivative<Real>("this_op", _var.name())),
36  _opj(_num_ops),
37  _dopjdarg(_num_ops)
38 {
39  if (_num_ops != _op_num)
40  mooseError(
41  "In ACGrGrPolyLinearizedInterface, number of coupled variables in v must match number of "
42  "coupled materials in other_ops");
43 
44  // Iterate over all coupled order parameters
45  for (unsigned int i = 0; i < _op_num; ++i)
46  {
47  _opj[i] = &getMaterialPropertyByName<Real>(_other_op_names[i]);
48  _dopjdarg[i] = &getMaterialPropertyDerivative<Real>(_other_op_names[i], i);
49  }
50 }
51 
52 Real
54 {
55  return _op[_qp];
56 }
57 
58 std::vector<Real>
60 {
61  std::vector<Real> other_ops(_op_num);
62  for (unsigned int i = 0; i < _op_num; ++i)
63  other_ops[i] = (*_opj[i])[_qp];
64 
65  return other_ops;
66 }
67 
68 Real
70 {
71  switch (type)
72  {
73  case Residual:
74  return ACGrGrPoly::computeDFDOP(type);
75 
76  case Jacobian:
77  return ACGrGrPoly::computeDFDOP(type) * _dopdphi[_qp];
78 
79  default:
80  mooseError("Invalid type passed in");
81  }
82 }
83 
84 Real
86 {
87 
88  for (unsigned int i = 0; i < _op_num; ++i)
89  if (jvar == _vals_var[i])
90  return ACGrGrPoly::computeQpOffDiagJacobian(jvar) * (*_dopjdarg[i])[_qp];
91 
92  return 0.0;
93 }
const unsigned int _op_num
Definition: ACGrGrBase.h:29
This kernel calculates the residual for grain growth for a single phase, poly-crystal system...
Definition: ACGrGrPoly.h:21
virtual Real computeDFDOP(PFFunctionType type)
void mooseError(Args &&... args)
const MaterialProperty< Real > & _op
std::vector< const MaterialProperty< Real > * > _opj
const std::vector< unsigned int > _vals_var
Definition: ACGrGrBase.h:32
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< const MaterialProperty< Real > * > _dopjdarg
const MaterialProperty< Real > & _dopdphi
virtual std::vector< Real > assignOtherOps()
virtual Real computeDFDOP(PFFunctionType type)
Definition: ACGrGrPoly.C:44
static InputParameters validParams()
Definition: ACGrGrPoly.C:15
ACGrGrPolyLinearizedInterface(const InputParameters &parameters)
const std::string name
Definition: Setup.h:20
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACGrGrPoly.C:75
This kernel calculates the residual for grain growth for a single phase, polycrystal system using the...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const std::vector< MaterialPropertyName > _other_op_names
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", ACGrGrPolyLinearizedInterface)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)