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 "ElementCentroidToSurfaceDistanceAux.h" 11 : #include "ShortestDistanceToSurface.h" 12 : 13 : // Register the new AuxKernel class name 14 : registerMooseObject("ShiftedBoundaryMethodApp", ElementCentroidToSurfaceDistanceAux); 15 : 16 : InputParameters 17 79 : ElementCentroidToSurfaceDistanceAux::validParams() 18 : { 19 79 : InputParameters params = AuxKernel::validParams(); 20 : 21 158 : params.addRequiredParam<UserObjectName>("distance_to_surface", 22 : "UserObject that provides distance calculations."); 23 : 24 79 : params.addClassDescription( 25 : "Creates a distance field based on the 'distance_to_surface' UserObject."); 26 : 27 79 : return params; 28 0 : } 29 : 30 44 : ElementCentroidToSurfaceDistanceAux::ElementCentroidToSurfaceDistanceAux( 31 44 : const InputParameters & parameters) 32 : : AuxKernel(parameters), 33 44 : _distance_to_surface(&getUserObject<ShortestDistanceToSurface>("distance_to_surface")) 34 : { 35 : // Ensure this kernel is used only on elemental variables 36 44 : if (isNodal()) 37 2 : paramError("variable", "This AuxKernel only supports Elemental fields"); 38 42 : } 39 : 40 : // computeValue - Perform distance calculation 41 : Real 42 1840448 : ElementCentroidToSurfaceDistanceAux::computeValue() 43 : { 44 : // distance value calculation 45 1840448 : const Point & pt = _current_elem->vertex_average(); 46 : 47 1840448 : const Point & closest_vec = _distance_to_surface->distanceVector(pt); 48 : 49 1840448 : return closest_vec.norm(); 50 : }