https://mooseframework.inl.gov
VariableValueTransferAux.C
Go to the documentation of this file.
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 
11 #include "SystemBase.h"
12 #include "NearestNodeLocator.h"
13 #include "PenetrationLocator.h"
14 
15 registerMooseObject("ThermalHydraulicsApp", VariableValueTransferAux);
16 
19 {
21  params.addClassDescription("Retrieves a field value from the closest node on the paired boundary "
22  "and stores it on this boundary or block.");
23  params.set<bool>("_dual_restrictable") = true;
24  params.addRequiredParam<BoundaryName>("paired_boundary", "The boundary to get the value from.");
25  params.addRequiredCoupledVar("paired_variable", "The variable to get the value of.");
26  return params;
27 }
28 
30  : AuxKernel(parameters),
31  _penetration_locator(getPenetrationLocator(
32  parameters.get<BoundaryName>("paired_boundary"), boundaryNames()[0], Order(FIRST))),
33  _nearest_node(_penetration_locator._nearest_node),
34  _serialized_solution(_nl_sys.currentSolution()),
35  _paired_variable(coupled("paired_variable"))
36 {
37  if (boundaryNames().size() > 1)
38  mooseError(name(), ": You can only use one boundary at a time!");
40 }
41 
42 Real
44 {
45  // Assumes the variable you are coupling to is from the nonlinear system for now.
46  const Node * nearest = _nearest_node.nearestNode(_current_node->id());
47  mooseAssert(nearest != NULL, "I do not have the nearest node for you");
48  dof_id_type dof_number = nearest->dof_number(_nl_sys.number(), _paired_variable, 0);
49 
50  return (*_serialized_solution)(dof_number);
51 }
PenetrationLocator & _penetration_locator
Order
const Node *const & _current_node
FIRST
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
VariableValueTransferAux(const InputParameters &parameters)
unsigned int number() const
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Transfer variable values from a surface of a 2D mesh onto 1D mesh.
const Node * nearestNode(dof_id_type node_id)
void mooseError(Args &&... args) const
const NumericVector< Number > *const & _serialized_solution
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
const std::vector< BoundaryName > & boundaryNames() const
NearestNodeLocator & _nearest_node
void setCheckWhetherReasonable(bool state)
const Elem & get(const ElemType type_in)
registerMooseObject("ThermalHydraulicsApp", VariableValueTransferAux)
virtual Real computeValue() override
uint8_t dof_id_type