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 "GBAnisotropy.h" 11 : 12 : registerMooseObject("PhaseFieldApp", GBAnisotropy); 13 : 14 : InputParameters 15 141 : GBAnisotropy::validParams() 16 : { 17 141 : InputParameters params = GBAnisotropyBase::validParams(); 18 141 : params.addClassDescription( 19 : "A material to compute anisotropic grain boundary energies and mobilities."); 20 282 : params.addRequiredParam<Real>("wGB", "Diffuse GB width in nm"); 21 141 : return params; 22 0 : } 23 : 24 108 : GBAnisotropy::GBAnisotropy(const InputParameters & parameters) 25 216 : : GBAnisotropyBase(parameters), _wGB(getParam<Real>("wGB")) 26 : { 27 : Real sigma_init; 28 : Real g2 = 0.0; 29 : Real f_interf = 0.0; 30 : Real a_0 = 0.75; 31 : Real a_star = 0.0; 32 : Real kappa_star = 0.0; 33 : Real gamma_star = 0.0; 34 : Real y = 0.0; // 1/gamma 35 : Real yyy = 0.0; 36 : 37 : Real sigma_big = 0.0; 38 : Real sigma_small = 0.0; 39 : 40 288 : for (unsigned int m = 0; m < _op_num - 1; ++m) 41 432 : for (unsigned int n = m + 1; n < _op_num; ++n) 42 : { 43 : // Convert units of mobility and energy 44 252 : _sigma[m][n] *= _JtoeV * (_length_scale * _length_scale); // eV/nm^2 45 : 46 252 : _mob[m][n] *= _time_scale / (_JtoeV * (_length_scale * _length_scale * _length_scale * 47 : _length_scale)); // Convert to nm^4/(eV*ns); 48 : 49 252 : if (m == 0 && n == 1) 50 : { 51 108 : sigma_big = _sigma[m][n]; 52 : sigma_small = sigma_big; 53 : } 54 : 55 144 : else if (_sigma[m][n] > sigma_big) 56 : sigma_big = _sigma[m][n]; 57 : 58 144 : else if (_sigma[m][n] < sigma_small) 59 : sigma_small = _sigma[m][n]; 60 : } 61 : 62 108 : sigma_init = (sigma_big + sigma_small) / 2.0; 63 108 : _mu_qp = 6.0 * sigma_init / _wGB; 64 : 65 288 : for (unsigned int m = 0; m < _op_num - 1; ++m) 66 432 : for (unsigned int n = m + 1; n < _op_num; ++n) // m<n 67 : { 68 : 69 : a_star = a_0; 70 : a_0 = 0.0; 71 : 72 1440 : while (std::abs(a_0 - a_star) > 1.0e-9) 73 : { 74 : a_0 = a_star; 75 468 : kappa_star = a_0 * _wGB * _sigma[m][n]; 76 468 : g2 = _sigma[m][n] * _sigma[m][n] / (kappa_star * _mu_qp); 77 468 : y = -5.288 * g2 * g2 * g2 * g2 - 0.09364 * g2 * g2 * g2 + 9.965 * g2 * g2 - 8.183 * g2 + 78 : 2.007; 79 468 : gamma_star = 1 / y; 80 468 : yyy = y * y * y; 81 468 : f_interf = 0.05676 * yyy * yyy - 0.2924 * yyy * y * y + 0.6367 * yyy * y - 0.7749 * yyy + 82 468 : 0.6107 * y * y - 0.4324 * y + 0.2792; 83 468 : a_star = std::sqrt(f_interf / g2); 84 : } 85 : 86 252 : _kappa_gamma[m][n] = kappa_star; // upper triangle stores the discrete set of kappa values 87 252 : _kappa_gamma[n][m] = gamma_star; // lower triangle stores the discrete set of gamma values 88 : 89 252 : _a_g2[m][n] = a_star; // upper triangle stores "a" data. 90 252 : _a_g2[n][m] = g2; // lower triangle stores "g2" data. 91 : } 92 108 : }