Go to the documentation of this file.
23 #include "libmesh/threads.h"
26 const std::set<TagID> & tags)
28 _nl(fe_problem.getNonlinearSystemBase()),
30 _integrated_bcs(_nl.getIntegratedBCWarehouse()),
31 _dg_kernels(_nl.getDGKernelWarehouse()),
32 _interface_kernels(_nl.getInterfaceKernelWarehouse()),
33 _kernels(_nl.getKernelWarehouse()),
34 _ad_jacobian_kernels(_nl.getADJacobianKernelWarehouse()),
43 _num_cached(
x._num_cached),
44 _integrated_bcs(
x._integrated_bcs),
45 _dg_kernels(
x._dg_kernels),
46 _interface_kernels(
x._interface_kernels),
48 _warehouse(
x._warehouse),
49 _ad_jacobian_kernels(
x._ad_jacobian_kernels),
62 for (
const auto & kernel : kernels)
63 if (kernel->isImplicit())
65 kernel->subProblem().prepareShapes(kernel->variable().number(),
_tid);
66 kernel->computeJacobian();
70 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
71 std::dynamic_pointer_cast<NonlocalKernel>(kernel);
73 kernel->computeNonlocalJacobian();
80 for (
const auto & kernel : kernels)
81 if (kernel->isImplicit())
82 kernel->computeJacobian();
90 for (
const auto & bc : bcs)
91 if (bc->shouldApply() && bc->isImplicit())
93 bc->subProblem().prepareFaceShapes(bc->variable().number(),
_tid);
94 bc->computeJacobian();
98 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
99 std::dynamic_pointer_cast<NonlocalIntegratedBC>(bc);
100 if (nonlocal_integrated_bc)
101 bc->computeNonlocalJacobian();
111 for (
const auto & dg : dgks)
112 if (dg->isImplicit())
114 dg->subProblem().prepareFaceShapes(dg->variable().number(),
_tid);
115 dg->subProblem().prepareNeighborShapes(dg->variable().number(),
_tid);
116 if (dg->hasBlocks(neighbor->subdomain_id()))
117 dg->computeJacobian();
126 for (
const auto & intk : intks)
127 if (intk->isImplicit())
129 intk->subProblem().prepareFaceShapes(intk->variable().number(),
_tid);
130 intk->subProblem().prepareNeighborShapes(intk->neighborVariable().number(),
_tid);
131 intk->computeJacobian();
141 std::set<MooseVariableFEBase *> needed_moose_vars;
149 std::set<unsigned int> needed_mat_props;
172 else if (
_tags.size() == 1)
233 const Elem * neighbor = elem->neighbor_ptr(side);
236 const dof_id_type elem_id = elem->id(), neighbor_id = neighbor->id();
238 if ((neighbor->active() && (neighbor->level() == elem->level()) && (elem_id < neighbor_id)) ||
239 (neighbor->level() < elem->level()))
254 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
267 const Elem * neighbor = elem->neighbor_ptr(side);
269 if (neighbor->active())
289 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
304 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
virtual void computeInternalInterFaceJacobian(BoundaryID bnd_id)
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void reinitMaterials(SubdomainID blk_id, THREAD_ID tid, bool swap_stateful=true)
virtual void reinitMaterialsFace(SubdomainID blk_id, THREAD_ID tid, bool swap_stateful=true)
const std::set< TagID > & _tags
Base class for assembly-like calculations.
std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Python like split function for strings.
virtual void computeJacobian()
virtual void swapBackMaterialsFace(THREAD_ID tid)
virtual ~ComputeJacobianThread()
virtual void clearActiveMaterialProperties(THREAD_ID tid) override
Clear the active material properties.
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id) override
Called when doing boundary assembling.
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id) override
Called when doing interface assembling.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void swapBackMaterials(THREAD_ID tid)
virtual void postElement(const Elem *) override
Called after the element assembly is done (including surface assembling)
FEProblemBase & _fe_problem
virtual unsigned int numMatrixTags() const
The total number of tags.
virtual void reinitNeighbor(const Elem *elem, unsigned int side, THREAD_ID tid) override
virtual void reinitMaterialsInterface(BoundaryID boundary_id, THREAD_ID tid, bool swap_stateful=true)
virtual void cacheJacobian(THREAD_ID tid) override
ComputeJacobianThread(FEProblemBase &fe_problem, const std::set< TagID > &tags)
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
static PetscErrorCode Vec x
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
virtual void reinitMaterialsBoundary(BoundaryID boundary_id, THREAD_ID tid, bool swap_stateful=true)
virtual void computeFaceJacobian(BoundaryID bnd_id)
void join(const ComputeJacobianThread &)
MooseObjectTagWarehouse< KernelBase > & _ad_jacobian_kernels
Reference to ADKernel<JACOBIAN> storage structure.
MooseObjectWarehouse< KernelBase > * _adjk_warehouse
Pointer to tags.
boundary_id_type BoundaryID
virtual void reinitElem(const Elem *elem, THREAD_ID tid) override
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
NonlinearSystemBase & _nl
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
virtual void subdomainSetup(SubdomainID subdomain, THREAD_ID tid)
virtual void addJacobianNeighbor(THREAD_ID tid) override
virtual bool checkNonlocalCouplingRequirement()
virtual void swapBackMaterialsNeighbor(THREAD_ID tid)
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
virtual void onInternalSide(const Elem *elem, unsigned int side) override
Called when doing internal edge assembling.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
void updateBoundaryVariableDependency(std::set< MooseVariableFEBase * > &needed_moose_vars, THREAD_ID tid=0) const
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid) override
virtual void post() override
Called after the element range loop.
virtual void prepare(const Elem *elem, THREAD_ID tid) override
virtual void prepareMaterials(SubdomainID blk_id, THREAD_ID tid)
Add the MooseVariables that the current materials depend on to the dependency list.
void updateBoundaryMatPropDependency(std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag.
SubdomainID _subdomain
The subdomain for the current element.
virtual void reinitOffDiagScalars(THREAD_ID tid) override
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,...
virtual void setActiveMaterialProperties(const std::set< unsigned int > &mat_prop_ids, THREAD_ID tid) override
Record and set the material properties required by the current computing thread.
virtual void reinitMaterialsNeighbor(SubdomainID blk_id, THREAD_ID tid, bool swap_stateful=true)
MooseObjectTagWarehouse< KernelBase > & _kernels
virtual void clearActiveElementalMooseVariables(THREAD_ID tid) override
Clear the active elemental MooseVariableFEBase.
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase * > &moose_vars, THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
void updateBlockVariableDependency(SubdomainID id, std::set< MooseVariableFEBase * > &needed_moose_vars, THREAD_ID tid=0) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
MooseObjectWarehouse< KernelBase > * _warehouse
virtual void computeInternalFaceJacobian(const Elem *neighbor)
void updateBlockMatPropDependency(SubdomainID id, std::set< unsigned int > &needed_mat_props, THREAD_ID tid=0) const
MooseObjectWarehouse< T > & getMatrixTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has one of the given matrix tags.
virtual void subdomainChanged() override
Called every time the current subdomain changes (i.e.
virtual void addCachedJacobian(THREAD_ID tid) override