https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
42Real
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}
registerMooseObject("ThermalHydraulicsApp", VariableValueTransferAux)
const Node *const & _current_node
static InputParameters validParams()
const std::vector< BoundaryName > & boundaryNames() const
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
const std::string & name() const
void mooseError(Args &&... args) const
const Node * nearestNode(dof_id_type node_id)
void setCheckWhetherReasonable(bool state)
unsigned int number() const
Transfer variable values from a surface of a 2D mesh onto 1D mesh.
virtual Real computeValue() override
const NumericVector< Number > *const & _serialized_solution
VariableValueTransferAux(const InputParameters &parameters)
PenetrationLocator & _penetration_locator
static InputParameters validParams()