https://mooseframework.inl.gov
NodeElemConstraintBase.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 
10 #include "NodeElemConstraintBase.h"
11 
12 #include "MooseVariableFE.h"
13 #include "SystemBase.h"
14 
17 {
19  params.addRequiredParam<SubdomainName>("secondary", "secondary block id");
20  params.addRequiredParam<SubdomainName>("primary", "primary block id");
21  params.addRequiredCoupledVar("primary_variable",
22  "The variable on the primary side of the domain");
23  return params;
24 }
25 
27  : Constraint(parameters),
28  // The secondary side is at nodes (hence passing 'true'). The neighbor side is the primary side
29  // and it is not at nodes (so passing false)
33  _var(_sys.getFieldVariable<Real>(_tid, parameters.get<NonlinearVariableName>("variable"))),
34  _primary_var(*getVar("primary_variable", 0)),
35 
36  _secondary(_mesh.getSubdomainID(getParam<SubdomainName>("secondary"))),
37  _primary(_mesh.getSubdomainID(getParam<SubdomainName>("primary"))),
38 
39  _current_node(_var.node()),
40  _current_elem(_var.neighbor()),
41 
42  _phi_secondary(1),
43  _test_secondary(1), // One entry
44 
45  _phi_primary(_assembly.phiNeighbor(_primary_var)),
46  _test_primary(_var.phiNeighbor()),
47 
48  _node_to_elem_map(_mesh.nodeToElemMap()),
49  _overwrite_secondary_residual(false)
50 {
52  _mesh.errorIfDistributedMesh("NodeElemConstraintBase");
53  // Put a "1" into test_secondary
54  // will always only have one entry that is 1
55  _test_secondary[0].push_back(1);
56 }
57 
59 {
61  _test_secondary.release();
62 }
63 
64 void
66 {
67  const dof_id_type & dof_idx = _var.nodalDofIndex();
68  _qp = 0;
69  current_solution.set(dof_idx, computeQpSecondaryValue());
70 }
71 
72 bool
74 {
76 }
MooseMesh & _mesh
Reference to this Kernel&#39;s mesh object.
VarFieldType
Definition: MooseTypes.h:721
virtual bool overwriteSecondaryResidual() const
Whether or not the secondary&#39;s residual should be overwritten.
Intermediate base class that ties together all the interfaces for getting MooseVariables with the Moo...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
Base class for all Constraint types.
Definition: Constraint.h:19
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool _overwrite_secondary_residual
Whether or not the secondary&#39;s residual should be overwritten.
void computeSecondaryValue(NumericVector< Number > &current_solution)
Compute the value the secondary node should have at the beginning of a timestep.
VariableTestValue _test_secondary
Shape function on the secondary side. This will always only have one entry and that entry will always...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
SubdomainID getSubdomainID(const SubdomainName &subdomain_name, const MeshBase &mesh)
Gets the subdomain ID associated with the given SubdomainName.
NodeElemConstraintBase(const InputParameters &parameters)
MooseVariable & _var
secondary node variable
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition: MooseMesh.C:3612
virtual Real computeQpSecondaryValue()=0
Compute the value the secondary node should have at the beginning of a timestep.
Enhances MooseVariableInterface interface provide values from neighbor elements.
VariablePhiValue _phi_secondary
Shape function on the secondary side.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:714
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const dof_id_type & nodalDofIndex() const override
void release()
Manually deallocates the data pointer.
Definition: MooseArray.h:66
static InputParameters validParams()
virtual void set(const numeric_index_type i, const Number value)=0
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
static InputParameters validParams()
Definition: Constraint.C:15
unsigned int _qp
Definition: Constraint.h:36
uint8_t dof_id_type