LCOV - code coverage report
Current view: top level - src/auxkernels - VariableValueTransferAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 20 22 90.9 %
Date: 2026-05-29 20:41:18 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14