https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeNodalAuxBcsThread.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 "libmesh/threads.h"
11
12// MOOSE includes
14#include "AuxiliarySystem.h"
15#include "FEProblem.h"
16#include "AuxKernel.h"
17
18template <typename AuxKernelType>
20 FEProblemBase & fe_problem, const MooseObjectWarehouse<AuxKernelType> & storage)
21 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem),
22 _aux_sys(fe_problem.getAuxiliarySystem()),
23 _storage(storage)
24{
25}
26
27// Splitting Constructor
28template <typename AuxKernelType>
30 Threads::split split)
31 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split),
32 _aux_sys(x._aux_sys),
33 _storage(x._storage)
34{
35}
36
37template <typename AuxKernelType>
38void
40{
41 const BndNode * bnode = *node_it;
42
43 BoundaryID boundary_id = bnode->_bnd_id;
44
45 Node * node = bnode->_node;
46
47 if (node->processor_id() == _fe_problem.processor_id())
48 {
49 // Get a map of all active block restricted AuxKernel objects
50 const auto & kernels = _storage.getActiveBoundaryObjects(_tid);
51
52 // Operate on the node BoundaryID only
53 const auto iter = kernels.find(boundary_id);
54 if (iter != kernels.end())
55 {
56 _fe_problem.reinitNodeFace(node, boundary_id, _tid);
57
58 for (const auto & aux : iter->second)
59 {
60 aux->compute();
61 // This is the same conditional check that the aux kernel performs internally before calling
62 // computeValue and _var.setNodalValue. We don't want to attempt to insert into the solution
63 // if we don't actually have any dofs on this node
64 if (aux->variable().isNodalDefined())
65 aux->variable().insert(_aux_sys.solution());
66 }
67 }
68 }
69}
70
71template <typename AuxKernelType>
72void
76
77template <typename AuxKernelType>
78void
80{
81 if (!_fe_problem.shouldPrintExecution(_tid) || !_storage.hasActiveObjects())
82 return;
83
84 const auto & console = _fe_problem.console();
85 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
86 console << "[DBG] Executing nodal auxiliary kernels on boundary nodes on " << execute_on
87 << std::endl;
88 console << "[DBG] Ordering of the kernels on each boundary they are defined on:" << std::endl;
89 // TODO Check that all objects are active at this point
90 console << _storage.activeObjectsToFormattedString() << std::endl;
91}
92
boundary_id_type BoundaryID
ComputeNodalAuxBcsThread(FEProblemBase &fe_problem, const MooseObjectWarehouse< AuxKernelType > &storage)
void printGeneralExecutionInformation() const override
Print information about the loop, mostly order of execution of objects.
virtual void onNode(ConstBndNodeRange::const_iterator &node_it) override
void join(const ComputeNodalAuxBcsThread &)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
A storage container for MooseObjects that inherit from SetupInterface.
vec_type::const_iterator const_iterator
BoundaryID _bnd_id
boundary id for the node
Definition BndNode.h:26
libMesh::Node * _node
pointer to the node
Definition BndNode.h:24