https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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)
32 this, true, Moose::VarKindType::VAR_SOLVER, Moose::VarFieldType::VAR_FIELD_STANDARD),
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
63
64void
65NodeElemConstraintBase::computeSecondaryValue(NumericVector<Number> & current_solution)
66{
67 const dof_id_type & dof_idx = _var.nodalDofIndex();
68 _qp = 0;
69 current_solution.set(dof_idx, computeQpSecondaryValue());
70}
71
72bool
Base class for all Constraint types.
Definition Constraint.h:20
unsigned int _qp
Definition Constraint.h:36
static InputParameters validParams()
Definition Constraint.C:15
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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...
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition MooseMesh.C:3718
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
const dof_id_type & nodalDofIndex() const override
Intermediate base class that ties together all the interfaces for getting MooseVariables with the Moo...
Enhances MooseVariableInterface interface provide values from neighbor elements.
virtual Real computeQpSecondaryValue()=0
Compute the value the secondary node should have at the beginning of a timestep.
bool _overwrite_secondary_residual
Whether or not the secondary's residual should be overwritten.
VariableTestValue _test_secondary
Shape function on the secondary side. This will always only have one entry and that entry will always...
VariablePhiValue _phi_secondary
Shape function on the secondary side.
static InputParameters validParams()
MooseVariable & _var
secondary node variable
NodeElemConstraintBase(const InputParameters &parameters)
virtual bool overwriteSecondaryResidual() const
Whether or not the secondary'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.
MooseMesh & _mesh
Reference to this Kernel's mesh object.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...