https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeResidualThread Class Reference

#include <ComputeResidualThread.h>

Inheritance diagram for ComputeResidualThread:
[legend]

Public Member Functions

 ComputeResidualThread (FEProblemBase &fe_problem, const std::set< TagID > &tags)
 
 ComputeResidualThread (ComputeResidualThread &x, Threads::split split)
 
virtual ~ComputeResidualThread ()
 
void join (const ComputeResidualThread &)
 
virtual void operator() (const ConstElemRange &range, bool bypass_threading=false) override
 
virtual void subdomainChanged () override
 Called every time the current subdomain changes (i.e. More...
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called when doing boundary assembling. More...
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id) override
 Called when doing interface assembling. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side) override
 Called when doing internal edge assembling. More...
 
virtual void postElement (const Elem *) override
 Called after the element assembly is done (including surface assembling) More...
 
virtual void post () override
 Called after the element range loop. More...
 
bool shouldComputeInternalSide (const Elem &elem, const Elem &neighbor) const override
 Whether to compute the internal side for the provided element-neighbor pair. More...
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing () override
 Whether or not the loop should continue. More...
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly. More...
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side. More...
 
virtual void preBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called before the boundary assembly. More...
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e. More...
 
virtual void pre ()
 Called before the element range loop. More...
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. More...
 
virtual void onExternalSide (const Elem *elem, unsigned int side)
 Called when iterating over external sides (no side neighbor) More...
 

Protected Member Functions

virtual void compute (ResidualObject &ro) override
 Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class. More...
 
virtual void computeOnInternalFace () override
 
void accumulateNeighbor () override
 Add neighbor residual/Jacobian into assembly global data. More...
 
void accumulateNeighborLower () override
 Add neighbor and lower residual/Jacobian into assembly global data. More...
 
void accumulateLower () override
 Add lower-d residual/Jacobian into assembly global data. More...
 
void accumulate () override
 Add element residual/Jacobian into assembly global data. More...
 
void determineObjectWarehouses () override
 Determine the objects we will actually compute based on vector/matrix tag information. More...
 
std::string objectType () const override
 Return what the loops is meant to compute. More...
 
virtual void compute (ResidualObject &ro)=0
 Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class. More...
 
virtual void compute (KernelBase &kernel)
 
virtual void compute (FVElementalKernel &kernel)
 
virtual void compute (IntegratedBCBase &bc)
 
virtual void compute (DGKernelBase &dg, const Elem *neighbor)
 
virtual void compute (InterfaceKernelBase &ik)
 
virtual void computeOnInternalFace (const Elem *neighbor)
 
virtual void computeOnInternalFace ()=0
 
void prepareFace (const Elem *elem, unsigned int side, BoundaryID bnd_id=Moose::INVALID_BOUNDARY_ID, const Elem *lower_d_elem=nullptr)
 Reinitialize variables and materials on a face. More...
 
void printGeneralExecutionInformation () const override
 Print information about the loop, mostly order of execution of objects. More...
 
void printBlockExecutionInformation () const override
 Print list of specific objects executed on each block and in which order. More...
 
void printBoundaryExecutionInformation (const unsigned int bid) const override
 Print list of specific objects executed on each boundary and in which order. More...
 
void prepareElement (const Elem *elem)
 
void clearVarsAndMaterials ()
 
void printExecutionOrdering (const std::vector< T * > &objs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 Routine to output the ordering of objects within a vector of pointers to these objects. More...
 
void printExecutionOrdering (const std::vector< std::shared_ptr< T >> &objs_ptrs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 
void resetExecPrintedSets () const
 Resets the set of blocks and boundaries visited. More...
 
virtual void computeOnElement ()
 
virtual void computeOnBoundary (BoundaryID bnd_id, const Elem *lower_d_elem)
 
virtual void computeOnInterface (BoundaryID bnd_id)
 
virtual void computeOnInternalFace (const Elem *neighbor)
 
virtual void compute (KernelBase &kernel)
 
virtual void compute (FVElementalKernel &kernel)
 
virtual void compute (IntegratedBCBase &bc)
 
virtual void compute (DGKernelBase &dg, const Elem *neighbor)
 
virtual void compute (InterfaceKernelBase &ik)
 

Protected Attributes

const std::set< TagID > & _tags
 the tags denoting the vectors we want our residual objects to fill More...
 
NonlinearSystemBase_nl
 
unsigned int _num_cached
 
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
 Reference to BC storage structures. More...
 
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
 
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
 Reference to DGKernel storage structure. More...
 
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
 
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
 Reference to interface kernel storage structure. More...
 
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
 
std::vector< FVElementalKernel * > _fv_kernels
 Current subdomain FVElementalKernels. More...
 
const bool _has_active_objects
 Whether there are any active residual objects; otherwise we will do an early return. More...
 
FEProblemBase_fe_problem
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element. More...
 
SubdomainID _old_subdomain
 The subdomain for the last element. More...
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor. More...
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor. More...
 
std::set< SubdomainID_blocks_exec_printed
 Keep track of which blocks were visited. More...
 
std::set< BoundaryID_boundaries_exec_printed
 Keep track of which boundaries were visited. More...
 
MooseObjectTagWarehouse< KernelBase > & _kernels
 
MooseObjectWarehouse< KernelBase > * _tag_kernels
 
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
 
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
 

Detailed Description

Definition at line 16 of file ComputeResidualThread.h.

Constructor & Destructor Documentation

◆ ComputeResidualThread() [1/2]

ComputeResidualThread::ComputeResidualThread ( FEProblemBase fe_problem,
const std::set< TagID > &  tags 
)

Definition at line 20 of file ComputeResidualThread.C.

22  : NonlinearThread(fe_problem), _tags(tags)
23 {
24 }
NonlinearThread(FEProblemBase &fe_problem)
const std::set< TagID > & _tags
the tags denoting the vectors we want our residual objects to fill

◆ ComputeResidualThread() [2/2]

ComputeResidualThread::ComputeResidualThread ( ComputeResidualThread x,
Threads::split  split 
)

Definition at line 27 of file ComputeResidualThread.C.

29 {
30 }
NonlinearThread(FEProblemBase &fe_problem)
tbb::split split
const std::set< TagID > & _tags
the tags denoting the vectors we want our residual objects to fill

◆ ~ComputeResidualThread()

ComputeResidualThread::~ComputeResidualThread ( )
virtual

Definition at line 32 of file ComputeResidualThread.C.

32 {}

Member Function Documentation

◆ accumulate()

void ComputeResidualThread::accumulate ( )
overrideprotectedvirtual

Add element residual/Jacobian into assembly global data.

Implements NonlinearThread.

Definition at line 60 of file ComputeResidualThread.C.

61 {
63  _num_cached++;
64 
65  if (_num_cached % 20 == 0)
66  {
67  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
69  }
70 }
unsigned int _num_cached
virtual void cacheResidual(const THREAD_ID tid) override
virtual void addCachedResidual(const THREAD_ID tid) override

◆ accumulateLower()

void ComputeResidualThread::accumulateLower ( )
overrideprotectedvirtual

Add lower-d residual/Jacobian into assembly global data.

Implements NonlinearThread.

Definition at line 41 of file ComputeResidualThread.C.

42 {
44 }
virtual void addResidualLower(const THREAD_ID tid) override

◆ accumulateNeighbor()

void ComputeResidualThread::accumulateNeighbor ( )
overrideprotectedvirtual

Add neighbor residual/Jacobian into assembly global data.

Implements NonlinearThread.

Definition at line 47 of file ComputeResidualThread.C.

48 {
50 }
virtual void addResidualNeighbor(const THREAD_ID tid) override

◆ accumulateNeighborLower()

void ComputeResidualThread::accumulateNeighborLower ( )
overrideprotectedvirtual

Add neighbor and lower residual/Jacobian into assembly global data.

Implements NonlinearThread.

Definition at line 53 of file ComputeResidualThread.C.

54 {
57 }
virtual void addResidualLower(const THREAD_ID tid) override
virtual void addResidualNeighbor(const THREAD_ID tid) override

◆ caughtMooseException()

void ThreadedElementLoop< ConstElemRange >::caughtMooseException ( MooseException e)
overridevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 105 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

106 {
107  Threads::spin_mutex::scoped_lock lock(threaded_element_mutex);
108 
109  std::string what(e.what());
111 }
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
static Threads::spin_mutex threaded_element_mutex
This mutex is used by all derived classes of the ThreadedElementLoop.

◆ clearVarsAndMaterials()

void ThreadedElementLoop< ConstElemRange >::clearVarsAndMaterials ( )
protectedinherited

Definition at line 195 of file ThreadedElementLoop.h.

Referenced by NonlinearThread::post().

196 {
199 }
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
virtual void clearActiveElementalMooseVariables(const THREAD_ID tid) override
Clear the active elemental MooseVariableFEBase.

◆ compute() [1/12]

virtual void NonlinearThread::compute
protected

Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class.

◆ compute() [2/12]

void NonlinearThread::compute
protected

Defaults to forwarding to the residual object class

Definition at line 284 of file NonlinearThread.C.

285 {
286  compute(static_cast<ResidualObject &>(kernel));
287 }
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [3/12]

void NonlinearThread::compute
protected

Definition at line 290 of file NonlinearThread.C.

291 {
292  compute(static_cast<ResidualObject &>(kernel));
293 }
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [4/12]

void NonlinearThread::compute
protected

Definition at line 296 of file NonlinearThread.C.

297 {
298  compute(static_cast<ResidualObject &>(bc));
299 }
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [5/12]

void NonlinearThread::compute
protected

Definition at line 302 of file NonlinearThread.C.

303 {
304  compute(static_cast<ResidualObject &>(dg));
305 }
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [6/12]

void NonlinearThread::compute
protected

Definition at line 308 of file NonlinearThread.C.

309 {
310  compute(static_cast<ResidualObject &>(ik));
311 }
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [7/12]

void ComputeResidualThread::compute ( ResidualObject ro)
overrideprotectedvirtual

Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class.

Implements NonlinearThread.

Definition at line 35 of file ComputeResidualThread.C.

36 {
37  ro.computeResidual();
38 }
virtual void computeResidual()=0
Compute this object&#39;s contribution to the residual.

◆ compute() [8/12]

void NonlinearThread::compute ( KernelBase kernel)
protectedvirtualinherited

Defaults to forwarding to the residual object class

Reimplemented in ComputeJacobianThread.

Definition at line 284 of file NonlinearThread.C.

285 {
286  compute(static_cast<ResidualObject &>(kernel));
287 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [9/12]

void NonlinearThread::compute ( FVElementalKernel kernel)
protectedvirtualinherited

Reimplemented in ComputeJacobianThread.

Definition at line 290 of file NonlinearThread.C.

291 {
292  compute(static_cast<ResidualObject &>(kernel));
293 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [10/12]

void NonlinearThread::compute ( IntegratedBCBase bc)
protectedvirtualinherited

Reimplemented in ComputeJacobianThread.

Definition at line 296 of file NonlinearThread.C.

297 {
298  compute(static_cast<ResidualObject &>(bc));
299 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [11/12]

void NonlinearThread::compute ( DGKernelBase dg,
const Elem *  neighbor 
)
protectedvirtualinherited

Reimplemented in ComputeJacobianThread.

Definition at line 302 of file NonlinearThread.C.

303 {
304  compute(static_cast<ResidualObject &>(dg));
305 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ compute() [12/12]

void NonlinearThread::compute ( InterfaceKernelBase ik)
protectedvirtualinherited

Reimplemented in ComputeJacobianThread.

Definition at line 308 of file NonlinearThread.C.

309 {
310  compute(static_cast<ResidualObject &>(ik));
311 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...

◆ computeOnBoundary()

void NonlinearThread::computeOnBoundary ( BoundaryID  bnd_id,
const Elem *  lower_d_elem 
)
protectedvirtualinherited

Reimplemented in ComputeFullJacobianThread.

Definition at line 181 of file NonlinearThread.C.

Referenced by NonlinearThread::onBoundary().

182 {
183  const auto & bcs = _ibc_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
184  for (const auto & bc : bcs)
185  if (bc->shouldApply())
186  compute(*bc);
187 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse

◆ computeOnElement()

void NonlinearThread::computeOnElement ( )
protectedvirtualinherited

Base class version just calls compute on each object for the element

Reimplemented in ComputeFullJacobianThread, and ComputeJacobianForScalingThread.

Definition at line 141 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::computeOnElement(), and NonlinearThread::onElement().

142 {
144  {
145  const auto & kernels = _tag_kernels->getActiveBlockObjects(_subdomain, _tid);
146  for (const auto & kernel : kernels)
147  compute(*kernel);
148  }
149 
150  if (_fe_problem.haveFV())
151  for (auto kernel : _fv_kernels)
152  compute(*kernel);
153 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< KernelBase > * _tag_kernels
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.

◆ computeOnInterface()

void NonlinearThread::computeOnInterface ( BoundaryID  bnd_id)
protectedvirtualinherited

Reimplemented in ComputeFullJacobianThread.

Definition at line 229 of file NonlinearThread.C.

Referenced by NonlinearThread::onInterface().

230 {
231  const auto & int_ks = _ik_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
232  for (const auto & interface_kernel : int_ks)
233  compute(*interface_kernel);
234 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const

◆ computeOnInternalFace() [1/4]

void NonlinearThread::computeOnInternalFace
protected

Definition at line 275 of file NonlinearThread.C.

276 {
277  const auto & dgks = _dg_warehouse->getActiveBlockObjects(_subdomain, _tid);
278  for (const auto & dg_kernel : dgks)
279  if (dg_kernel->hasBlocks(neighbor->subdomain_id()))
280  compute(*dg_kernel, neighbor);
281 }
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse

◆ computeOnInternalFace() [2/4]

virtual void NonlinearThread::computeOnInternalFace
protected

◆ computeOnInternalFace() [3/4]

void ComputeResidualThread::computeOnInternalFace ( )
overrideprotectedvirtual

Implements NonlinearThread.

Definition at line 125 of file ComputeResidualThread.C.

126 {
128  "We should not be called if we have no active HDG kernels");
129  for (const auto & hdg_kernel : _hdg_warehouse->getActiveBlockObjects(_subdomain, _tid))
130  {
131  mooseAssert(
132  hdg_kernel->hasBlocks(_subdomain),
133  "We queried the warehouse for active blocks on this subdomain, so this better be active");
134  mooseAssert(
136  "We should have set a valid neighbor subdomain ID if we made it in side this method");
137  if (hdg_kernel->hasBlocks(_neighbor_subdomain))
138  hdg_kernel->computeResidualOnSide();
139  }
140 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.C:20
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
SubdomainID _subdomain
The subdomain for the current element.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.

◆ computeOnInternalFace() [4/4]

void NonlinearThread::computeOnInternalFace ( const Elem *  neighbor)
protectedvirtualinherited

Reimplemented in ComputeFullJacobianThread.

Definition at line 275 of file NonlinearThread.C.

276 {
277  const auto & dgks = _dg_warehouse->getActiveBlockObjects(_subdomain, _tid);
278  for (const auto & dg_kernel : dgks)
279  if (dg_kernel->hasBlocks(neighbor->subdomain_id()))
280  compute(*dg_kernel, neighbor);
281 }
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse

◆ determineObjectWarehouses()

void ComputeResidualThread::determineObjectWarehouses ( )
overrideprotectedvirtual

Determine the objects we will actually compute based on vector/matrix tag information.

Implements NonlinearThread.

Definition at line 78 of file ComputeResidualThread.C.

79 {
80  // If users pass a empty vector or a full size of vector,
81  // we take all kernels
83  {
89  }
90  // If we have one tag only,
91  // We call tag based storage
92  else if (_tags.size() == 1)
93  {
99  }
100  // This one may be expensive
101  else
102  {
108  }
109 
110  if (_fe_problem.haveFV())
111  {
112  _fv_kernels.clear();
114  .query()
115  .template condition<AttribSysNum>(_nl.number())
116  .template condition<AttribSystem>("FVElementalKernel")
117  .template condition<AttribSubdomains>(_subdomain)
118  .template condition<AttribThread>(_tid)
119  .template condition<AttribVectorTags>(_tags)
120  .queryInto(_fv_kernels);
121  }
122 }
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
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...
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > & _kernels
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
NonlinearSystemBase & _nl
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
const std::set< TagID > & _tags
the tags denoting the vectors we want our residual objects to fill
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
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:195
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.

◆ join()

void ComputeResidualThread::join ( const ComputeResidualThread )

Definition at line 73 of file ComputeResidualThread.C.

74 {
75 }

◆ keepGoing()

virtual bool ThreadedElementLoop< ConstElemRange >::keepGoing ( )
inlineoverridevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 45 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

45 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.

◆ neighborSubdomainChanged()

void ThreadedElementLoop< ConstElemRange >::neighborSubdomainChanged ( )
overridevirtualinherited

Called every time the neighbor subdomain changes (i.e.

the subdomain of this neighbor is not the same as the subdomain of the last neighbor). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 139 of file ThreadedElementLoop.h.

140 {
143 }
Base class for assembly-like calculations.
virtual void neighborSubdomainSetup(SubdomainID subdomain, const THREAD_ID tid)

◆ objectType()

std::string ComputeResidualThread::objectType ( ) const
inlineoverrideprotectedvirtual

Return what the loops is meant to compute.

Reimplemented from NonlinearThread.

Definition at line 40 of file ComputeResidualThread.h.

40 { return "Residual"; }

◆ onBoundary()

void NonlinearThread::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtualinherited

Called when doing boundary assembling.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 156 of file NonlinearThread.C.

160 {
162  {
163  // Set up Sentinel class so that, after we swap in reinitMaterialsFace in prepareFace, even if
164  // one of our callees throws we remember to swap back during stack unwinding. We put our
165  // sentinel here as opposed to in prepareFace because we certainly don't want our materials
166  // swapped back before we proceed to residual/Jacobian computation
168 
169  prepareFace(elem, side, bnd_id, lower_d_elem);
170  computeOnBoundary(bnd_id, lower_d_elem);
171 
172  if (lower_d_elem)
173  {
174  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
175  accumulateLower();
176  }
177  }
178 }
virtual void accumulateLower()=0
Add lower-d residual/Jacobian into assembly global data.
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem)
void prepareFace(const Elem *elem, unsigned int side, BoundaryID bnd_id=Moose::INVALID_BOUNDARY_ID, const Elem *lower_d_elem=nullptr)
Reinitialize variables and materials on a face.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void swapBackMaterialsFace(const THREAD_ID tid)
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ onElement()

void NonlinearThread::onElement ( const Elem *  elem)
overridevirtualinherited

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 125 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::operator()().

126 {
127  // Set up Sentinel class so that, even if reinitMaterials() throws in prepareElement, we
128  // still remember to swap back during stack unwinding.
130 
131  prepareElement(elem);
132 
133  if (dynamic_cast<ComputeJacobianThread *>(this))
134  if (_nl.getScalarVariables(_tid).size() > 0)
136 
138 }
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:757
virtual void computeOnElement()
NonlinearSystemBase & _nl
virtual void swapBackMaterials(const THREAD_ID tid)
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ onExternalSide()

void ThreadedElementLoopBase< ConstElemRange >::onExternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when iterating over external sides (no side neighbor)

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeUserObjectsThread.

Definition at line 393 of file ThreadedElementLoopBase.h.

394 {
395 }

◆ onInterface()

void NonlinearThread::onInterface ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
overridevirtualinherited

Called when doing interface assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
bnd_id- ID of the interface we are at

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 190 of file NonlinearThread.C.

191 {
193  {
194 
195  // Pointer to the neighbor we are currently working on.
196  const Elem * neighbor = elem->neighbor_ptr(side);
197 
198  if (neighbor->active())
199  {
200  _fe_problem.reinitNeighbor(elem, side, _tid);
201 
202  // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
203  // still remember to swap back during stack unwinding. Note that face, boundary, and interface
204  // all operate with the same MaterialData object
206  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
208 
210  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
211 
212  // Has to happen after face and neighbor properties have been computed. Note that we don't use
213  // a sentinel here because FEProblem::swapBackMaterialsFace is going to handle face materials,
214  // boundary materials, and interface materials (e.g. it queries the boundary material data
215  // with the current element and side
217 
218  computeOnInterface(bnd_id);
219 
220  {
221  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
223  }
224  }
225  }
226 }
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
void reinitMaterialsBoundary(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on a boundary
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on element faces
virtual void accumulateNeighbor()=0
Add neighbor residual/Jacobian into assembly global data.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void swapBackMaterialsFace(const THREAD_ID tid)
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
virtual void computeOnInterface(BoundaryID bnd_id)
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
void reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ onInternalSide()

void NonlinearThread::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called when doing internal edge assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 237 of file NonlinearThread.C.

238 {
240  {
241  // Pointer to the neighbor we are currently working on.
242  const Elem * neighbor = elem->neighbor_ptr(side);
243 
245 
246  // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
247  // still remember to swap back during stack unwinding.
249  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
250 
252  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
253 
254  computeOnInternalFace(neighbor);
255 
256  {
257  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
259  }
260  }
262  {
263  // Set up Sentinel class so that, after we swap in reinitMaterialsFace in prepareFace, even if
264  // one of our callees throws we remember to swap back during stack unwinding. We put our
265  // sentinel here as opposed to in prepareFace because we certainly don't want our materials
266  // swapped back before we proceed to residual/Jacobian computation
268 
269  prepareFace(elem, side, Moose::INVALID_BOUNDARY_ID, nullptr);
271  }
272 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const BoundaryID INVALID_BOUNDARY_ID
Definition: MooseTypes.C:22
void prepareFace(const Elem *elem, unsigned int side, BoundaryID bnd_id=Moose::INVALID_BOUNDARY_ID, const Elem *lower_d_elem=nullptr)
Reinitialize variables and materials on a face.
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on element faces
virtual void reinitElemNeighborAndLowerD(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual void swapBackMaterialsFace(const THREAD_ID tid)
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
virtual void computeOnInternalFace()=0
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
virtual void accumulateNeighborLower()=0
Add neighbor and lower residual/Jacobian into assembly global data.
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.

◆ operator()()

void NonlinearThread::operator() ( const ConstElemRange range,
bool  bypass_threading = false 
)
overridevirtualinherited

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Reimplemented in ComputeJacobianForScalingThread.

Definition at line 61 of file NonlinearThread.C.

62 {
64  ThreadedElementLoop<ConstElemRange>::operator()(range, bypass_threading);
65 }
const bool _has_active_objects
Whether there are any active residual objects; otherwise we will do an early return.
virtual void operator()(const RangeType &range, bool bypass_threading=false)

◆ post()

void NonlinearThread::post ( )
overridevirtualinherited

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 320 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ postElement()

void NonlinearThread::postElement ( const Elem *  elem)
overridevirtualinherited

Called after the element assembly is done (including surface assembling)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Reimplemented in ComputeJacobianBlocksThread, and ComputeJacobianThread.

Definition at line 314 of file NonlinearThread.C.

315 {
316  accumulate();
317 }
virtual void accumulate()=0
Add element residual/Jacobian into assembly global data.

◆ postInternalSide()

void ThreadedElementLoopBase< ConstElemRange >::postInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called after evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeJacobianBlocksThread.

Definition at line 381 of file ThreadedElementLoopBase.h.

382 {
383 }

◆ pre()

void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

Definition at line 327 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

328 {
329 }

◆ preBoundary()

void ThreadedElementLoop< ConstElemRange >::preBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtualinherited

Called before the boundary assembly.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 129 of file ThreadedElementLoop.h.

133 {
135 }
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
Base class for assembly-like calculations.

◆ preElement()

void ThreadedElementLoop< ConstElemRange >::preElement ( const Elem *  elem)
overridevirtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 115 of file ThreadedElementLoop.h.

Referenced by ComputeJacobianForScalingThread::operator()().

116 {
118 }
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
Base class for assembly-like calculations.

◆ preInternalSide()

void ThreadedElementLoop< ConstElemRange >::preInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called before evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 122 of file ThreadedElementLoop.h.

123 {
125 }
Base class for assembly-like calculations.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override

◆ prepareElement()

void ThreadedElementLoop< ConstElemRange >::prepareElement ( const Elem *  elem)
protectedinherited

Definition at line 186 of file ThreadedElementLoop.h.

Referenced by NonlinearThread::onElement().

187 {
188  _fe_problem.prepare(elem, this->_tid);
189  _fe_problem.reinitElem(elem, this->_tid);
191 }
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
SubdomainID _subdomain
The subdomain for the current element.

◆ prepareFace()

void NonlinearThread::prepareFace ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id = Moose::INVALID_BOUNDARY_ID,
const Elem *  lower_d_elem = nullptr 
)
protectedinherited

Reinitialize variables and materials on a face.

Parameters
fe_problemThe finite element problem to call reinit methods on
tidThe thread ID for which we should reinit variables and materials
elemThe element we are reiniting
sideThe element side corresponding to the face we are reiniting
bnd_idIf provided, materials associated with this boundary ID will be reinit'd
lower_d_elemIf provided, lower dimensional variables coincident with the element face will be reinit'd

Definition at line 422 of file NonlinearThread.C.

Referenced by NonlinearThread::onBoundary(), and NonlinearThread::onInternalSide().

426 {
427  _fe_problem.reinitElemFace(elem, side, _tid);
428 
429  // Needed to use lower-dimensional variables on Materials
430  if (lower_d_elem)
431  _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
432 
433  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
434  if (bnd_id != Moose::INVALID_BOUNDARY_ID)
436 }
const BoundaryID INVALID_BOUNDARY_ID
Definition: MooseTypes.C:22
void reinitMaterialsBoundary(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on a boundary
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on element faces
virtual void reinitLowerDElem(const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)

◆ printBlockExecutionInformation()

void NonlinearThread::printBlockExecutionInformation ( ) const
overrideprotectedvirtualinherited

Print list of specific objects executed on each block and in which order.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 346 of file NonlinearThread.C.

347 {
348  // Number of objects executing is approximated by size of warehouses
349  const int num_objects = _kernels.size() + _fv_kernels.size() + _integrated_bcs.size() +
351  const auto & console = _fe_problem.console();
352  const auto block_name = _mesh.getSubdomainName(_subdomain);
353 
354  if (_fe_problem.shouldPrintExecution(_tid) && num_objects > 0)
355  {
356  if (_blocks_exec_printed.count(_subdomain))
357  return;
358  console << "[DBG] Ordering of " + objectType() + " Objects on block " << block_name << " ("
359  << _subdomain << ")" << std::endl;
361  {
362  console << "[DBG] Ordering of kernels:" << std::endl;
363  console << _kernels.activeObjectsToFormattedString() << std::endl;
364  }
365  if (_fv_kernels.size())
366  {
367  console << "[DBG] Ordering of FV elemental kernels:" << std::endl;
368  std::string fvkernels =
369  std::accumulate(_fv_kernels.begin() + 1,
370  _fv_kernels.end(),
371  _fv_kernels[0]->name(),
372  [](const std::string & str_out, FVElementalKernel * kernel)
373  { return str_out + " " + kernel->name(); });
374  console << ConsoleUtils::formatString(fvkernels, "[DBG]") << std::endl;
375  }
377  {
378  console << "[DBG] Ordering of DG kernels:" << std::endl;
379  console << _dg_kernels.activeObjectsToFormattedString() << std::endl;
380  }
381  }
382  else if (_fe_problem.shouldPrintExecution(_tid) && num_objects == 0 &&
384  console << "[DBG] No Active " + objectType() + " Objects on block " << block_name << " ("
385  << _subdomain << ")" << std::endl;
386 
388 }
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...
unsigned int size(THREAD_ID tid=0) const
Return how many kernels we store in the current warehouse.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
Definition: MooseMesh.C:1758
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
MooseObjectTagWarehouse< KernelBase > & _kernels
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
Definition: ConsoleUtils.C:582
virtual std::string objectType() const
Return what the loops is meant to compute.
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
SubdomainID _subdomain
The subdomain for the current element.
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.

◆ printBoundaryExecutionInformation()

void NonlinearThread::printBoundaryExecutionInformation ( const unsigned int  bid) const
overrideprotectedvirtualinherited

Print list of specific objects executed on each boundary and in which order.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 391 of file NonlinearThread.C.

392 {
396  return;
397 
398  const auto & console = _fe_problem.console();
399  const auto b_name = _mesh.getBoundaryName(bid);
400  console << "[DBG] Ordering of " + objectType() + " Objects on boundary " << b_name << " (" << bid
401  << ")" << std::endl;
402 
404  {
405  console << "[DBG] Ordering of integrated boundary conditions:" << std::endl;
406  console << _integrated_bcs.activeObjectsToFormattedString() << std::endl;
407  }
408 
409  // We have not checked if we have a neighbor. This could be premature for saying we are executing
410  // interface kernels. However, we should assume the execution will happen on another side of the
411  // same boundary
413  {
414  console << "[DBG] Ordering of interface kernels:" << std::endl;
415  console << _interface_kernels.activeObjectsToFormattedString() << std::endl;
416  }
417 
418  _boundaries_exec_printed.insert(bid);
419 }
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...
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
const std::string & getBoundaryName(BoundaryID boundary_id)
Return the name of the boundary given the id.
Definition: MooseMesh.C:1787
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
virtual std::string objectType() const
Return what the loops is meant to compute.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.

◆ printExecutionOrdering() [1/2]

void ThreadedElementLoop< ConstElemRange >::printExecutionOrdering ( const std::vector< T *> &  objs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Routine to output the ordering of objects within a vector of pointers to these objects.

These objects must implement the name() routine, and it must return a string or compatible type.

Template Parameters
Tthe object type
Parameters
objsthe vector with all the objects (should be pointers)
objects_typethe name of the type of objects. Defaults to the CPP object name
print_headerwhether to print a header about the timing of execution and the type of objects

Definition at line 148 of file ThreadedElementLoop.h.

151 {
152  if (!objs.size())
153  return;
154 
155  auto & console = _fe_problem.console();
156  const auto objects_type = MooseUtils::prettyCppType(objs[0]);
157  std::vector<MooseObject *> moose_objs;
158  for (auto obj_ptr : objs)
159  moose_objs.push_back(dynamic_cast<MooseObject *>(obj_ptr));
160  const auto names = ConsoleUtils::mooseObjectVectorToString(moose_objs);
161 
162  // Print string with a DBG prefix and with sufficient line breaks
163  std::string message = print_header ? "Executing " + objects_type + " on " +
165  : "";
166  message += (print_header ? "Order of execution:\n" : "") + names;
167  console << ConsoleUtils::formatString(message, line_prefix) << std::endl;
168 }
std::string mooseObjectVectorToString(const std::vector< MooseObject *> &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
Definition: ConsoleUtils.C:598
const std::string & name() const
Definition: MooseEnumItem.h:35
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
Definition: ConsoleUtils.C:582
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1246

◆ printExecutionOrdering() [2/2]

void ThreadedElementLoop< ConstElemRange >::printExecutionOrdering ( const std::vector< std::shared_ptr< T >> &  objs_ptrs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Definition at line 173 of file ThreadedElementLoop.h.

177 {
178  std::vector<T *> regular_ptrs;
179  for (auto shared_ptr : objs_ptrs)
180  regular_ptrs.push_back(shared_ptr.get());
181  printExecutionOrdering<T>(regular_ptrs, print_header, line_prefix);
182 }

◆ printGeneralExecutionInformation()

void NonlinearThread::printGeneralExecutionInformation ( ) const
overrideprotectedvirtualinherited

Print information about the loop, mostly order of execution of objects.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 326 of file NonlinearThread.C.

327 {
329  {
330  const auto & console = _fe_problem.console();
331  const auto execute_on = _fe_problem.getCurrentExecuteOnFlag();
332  console << "[DBG] Beginning elemental loop to compute " + objectType() + " on " << execute_on
333  << std::endl;
334  mooseDoOnce(
335  console << "[DBG] Execution order on each element:" << std::endl;
336  console << "[DBG] - kernels on element quadrature points" << std::endl;
337  console << "[DBG] - finite volume elemental kernels on element" << std::endl;
338  console << "[DBG] - integrated boundary conditions on element side quadrature points"
339  << std::endl;
340  console << "[DBG] - DG kernels on element side quadrature points" << std::endl;
341  console << "[DBG] - interface kernels on element side quadrature points" << std::endl;);
342  }
343 }
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
virtual std::string objectType() const
Return what the loops is meant to compute.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48

◆ resetExecPrintedSets()

void ThreadedElementLoopBase< ConstElemRange >::resetExecPrintedSets ( ) const
protectedinherited

Resets the set of blocks and boundaries visited.

Definition at line 444 of file ThreadedElementLoopBase.h.

445 {
446  _blocks_exec_printed.clear();
447  _boundaries_exec_printed.clear();
448 }
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.

◆ shouldComputeInternalSide()

bool NonlinearThread::shouldComputeInternalSide ( const Elem &  elem,
const Elem &  neighbor 
) const
overridevirtualinherited

Whether to compute the internal side for the provided element-neighbor pair.

Typically this will return true if the element id is less than the neighbor id when the elements are equal level, or when the element is more refined than the neighbor, and then false otherwise. One type of loop where the logic will be different is when projecting stateful material properties

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 439 of file NonlinearThread.C.

440 {
444 }
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
SubdomainID _subdomain
The subdomain for the current element.

◆ subdomainChanged()

void NonlinearThread::subdomainChanged ( )
overridevirtualinherited

Called every time the current subdomain changes (i.e.

the subdomain of this element is not the same as the subdomain of the last element). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 68 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::operator()().

69 {
70  // This should come first to setup the residual objects before we do dependency determination of
71  // material properties and variables
73 
75 
76  // Update variable Dependencies
77  std::set<MooseVariableFEBase *> needed_moose_vars;
82 
83  // Update FE variable coupleable vector tags
84  std::set<TagID> needed_fe_var_vector_tags;
86  _subdomain, needed_fe_var_vector_tags, _tid);
88  _subdomain, needed_fe_var_vector_tags, _tid);
90  _subdomain, needed_fe_var_vector_tags, _tid);
91 
92  // Update material dependencies
93  std::unordered_set<unsigned int> needed_mat_props;
98 
99  if (_fe_problem.haveFV())
100  {
101  // Re-query the finite volume elemental kernels
102  _fv_kernels.clear();
104  .query()
105  .template condition<AttribSysNum>(_nl.number())
106  .template condition<AttribSystem>("FVElementalKernel")
107  .template condition<AttribSubdomains>(_subdomain)
108  .template condition<AttribThread>(_tid)
110  for (const auto fv_kernel : _fv_kernels)
111  {
112  const auto & fv_mv_deps = fv_kernel->getMooseVariableDependencies();
113  needed_moose_vars.insert(fv_mv_deps.begin(), fv_mv_deps.end());
114  const auto & fv_mp_deps = fv_kernel->getMatPropDependencies();
115  needed_mat_props.insert(fv_mp_deps.begin(), fv_mp_deps.end());
116  }
117  }
118 
120  _fe_problem.setActiveFEVariableCoupleableVectorTags(needed_fe_var_vector_tags, _tid);
121  _fe_problem.prepareMaterials(needed_mat_props, _subdomain, _tid);
122 }
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
const MaterialWarehouse & getMaterialWarehouse() const
void updateBlockVariableDependency(SubdomainID id, std::set< MooseVariableFieldBase *> &needed_moose_vars, THREAD_ID tid=0) const
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase *> &moose_vars, const THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
TheWarehouse & theWarehouse() const
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
NonlinearSystemBase & _nl
void updateBoundaryMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
void updateBlockMatPropDependency(SubdomainID id, std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
void updateBlockFEVariableCoupledVectorTagDependency(SubdomainID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
Update FE variable coupleable vector tag vector.
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
virtual void determineObjectWarehouses()=0
Determine the objects we will actually compute based on vector/matrix tag information.
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
void updateBoundaryVariableDependency(std::set< MooseVariableFieldBase *> &needed_moose_vars, THREAD_ID tid=0) const
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
void prepareMaterials(const std::unordered_set< unsigned int > &consumer_needed_mat_props, const SubdomainID blk_id, const THREAD_ID tid)
Add the MooseVariables and the material properties that the current materials depend on to the depend...

Member Data Documentation

◆ _blocks_exec_printed

std::set<SubdomainID> ThreadedElementLoopBase< ConstElemRange >::_blocks_exec_printed
mutableprotectedinherited

◆ _boundaries_exec_printed

std::set<BoundaryID> ThreadedElementLoopBase< ConstElemRange >::_boundaries_exec_printed
mutableprotectedinherited

Keep track of which boundaries were visited.

Definition at line 190 of file ThreadedElementLoopBase.h.

Referenced by NonlinearThread::printBoundaryExecutionInformation().

◆ _dg_kernels

MooseObjectTagWarehouse<DGKernelBase>& NonlinearThread::_dg_kernels
protectedinherited

◆ _dg_warehouse

MooseObjectWarehouse<DGKernelBase>* NonlinearThread::_dg_warehouse
protectedinherited

◆ _fe_problem

FEProblemBase& ThreadedElementLoop< ConstElemRange >::_fe_problem
protectedinherited

Definition at line 62 of file ThreadedElementLoop.h.

Referenced by accumulate(), ComputeResidualAndJacobianThread::accumulate(), accumulateLower(), ComputeResidualAndJacobianThread::accumulateLower(), ComputeJacobianThread::accumulateLower(), accumulateNeighbor(), ComputeResidualAndJacobianThread::accumulateNeighbor(), ComputeJacobianThread::accumulateNeighbor(), accumulateNeighborLower(), ComputeResidualAndJacobianThread::accumulateNeighborLower(), ComputeJacobianThread::accumulateNeighborLower(), ComputeJacobianThread::compute(), ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), NonlinearThread::computeOnElement(), ComputeFullJacobianThread::computeOnInterface(), ComputeFullJacobianThread::computeOnInternalFace(), determineObjectWarehouses(), ComputeJacobianThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), NonlinearThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeElemDampingThread::onElement(), NonlinearThread::onElement(), ComputeUserObjectsThread::onElement(), NonlinearThread::onInterface(), ComputeUserObjectsThread::onInterface(), NonlinearThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeUserObjectsThread::post(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeJacobianBlocksThread::postInternalSide(), NonlinearThread::prepareFace(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), NonlinearThread::printBoundaryExecutionInformation(), ComputeElemDampingThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::printGeneralExecutionInformation(), NonlinearThread::printGeneralExecutionInformation(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().

◆ _fv_kernels

std::vector<FVElementalKernel *> NonlinearThread::_fv_kernels
protectedinherited

◆ _has_active_objects

const bool NonlinearThread::_has_active_objects
protectedinherited

Whether there are any active residual objects; otherwise we will do an early return.

Definition at line 167 of file NonlinearThread.h.

Referenced by NonlinearThread::operator()().

◆ _hdg_kernels

MooseObjectTagWarehouse<HDGKernel>& NonlinearThread::_hdg_kernels
protectedinherited

◆ _hdg_warehouse

MooseObjectWarehouse<HDGKernel>* NonlinearThread::_hdg_warehouse
protectedinherited

◆ _ibc_warehouse

MooseObjectWarehouse<IntegratedBCBase>* NonlinearThread::_ibc_warehouse
protectedinherited

◆ _ik_warehouse

MooseObjectWarehouse<InterfaceKernelBase>* NonlinearThread::_ik_warehouse
protectedinherited

◆ _integrated_bcs

MooseObjectTagWarehouse<IntegratedBCBase>& NonlinearThread::_integrated_bcs
protectedinherited

◆ _interface_kernels

MooseObjectTagWarehouse<InterfaceKernelBase>& NonlinearThread::_interface_kernels
protectedinherited

◆ _kernels

MooseObjectTagWarehouse<KernelBase>& NonlinearThread::_kernels
protectedinherited

◆ _mesh

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

◆ _nl

NonlinearSystemBase& NonlinearThread::_nl
protectedinherited

◆ _num_cached

unsigned int NonlinearThread::_num_cached
protectedinherited

◆ _old_neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 175 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 169 of file ThreadedElementLoopBase.h.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited

The subdomain for the current element.

Definition at line 166 of file ThreadedElementLoopBase.h.

Referenced by ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), NonlinearThread::computeOnElement(), computeOnInternalFace(), ComputeFullJacobianThread::computeOnInternalFace(), ComputeResidualAndJacobianThread::computeOnInternalFace(), ComputeJacobianThread::computeOnInternalFace(), NonlinearThread::computeOnInternalFace(), determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeMaterialsObjectThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), ComputeMaterialsObjectThread::onInternalSide(), NonlinearThread::onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeJacobianBlocksThread::postInternalSide(), ComputeMarkerThread::printBlockExecutionInformation(), ComputeIndicatorThread::printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), ComputeUserObjectsThread::querySubdomain(), NonlinearThread::shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().

◆ _tag_kernels

MooseObjectWarehouse<KernelBase>* NonlinearThread::_tag_kernels
protectedinherited

◆ _tags

const std::set<TagID>& ComputeResidualThread::_tags
protected

the tags denoting the vectors we want our residual objects to fill

Definition at line 43 of file ComputeResidualThread.h.

Referenced by determineObjectWarehouses().

◆ _tid

THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 163 of file ThreadedElementLoopBase.h.

Referenced by accumulate(), ComputeResidualAndJacobianThread::accumulate(), accumulateLower(), ComputeResidualAndJacobianThread::accumulateLower(), ComputeJacobianThread::accumulateLower(), accumulateNeighbor(), ComputeResidualAndJacobianThread::accumulateNeighbor(), ComputeJacobianThread::accumulateNeighbor(), accumulateNeighborLower(), ComputeResidualAndJacobianThread::accumulateNeighborLower(), ComputeJacobianThread::accumulateNeighborLower(), ComputeFullJacobianThread::computeOnBoundary(), NonlinearThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), NonlinearThread::computeOnElement(), ComputeFullJacobianThread::computeOnInterface(), NonlinearThread::computeOnInterface(), computeOnInternalFace(), ComputeFullJacobianThread::computeOnInternalFace(), ComputeResidualAndJacobianThread::computeOnInternalFace(), ComputeJacobianThread::computeOnInternalFace(), NonlinearThread::computeOnInternalFace(), determineObjectWarehouses(), ComputeJacobianThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), NonlinearThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeElemDampingThread::onElement(), ComputeIndicatorThread::onElement(), ComputeMaterialsObjectThread::onElement(), NonlinearThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), NonlinearThread::onInterface(), ComputeUserObjectsThread::onInterface(), ComputeIndicatorThread::onInternalSide(), ComputeMaterialsObjectThread::onInternalSide(), NonlinearThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeMaterialsObjectThread::post(), ComputeMarkerThread::post(), ComputeIndicatorThread::post(), ComputeUserObjectsThread::post(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeJacobianBlocksThread::postInternalSide(), NonlinearThread::prepareFace(), ComputeMarkerThread::printBlockExecutionInformation(), ComputeIndicatorThread::printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), NonlinearThread::printBoundaryExecutionInformation(), ComputeElemDampingThread::printGeneralExecutionInformation(), ComputeMarkerThread::printGeneralExecutionInformation(), ComputeIndicatorThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::printGeneralExecutionInformation(), NonlinearThread::printGeneralExecutionInformation(), ComputeUserObjectsThread::queryBoundary(), ComputeUserObjectsThread::querySubdomain(), NonlinearThread::shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), NonlinearThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


The documentation for this class was generated from the following files: