https://mooseframework.inl.gov
NonlinearThread.h
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 
10 #pragma once
11 
12 #include "ThreadedElementLoop.h"
14 
15 #include "libmesh/elem_range.h"
16 
17 // Forward declarations
18 class FEProblemBase;
20 class IntegratedBCBase;
21 class DGKernelBase;
23 class TimeKernel;
24 class KernelBase;
25 class Kernel;
26 class ResidualObject;
27 class FVElementalKernel;
28 class HDGKernel;
29 
30 class NonlinearThread : public ThreadedElementLoop<ConstElemRange>
31 {
32 public:
33  NonlinearThread(FEProblemBase & fe_problem);
34 
35  // Splitting Constructor
37 
38  virtual ~NonlinearThread();
39 
40  virtual void operator()(const ConstElemRange & range, bool bypass_threading = false) override;
41 
42  virtual void subdomainChanged() override;
43  virtual void onElement(const Elem * elem) override;
44  virtual void onBoundary(const Elem * elem,
45  unsigned int side,
46  BoundaryID bnd_id,
47  const Elem * lower_d_elem = nullptr) override;
48  virtual void onInterface(const Elem * elem, unsigned int side, BoundaryID bnd_id) override;
49  virtual void onInternalSide(const Elem * elem, unsigned int side) override;
50  virtual void postElement(const Elem * /*elem*/) override;
51  virtual void post() override;
52  bool shouldComputeInternalSide(const Elem & elem, const Elem & neighbor) const override;
53 
54 protected:
65  void prepareFace(const Elem * elem,
66  unsigned int side,
68  const Elem * lower_d_elem = nullptr);
69 
72  virtual void computeOnElement();
73  virtual void computeOnBoundary(BoundaryID bnd_id, const Elem * lower_d_elem);
74  virtual void computeOnInterface(BoundaryID bnd_id);
75  virtual void computeOnInternalFace(const Elem * neighbor);
76  virtual void computeOnInternalFace() = 0;
78 
83  virtual void compute(ResidualObject & ro) = 0;
84 
87  virtual void compute(KernelBase & kernel);
88  virtual void compute(FVElementalKernel & kernel);
89  virtual void compute(IntegratedBCBase & bc);
90  virtual void compute(DGKernelBase & dg, const Elem * neighbor);
91  virtual void compute(InterfaceKernelBase & ik);
93 
97  virtual void accumulateNeighbor() = 0;
98 
102  virtual void accumulateNeighborLower() = 0;
103 
107  virtual void accumulateLower() = 0;
108 
112  virtual void accumulate() = 0;
113 
117  virtual void determineObjectWarehouses() = 0;
118 
120  void printGeneralExecutionInformation() const override;
121 
123  void printBlockExecutionInformation() const override;
124 
126  void printBoundaryExecutionInformation(const unsigned int bid) const override;
127 
129  virtual std::string objectType() const { return ""; };
130 
132  unsigned int _num_cached;
133 
136 
138 
141 
143 
146 
148 
152 
155 
159 
162 
164  std::vector<FVElementalKernel *> _fv_kernels;
165 
168 
169 private:
174  mutable bool _should_execute_dg;
175 };
Base class for assembly-like calculations.
A kernel for hybridized finite element formulations.
Definition: HDGKernel.h:17
virtual void accumulate()=0
Add element residual/Jacobian into assembly global data.
virtual void accumulateLower()=0
Add lower-d residual/Jacobian into assembly global data.
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem)
const BoundaryID INVALID_BOUNDARY_ID
Definition: MooseTypes.C:22
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
unsigned int _num_cached
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
void prepareFace(const Elem *elem, unsigned int side, BoundaryID bnd_id=Moose::INVALID_BOUNDARY_ID, const Elem *lower_d_elem=nullptr)
Reinitialize variables and materials on a face.
bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const override
Whether to compute the internal side for the provided element-neighbor pair.
Serves as a base class for DGKernel and ADDGKernel.
Definition: DGKernelBase.h:32
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
Called when doing boundary assembling.
virtual void accumulateNeighbor()=0
Add neighbor residual/Jacobian into assembly global data.
Nonlinear system to be solved.
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
const bool _has_active_objects
Whether there are any active residual objects; otherwise we will do an early return.
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
This is the common base class for the three main kernel types implemented in MOOSE, Kernel, VectorKernel and ArrayKernel.
Definition: KernelBase.h:23
void printBlockExecutionInformation() const override
Print list of specific objects executed on each block and in which order.
MooseObjectTagWarehouse< KernelBase > & _kernels
boundary_id_type BoundaryID
virtual void computeOnElement()
virtual std::string objectType() const
Return what the loops is meant to compute.
NonlinearThread(FEProblemBase &fe_problem)
void printGeneralExecutionInformation() const override
Print information about the loop, mostly order of execution of objects.
virtual void computeOnInterface(BoundaryID bnd_id)
NonlinearSystemBase & _nl
virtual void postElement(const Elem *) override
Called after the element assembly is done (including surface assembling)
virtual void operator()(const ConstElemRange &range, bool bypass_threading=false) override
virtual void onInternalSide(const Elem *elem, unsigned int side) override
Called when doing internal edge assembling.
virtual void computeOnInternalFace()=0
tbb::split split
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
This is the common base class for objects that give residual contributions.
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
All time kernels should inherit from this class.
Definition: TimeKernel.h:18
virtual void accumulateNeighborLower()=0
Add neighbor and lower residual/Jacobian into assembly global data.
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
Definition: Kernel.h:15
Base class for deriving any boundary condition of a integrated type.
void printBoundaryExecutionInformation(const unsigned int bid) const override
Print list of specific objects executed on each boundary and in which order.
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id) override
Called when doing interface assembling.
InterfaceKernelBase is the base class for all InterfaceKernel type classes.
virtual void determineObjectWarehouses()=0
Determine the objects we will actually compute based on vector/matrix tag information.
MooseObjectWarehouse< KernelBase > * _tag_kernels
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
virtual void post() override
Called after the element range loop.
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.
virtual ~NonlinearThread()
virtual void subdomainChanged() override
Called every time the current subdomain changes (i.e.