Line data Source code
1 : /****************************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* */ 4 : /* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */ 5 : /* */ 6 : /* Copyright 2021 - 2024, Battelle Energy Alliance, LLC */ 7 : /* ALL RIGHTS RESERVED */ 8 : /****************************************************************************/ 9 : 10 : #include "LevelSetCurvatureRegularization.h" 11 : 12 : registerMooseObject("MalamuteApp", LevelSetCurvatureRegularization); 13 : 14 : InputParameters 15 10 : LevelSetCurvatureRegularization::validParams() 16 : { 17 10 : InputParameters params = ADKernel::validParams(); 18 10 : params.addClassDescription("Computes regularized interface curvature that is represented by a " 19 : "level set function (Elin Olsson et al, JCP 225 (2007) 785-807)."); 20 20 : params.addRequiredCoupledVar("level_set_regularized_gradient", 21 : "Vector variable of level set's regularized gradient."); 22 20 : params.addRequiredParam<Real>("varepsilon", "Regulizatione parameter."); 23 10 : return params; 24 0 : } 25 : 26 5 : LevelSetCurvatureRegularization::LevelSetCurvatureRegularization(const InputParameters & parameters) 27 : : ADKernel(parameters), 28 5 : _grad_c(adCoupledVectorValue("level_set_regularized_gradient")), 29 15 : _varepsilon(getParam<Real>("varepsilon")) 30 : { 31 5 : } 32 : 33 : ADReal 34 1393920 : LevelSetCurvatureRegularization::computeQpResidual() 35 : { 36 2787840 : const auto grad_c_norm = MooseUtils::isZero(_grad_c[_qp]) ? ADReal(1e-42) : _grad_c[_qp].norm(); 37 1393920 : if (MetaPhysicL::raw_value(grad_c_norm) > libMesh::TOLERANCE) 38 : { 39 857968 : ADRealVectorValue n = (_grad_c[_qp]) / grad_c_norm; 40 1715936 : return _test[_i][_qp] * _u[_qp] - _grad_test[_i][_qp] * (n - _varepsilon * _grad_u[_qp]); 41 : } 42 : else 43 1071904 : return _test[_i][_qp] * _u[_qp] + _grad_test[_i][_qp] * _varepsilon * _grad_u[_qp]; 44 : }