https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
NonlinearThread Class Referenceabstract

#include <NonlinearThread.h>

Inheritance diagram for NonlinearThread:
[legend]

Public Member Functions

 NonlinearThread (FEProblemBase &fe_problem)
 
 NonlinearThread (NonlinearThread &x, Threads::split split)
 
virtual ~NonlinearThread ()
 
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

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...
 
virtual void compute (ResidualObject &ro)=0
 Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class. More...
 
virtual void accumulateNeighbor ()=0
 Add neighbor residual/Jacobian into assembly global data. More...
 
virtual void accumulateNeighborLower ()=0
 Add neighbor and lower residual/Jacobian into assembly global data. More...
 
virtual void accumulateLower ()=0
 Add lower-d residual/Jacobian into assembly global data. More...
 
virtual void accumulate ()=0
 Add element residual/Jacobian into assembly global data. More...
 
virtual void determineObjectWarehouses ()=0
 Determine the objects we will actually compute based on vector/matrix tag information. 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...
 
virtual std::string objectType () const
 Return what the loops is meant to compute. 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 computeOnInternalFace ()=0
 
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

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
 

Private Attributes

bool _should_execute_dg
 Whether DG kernels should be executed for a given elem-neighbor pairing. More...
 
bool _subdomain_has_dg
 Whether the subdomain has DGKernels. More...
 
bool _subdomain_has_hdg
 Whether the subdomain has HDGKernels. More...
 

Detailed Description

Definition at line 30 of file NonlinearThread.h.

Constructor & Destructor Documentation

◆ NonlinearThread() [1/2]

NonlinearThread::NonlinearThread ( FEProblemBase fe_problem)

Definition at line 26 of file NonlinearThread.C.

28  _nl(fe_problem.currentNonlinearSystem()),
29  _num_cached(0),
38  _should_execute_dg(false)
39 {
40 }
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
unsigned int _num_cached
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse()
Access functions to Warehouses from outside NonlinearSystemBase.
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse()
MooseObjectTagWarehouse< HDGKernel > & getHDGKernelWarehouse()
MooseObjectTagWarehouse< InterfaceKernelBase > & getInterfaceKernelWarehouse()
const bool _has_active_objects
Whether there are any active residual objects; otherwise we will do an early return.
MooseObjectTagWarehouse< KernelBase > & _kernels
NonlinearSystemBase & currentNonlinearSystem()
NonlinearSystemBase & _nl
bool hasActiveObjects(THREAD_ID tid=0) const
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
MooseObjectTagWarehouse< DGKernelBase > & getDGKernelWarehouse()
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.

◆ NonlinearThread() [2/2]

NonlinearThread::NonlinearThread ( NonlinearThread x,
Threads::split  split 
)

Definition at line 43 of file NonlinearThread.C.

45  _nl(x._nl),
46  _num_cached(x._num_cached),
47  _integrated_bcs(x._integrated_bcs),
48  _dg_kernels(x._dg_kernels),
49  _interface_kernels(x._interface_kernels),
50  _kernels(x._kernels),
51  _tag_kernels(x._tag_kernels),
52  _hdg_kernels(x._hdg_kernels),
53  _has_active_objects(x._has_active_objects),
54  _should_execute_dg(x._should_execute_dg)
55 {
56 }
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
unsigned int _num_cached
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
const bool _has_active_objects
Whether there are any active residual objects; otherwise we will do an early return.
MooseObjectTagWarehouse< KernelBase > & _kernels
NonlinearSystemBase & _nl
tbb::split split
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.

◆ ~NonlinearThread()

NonlinearThread::~NonlinearThread ( )
virtual

Definition at line 58 of file NonlinearThread.C.

58 {}

Member Function Documentation

◆ accumulate()

virtual void NonlinearThread::accumulate ( )
protectedpure virtual

Add element residual/Jacobian into assembly global data.

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Referenced by postElement().

◆ accumulateLower()

virtual void NonlinearThread::accumulateLower ( )
protectedpure virtual

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

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Referenced by onBoundary().

◆ accumulateNeighbor()

virtual void NonlinearThread::accumulateNeighbor ( )
protectedpure virtual

Add neighbor residual/Jacobian into assembly global data.

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Referenced by onInterface().

◆ accumulateNeighborLower()

virtual void NonlinearThread::accumulateNeighborLower ( )
protectedpure virtual

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

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Referenced by onInternalSide().

◆ 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 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/6]

virtual void NonlinearThread::compute ( ResidualObject ro)
protectedpure virtual

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

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Referenced by compute(), computeOnBoundary(), computeOnElement(), computeOnInterface(), and computeOnInternalFace().

◆ compute() [2/6]

void NonlinearThread::compute ( KernelBase kernel)
protectedvirtual

Defaults to forwarding to the residual object class

Reimplemented in ComputeJacobianThread.

Definition at line 288 of file NonlinearThread.C.

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

◆ compute() [3/6]

void NonlinearThread::compute ( FVElementalKernel kernel)
protectedvirtual

Reimplemented in ComputeJacobianThread.

Definition at line 294 of file NonlinearThread.C.

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

◆ compute() [4/6]

void NonlinearThread::compute ( IntegratedBCBase bc)
protectedvirtual

Reimplemented in ComputeJacobianThread.

Definition at line 300 of file NonlinearThread.C.

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

◆ compute() [5/6]

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

Reimplemented in ComputeJacobianThread.

Definition at line 306 of file NonlinearThread.C.

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

◆ compute() [6/6]

void NonlinearThread::compute ( InterfaceKernelBase ik)
protectedvirtual

Reimplemented in ComputeJacobianThread.

Definition at line 312 of file NonlinearThread.C.

313 {
314  compute(static_cast<ResidualObject &>(ik));
315 }
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 
)
protectedvirtual

Reimplemented in ComputeFullJacobianThread.

Definition at line 185 of file NonlinearThread.C.

Referenced by onBoundary().

186 {
187  const auto & bcs = _ibc_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
188  for (const auto & bc : bcs)
189  if (bc->shouldApply())
190  compute(*bc);
191 }
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 ( )
protectedvirtual

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

Reimplemented in ComputeFullJacobianThread, and ComputeJacobianForScalingThread.

Definition at line 145 of file NonlinearThread.C.

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

146 {
148  {
149  const auto & kernels = _tag_kernels->getActiveBlockObjects(_subdomain, _tid);
150  for (const auto & kernel : kernels)
151  compute(*kernel);
152  }
153 
154  if (_fe_problem.haveFV())
155  for (auto kernel : _fv_kernels)
156  compute(*kernel);
157 }
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)
protectedvirtual

Reimplemented in ComputeFullJacobianThread.

Definition at line 233 of file NonlinearThread.C.

Referenced by onInterface().

234 {
235  const auto & int_ks = _ik_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
236  for (const auto & interface_kernel : int_ks)
237  compute(*interface_kernel);
238 }
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/2]

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

Reimplemented in ComputeFullJacobianThread.

Definition at line 279 of file NonlinearThread.C.

280 {
281  const auto & dgks = _dg_warehouse->getActiveBlockObjects(_subdomain, _tid);
282  for (const auto & dg_kernel : dgks)
283  if (dg_kernel->hasBlocks(neighbor->subdomain_id()))
284  compute(*dg_kernel, neighbor);
285 }
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

◆ computeOnInternalFace() [2/2]

virtual void NonlinearThread::computeOnInternalFace ( )
protectedpure virtual

◆ determineObjectWarehouses()

virtual void NonlinearThread::determineObjectWarehouses ( )
protectedpure virtual

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

Implemented in ComputeResidualAndJacobianThread, ComputeJacobianThread, and ComputeResidualThread.

Referenced by subdomainChanged().

◆ 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()

virtual std::string NonlinearThread::objectType ( ) const
inlineprotectedvirtual

Return what the loops is meant to compute.

Reimplemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

Definition at line 129 of file NonlinearThread.h.

Referenced by printBlockExecutionInformation(), printBoundaryExecutionInformation(), and printGeneralExecutionInformation().

129 { return ""; };

◆ onBoundary()

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

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 160 of file NonlinearThread.C.

164 {
166  {
167  // Set up Sentinel class so that, after we swap in reinitMaterialsFace in prepareFace, even if
168  // one of our callees throws we remember to swap back during stack unwinding. We put our
169  // sentinel here as opposed to in prepareFace because we certainly don't want our materials
170  // swapped back before we proceed to residual/Jacobian computation
172 
173  prepareFace(elem, side, bnd_id, lower_d_elem);
174  computeOnBoundary(bnd_id, lower_d_elem);
175 
176  if (lower_d_elem)
177  {
178  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
179  accumulateLower();
180  }
181  }
182 }
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)
overridevirtual

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 129 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::operator()().

130 {
131  // Set up Sentinel class so that, even if reinitMaterials() throws in prepareElement, we
132  // still remember to swap back during stack unwinding.
134 
135  prepareElement(elem);
136 
137  if (dynamic_cast<ComputeJacobianThread *>(this))
138  if (_nl.getScalarVariables(_tid).size() > 0)
140 
142 }
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:756
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 
)
overridevirtual

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 194 of file NonlinearThread.C.

195 {
197  {
198 
199  // Pointer to the neighbor we are currently working on.
200  const Elem * neighbor = elem->neighbor_ptr(side);
201 
202  if (neighbor->active())
203  {
204  _fe_problem.reinitNeighbor(elem, side, _tid);
205 
206  // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
207  // still remember to swap back during stack unwinding. Note that face, boundary, and interface
208  // all operate with the same MaterialData object
210  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
212 
214  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
215 
216  // Has to happen after face and neighbor properties have been computed. Note that we don't use
217  // a sentinel here because FEProblem::swapBackMaterialsFace is going to handle face materials,
218  // boundary materials, and interface materials (e.g. it queries the boundary material data
219  // with the current element and side
221 
222  computeOnInterface(bnd_id);
223 
224  {
225  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
227  }
228  }
229  }
230 }
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 
)
overridevirtual

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 241 of file NonlinearThread.C.

242 {
243  if (_should_execute_dg)
244  {
245  // Pointer to the neighbor we are currently working on.
246  const Elem * neighbor = elem->neighbor_ptr(side);
247 
249 
250  // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
251  // still remember to swap back during stack unwinding.
253  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
254 
256  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
257 
258  computeOnInternalFace(neighbor);
259 
260  {
261  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
263  }
264  }
265  if (_subdomain_has_hdg)
266  {
267  // Set up Sentinel class so that, after we swap in reinitMaterialsFace in prepareFace, even if
268  // one of our callees throws we remember to swap back during stack unwinding. We put our
269  // sentinel here as opposed to in prepareFace because we certainly don't want our materials
270  // swapped back before we proceed to residual/Jacobian computation
272 
273  prepareFace(elem, side, Moose::INVALID_BOUNDARY_ID, nullptr);
275  }
276 }
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)
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
bool _subdomain_has_hdg
Whether the subdomain has HDGKernels.
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.
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 
)
overridevirtual

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 ( )
overridevirtual

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 324 of file NonlinearThread.C.

Referenced by ComputeJacobianForScalingThread::operator()().

◆ postElement()

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

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 318 of file NonlinearThread.C.

319 {
320  accumulate();
321 }
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 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 
)
protected

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 426 of file NonlinearThread.C.

Referenced by onBoundary(), and onInternalSide().

430 {
431  _fe_problem.reinitElemFace(elem, side, _tid);
432 
433  // Needed to use lower-dimensional variables on Materials
434  if (lower_d_elem)
435  _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
436 
437  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
438  if (bnd_id != Moose::INVALID_BOUNDARY_ID)
440 }
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
overrideprotectedvirtual

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

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 350 of file NonlinearThread.C.

351 {
352  // Number of objects executing is approximated by size of warehouses
353  const int num_objects = _kernels.size() + _fv_kernels.size() + _integrated_bcs.size() +
355  const auto & console = _fe_problem.console();
356  const auto block_name = _mesh.getSubdomainName(_subdomain);
357 
358  if (_fe_problem.shouldPrintExecution(_tid) && num_objects > 0)
359  {
360  if (_blocks_exec_printed.count(_subdomain))
361  return;
362  console << "[DBG] Ordering of " + objectType() + " Objects on block " << block_name << " ("
363  << _subdomain << ")" << std::endl;
365  {
366  console << "[DBG] Ordering of kernels:" << std::endl;
367  console << _kernels.activeObjectsToFormattedString() << std::endl;
368  }
369  if (_fv_kernels.size())
370  {
371  console << "[DBG] Ordering of FV elemental kernels:" << std::endl;
372  std::string fvkernels =
373  std::accumulate(_fv_kernels.begin() + 1,
374  _fv_kernels.end(),
375  _fv_kernels[0]->name(),
376  [](const std::string & str_out, FVElementalKernel * kernel)
377  { return str_out + " " + kernel->name(); });
378  console << ConsoleUtils::formatString(fvkernels, "[DBG]") << std::endl;
379  }
381  {
382  console << "[DBG] Ordering of DG kernels:" << std::endl;
383  console << _dg_kernels.activeObjectsToFormattedString() << std::endl;
384  }
385  }
386  else if (_fe_problem.shouldPrintExecution(_tid) && num_objects == 0 &&
388  console << "[DBG] No Active " + objectType() + " Objects on block " << block_name << " ("
389  << _subdomain << ")" << std::endl;
390 
392 }
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:1801
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:581
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
overrideprotectedvirtual

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

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 395 of file NonlinearThread.C.

396 {
400  return;
401 
402  const auto & console = _fe_problem.console();
403  const auto b_name = _mesh.getBoundaryName(bid);
404  console << "[DBG] Ordering of " + objectType() + " Objects on boundary " << b_name << " (" << bid
405  << ")" << std::endl;
406 
408  {
409  console << "[DBG] Ordering of integrated boundary conditions:" << std::endl;
410  console << _integrated_bcs.activeObjectsToFormattedString() << std::endl;
411  }
412 
413  // We have not checked if we have a neighbor. This could be premature for saying we are executing
414  // interface kernels. However, we should assume the execution will happen on another side of the
415  // same boundary
417  {
418  console << "[DBG] Ordering of interface kernels:" << std::endl;
419  console << _interface_kernels.activeObjectsToFormattedString() << std::endl;
420  }
421 
422  _boundaries_exec_printed.insert(bid);
423 }
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:1830
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:597
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:581
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1147

◆ 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
overrideprotectedvirtual

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

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 330 of file NonlinearThread.C.

331 {
333  {
334  const auto & console = _fe_problem.console();
335  const auto execute_on = _fe_problem.getCurrentExecuteOnFlag();
336  console << "[DBG] Beginning elemental loop to compute " + objectType() + " on " << execute_on
337  << std::endl;
338  mooseDoOnce(
339  console << "[DBG] Execution order on each element:" << std::endl;
340  console << "[DBG] - kernels on element quadrature points" << std::endl;
341  console << "[DBG] - finite volume elemental kernels on element" << std::endl;
342  console << "[DBG] - integrated boundary conditions on element side quadrature points"
343  << std::endl;
344  console << "[DBG] - DG kernels on element side quadrature points" << std::endl;
345  console << "[DBG] - interface kernels on element side quadrature points" << std::endl;);
346  }
347 }
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
overridevirtual

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 443 of file NonlinearThread.C.

444 {
445  // ThreadedElementLoop<ConstElemRange>::shouldComputeInternalSide gets expensive on high
446  // h-refinement cases so we avoid it if possible
447  _should_execute_dg = false;
448  if (_subdomain_has_dg)
452 }
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
bool _subdomain_has_hdg
Whether the subdomain has HDGKernels.
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
bool _subdomain_has_dg
Whether the subdomain has DGKernels.

◆ subdomainChanged()

void NonlinearThread::subdomainChanged ( )
overridevirtual

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 
119  // Cache these to avoid computing them on every side
122 
124  _fe_problem.setActiveFEVariableCoupleableVectorTags(needed_fe_var_vector_tags, _tid);
125  _fe_problem.prepareMaterials(needed_mat_props, _subdomain, _tid);
126 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
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.
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
TheWarehouse & theWarehouse() const
bool _subdomain_has_hdg
Whether the subdomain has HDGKernels.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1157
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...
bool _subdomain_has_dg
Whether the subdomain has DGKernels.

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 printBoundaryExecutionInformation().

◆ _dg_kernels

MooseObjectTagWarehouse<DGKernelBase>& NonlinearThread::_dg_kernels
protected

◆ _dg_warehouse

MooseObjectWarehouse<DGKernelBase>* NonlinearThread::_dg_warehouse
protected

◆ _fe_problem

FEProblemBase& ThreadedElementLoop< ConstElemRange >::_fe_problem
protectedinherited

Definition at line 62 of file ThreadedElementLoop.h.

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

◆ _fv_kernels

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

◆ _has_active_objects

const bool NonlinearThread::_has_active_objects
protected

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

Definition at line 167 of file NonlinearThread.h.

Referenced by operator()().

◆ _hdg_kernels

MooseObjectTagWarehouse<HDGKernel>& NonlinearThread::_hdg_kernels
protected

◆ _hdg_warehouse

MooseObjectWarehouse<HDGKernel>* NonlinearThread::_hdg_warehouse
protected

◆ _ibc_warehouse

MooseObjectWarehouse<IntegratedBCBase>* NonlinearThread::_ibc_warehouse
protected

◆ _ik_warehouse

MooseObjectWarehouse<InterfaceKernelBase>* NonlinearThread::_ik_warehouse
protected

◆ _integrated_bcs

MooseObjectTagWarehouse<IntegratedBCBase>& NonlinearThread::_integrated_bcs
protected

◆ _interface_kernels

MooseObjectTagWarehouse<InterfaceKernelBase>& NonlinearThread::_interface_kernels
protected

◆ _kernels

MooseObjectTagWarehouse<KernelBase>& NonlinearThread::_kernels
protected

◆ _mesh

MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

◆ _nl

NonlinearSystemBase& NonlinearThread::_nl
protected

◆ _num_cached

unsigned int NonlinearThread::_num_cached
protected

◆ _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()().

◆ _should_execute_dg

bool NonlinearThread::_should_execute_dg
mutableprivate

Whether DG kernels should be executed for a given elem-neighbor pairing.

This is determined by calling down to our parent (ThreadedElementLoop) class's shouldComputeOnInternalSide method which checks things like whether the elem id is less than the neighbor id such that we make sure we do not execute DGKernels twice on the same face

Definition at line 174 of file NonlinearThread.h.

Referenced by onInternalSide(), and shouldComputeInternalSide().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited

◆ _subdomain_has_dg

bool NonlinearThread::_subdomain_has_dg
private

Whether the subdomain has DGKernels.

Definition at line 176 of file NonlinearThread.h.

Referenced by shouldComputeInternalSide(), and subdomainChanged().

◆ _subdomain_has_hdg

bool NonlinearThread::_subdomain_has_hdg
private

Whether the subdomain has HDGKernels.

Definition at line 178 of file NonlinearThread.h.

Referenced by onInternalSide(), shouldComputeInternalSide(), and subdomainChanged().

◆ _tag_kernels

MooseObjectWarehouse<KernelBase>* NonlinearThread::_tag_kernels
protected

◆ _tid

THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 163 of file ThreadedElementLoopBase.h.

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


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