https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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#include "libmesh/elem_side_builder.h"
17
18// Forward declarations
19class FEProblemBase;
22class DGKernelBase;
24class TimeKernel;
25class KernelBase;
26class Kernel;
27class ResidualObject;
29class HDGKernel;
30
31class NonlinearThread : public ThreadedElementLoop<ConstElemRange>
32{
33public:
34 NonlinearThread(FEProblemBase & fe_problem);
35
36 // Splitting Constructor
38
39 virtual ~NonlinearThread();
40
41 virtual void operator()(const ConstElemRange & range, bool bypass_threading = false) override;
42
43 virtual void subdomainChanged() override;
44 virtual void onElement(const Elem * elem) override;
45 virtual void onBoundary(const Elem * elem,
46 unsigned int side,
47 BoundaryID bnd_id,
48 const Elem * lower_d_elem = nullptr) override;
49 virtual void onInterface(const Elem * elem, unsigned int side, BoundaryID bnd_id) override;
50 virtual void onInternalSide(const Elem * elem, unsigned int side) override;
51 virtual void onExternalSide(const Elem * elem, unsigned int side) override;
52 virtual void postElement(const Elem * /*elem*/) override;
53 virtual void post() override;
54 bool shouldComputeInternalSide(const Elem & elem, const Elem & neighbor) const override;
55
56protected:
67 void prepareFace(const Elem * elem,
68 unsigned int side,
70 const Elem * lower_d_elem = nullptr);
71
91 void onInterfaceWithHRefinementMismatch(const Elem * elem,
92 unsigned int side,
93 BoundaryID bnd_id,
94 const Elem * fine_neighbor);
95
98 virtual void computeOnElement();
99 virtual void computeOnBoundary(BoundaryID bnd_id, const Elem * lower_d_elem);
100 virtual void computeOnInterface(BoundaryID bnd_id);
101 virtual void computeOnInternalFace(const Elem * neighbor);
102 virtual void computeOnInternalFace() = 0;
104
109 virtual void compute(ResidualObject & ro) = 0;
110
113 virtual void compute(KernelBase & kernel);
114 virtual void compute(FVElementalKernel & kernel);
115 virtual void compute(IntegratedBCBase & bc);
116 virtual void compute(DGKernelBase & dg, const Elem * neighbor);
117 virtual void compute(InterfaceKernelBase & ik);
119
123 virtual void accumulateNeighbor() = 0;
124
128 virtual void accumulateNeighborLower() = 0;
129
133 virtual void accumulateLower() = 0;
134
138 virtual void accumulate() = 0;
139
143 virtual void determineObjectWarehouses() = 0;
144
146 void printGeneralExecutionInformation() const override;
147
149 void printBlockExecutionInformation() const override;
150
152 void printBoundaryExecutionInformation(const unsigned int bid) const override;
153
155 virtual std::string objectType() const { return ""; };
156
159
160 unsigned int _num_cached;
161
164
166
169
171
174
176
180
183
187
190
192 std::vector<FVElementalKernel *> _fv_kernels;
193
196
197private:
202 mutable bool _should_execute_dg;
207
210};
boundary_id_type BoundaryID
Serves as a base class for DGKernel and ADDGKernel.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
Base kernel for hybridized finite element formulations.
Definition HDGKernel.h:18
Base class for deriving any boundary condition of a integrated type.
InterfaceKernelBase is the base class for all InterfaceKernel type classes.
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition KernelBase.h:29
A storage container for MooseObjects that inherit from SetupInterface.
A storage container for MooseObjects that inherit from SetupInterface.
Nonlinear system to be solved.
MooseObjectTagWarehouse< HDGKernel > & _hdg_kernels
MooseObjectTagWarehouse< KernelBase > & _kernels
virtual std::string objectType() const
Return what the loops is meant to compute.
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
Called when doing boundary assembling.
bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const override
Whether to compute the internal side for the provided element-neighbor pair.
virtual void onInternalSide(const Elem *elem, unsigned int side) override
Called when doing internal edge assembling.
void onInterfaceWithHRefinementMismatch(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *fine_neighbor)
Compute and accumulate the interface kernel contribution from a single active fine neighbor when elem...
MooseObjectTagWarehouse< IntegratedBCBase > & _integrated_bcs
Reference to BC storage structures.
virtual void accumulateNeighbor()=0
Add neighbor residual/Jacobian into assembly global data.
virtual void operator()(const ConstElemRange &range, bool bypass_threading=false) override
virtual void determineObjectWarehouses()=0
Determine the objects we will actually compute based on vector/matrix tag information.
virtual void computeOnInterface(BoundaryID bnd_id)
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.
MooseObjectWarehouse< InterfaceKernelBase > * _ik_warehouse
bool _subdomain_has_dg
Whether the subdomain has DGKernels.
virtual void computeOnBoundary(BoundaryID bnd_id, const Elem *lower_d_elem)
MooseObjectTagWarehouse< DGKernelBase > & _dg_kernels
Reference to DGKernel storage structure.
virtual void post() override
Called after the element range loop.
virtual void accumulateNeighborLower()=0
Add neighbor and lower residual/Jacobian into assembly global data.
void printBlockExecutionInformation() const override
Print list of specific objects executed on each block and in which order.
unsigned int _num_cached
virtual void accumulate()=0
Add element residual/Jacobian into assembly global data.
virtual void onExternalSide(const Elem *elem, unsigned int side) override
Called when iterating over external sides (no side neighbor)
virtual void compute(ResidualObject &ro)=0
Will dispatch to computeResidual/computeJacobian/computeResidualAndJacobian based on the derived clas...
virtual void computeOnElement()
virtual void computeOnInternalFace()=0
std::vector< FVElementalKernel * > _fv_kernels
Current subdomain FVElementalKernels.
bool _subdomain_has_hdg
Whether the subdomain has HDGKernels.
NonlinearSystemBase & _nl
Reference to the underlying NonlinearSystemBase.
void printBoundaryExecutionInformation(const unsigned int bid) const override
Print list of specific objects executed on each boundary and in which order.
virtual void subdomainChanged() override
Called every time the current subdomain changes (i.e.
libMesh::ElemSideBuilder _elem_side_builder
Builds (and caches) the side element for elem/side pairs in onInterfaceWithHRefinementMismatch.
const bool _has_active_objects
Whether there are any active residual objects; otherwise we will do an early return.
MooseObjectWarehouse< DGKernelBase > * _dg_warehouse
MooseObjectWarehouse< HDGKernel > * _hdg_warehouse
MooseObjectWarehouse< KernelBase > * _tag_kernels
void printGeneralExecutionInformation() const override
Print information about the loop, mostly order of execution of objects.
virtual ~NonlinearThread()
MooseObjectTagWarehouse< InterfaceKernelBase > & _interface_kernels
Reference to interface kernel storage structure.
virtual void accumulateLower()=0
Add lower-d residual/Jacobian into assembly global data.
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id) override
Called when doing interface assembling.
virtual void postElement(const Elem *) override
Called after the element assembly is done (including surface assembling)
MooseObjectWarehouse< IntegratedBCBase > * _ibc_warehouse
bool _should_execute_dg
Whether DG kernels should be executed for a given elem-neighbor pairing.
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
This is the common base class for objects that give residual contributions.
Base class for assembly-like calculations.
All time kernels should inherit from this class.
Definition TimeKernel.h:19
const BoundaryID INVALID_BOUNDARY_ID
Definition MooseTypes.C:22