https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CrossTermBarrierFunctionMaterial.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
13
16{
19 "Free energy contribution symmetric across interfaces between arbitrary pairs of phases.");
20 return params;
21}
22
24 const InputParameters & parameters)
26{
27 // error out if W_ij is not symmetric
28 for (unsigned int i = 0; i < _num_eta; ++i)
29 for (unsigned int j = 0; j < i; ++j)
30 if (_W_ij[_num_eta * i + j] != _W_ij[_num_eta * j + i])
31 paramError("W_ij", "Please supply a symmetric W_ij matrix");
32}
33
34void
36{
37 // Initialize properties to zero before accumulating
39
40 // Sum the components of our W_ij matrix to get constant used in our g function
41 for (unsigned int i = 0; i < _num_eta; ++i)
42 for (unsigned int j = i + 1; j < _num_eta; ++j)
43 {
44 const Real ni = (*_eta[i])[_qp];
45 const Real nj = (*_eta[j])[_qp];
46 const Real Wij = _W_ij[_num_eta * i + j];
47
48 switch (_g_order)
49 {
50 case 0: // SIMPLE
51 _prop_g[_qp] += 16.0 * Wij * (ni * ni * nj * nj);
52 // first derivatives
53 (*_prop_dg[i])[_qp] += 16.0 * Wij * (2 * ni * nj * nj);
54 (*_prop_dg[j])[_qp] += 16.0 * Wij * (2 * ni * ni * nj);
55 // second derivatives (diagonal)
56 (*_prop_d2g[i][i])[_qp] += 16.0 * Wij * (2 * nj * nj);
57 (*_prop_d2g[j][j])[_qp] += 16.0 * Wij * (2 * ni * ni);
58 // second derivatives (off-diagonal)
59 (*_prop_d2g[i][j])[_qp] = 16.0 * Wij * (4 * ni * nj);
60 break;
61
62 case 1: // LOW
63 _prop_g[_qp] += 4.0 * Wij * (ni * nj);
64 // first derivatives
65 (*_prop_dg[i])[_qp] += 4.0 * Wij * nj;
66 (*_prop_dg[j])[_qp] += 4.0 * Wij * ni;
67 // second derivatives (diagonal) vanish
68 // second derivatives (off-diagonal)
69 (*_prop_d2g[i][j])[_qp] = 4.0 * Wij;
70 break;
71
72 default:
73 mooseError("Internal error");
74 }
75 }
76}
registerMooseObject("PhaseFieldApp", CrossTermBarrierFunctionMaterial)
void mooseError(Args &&... args)
CrossTermBarrierFunctionBase is the base to a set of free energy penalties that set the phase interfa...
MaterialProperty< Real > & _prop_g
Barrier function and its derivatives.
unsigned int _num_eta
order parameters
std::vector< Real > _W_ij
barrier function height matrix
const std::vector< const VariableValue * > _eta
std::vector< MaterialProperty< Real > * > _prop_dg
unsigned int _g_order
polynomial order of the switching function
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2g
CrossTermBarrierFunctionMaterial adds free energy contribution on the interfaces between arbitrary pa...
CrossTermBarrierFunctionMaterial(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)