https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeJacobianThread.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12#include "DGKernelBase.h"
13#include "FEProblem.h"
14#include "IntegratedBCBase.h"
15#include "InterfaceKernelBase.h"
16#include "HDGKernel.h"
17#include "MooseVariableFE.h"
18#include "NonlinearSystem.h"
19#include "SwapBackSentinel.h"
20#include "TimeDerivative.h"
21#include "FVElementalKernel.h"
22#include "MaterialBase.h"
23#include "ConsoleUtils.h"
24#include "Assembly.h"
25
26#include "libmesh/threads.h"
27
29 const std::set<TagID> & tags)
30 : NonlinearThread(fe_problem), _tags(tags)
31{
32}
33
34// Splitting Constructor
39
41
42void
44{
45 if (kernel.isImplicit())
46 {
47 kernel.prepareShapes(kernel.variable().number());
48 kernel.computeJacobian();
50 mooseError("Nonlocal kernels only supported for non-diagonal coupling. Please specify an SMP "
51 "preconditioner, with appropriate row-column coupling or specify full = true.");
52 }
53}
54
55void
57{
58 if (fvkernel.isImplicit())
59 fvkernel.computeJacobian();
60}
61
62void
64{
65 if (bc.shouldApply() && bc.isImplicit())
66 {
67 bc.prepareShapes(bc.variable().number());
68 bc.computeJacobian();
70 mooseError("Nonlocal boundary conditions only supported for non-diagonal coupling. Please "
71 "specify an SMP preconditioner, with appropriate row-column coupling or specify "
72 "full = true.");
73 }
74}
75
76void
77ComputeJacobianThread::compute(DGKernelBase & dg, const Elem * neighbor)
78{
79 if (dg.isImplicit())
80 {
81 dg.prepareShapes(dg.variable().number());
83 if (dg.hasBlocks(neighbor->subdomain_id()))
84 dg.computeJacobian();
85 }
86}
87
88void
90{
91 if (intk.isImplicit())
92 {
93 intk.prepareShapes(intk.variable().number());
95 intk.computeJacobian();
96 }
97}
98
99void
101{
102 // If users pass a empty vector or a full size of vector,
103 // we take all kernels
104 if (!_tags.size() || _tags.size() == _fe_problem.numMatrixTags())
105 {
111 }
112 // If we have one tag only,
113 // We call tag based storage
114 else if (_tags.size() == 1)
115 {
121 }
122 // This one may be expensive, and hopefully we do not use it so often
123 else
124 {
130 }
131}
132
133void
138
139void
144
145void
150
151void
160
161void
165
166void
168{
170 "We should not be called if we have no active HDG kernels");
171 mooseAssert(false, "HDGKernels must compute the full Jacobian");
172}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
virtual void compute(ResidualObject &) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
virtual void postElement(const Elem *) override
Called after the element assembly is done (including surface assembling)
void determineObjectWarehouses() override
Determine the objects we will actually compute based on vector/matrix tag information.
virtual void accumulateLower() override
Add lower-d residual/Jacobian into assembly global data.
virtual void accumulateNeighborLower() override
Add neighbor and lower residual/Jacobian into assembly global data.
void join(const ComputeJacobianThread &)
void accumulateNeighbor() override
Add neighbor residual/Jacobian into assembly global data.
virtual void computeOnInternalFace() override
const std::set< TagID > & _tags
ComputeJacobianThread(FEProblemBase &fe_problem, const std::set< TagID > &tags)
Serves as a base class for DGKernel and ADDGKernel.
virtual void computeJacobian() override
Computes the jacobian for the current side.
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void addJacobianLowerD(const THREAD_ID tid) override
virtual void addJacobianNeighbor(const THREAD_ID tid) override
virtual void addCachedJacobian(const THREAD_ID tid) override
virtual void cacheJacobian(const THREAD_ID tid) override
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we're computing the scaling jacobian.
virtual void addJacobianNeighborLowerD(const THREAD_ID tid) override
virtual bool checkNonlocalCouplingRequirement() const override
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
Base class for deriving any boundary condition of a integrated type.
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
virtual bool shouldApply() const override
Hook for turning the boundary condition on and off.
InterfaceKernelBase is the base class for all InterfaceKernel type classes.
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
virtual const MooseVariableFEBase & neighborVariable() const =0
The neighbor variable number that this interface kernel operates on.
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition KernelBase.h:29
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.
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag.
bool hasActiveBlockObjects(THREAD_ID tid=0) const
unsigned int number() const
Get variable number coming from libMesh.
void prepareNeighborShapes(unsigned int var_num)
Prepare neighbor shape functions.
virtual libMesh::System & system() override
Get the reference to the libMesh system.
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
MooseObjectTagWarehouse< KernelBase > & _kernels
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.
unsigned int _num_cached
NonlinearSystemBase & _nl
Reference to the underlying NonlinearSystemBase.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
virtual void prepareShapes(unsigned int var_num)
Prepare shape functions.
virtual const MooseVariableBase & variable() const =0
Returns the variable that this object operates on.
virtual void computeJacobian()=0
Compute this object's contribution to the diagonal Jacobian entries.
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition SubProblem.h:248
SubdomainID _subdomain
The subdomain for the current element.
bool has_static_condensation() const