https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly)
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called when doing boundary assembling.
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id) override
 Called when doing interface assembling.
 
virtual void onInternalSide (const Elem *elem, unsigned int side) override
 Called when doing internal edge assembling.
 
virtual void onExternalSide (const Elem *elem, unsigned int side) override
 Called when iterating over external sides (no side neighbor)
 
virtual void postElement (const Elem *) override
 Called after the element assembly is done (including surface assembling)
 
virtual void post () override
 Called after the element range loop.
 
bool shouldComputeInternalSide (const Elem &elem, const Elem &neighbor) const override
 Whether to compute the internal side for the provided element-neighbor pair.
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation.
 
virtual bool keepGoing () override
 Whether or not the loop should continue.
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly.
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side.
 
virtual void preBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called before the boundary assembly.
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e.
 
virtual void operator() (const RangeType &range, bool bypass_threading=false)
 
virtual void pre ()
 Called before the element range loop.
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side.
 

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.
 
virtual void compute (ResidualObject &ro)=0
 Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived class.
 
virtual void accumulateNeighbor ()=0
 Add neighbor residual/Jacobian into assembly global data.
 
virtual void accumulateNeighborLower ()=0
 Add neighbor and lower residual/Jacobian into assembly global data.
 
virtual void accumulateLower ()=0
 Add lower-d residual/Jacobian into assembly global data.
 
virtual void accumulate ()=0
 Add element residual/Jacobian into assembly global data.
 
virtual void determineObjectWarehouses ()=0
 Determine the objects we will actually compute based on vector/matrix tag information.
 
void printGeneralExecutionInformation () const override
 Print information about the loop, mostly order of execution of objects.
 
void printBlockExecutionInformation () const override
 Print list of specific objects executed on each block and in which order.
 
void printBoundaryExecutionInformation (const unsigned int bid) const override
 Print list of specific objects executed on each boundary and in which order.
 
virtual std::string objectType () const
 Return what the loops is meant to compute.
 
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.
 
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.
 
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
 Reference to the underlying NonlinearSystemBase.
 
unsigned int _num_cached
 
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
 Reference to BC storage structures.
 
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
 
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
 Reference to DGKernel storage structure.
 
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
 
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
 Reference to interface kernel storage structure.
 
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
 
std::vector< FVElementalKernel * > _fv_kernels
 Current subdomain FVElementalKernels.
 
const bool _has_active_objects
 Whether there are any active residual objects; otherwise we will do an early return.
 
FEProblemBase_fe_problem
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element.
 
SubdomainID _old_subdomain
 The subdomain for the last element.
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor.
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor.
 
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.
 
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.
 
bool _subdomain_has_dg
 Whether the subdomain has DGKernels.
 
bool _subdomain_has_hdg
 Whether the subdomain has HDGKernels.
 

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

◆ NonlinearThread() [2/2]

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

◆ ~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< RangeType >.

Definition at line 43 of file ThreadedElementLoop.h.

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

◆ clearVarsAndMaterials()

void ThreadedElementLoop< ConstElemRange >::clearVarsAndMaterials ( )
protectedinherited

Definition at line 60 of file ThreadedElementLoop.h.

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]

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

Reimplemented in ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeJacobianThread.

Definition at line 317 of file NonlinearThread.C.

318{
319 compute(static_cast<ResidualObject &>(dg));
320}
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
This is the common base class for objects that give residual contributions.

◆ compute() [2/6]

void NonlinearThread::compute ( FVElementalKernel kernel)
protectedvirtual

Reimplemented in ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeJacobianThread.

Definition at line 305 of file NonlinearThread.C.

306{
307 compute(static_cast<ResidualObject &>(kernel));
308}

◆ compute() [3/6]

void NonlinearThread::compute ( IntegratedBCBase bc)
protectedvirtual

Reimplemented in ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeJacobianThread.

Definition at line 311 of file NonlinearThread.C.

312{
313 compute(static_cast<ResidualObject &>(bc));
314}

◆ compute() [4/6]

void NonlinearThread::compute ( InterfaceKernelBase ik)
protectedvirtual

Reimplemented in ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeJacobianThread.

Definition at line 323 of file NonlinearThread.C.

324{
325 compute(static_cast<ResidualObject &>(ik));
326}

◆ compute() [5/6]

void NonlinearThread::compute ( KernelBase kernel)
protectedvirtual

Defaults to forwarding to the residual object class

Reimplemented in ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeJacobianThread.

Definition at line 299 of file NonlinearThread.C.

300{
301 compute(static_cast<ResidualObject &>(kernel));
302}

◆ compute() [6/6]

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

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

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, ComputeResidualThread, ComputeResidualAndJacobianThread, and ComputeResidualThread.

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

◆ computeOnBoundary()

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

Reimplemented in ComputeFullJacobianThread.

Definition at line 182 of file NonlinearThread.C.

183{
184 const auto & bcs = _ibc_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
185 for (const auto & bc : bcs)
186 if (bc->shouldApply())
187 compute(*bc);
188}
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse

Referenced by onBoundary().

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

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}
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
SubdomainID _subdomain
The subdomain for the current element.

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

◆ computeOnInterface()

void NonlinearThread::computeOnInterface ( BoundaryID  bnd_id)
protectedvirtual

Reimplemented in ComputeFullJacobianThread.

Definition at line 227 of file NonlinearThread.C.

228{
229 const auto & int_ks = _ik_warehouse->getActiveBoundaryObjects(bnd_id, _tid);
230 for (const auto & interface_kernel : int_ks)
231 compute(*interface_kernel);
232}
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse

Referenced by onInterface().

◆ computeOnInternalFace() [1/2]

virtual void NonlinearThread::computeOnInternalFace ( )
protectedpure virtual

◆ computeOnInternalFace() [2/2]

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

Reimplemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, ComputeResidualThread, and ComputeFullJacobianThread.

Definition at line 290 of file NonlinearThread.C.

291{
292 const auto & dgks = _dg_warehouse->getActiveBlockObjects(_subdomain, _tid);
293 for (const auto & dg_kernel : dgks)
294 if (dg_kernel->hasBlocks(neighbor->subdomain_id()))
295 compute(*dg_kernel, neighbor);
296}
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse

◆ determineObjectWarehouses()

virtual void NonlinearThread::determineObjectWarehouses ( )
protectedpure virtual

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

Implemented in ComputeJacobianThread, ComputeResidualAndJacobianThread, 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< RangeType >.

Definition at line 45 of file ThreadedElementLoop.h.

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

Definition at line 56 of file ThreadedElementLoop.h.

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

◆ 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 130 of file NonlinearThread.h.

130{ return ""; };

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

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

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)
178 }
179}
virtual void swapBackMaterialsFace(const THREAD_ID tid)
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
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.
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem)
virtual void accumulateLower()=0
Add lower-d residual/Jacobian into assembly global data.
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,...

◆ onElement()

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

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 129 of file NonlinearThread.C.

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}
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
virtual void swapBackMaterials(const THREAD_ID tid)
virtual void computeOnElement()
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition SystemBase.h:777

Referenced by ComputeJacobianForScalingThread::operator()().

◆ onExternalSide()

void NonlinearThread::onExternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtual

Called when iterating over external sides (no side neighbor)

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

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 270 of file NonlinearThread.C.

271{
272 // Check that we don't have any interface kernels defined on this boundary
273 const auto boundary_ids = _mesh.getBoundaryIDs(elem, side);
274
275 bool has_interface_kernels = false;
276 for (const auto bid : boundary_ids)
277 if (_ik_warehouse && _ik_warehouse->hasActiveBoundaryObjects(bid, _tid))
278 has_interface_kernels = true;
279
280 if (has_interface_kernels)
281 mooseError("Element ",
282 elem->id(),
283 " on side ",
284 side,
285 " is missing a neighbor (hence identified as an external side) but "
286 "has interface kernel(s) defined on the boundary.");
287}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side.
Definition MooseMesh.C:3027

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

Definition at line 191 of file NonlinearThread.C.

192{
194 {
195
196 // Pointer to the neighbor we are currently working on.
197 const Elem * neighbor = elem->neighbor_ptr(side);
198
199 if (neighbor->active())
200 {
201 _fe_problem.reinitNeighbor(elem, side, _tid);
202
203 // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
204 // still remember to swap back during stack unwinding. Note that face, boundary, and interface
205 // all operate with the same MaterialData object
207 _fe_problem.reinitMaterialsFaceOnBoundary(bnd_id, elem->subdomain_id(), _tid);
209
211 _fe_problem.reinitMaterialsNeighborOnBoundary(bnd_id, neighbor->subdomain_id(), _tid);
212
213 // Has to happen after face and neighbor properties have been computed. Note that we don't use
214 // a sentinel here because FEProblem::swapBackMaterialsFace is going to handle face materials,
215 // boundary materials, and interface materials (e.g. it queries the boundary material data
216 // with the current element and side
218
219 computeOnInterface(bnd_id);
220
222 }
223 }
224}
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
void reinitMaterialsFaceOnBoundary(const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
reinit materials on element faces on a boundary (internal or external) This specific routine helps us...
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 reinitMaterialsNeighborOnBoundary(const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
reinit materials on neighbor element (usually faces) on a boundary (internal or external) This specif...
void reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual void accumulateNeighbor()=0
Add neighbor residual/Jacobian into assembly global data.
virtual void computeOnInterface(BoundaryID bnd_id)

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

Definition at line 235 of file NonlinearThread.C.

236{
238 {
239 // Pointer to the neighbor we are currently working on.
240 const Elem * neighbor = elem->neighbor_ptr(side);
241
243
244 // Set up Sentinels so that, even if one of the reinitMaterialsXXX() calls throws, we
245 // still remember to swap back during stack unwinding.
247 _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
248
250 _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
251
252 computeOnInternalFace(neighbor);
253
255 }
257 {
258 // Set up Sentinel class so that, after we swap in reinitMaterialsFace in prepareFace, even if
259 // one of our callees throws we remember to swap back during stack unwinding. We put our
260 // sentinel here as opposed to in prepareFace because we certainly don't want our materials
261 // swapped back before we proceed to residual/Jacobian computation
263
264 prepareFace(elem, side, Moose::INVALID_BOUNDARY_ID, nullptr);
266 }
267}
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
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 accumulateNeighborLower()=0
Add neighbor and lower residual/Jacobian into assembly global data.
virtual void computeOnInternalFace()=0
bool _subdomain_has_hdg
Whether the subdomain has HDGKernels.
const BoundaryID INVALID_BOUNDARY_ID
Definition MooseTypes.C:22

◆ operator()() [1/2]

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

Definition at line 61 of file NonlinearThread.C.

62{
65}
virtual void operator()(const RangeType &range, bool bypass_threading=false)

◆ operator()() [2/2]

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::operator() ( const RangeType &  range,
bool  bypass_threading = false 
)
virtualinherited

Definition at line 226 of file ThreadedElementLoopBase.h.

227{
228 try
229 {
230 try
231 {
232 ParallelUniqueId puid;
233 _tid = bypass_threading ? 0 : puid.id;
234
235 pre();
237
240 typename RangeType::const_iterator el = range.begin();
241 for (el = range.begin(); el != range.end(); ++el)
242 {
243 if (!keepGoing())
244 break;
245
246 const Elem * elem = *el;
247
248 preElement(elem);
249
251 _subdomain = elem->subdomain_id();
253 {
256 }
257
258 onElement(elem);
259
260 if (_mesh.interiorLowerDBlocks().count(elem->subdomain_id()) > 0 ||
261 _mesh.boundaryLowerDBlocks().count(elem->subdomain_id()) > 0)
262 {
263 postElement(elem);
264 continue;
265 }
266
267 const auto elem_boundary_ids = _mesh.getBoundaryIDs(elem);
268 for (unsigned int side = 0; side < elem->n_sides(); side++)
269 {
270 const auto & boundary_ids = elem_boundary_ids[side];
271 const Elem * lower_d_elem = _mesh.getLowerDElem(elem, side);
272
273 for (const auto bnd_id : boundary_ids)
274 {
275 preBoundary(elem, side, bnd_id, lower_d_elem);
277 onBoundary(elem, side, bnd_id, lower_d_elem);
278 }
279
280 const Elem * neighbor = elem->neighbor_ptr(side);
281 if (neighbor)
282 {
283 preInternalSide(elem, side);
284
286 _neighbor_subdomain = neighbor->subdomain_id();
289
290 if (shouldComputeInternalSide(*elem, *neighbor))
291 onInternalSide(elem, side);
292
293 for (const auto bnd_id : boundary_ids)
294 onInterface(elem, side, bnd_id);
295
296 postInternalSide(elem, side);
297 }
298 else
299 onExternalSide(elem, side);
300 } // sides
301
302 postElement(elem);
303 } // range
304
305 post();
307 }
308 catch (MetaPhysicL::LogicError & e)
309 {
311 }
312 catch (std::exception & e)
313 {
314 // Continue if we find a libMesh degenerate map exception, but
315 // just re-throw for any real error
316 if (!strstr(e.what(), "Jacobian") && !strstr(e.what(), "singular") &&
317 !strstr(e.what(), "det != 0"))
318 throw; // not "throw e;" - that destroys type info!
319
320 mooseException("We caught a libMesh degeneracy exception in ThreadedElementLoopBase:\n",
321 e.what());
322 }
323 }
324 catch (MooseException & e)
325 {
327 }
328}
Provides a way for users to bail out of the current solve.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition MooseMesh.C:1690
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition MooseMesh.h:1552
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition MooseMesh.h:1556
virtual void onExternalSide(const Elem *elem, unsigned int side)
Called when iterating over external sides (no side neighbor)
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called when doing boundary assembling.
virtual void printBoundaryExecutionInformation(const unsigned int) const
Print information about the particular ordering of objects on each boundary.
virtual void neighborSubdomainChanged()
Called every time the neighbor subdomain changes (i.e.
virtual void printGeneralExecutionInformation() const
Print information about the loop ordering.
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Called when doing interface assembling.
virtual bool keepGoing()
Whether or not the loop should continue.
void resetExecPrintedSets() const
Resets the set of blocks and boundaries visited.
SubdomainID _old_subdomain
The subdomain for the last element.
virtual void preInternalSide(const Elem *elem, unsigned int side)
Called before evaluations on an element internal side.
virtual void postInternalSide(const Elem *elem, unsigned int side)
Called after evaluations on an element internal side.
virtual void subdomainChanged()
Called every time the current subdomain changes (i.e.
virtual void onInternalSide(const Elem *elem, unsigned int side)
Called when doing internal edge assembling.
virtual void preBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called before the boundary assembly.
virtual void onElement(const Elem *elem)
Assembly of the element (not including surface assembly)
virtual void postElement(const Elem *elem)
Called after the element assembly is done (including surface assembling)
virtual void preElement(const Elem *elem)
Called before the element assembly.
SubdomainID _old_neighbor_subdomain
The subdomain for the last neighbor.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.
virtual void printBlockExecutionInformation() const
Print information about the particular ordering of objects on each block.
virtual void post()
Called after the element range loop.
virtual void pre()
Called before the element range loop.
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Definition MooseError.C:155

Referenced by operator()().

◆ post()

void NonlinearThread::post ( )
overridevirtual

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 335 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< RangeType >.

Reimplemented in ComputeJacobianThread, and ComputeJacobianBlocksThread.

Definition at line 329 of file NonlinearThread.C.

330{
331 accumulate();
332}
virtual void accumulate()=0
Add element residual/Jacobian into assembly global data.

◆ postInternalSide()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::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 386 of file ThreadedElementLoopBase.h.

387{
388}

◆ pre()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::pre ( )
virtualinherited

Called before the element range loop.

Reimplemented in ComputeDiracThread.

Definition at line 332 of file ThreadedElementLoopBase.h.

333{
334}

Referenced by ComputeJacobianForScalingThread::operator()().

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

Definition at line 51 of file ThreadedElementLoop.h.

133{
135}
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly

◆ preElement()

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

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 47 of file ThreadedElementLoop.h.

116{
118}
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override

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

Definition at line 49 of file ThreadedElementLoop.h.

123{
125}
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 59 of file ThreadedElementLoop.h.

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

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

441{
442 _fe_problem.reinitElemFace(elem, side, _tid);
443
444 // Needed to use lower-dimensional variables on Materials
445 if (lower_d_elem)
446 _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
447
448 if (bnd_id != Moose::INVALID_BOUNDARY_ID)
449 {
450 _fe_problem.reinitMaterialsFaceOnBoundary(bnd_id, elem->subdomain_id(), _tid);
452 }
453 // Currently only used by HDG
454 else
455 _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
456}
void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)
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

Referenced by onBoundary(), and onInternalSide().

◆ printBlockExecutionInformation()

void NonlinearThread::printBlockExecutionInformation ( ) const
overrideprotectedvirtual

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

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 361 of file NonlinearThread.C.

362{
363 // Number of objects executing is approximated by size of warehouses
364 const int num_objects = _kernels.size() + _fv_kernels.size() + _integrated_bcs.size() +
366 const auto & console = _fe_problem.console();
367 const auto block_name = _mesh.getSubdomainName(_subdomain);
368
369 if (_fe_problem.shouldPrintExecution(_tid) && num_objects > 0)
370 {
372 return;
373 console << "[DBG] Ordering of " + objectType() + " Objects on block " << block_name << " ("
374 << _subdomain << ")" << std::endl;
376 {
377 console << "[DBG] Ordering of kernels:" << std::endl;
378 console << _kernels.activeObjectsToFormattedString() << std::endl;
379 }
380 if (_fv_kernels.size())
381 {
382 console << "[DBG] Ordering of FV elemental kernels:" << std::endl;
383 std::string fvkernels =
384 std::accumulate(_fv_kernels.begin() + 1,
385 _fv_kernels.end(),
386 _fv_kernels[0]->name(),
387 [](const std::string & str_out, FVElementalKernel * kernel)
388 { return str_out + " " + kernel->name(); });
389 console << ConsoleUtils::formatString(fvkernels, "[DBG]") << std::endl;
390 }
392 {
393 console << "[DBG] Ordering of DG kernels:" << std::endl;
394 console << _dg_kernels.activeObjectsToFormattedString() << std::endl;
395 }
396 }
397 else if (_fe_problem.shouldPrintExecution(_tid) && num_objects == 0 &&
399 console << "[DBG] No Active " + objectType() + " Objects on block " << block_name << " ("
400 << _subdomain << ")" << std::endl;
401
403}
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
Definition MooseMesh.C:1751
unsigned int size(THREAD_ID tid=0) const
Return how many kernels we store in the current warehouse.
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.
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< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
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...

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

Definition at line 406 of file NonlinearThread.C.

407{
411 return;
412
413 const auto & console = _fe_problem.console();
414 const auto b_name = _mesh.getBoundaryName(bid);
415 console << "[DBG] Ordering of " + objectType() + " Objects on boundary " << b_name << " (" << bid
416 << ")" << std::endl;
417
419 {
420 console << "[DBG] Ordering of integrated boundary conditions:" << std::endl;
421 console << _integrated_bcs.activeObjectsToFormattedString() << std::endl;
422 }
423
424 // We have not checked if we have a neighbor. This could be premature for saying we are executing
425 // interface kernels. However, we should assume the execution will happen on another side of the
426 // same boundary
428 {
429 console << "[DBG] Ordering of interface kernels:" << std::endl;
430 console << _interface_kernels.activeObjectsToFormattedString() << std::endl;
431 }
432
433 _boundaries_exec_printed.insert(bid);
434}
const std::string & getBoundaryName(const BoundaryID boundary_id) const
Return the name of the boundary given the id.
Definition MooseMesh.C:1780
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.

◆ printExecutionOrdering() [1/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 80 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}
const Elem & get(const ElemType type_in)

◆ printExecutionOrdering() [2/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 76 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}
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
const std::string & name() const
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
std::string mooseObjectVectorToString(const std::vector< MooseObject * > &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
std::string prettyCppType(const std::string &cpp_type)

◆ printGeneralExecutionInformation()

void NonlinearThread::printGeneralExecutionInformation ( ) const
overrideprotectedvirtual

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

Reimplemented from ThreadedElementLoopBase< RangeType >.

Definition at line 341 of file NonlinearThread.C.

342{
344 {
345 const auto & console = _fe_problem.console();
346 const auto execute_on = _fe_problem.getCurrentExecuteOnFlag();
347 console << "[DBG] Beginning elemental loop to compute " + objectType() + " on " << execute_on
348 << std::endl;
349 mooseDoOnce(
350 console << "[DBG] Execution order on each element:" << std::endl;
351 console << "[DBG] - kernels on element quadrature points" << std::endl;
352 console << "[DBG] - finite volume elemental kernels on element" << std::endl;
353 console << "[DBG] - integrated boundary conditions on element side quadrature points"
354 << std::endl;
355 console << "[DBG] - DG kernels on element side quadrature points" << std::endl;
356 console << "[DBG] - interface kernels on element side quadrature points" << std::endl;);
357 }
358}

◆ resetExecPrintedSets()

template<typename RangeType >
void ThreadedElementLoopBase< RangeType >::resetExecPrintedSets ( ) const
protectedinherited

Resets the set of blocks and boundaries visited.

Definition at line 454 of file ThreadedElementLoopBase.h.

455{
456 _blocks_exec_printed.clear();
458}

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

Definition at line 459 of file NonlinearThread.C.

460{
461 // ThreadedElementLoop<ConstElemRange>::shouldComputeInternalSide gets expensive on high
462 // h-refinement cases so we avoid it if possible
463 _should_execute_dg = false;
468}
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< RangeType >.

Definition at line 68 of file NonlinearThread.C.

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}
const MaterialWarehouse & getMaterialWarehouse() const
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...
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase * > &moose_vars, const THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
TheWarehouse & theWarehouse() const
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
void updateBlockMatPropDependency(SubdomainID id, std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
void updateBlockFEVariableCoupledVectorTagDependency(SubdomainID id, std::set< TagID > &needed_fe_var_vector_tags, THREAD_ID tid=0) const
void updateBoundaryVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
void updateBlockVariableDependency(SubdomainID id, std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
void updateBoundaryMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
virtual void determineObjectWarehouses()=0
Determine the objects we will actually compute based on vector/matrix tag information.
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
unsigned int number() const
Gets the number of this system.
std::vector< T * > & queryInto(std::vector< T * > &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse.

Referenced by ComputeJacobianForScalingThread::operator()().

Member Data Documentation

◆ _blocks_exec_printed

template<typename RangeType >
std::set<SubdomainID> ThreadedElementLoopBase< RangeType >::_blocks_exec_printed
mutableprotectedinherited

◆ _boundaries_exec_printed

template<typename RangeType >
std::set<BoundaryID> ThreadedElementLoopBase< RangeType >::_boundaries_exec_printed
mutableprotectedinherited

Keep track of which boundaries were visited.

Definition at line 193 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.

◆ _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 170 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

template<typename RangeType >
MooseMesh& ThreadedElementLoopBase< RangeType >::_mesh
protectedinherited

◆ _neighbor_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_neighbor_subdomain
protectedinherited

◆ _nl

NonlinearSystemBase& NonlinearThread::_nl
protected

◆ _num_cached

unsigned int NonlinearThread::_num_cached
protected

◆ _old_neighbor_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 178 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 172 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 177 of file NonlinearThread.h.

Referenced by onInternalSide(), and shouldComputeInternalSide().

◆ _subdomain

template<typename RangeType >
SubdomainID ThreadedElementLoopBase< RangeType >::_subdomain
protectedinherited

The subdomain for the current element.

Definition at line 169 of file ThreadedElementLoopBase.h.

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

◆ _subdomain_has_dg

bool NonlinearThread::_subdomain_has_dg
private

Whether the subdomain has DGKernels.

Definition at line 179 of file NonlinearThread.h.

Referenced by shouldComputeInternalSide().

◆ _subdomain_has_hdg

bool NonlinearThread::_subdomain_has_hdg
private

Whether the subdomain has HDGKernels.

Definition at line 181 of file NonlinearThread.h.

Referenced by onInternalSide(), and shouldComputeInternalSide().

◆ _tag_kernels

MooseObjectWarehouse<KernelBase>* NonlinearThread::_tag_kernels
protected

◆ _tid

template<typename RangeType >
THREAD_ID ThreadedElementLoopBase< RangeType >::_tid
protectedinherited

Definition at line 166 of file ThreadedElementLoopBase.h.

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


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