www.mooseframework.org
InterfaceKernelBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "InterfaceKernelBase.h"
11 
12 // MOOSE includes
13 #include "Assembly.h"
14 #include "MooseVariableFE.h"
15 #include "SystemBase.h"
16 
17 #include "libmesh/quadrature.h"
18 
21 {
25 
26  params.addParam<bool>("use_displaced_mesh",
27  false,
28  "Whether or not this object should use the "
29  "displaced mesh for computation. Note that in "
30  "the case this is true but no displacements "
31  "are provided in the Mesh block the "
32  "undisplaced mesh will still be used.");
33  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
34 
35  params.declareControllable("enable");
36  params.addRequiredCoupledVar("neighbor_var", "The variable on the other side of the interface.");
37  params.set<std::string>("_moose_base") = "InterfaceKernel";
38  params.addParam<std::vector<AuxVariableName>>(
39  "save_in",
40  {},
41  "The name of auxiliary variables to save this Kernel's residual contributions to. "
42  " Everything about that variable must match everything about this variable (the "
43  "type, what blocks it's on, etc.)");
44  params.addParam<std::vector<AuxVariableName>>(
45  "diag_save_in",
46  {},
47  "The name of auxiliary variables to save this Kernel's diagonal Jacobian "
48  "contributions to. Everything about that variable must match everything "
49  "about this variable (the type, what blocks it's on, etc.)");
50 
51  MultiMooseEnum save_in_var_side("m s");
52  params.addParam<MultiMooseEnum>(
53  "save_in_var_side",
54  save_in_var_side,
55  "This parameter must exist if save_in variables are specified and must have the same length "
56  "as save_in. This vector specifies whether the corresponding aux_var should save-in "
57  "residual contributions from the primary ('p') or secondary side ('s').");
58  params.addParam<MultiMooseEnum>(
59  "diag_save_in_var_side",
60  save_in_var_side,
61  "This parameter must exist if diag_save_in variables are specified and must have the same "
62  "length as diag_save_in. This vector specifies whether the corresponding aux_var should "
63  "save-in jacobian contributions from the primary ('p') or secondary side ('s').");
64  params.addParamNamesToGroup("diag_save_in save_in save_in_var_side diag_save_in_var_side",
65  "Advanced");
66 
67  // InterfaceKernels always need one layer of ghosting.
68  params.addRelationshipManager("ElementSideNeighborLayers",
72  return params;
73 }
74 
75 // Static mutex definitions
76 Threads::spin_mutex InterfaceKernelBase::_resid_vars_mutex;
77 Threads::spin_mutex InterfaceKernelBase::_jacoby_vars_mutex;
78 
80  : NeighborResidualObject(parameters),
81  BoundaryRestrictable(this, false), // false for _not_ nodal
83  TwoMaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()),
84  ElementIDInterface(this),
85  _current_elem(_assembly.elem()),
86  _current_elem_volume(_assembly.elemVolume()),
87  _neighbor_elem(_assembly.neighbor()),
88  _neighbor_elem_volume(_assembly.neighborVolume()),
89  _current_side(_assembly.side()),
90  _current_side_elem(_assembly.sideElem()),
91  _current_side_volume(_assembly.sideElemVolume()),
92  _coord_sys(_assembly.coordSystem()),
93  _q_point(_assembly.qPointsFace()),
94  _qrule(_assembly.qRuleFace()),
95  _JxW(_assembly.JxWFace()),
96  _coord(_assembly.coordTransformation()),
97  _save_in_var_side(parameters.get<MultiMooseEnum>("save_in_var_side")),
98  _save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
99  _diag_save_in_var_side(parameters.get<MultiMooseEnum>("diag_save_in_var_side")),
100  _diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in"))
101 
102 {
103 }
104 
105 const Real &
107 {
108  return _assembly.neighborVolume();
109 }
110 
111 void
112 InterfaceKernelBase::prepareShapes(const unsigned int var_num)
113 {
115 }
const Real & neighborVolume()
Returns the reference to the current neighbor volume.
Definition: Assembly.h:461
static Threads::spin_mutex _resid_vars_mutex
Mutex that prevents multiple threads from saving into the residual aux_var at the same time...
static InputParameters validParams()
Intermediate base class that ties together all the interfaces for getting MooseVariables with the Moo...
static InputParameters validParams()
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:1147
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
THREAD_ID _tid
The thread ID for this kernel.
const Real & getNeighborElemVolume()
The volume of the current neighbor.
InterfaceKernelBase(const InputParameters &parameters)
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
SubProblem & _subproblem
Reference to this kernel&#39;s SubProblem.
static InputParameters validParams()
This is a base class for objects that can provide residual contributions for both local and neighbor ...
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
static Threads::spin_mutex _jacoby_vars_mutex
Mutex that prevents multiple threads from saving into the jacobian aux_var at the same time...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const std::set< SubdomainID > EMPTY_BLOCK_IDS
Definition: MooseTypes.h:596
This interface is designed for DGKernel, InternalSideUserObject, InterfaceUserObject, where material properties on a side of both its primary side (face) and its secondary side (neighbor) all required.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
virtual void prepareFaceShapes(unsigned int var, const THREAD_ID tid)=0
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...