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 =
94 if ((kernel->variable().number() == ivar) && kernel->isImplicit())
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 =
206 if (nonlocal_integrated_bc)
207 if ((integrated_bc->variable().number() == ivar) && integrated_bc->isImplicit())
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();
const std::vector< std::shared_ptr< T > > & getActiveVariableBlockObjects(unsigned int variable_id, SubdomainID block_id, THREAD_ID tid=0) const
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase * > > & couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
const std::set< SubdomainID > & interiorLowerDBlocks() const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
virtual void computeOnInternalFace() override
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
unsigned int number() const
Get variable number coming from libMesh.
ComputeFullJacobianThread(FEProblemBase &fe_problem, const std::set< TagID > &tags)
FEProblemBase & _fe_problem
NonlocalIntegratedBC is used for solving integral terms in integro-differential equations.
virtual bool checkNonlocalCouplingRequirement() const override
virtual bool isFV() const
virtual ~ComputeFullJacobianThread()
virtual void prepareShapes(unsigned int var_num)
Prepare shape functions.
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const SubdomainID INVALID_BLOCK_ID
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.
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
boundary_id_type BoundaryID
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getBoundaryObjects(THREAD_ID tid=0) const
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
unsigned int number() const
Gets the number of this system.
NonlinearSystemBase & _nl
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase * > > & nonlocalCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
virtual MooseMesh & mesh() override
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem) override
NonlocalKernel is used for solving integral terms in integro-differential equations.
virtual void computeOnInterface(BoundaryID bnd_id) override
bool activeOnSubdomain(SubdomainID subdomain) const
Is the variable active on the subdomain?
SubdomainID _subdomain
The subdomain for the current element.
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
virtual bool hasScalarVariable(const std::string &var_name) const
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
virtual void computeOnElement() override
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.