https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeNodalKernelBcsThread.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// MOOSE includes
13#include "AuxiliarySystem.h"
14#include "FEProblem.h"
15#include "MooseVariableFE.h"
16#include "NodalKernelBase.h"
17
18#include "libmesh/threads.h"
19
21 FEProblemBase & fe_problem,
23 const std::set<TagID> & tags)
24 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem),
25 _fe_problem(fe_problem),
26 _aux_sys(fe_problem.getAuxiliarySystem()),
27 _tags(tags),
28 _nodal_kernels(nodal_kernels),
29 _num_cached(0)
30{
31}
32
33// Splitting Constructor
35 Threads::split split)
36 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split),
37 _fe_problem(x._fe_problem),
38 _aux_sys(x._aux_sys),
39 _tags(x._tags),
40 _nodal_kernels(x._nodal_kernels),
41 _num_cached(0)
42{
43}
44
45void
57
58void
60{
61 const BndNode * bnode = *node_it;
62
63 BoundaryID boundary_id = bnode->_bnd_id;
64
65 // prepare variables
66 for (auto * var : _aux_sys._nodal_vars[_tid])
67 var->prepareAux();
68
70 {
71 Node * node = bnode->_node;
72 if (node->processor_id() == _fe_problem.processor_id())
73 {
74 std::set<TagID> needed_fe_var_vector_tags;
76 boundary_id, needed_fe_var_vector_tags, _tid);
78
79 _fe_problem.reinitNodeFace(node, boundary_id, _tid);
80 const auto & objects = _nkernel_warehouse->getActiveBoundaryObjects(boundary_id, _tid);
81 for (const auto & nodal_kernel : objects)
82 {
83 nodal_kernel->setSubdomains(Moose::NodeArg::undefined_subdomain_connection);
84 nodal_kernel->computeResidual();
85 }
86
88 }
89 }
90
91 if (_num_cached == 20) // cache 20 nodes worth before adding into the residual
92 {
93 _num_cached = 0;
95 }
96}
97
98void
102
103void
105{
107 return;
108
109 const auto & console = _fe_problem.console();
110 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
111 console << "[DBG] Executing nodal kernels contribution to residual on nodes on " << execute_on
112 << std::endl;
113 console << "[DBG] Ordering of the nodal kernels on the nodes they are defined on:" << std::endl;
114 console << _nkernel_warehouse->activeObjectsToFormattedString() << std::endl;
115}
boundary_id_type BoundaryID
std::vector< std::vector< MooseVariableFEBase * > > _nodal_vars
void join(const ComputeNodalKernelBcsThread &)
ComputeNodalKernelBcsThread(FEProblemBase &fe_problem, MooseObjectTagWarehouse< NodalKernelBase > &nodal_kernels, const std::set< TagID > &tags)
MooseObjectWarehouse< NodalKernelBase > * _nkernel_warehouse
virtual void onNode(ConstBndNodeRange::const_iterator &node_it) override
void printGeneralExecutionInformation() const override
Print information about the loop, mostly order of execution of objects.
virtual void pre() override
Called before the node range loop.
MooseObjectTagWarehouse< NodalKernelBase > & _nodal_kernels
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void addCachedResidual(const THREAD_ID tid) override
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
A storage container for MooseObjects that inherit from SetupInterface.
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag.
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
std::string activeObjectsToFormattedString(THREAD_ID tid=0, const std::string &prefix="[DBG]") const
Output the active content of the warehouse to a string, meant to be output to the console.
void updateBoundaryFEVariableCoupledVectorTagDependency(BoundaryID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
bool hasActiveObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConsoleStream & console() const
Return console handle.
Definition Problem.h:48
virtual unsigned int numVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
The total number of tags, which can be limited to the tag type.
Definition SubProblem.C:196
processor_id_type processor_id() const
vec_type::const_iterator const_iterator
@ VECTOR_TAG_RESIDUAL
BoundaryID _bnd_id
boundary id for the node
Definition BndNode.h:26
libMesh::Node * _node
pointer to the node
Definition BndNode.h:24
static const std::set< SubdomainID > undefined_subdomain_connection
A static member that can be used when the connection of a node to subdomains is unknown.