https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeResidualThread.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#include "NonlinearSystemBase.h"
12#include "KernelBase.h"
13#include "DGKernelBase.h"
14#include "IntegratedBCBase.h"
15#include "FVElementalKernel.h"
16#include "InterfaceKernelBase.h"
17#include "HDGKernel.h"
18#include "libmesh/threads.h"
19
21 const std::set<TagID> & tags)
22 : NonlinearThread(fe_problem), _tags(tags)
23{
24}
25
26// Splitting Constructor
31
33
34void
39
40void
45
46void
51
52void
58
59void
68
69void
73
74void
76{
77 // If users pass a empty vector or a full size of vector,
78 // we take all kernels
80 {
86 }
87 // If we have one tag only,
88 // We call tag based storage
89 else if (_tags.size() == 1)
90 {
96 }
97 // This one may be expensive
98 else
99 {
105 }
106
107 if (_fe_problem.haveFV())
108 {
109 _fv_kernels.clear();
111 .query()
112 .template condition<AttribSysNum>(_nl.number())
113 .template condition<AttribSystem>("FVElementalKernel")
114 .template condition<AttribSubdomains>(_subdomain)
115 .template condition<AttribThread>(_tid)
116 .template condition<AttribVectorTags>(_tags)
118 }
119}
120
121void
123{
125 "We should not be called if we have no active HDG kernels");
126 for (const auto & hdg_kernel : _hdg_warehouse->getActiveBlockObjects(_subdomain, _tid))
127 {
128 mooseAssert(
129 hdg_kernel->hasBlocks(_subdomain),
130 "We queried the warehouse for active blocks on this subdomain, so this better be active");
131 mooseAssert(
133 "We should have set a valid neighbor subdomain ID if we made it in side this method");
134 if (hdg_kernel->hasBlocks(_neighbor_subdomain))
135 hdg_kernel->computeResidualOnSide();
136 }
137}
virtual void computeOnInternalFace() override
void join(const ComputeResidualThread &)
void accumulateNeighbor() override
Add neighbor residual/Jacobian into assembly global data.
void accumulate() override
Add element residual/Jacobian into assembly global data.
void accumulateNeighborLower() override
Add neighbor and lower residual/Jacobian into assembly global data.
void determineObjectWarehouses() override
Determine the objects we will actually compute based on vector/matrix tag information.
ComputeResidualThread(FEProblemBase &fe_problem, const std::set< TagID > &tags)
void accumulateLower() override
Add lower-d residual/Jacobian into assembly global data.
virtual void compute(ResidualObject &ro) override
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
const std::set< TagID > & _tags
the tags denoting the vectors we want our residual objects to fill
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void cacheResidual(const THREAD_ID tid) override
virtual void addResidualLower(const THREAD_ID tid) override
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
virtual void addCachedResidual(const THREAD_ID tid) override
virtual void addResidualNeighbor(const THREAD_ID tid) override
TheWarehouse & theWarehouse() const
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag.
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
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
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
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
This is the common base class for objects that give residual contributions.
virtual void computeResidual()=0
Compute this object's contribution to the residual.
virtual unsigned int numVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
The total number of tags, which can be limited to the tag type.
Definition SubProblem.C:196
unsigned int number() const
Gets the number of this system.
std::vector< T * > & queryInto(std::vector< T * > &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse.
SubdomainID _subdomain
The subdomain for the current element.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.
@ VECTOR_TAG_RESIDUAL
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20