23#include "libmesh/threads.h"
26 const std::set<TagID> & tags)
44 for (
const auto & it : ce)
52 unsigned int ivar = ivariable.
number();
53 unsigned int jvar = jvariable.
number();
61 for (
const auto & kernel : kernels)
62 if ((kernel->variable().number() == ivar) && kernel->isImplicit())
64 kernel->prepareShapes(jvar);
65 kernel->computeOffDiagJacobian(jvar);
74 for (
const auto & it : cne)
82 unsigned int ivar = ivariable.
number();
83 unsigned int jvar = jvariable.
number();
89 for (
const auto & kernel : kernels)
91 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
92 std::dynamic_pointer_cast<NonlocalKernel>(kernel);
94 if ((kernel->variable().number() == ivar) && kernel->isImplicit())
96 kernel->prepareShapes(jvar);
97 kernel->computeNonlocalOffDiagJacobian(jvar);
105 if (scalar_vars.size() > 0)
109 for (
const auto & ivariable :
vars)
110 if (ivariable->activeOnSubdomain(
_subdomain) > 0 &&
114 const auto & kernels =
116 for (
const auto & kernel : kernels)
117 if (kernel->isImplicit())
120 const auto & coupled_scalar_vars = kernel->getCoupledMooseScalarVars();
123 for (
const auto & jvariable : coupled_scalar_vars)
125 kernel->computeOffDiagJacobianScalar(jvariable->number());
132 if (fv_kernel->isImplicit())
133 fv_kernel->computeOffDiagJacobian();
140 for (
const auto & it : ce)
146 if (ivariable.
isFV() || jvariable.
isFV())
149 const auto ivar = ivariable.
number();
150 const auto jvar = jvariable.
number();
159 auto lower_d_subdomain = lower_d_elem->subdomain_id();
174 for (
const auto & bc : bcs)
175 if (bc->shouldApply() && bc->variable().number() == ivar && bc->isImplicit())
177 bc->prepareShapes(jvar);
178 bc->computeOffDiagJacobian(jvar);
186 for (
const auto & it : cne)
191 if (ivariable.
isFV())
194 unsigned int ivar = ivariable.
number();
195 unsigned int jvar = jvariable.
number();
200 const std::vector<std::shared_ptr<IntegratedBCBase>> & integrated_bcs =
202 for (
const auto & integrated_bc : integrated_bcs)
204 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
205 std::dynamic_pointer_cast<NonlocalIntegratedBC>(integrated_bc);
206 if (nonlocal_integrated_bc)
207 if ((integrated_bc->variable().number() == ivar) && integrated_bc->isImplicit())
209 integrated_bc->prepareShapes(jvar);
210 integrated_bc->computeNonlocalOffDiagJacobian(jvar);
218 if (scalar_vars.size() > 0)
222 for (
const auto & ivar :
vars)
223 if (ivar->activeOnSubdomain(
_subdomain) > 0 &&
228 for (
const auto & bc : bcs)
229 if (bc->variable().number() == ivar->number() && bc->isImplicit())
232 const std::vector<MooseVariableScalar *> coupled_scalar_vars =
233 bc->getCoupledMooseScalarVars();
236 for (
const auto & jvar : coupled_scalar_vars)
238 bc->computeOffDiagJacobianScalar(jvar->number());
250 for (
const auto & it : ce)
255 if (ivariable.
isFV())
258 unsigned int ivar = ivariable.
number();
259 unsigned int jvar = jvariable.
number();
262 for (
const auto & interface_kernel : int_ks)
264 if (!interface_kernel->isImplicit())
267 interface_kernel->prepareShapes(jvar);
268 interface_kernel->prepareNeighborShapes(jvar);
270 if (interface_kernel->variable().number() == ivar)
271 interface_kernel->computeElementOffDiagJacobian(jvar);
273 if (interface_kernel->neighborVariable().number() == ivar)
274 interface_kernel->computeNeighborOffDiagJacobian(jvar);
286 for (
const auto & it : ce)
291 if (ivariable.
isFV())
294 unsigned int ivar = ivariable.
number();
295 unsigned int jvar = jvariable.
number();
298 for (
const auto & dg : dgks)
301 if (dg->variable().number() == ivar && dg->isImplicit() &&
302 dg->hasBlocks(neighbor->subdomain_id()) &&
306 dg->prepareShapes(jvar);
307 dg->prepareNeighborShapes(jvar);
308 dg->computeOffDiagJacobian(jvar);
319 "We should not be called if we have no active HDG kernels");
324 "We queried the warehouse for active blocks on this subdomain, so this better be active");
327 "We should have set a valid neighbor subdomain ID if we made it in side this method");
329 hdg_kernel->computeJacobianOnSide();
boundary_id_type BoundaryID
ComputeFullJacobianThread(FEProblemBase &fe_problem, const std::set< TagID > &tags)
virtual ~ComputeFullJacobianThread()
virtual void computeOnInternalFace() override
virtual void computeOnElement() override
virtual void computeOnInterface(BoundaryID bnd_id) override
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem) override
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
virtual MooseMesh & mesh() override
virtual bool checkNonlocalCouplingRequirement() const override
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
const std::set< SubdomainID > & interiorLowerDBlocks() const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveVariableBlockObjects(unsigned int variable_id, SubdomainID block_id, THREAD_ID tid=0) const
Methods for checking/getting variable kernels for a variable and SubdomainID.
const std::vector< std::shared_ptr< T > > & getActiveVariableBlockObjects(unsigned int variable_id, SubdomainID block_id, THREAD_ID tid=0) const
unsigned int number() const
Get variable number coming from libMesh.
This class provides an interface for common operations on field variables of both FE and FV types wit...
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
virtual bool isFV() const
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
NonlinearSystemBase & _nl
Reference to the underlying NonlinearSystemBase.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
unsigned int number() const
Gets the number of this system.
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
virtual bool hasScalarVariable(const std::string &var_name) const
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
SubdomainID _subdomain
The subdomain for the current element.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.
FEProblemBase & _fe_problem
const SubdomainID INVALID_BLOCK_ID