22 #include "libmesh/threads.h" 25 const std::set<TagID> & tags)
43 for (
const auto & it : ce)
51 unsigned int ivar = ivariable.
number();
52 unsigned int jvar = jvariable.
number();
60 for (
const auto & kernel : kernels)
61 if ((kernel->variable().number() == ivar) && kernel->isImplicit())
63 kernel->prepareShapes(jvar);
64 kernel->computeOffDiagJacobian(jvar);
73 for (
const auto & it : cne)
81 unsigned int ivar = ivariable.
number();
82 unsigned int jvar = jvariable.
number();
88 for (
const auto & kernel : kernels)
90 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
93 if ((kernel->variable().number() == ivar) && kernel->isImplicit())
96 kernel->computeNonlocalOffDiagJacobian(jvar);
104 if (scalar_vars.size() > 0)
108 for (
const auto & ivariable : vars)
109 if (ivariable->activeOnSubdomain(
_subdomain) > 0 &&
113 const auto & kernels =
115 for (
const auto & kernel : kernels)
116 if (kernel->isImplicit())
119 const auto & coupled_scalar_vars = kernel->getCoupledMooseScalarVars();
122 for (
const auto & jvariable : coupled_scalar_vars)
124 kernel->computeOffDiagJacobianScalar(jvariable->number());
131 if (fv_kernel->isImplicit())
132 fv_kernel->computeOffDiagJacobian();
139 for (
const auto & it : ce)
145 if (ivariable.
isFV() || jvariable.
isFV())
148 const auto ivar = ivariable.
number();
149 const auto jvar = jvariable.
number();
158 auto lower_d_subdomain = lower_d_elem->subdomain_id();
173 for (
const auto & bc : bcs)
174 if (bc->shouldApply() && bc->variable().number() == ivar && bc->isImplicit())
176 bc->prepareShapes(jvar);
177 bc->computeOffDiagJacobian(jvar);
185 for (
const auto & it : cne)
190 if (ivariable.
isFV())
193 unsigned int ivar = ivariable.
number();
194 unsigned int jvar = jvariable.
number();
199 const std::vector<std::shared_ptr<IntegratedBCBase>> & integrated_bcs =
201 for (
const auto & integrated_bc : integrated_bcs)
203 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
205 if (nonlocal_integrated_bc)
206 if ((integrated_bc->variable().number() == ivar) && integrated_bc->isImplicit())
209 integrated_bc->computeNonlocalOffDiagJacobian(jvar);
217 if (scalar_vars.size() > 0)
221 for (
const auto & ivar : vars)
222 if (ivar->activeOnSubdomain(
_subdomain) > 0 &&
227 for (
const auto & bc : bcs)
228 if (bc->variable().number() == ivar->number() && bc->isImplicit())
231 const std::vector<MooseVariableScalar *> coupled_scalar_vars =
232 bc->getCoupledMooseScalarVars();
235 for (
const auto & jvar : coupled_scalar_vars)
237 bc->computeOffDiagJacobianScalar(jvar->number());
249 for (
const auto & it : ce)
254 if (ivariable.
isFV())
257 unsigned int ivar = ivariable.
number();
258 unsigned int jvar = jvariable.
number();
261 for (
const auto & interface_kernel : int_ks)
263 if (!interface_kernel->isImplicit())
266 interface_kernel->prepareShapes(jvar);
267 interface_kernel->prepareNeighborShapes(jvar);
269 if (interface_kernel->variable().number() == ivar)
270 interface_kernel->computeElementOffDiagJacobian(jvar);
272 if (interface_kernel->neighborVariable().number() == ivar)
273 interface_kernel->computeNeighborOffDiagJacobian(jvar);
285 for (
const auto & it : ce)
290 if (ivariable.
isFV())
293 unsigned int ivar = ivariable.
number();
294 unsigned int jvar = jvariable.
number();
297 for (
const auto & dg : dgks)
300 if (dg->variable().number() == ivar && dg->isImplicit() &&
301 dg->hasBlocks(neighbor->subdomain_id()) &&
305 dg->prepareShapes(jvar);
306 dg->prepareNeighborShapes(jvar);
307 dg->computeOffDiagJacobian(jvar);
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)
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 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 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
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.
virtual void computeOnInternalFace(const Elem *neighbor) override
boundary_id_type BoundaryID
virtual bool checkNonlocalCouplingRequirement()
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
const SubdomainID INTERNAL_SIDE_LOWERD_ID
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase * > > & nonlocalCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
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