https://mooseframework.inl.gov
GatherRCDataElementThread.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 #include "INSFVAttributes.h"
13 #include "FVElementalKernel.h"
14 #include "FVTimeKernel.h"
15 
17  const unsigned int nl_sys_number,
18  const std::vector<unsigned int> & vars)
19  : ThreadedElementLoop<ConstElemRange>(fe_problem), _nl_system_num(nl_sys_number), _vars(vars)
20 {
21 }
22 
23 // Splitting Constructor
25  Threads::split split)
26  : ThreadedElementLoop<ConstElemRange>(x, split), _nl_system_num(x._nl_system_num), _vars(x._vars)
27 {
28 }
29 
30 void
32 {
34 
36 
37  auto queries = _fe_problem.theWarehouse()
38  .query()
39  .template condition<AttribSystem>("FVElementalKernel")
40  .template condition<AttribSysNum>(this->_nl_system_num)
41  .template condition<AttribThread>(_tid)
42  .template condition<AttribSubdomains>(_subdomain);
43 
44  for (const auto var_num : _vars)
45  {
46  // We don't want to do cascading var num attributes or else the second time around we won't get
47  // any results out of the query (e.g. an object cannot have a variable that simultaneously has
48  // both var number 0 and 1)
49  auto copied_queries = queries;
50  std::vector<FVElementalKernel *> var_eks;
51  copied_queries.template condition<AttribVar>(static_cast<int>(var_num)).queryInto(var_eks);
52  for (auto var_ek : var_eks)
53  if (auto insfv_ek = dynamic_cast<INSFVMomentumResidualObject *>(var_ek))
54  _insfv_elemental_kernels.push_back(insfv_ek);
55  }
56 }
57 
58 void
59 GatherRCDataElementThread::onElement(const Elem * const elem)
60 {
61  mooseAssert(elem && elem->subdomain_id() == _subdomain, "sub ids don't match");
62 
63  for (auto * const insfv_ek : _insfv_elemental_kernels)
64  insfv_ek->gatherRCData(*elem);
65 }
A class that gathers body force data from elemental kernels contributing to the Navier-Stokes momentu...
void subdomainChanged() override final
void onElement(const Elem *elem) override final
GatherRCDataElementThread(FEProblemBase &fe_problem, const unsigned int _nl_sys_number, const std::vector< unsigned int > &vars)
char ** vars
virtual void subdomainChanged()
std::vector< INSFVMomentumResidualObject * > _insfv_elemental_kernels
The collection of elemental kernels that contributive to the momentum equation residuals.
StoredRange< MeshBase::const_element_iterator, const Elem *> ConstElemRange
const std::vector< unsigned int > & _vars
The velocity variable numbers.
TheWarehouse & theWarehouse() const
const std::vector< double > x
tbb::split split
Query query()