Line data Source code
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 "CrossTermBarrierFunctionMaterial.h" 11 : 12 : registerMooseObject("PhaseFieldApp", CrossTermBarrierFunctionMaterial); 13 : 14 : InputParameters 15 94 : CrossTermBarrierFunctionMaterial::validParams() 16 : { 17 94 : InputParameters params = CrossTermBarrierFunctionBase::validParams(); 18 94 : params.addClassDescription( 19 : "Free energy contribution symmetric across interfaces between arbitrary pairs of phases."); 20 94 : return params; 21 0 : } 22 : 23 72 : CrossTermBarrierFunctionMaterial::CrossTermBarrierFunctionMaterial( 24 72 : const InputParameters & parameters) 25 72 : : CrossTermBarrierFunctionBase(parameters) 26 : { 27 : // error out if W_ij is not symmetric 28 288 : for (unsigned int i = 0; i < _num_eta; ++i) 29 432 : for (unsigned int j = 0; j < i; ++j) 30 216 : if (_W_ij[_num_eta * i + j] != _W_ij[_num_eta * j + i]) 31 0 : paramError("W_ij", "Please supply a symmetric W_ij matrix"); 32 72 : } 33 : 34 : void 35 4800 : CrossTermBarrierFunctionMaterial::computeQpProperties() 36 : { 37 : // Initialize properties to zero before accumulating 38 4800 : CrossTermBarrierFunctionBase::computeQpProperties(); 39 : 40 : // Sum the components of our W_ij matrix to get constant used in our g function 41 19200 : for (unsigned int i = 0; i < _num_eta; ++i) 42 28800 : for (unsigned int j = i + 1; j < _num_eta; ++j) 43 : { 44 14400 : const Real ni = (*_eta[i])[_qp]; 45 14400 : const Real nj = (*_eta[j])[_qp]; 46 14400 : const Real Wij = _W_ij[_num_eta * i + j]; 47 : 48 14400 : switch (_g_order) 49 : { 50 7200 : case 0: // SIMPLE 51 7200 : _prop_g[_qp] += 16.0 * Wij * (ni * ni * nj * nj); 52 : // first derivatives 53 7200 : (*_prop_dg[i])[_qp] += 16.0 * Wij * (2 * ni * nj * nj); 54 7200 : (*_prop_dg[j])[_qp] += 16.0 * Wij * (2 * ni * ni * nj); 55 : // second derivatives (diagonal) 56 7200 : (*_prop_d2g[i][i])[_qp] += 16.0 * Wij * (2 * nj * nj); 57 7200 : (*_prop_d2g[j][j])[_qp] += 16.0 * Wij * (2 * ni * ni); 58 : // second derivatives (off-diagonal) 59 7200 : (*_prop_d2g[i][j])[_qp] = 16.0 * Wij * (4 * ni * nj); 60 7200 : break; 61 : 62 7200 : case 1: // LOW 63 7200 : _prop_g[_qp] += 4.0 * Wij * (ni * nj); 64 : // first derivatives 65 7200 : (*_prop_dg[i])[_qp] += 4.0 * Wij * nj; 66 7200 : (*_prop_dg[j])[_qp] += 4.0 * Wij * ni; 67 : // second derivatives (diagonal) vanish 68 : // second derivatives (off-diagonal) 69 7200 : (*_prop_d2g[i][j])[_qp] = 4.0 * Wij; 70 7200 : break; 71 : 72 0 : default: 73 0 : mooseError("Internal error"); 74 : } 75 : } 76 4800 : }