https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ACBulk.h
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#pragma once
11
12#include "KernelValue.h"
13#include "JvarMapInterface.h"
15
23template <typename T>
24class ACBulk : public DerivativeMaterialInterface<JvarMapKernelInterface<KernelValue>>
25{
26public:
27 ACBulk(const InputParameters & parameters);
28
30 virtual void initialSetup();
31
32protected:
33 virtual Real precomputeQpResidual();
34 virtual Real precomputeQpJacobian();
35 virtual Real computeQpOffDiagJacobian(unsigned int jvar);
36
42
43 virtual Real computeDFDOP(PFFunctionType type) = 0;
44
47
50
52 std::vector<const MaterialProperty<T> *> _dLdarg;
53};
54
55template <typename T>
58 _L(getMaterialProperty<T>("mob_name")),
59 _dLdop(getMaterialPropertyDerivative<T>("mob_name", _var.name())),
60 _dLdarg(_n_args)
61{
62 // Iterate over all coupled variables
63 for (unsigned int i = 0; i < _n_args; ++i)
64 _dLdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", i);
65}
66
67template <typename T>
70{
72 params.addClassDescription("Allen-Cahn base Kernel");
73 params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
74 return params;
75}
76
77template <typename T>
78void
80{
81 validateNonlinearCoupling<Real>("mob_name");
82}
83
84template <typename T>
85Real
87{
88 // Get free energy derivative from function
89 Real dFdop = computeDFDOP(Residual);
90
91 // Set residual
92 return _L[_qp] * dFdop;
93}
94
95template <typename T>
96Real
98{
99 // Get free energy derivative and Jacobian
100 Real dFdop = computeDFDOP(Residual);
101
102 Real JdFdop = computeDFDOP(Jacobian);
103
104 // Set Jacobian value using product rule
105 return _L[_qp] * JdFdop + _dLdop[_qp] * _phi[_j][_qp] * dFdop;
106}
107
108template <typename T>
109Real
111{
112 // Get the coupled variable jvar is referring to
113 const unsigned int cvar = mapJvarToCvar(jvar);
114
115 // Set off-diagonal Jacobian term from mobility derivatives
116 return (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * computeDFDOP(Residual) * _test[_i][_qp];
117}
const double T
const std::string name
Definition Setup.h:21
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition ACBulk.h:25
PFFunctionType
Definition ACBulk.h:38
@ Jacobian
Definition ACBulk.h:39
virtual Real precomputeQpResidual()
Definition ACBulk.h:86
const MaterialProperty< T > & _L
Mobility.
Definition ACBulk.h:46
ACBulk(const InputParameters &parameters)
Definition ACBulk.h:56
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACBulk.h:110
virtual Real computeDFDOP(PFFunctionType type)=0
virtual void initialSetup()
Definition ACBulk.h:79
std::vector< const MaterialProperty< T > * > _dLdarg
Mobility derivative w.r.t coupled variables.
Definition ACBulk.h:52
const MaterialProperty< T > & _dLdop
Mobility derivative w.r.t. order parameter.
Definition ACBulk.h:49
static InputParameters validParams()
Definition ACBulk.h:69
virtual Real precomputeQpJacobian()
Definition ACBulk.h:97
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)
static InputParameters validParams()