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();
125 for (
const auto & jvariable : coupled_scalar_vars)
128 kernel->computeOffDiagJacobianScalar(jvariable->number());
135 if (fv_kernel->isImplicit())
136 fv_kernel->computeOffDiagJacobian();
143 for (
const auto & it : ce)
149 if (ivariable.
isFV() || jvariable.
isFV())
152 const auto ivar = ivariable.
number();
153 const auto jvar = jvariable.
number();
162 auto lower_d_subdomain = lower_d_elem->subdomain_id();
177 for (
const auto & bc : bcs)
178 if (bc->shouldApply() && bc->variable().number() == ivar && bc->isImplicit())
180 bc->prepareShapes(jvar);
181 bc->computeOffDiagJacobian(jvar);
189 for (
const auto & it : cne)
194 if (ivariable.
isFV())
197 unsigned int ivar = ivariable.
number();
198 unsigned int jvar = jvariable.
number();
203 const std::vector<std::shared_ptr<IntegratedBCBase>> & integrated_bcs =
205 for (
const auto & integrated_bc : integrated_bcs)
207 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
208 std::dynamic_pointer_cast<NonlocalIntegratedBC>(integrated_bc);
209 if (nonlocal_integrated_bc)
210 if ((integrated_bc->variable().number() == ivar) && integrated_bc->isImplicit())
212 integrated_bc->prepareShapes(jvar);
213 integrated_bc->computeNonlocalOffDiagJacobian(jvar);
221 if (scalar_vars.size() > 0)
225 for (
const auto & ivar :
vars)
226 if (ivar->activeOnSubdomain(
_subdomain) > 0 &&
231 for (
const auto & bc : bcs)
232 if (bc->variable().number() == ivar->number() && bc->isImplicit())
235 const std::vector<MooseVariableScalar *> coupled_scalar_vars =
236 bc->getCoupledMooseScalarVars();
241 for (
const auto & jvar : coupled_scalar_vars)
244 bc->computeOffDiagJacobianScalar(jvar->number());
256 for (
const auto & it : ce)
261 if (ivariable.
isFV())
264 unsigned int ivar = ivariable.
number();
265 unsigned int jvar = jvariable.
number();
268 for (
const auto & interface_kernel : int_ks)
270 if (!interface_kernel->isImplicit())
273 interface_kernel->prepareShapes(jvar);
274 interface_kernel->prepareNeighborShapes(jvar);
276 if (interface_kernel->variable().number() == ivar)
277 interface_kernel->computeElementOffDiagJacobian(jvar);
279 if (interface_kernel->neighborVariable().number() == ivar)
280 interface_kernel->computeNeighborOffDiagJacobian(jvar);
292 for (
const auto & it : ce)
297 if (ivariable.
isFV())
300 unsigned int ivar = ivariable.
number();
301 unsigned int jvar = jvariable.
number();
304 for (
const auto & dg : dgks)
307 if (dg->variable().number() == ivar && dg->isImplicit() &&
308 dg->hasBlocks(neighbor->subdomain_id()) &&
312 dg->prepareShapes(jvar);
313 dg->prepareNeighborShapes(jvar);
314 dg->computeOffDiagJacobian(jvar);
325 "We should not be called if we have no active HDG kernels");
330 "We queried the warehouse for active blocks on this subdomain, so this better be active");
333 "We should have set a valid neighbor subdomain ID if we made it in side this method");
335 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.
bool areCoupled(const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const
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
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
unsigned int number() const
Get variable number coming from libMesh.
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual bool isFV() const
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