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 "VariableValueTransferAux.h" 11 : #include "SystemBase.h" 12 : #include "NearestNodeLocator.h" 13 : #include "PenetrationLocator.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", VariableValueTransferAux); 16 : 17 : InputParameters 18 662 : VariableValueTransferAux::validParams() 19 : { 20 662 : InputParameters params = AuxKernel::validParams(); 21 662 : params.addClassDescription("Retrieves a field value from the closest node on the paired boundary " 22 : "and stores it on this boundary or block."); 23 662 : params.set<bool>("_dual_restrictable") = true; 24 1324 : params.addRequiredParam<BoundaryName>("paired_boundary", "The boundary to get the value from."); 25 1324 : params.addRequiredCoupledVar("paired_variable", "The variable to get the value of."); 26 662 : return params; 27 0 : } 28 : 29 374 : VariableValueTransferAux::VariableValueTransferAux(const InputParameters & parameters) 30 : : AuxKernel(parameters), 31 374 : _penetration_locator(getPenetrationLocator( 32 374 : parameters.get<BoundaryName>("paired_boundary"), boundaryNames()[0], Order(FIRST))), 33 374 : _nearest_node(_penetration_locator._nearest_node), 34 374 : _serialized_solution(_nl_sys.currentSolution()), 35 748 : _paired_variable(coupled("paired_variable")) 36 : { 37 374 : if (boundaryNames().size() > 1) 38 0 : mooseError(name(), ": You can only use one boundary at a time!"); 39 374 : _penetration_locator.setCheckWhetherReasonable(false); 40 374 : } 41 : 42 : Real 43 130546 : VariableValueTransferAux::computeValue() 44 : { 45 : // Assumes the variable you are coupling to is from the nonlinear system for now. 46 130546 : const Node * nearest = _nearest_node.nearestNode(_current_node->id()); 47 : mooseAssert(nearest != NULL, "I do not have the nearest node for you"); 48 130546 : dof_id_type dof_number = nearest->dof_number(_nl_sys.number(), _paired_variable, 0); 49 : 50 130546 : return (*_serialized_solution)(dof_number); 51 : }