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 const TheWarehouse::Query & query)
21 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem),
22 _aux_sys(fe_problem.getAuxiliarySystem()),
23 _all_kernels_query(query),
24 _query_boundary(query)
25{
26}
27
28// Splitting Constructor
29template <typename AuxKernelType>
31 Threads::split split)
32 : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split),
33 _aux_sys(x._aux_sys),
34 _all_kernels_query(x._all_kernels_query),
35 _query_boundary(x._query_boundary)
36{
37}
38
39template <typename AuxKernelType>
40void
42{
43 const BndNode * bnode = *node_it;
44
45 BoundaryID boundary_id = bnode->_bnd_id;
46
47 Node * node = bnode->_node;
48
49 if (node->processor_id() == _fe_problem.processor_id())
50 {
51 // Only kernels actually restricted to this boundary - unrestricted ones are already handled
52 // by the block-based nodal loop.
53 std::vector<AuxKernelType *> kernels;
54 _query_boundary.queryInto(
55 kernels, _tid, std::make_tuple(boundary_id, /*must_be_restricted=*/true));
56
57 if (kernels.size())
58 {
59 _fe_problem.reinitNodeFace(node, boundary_id, _tid);
60
61 for (const auto & aux : kernels)
62 {
63 aux->compute();
64 // This is the same conditional check that the aux kernel performs internally before calling
65 // computeValue and _var.setNodalValue. We don't want to attempt to insert into the solution
66 // if we don't actually have any dofs on this node
67 if (aux->variable().isNodalDefined())
68 aux->variable().insert(_aux_sys.solution());
69 }
70 }
71 }
72}
73
74template <typename AuxKernelType>
75void
79
80template <typename AuxKernelType>
81void
83{
84 if (!_fe_problem.shouldPrintExecution(_tid))
85 return;
86
87 std::vector<AuxKernelType *> all_kernels;
88 // clone the query until we have a const query, see #32362
89 _all_kernels_query.clone().condition<AttribThread>(_tid).queryInto(all_kernels);
90 if (all_kernels.empty())
91 return;
92
93 const auto & console = _fe_problem.console();
94 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
95 console << "[DBG] Executing nodal auxiliary kernels on boundary nodes on " << execute_on
96 << std::endl;
97 console << "[DBG] Ordering of the kernels on each boundary they are defined on:" << std::endl;
98 printExecutionOrdering<AuxKernelType>(all_kernels, /*print_header=*/false);
99}
100
boundary_id_type BoundaryID
ComputeNodalAuxBcsThread(FEProblemBase &fe_problem, const TheWarehouse::Query &query)
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.
QueryCache is a convenient way to construct and pass around (possible partially constructed) warehous...
const object_type * const_iterator
query_obj query
BoundaryID _bnd_id
boundary id for the node
Definition BndNode.h:26
libMesh::Node * _node
pointer to the node
Definition BndNode.h:24