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...
 

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 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() [3/6]

void NonlinearThread::compute ( FVElementalKernel kernel)
protectedvirtual

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() [4/6]

void NonlinearThread::compute ( IntegratedBCBase bc)
protectedvirtual

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() [5/6]

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

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() [6/6]

void NonlinearThread::compute ( InterfaceKernelBase ik)
protectedvirtual

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 
)
protectedvirtual

Reimplemented in ComputeFullJacobianThread.

Definition at line 181 of file NonlinearThread.C.

Referenced by 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 ( )
protectedvirtual

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 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)
protectedvirtual

Reimplemented in ComputeFullJacobianThread.

Definition at line 229 of file NonlinearThread.C.

Referenced by 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/2]

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

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

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

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 
)
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 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 
)
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 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 
)
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 320 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 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 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 422 of file NonlinearThread.C.

Referenced by onBoundary(), and 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
overrideprotectedvirtual

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
overrideprotectedvirtual

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
overrideprotectedvirtual

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

The subdomain for the current element.

Definition at line 166 of file ThreadedElementLoopBase.h.

Referenced by ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), computeOnElement(), ComputeResidualThread::computeOnInternalFace(), ComputeFullJacobianThread::computeOnInternalFace(), ComputeResidualAndJacobianThread::computeOnInternalFace(), ComputeJacobianThread::computeOnInternalFace(), computeOnInternalFace(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), ComputeMaterialsObjectThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeMaterialsObjectThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onInterface(), ComputeMaterialsObjectThread::onInternalSide(), onInternalSide(), ComputeJacobianForScalingThread::operator()(), ComputeJacobianBlocksThread::postInternalSide(), ComputeMarkerThread::printBlockExecutionInformation(), ComputeIndicatorThread::printBlockExecutionInformation(), ComputeUserObjectsThread::printBlockExecutionInformation(), printBlockExecutionInformation(), ComputeUserObjectsThread::querySubdomain(), shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), subdomainChanged(), and ComputeUserObjectsThread::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(), ComputeIndicatorThread::onInternalSide(), ComputeMaterialsObjectThread::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(), shouldComputeInternalSide(), ComputeMarkerThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


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