https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DisplacedSystem.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 "SystemBase.h"
13
14// Forward declarations
16namespace libMesh
17{
18class System;
19}
20
22{
23public:
26
28 FEProblemBase & fe_problem,
29 SystemBase & undisplaced_system,
30 const std::string & name,
31 Moose::VarKindType var_kind);
32 virtual ~DisplacedSystem();
33
34 virtual NumericVector<Number> & getVector(TagID tag_id) override
35 {
36 return _undisplaced_system.getVector(tag_id);
37 }
38 virtual const NumericVector<Number> & getVector(TagID tag_id) const override
39 {
40 return _undisplaced_system.getVector(tag_id);
41 }
42
43 virtual TagID residualVectorTag() const override
44 {
46 }
47
48 virtual TagID systemMatrixTag() const override { return _undisplaced_system.systemMatrixTag(); }
49
50 virtual TagID timeVectorTag() const override { return _undisplaced_system.timeVectorTag(); }
51
52 virtual TagID nonTimeVectorTag() const override { return _undisplaced_system.nonTimeVectorTag(); }
53
54 virtual std::set<TagID> defaultVectorTags() const override
55 {
57 }
58 virtual std::set<TagID> defaultMatrixTags() const override
59 {
61 }
62
63 virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag) override
64 {
66 }
67
68 virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag) override
69 {
71 }
72
77
82
83 virtual void associateMatrixToTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override
84 {
86 }
87
92
97
102
103 virtual NumericVector<Number> & getVector(const std::string & name) override;
104 virtual const NumericVector<Number> & getVector(const std::string & name) const override;
105
106 virtual NumericVector<Number> & serializedSolution() override
107 {
109 }
110
111 const NumericVector<Number> * const & currentSolution() const override
112 {
114 }
115
116 NumericVector<Number> * solutionPreviousNewton() override { return nullptr; }
117 const NumericVector<Number> * solutionPreviousNewton() const override { return nullptr; }
118
119 NumericVector<Number> * solutionUDot() override { return _undisplaced_system.solutionUDot(); }
120 NumericVector<Number> * solutionUDotDot() override
121 {
123 }
124 NumericVector<Number> * solutionUDotOld() override
125 {
127 }
128 NumericVector<Number> * solutionUDotDotOld() override
129 {
131 }
132 const NumericVector<Number> * solutionUDot() const override
133 {
135 }
136 const NumericVector<Number> * solutionUDotDot() const override
137 {
139 }
140 const NumericVector<Number> * solutionUDotOld() const override
141 {
143 }
144 const NumericVector<Number> * solutionUDotDotOld() const override
145 {
147 }
148
149 virtual std::vector<Number> & duDotDus() override { return _undisplaced_system.duDotDus(); }
150 virtual Number & duDotDotDu() override { return _undisplaced_system.duDotDotDu(); }
151 virtual const Number & duDotDu(unsigned int var_num = 0) const override;
152 virtual const Number & duDotDotDu() const override { return _undisplaced_system.duDotDotDu(); }
153
154 virtual void addDotVectors() override { _undisplaced_system.addDotVectors(); }
155
160 virtual NumericVector<Number> & residualCopy() override
161 {
163 }
164 virtual NumericVector<Number> & residualGhosted() override
165 {
167 }
168
169 virtual void augmentSendList(std::vector<dof_id_type> & send_list) override
170 {
172 }
173
179 std::vector<dof_id_type> & /*n_nz*/,
180 std::vector<dof_id_type> & /*n_oz*/) override
181 {
182 }
183
188 virtual void addVariableToZeroOnResidual(std::string var_name) override
189 {
191 }
192
197 virtual void addVariableToZeroOnJacobian(std::string var_name) override
198 {
200 }
201
205 virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed) override
206 {
207 _undisplaced_system.zeroVariables(vars_to_be_zeroed);
208 }
209
210 virtual bool hasVector(TagID tag_id) const override
211 {
212 return _undisplaced_system.hasVector(tag_id);
213 }
214
215 virtual bool hasMatrix(TagID tag_id) const override
216 {
217 return _undisplaced_system.hasMatrix(tag_id);
218 }
219
220 virtual void initSolutionState() override;
221 virtual NumericVector<Number> & solutionState(
222 const unsigned int state,
224 virtual const NumericVector<Number> &
225 solutionState(const unsigned int state,
226 Moose::SolutionIterationType iteration_type =
228 virtual void needSolutionState(
229 const unsigned int state,
231 libMesh::ParallelType parallel_type = GHOSTED) override;
232 virtual bool hasSolutionState(const unsigned int state,
233 Moose::SolutionIterationType iteration_type =
235
237 {
238 return _undisplaced_system.getMatrix(tag);
239 }
240 virtual const libMesh::SparseMatrix<Number> & getMatrix(TagID tag) const override
241 {
242 return _undisplaced_system.getMatrix(tag);
243 }
244
245 virtual libMesh::System & sys() { return _sys; }
246
247 virtual System & system() override;
248 virtual const System & system() const override;
249
250 virtual void compute(ExecFlagType) override {}
251
252protected:
253 NumericVector<Number> & solutionInternal() const override
254 {
256 }
257
260};
261
262inline void
267
268inline NumericVector<Number> &
269DisplacedSystem::solutionState(const unsigned int state,
270 const Moose::SolutionIterationType iteration_type)
271{
272 return _undisplaced_system.solutionState(state, iteration_type);
273}
274
275inline const NumericVector<Number> &
276DisplacedSystem::solutionState(const unsigned int state,
277 const Moose::SolutionIterationType iteration_type) const
278{
279 return _undisplaced_system.solutionState(state, iteration_type);
280}
281
282inline void
283DisplacedSystem::needSolutionState(const unsigned int state,
284 const Moose::SolutionIterationType iteration_type,
285 const libMesh::ParallelType parallel_type)
286{
287 _undisplaced_system.needSolutionState(state, iteration_type, parallel_type);
288}
289
290inline bool
291DisplacedSystem::hasSolutionState(const unsigned int state,
292 const Moose::SolutionIterationType iteration_type) const
293{
294 return _undisplaced_system.hasSolutionState(state, iteration_type);
295}
296
297inline const Number &
298DisplacedSystem::duDotDu(const unsigned int var_num) const
299{
300 return _undisplaced_system.duDotDu(var_num);
301}
unsigned int TagID
Definition MooseTypes.h:238
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const override
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older,...
virtual std::vector< Number > & duDotDus() override
virtual void augmentSendList(std::vector< dof_id_type > &send_list) override
Will modify the send_list to add all of the extra ghosted dofs for this system.
virtual void disassociateDefaultMatrixTags() override
Disassociate the matrices associated with the default matrix tags of this system.
DisplacedSystem & operator=(DisplacedSystem &&)=delete
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag) override
Disassociate a matrix from a tag.
NumericVector< Number > & solutionInternal() const override
Internal getter for solution owned by libMesh.
virtual const libMesh::SparseMatrix< Number > & getMatrix(TagID tag) const override
Get a raw SparseMatrix.
const NumericVector< Number > * solutionPreviousNewton() const override
virtual bool hasVector(TagID tag_id) const override
Check if the tagged vector exists in the system.
virtual bool hasMatrix(TagID tag_id) const override
Check if the tagged matrix exists in the system.
NumericVector< Number > * solutionUDotDotOld() override
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag) override
Associate a vector for a given tag.
const NumericVector< Number > * solutionUDotDot() const override
SystemBase & _undisplaced_system
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed) override
Zero out the solution for the list of variables passed in.
virtual void addDotVectors() override
Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.
virtual void initSolutionState() override
Initializes the solution state.
virtual void disassociateVectorFromTag(TagID tag) override
Disassociate any vector that is associated with a given tag.
virtual NumericVector< Number > & residualGhosted() override
virtual TagID nonTimeVectorTag() const override
virtual const Number & duDotDotDu() const override
virtual void compute(ExecFlagType) override
Compute time derivatives, auxiliary variables, etc.
virtual void addVariableToZeroOnResidual(std::string var_name) override
Adds this variable to the list of variables to be zeroed during each residual evaluation.
virtual std::set< TagID > defaultMatrixTags() const override
Get the default matrix tags associted with this system.
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag) override
Disassociate a given vector from a given tag.
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag) override
Associate a matrix to a tag.
virtual std::set< TagID > defaultVectorTags() const override
Get the default vector tags associated with this system.
virtual void addVariableToZeroOnJacobian(std::string var_name) override
Adds this variable to the list of variables to be zeroed during each jacobian evaluation.
virtual const Number & duDotDu(unsigned int var_num=0) const override
NumericVector< Number > * solutionUDotOld() override
libMesh::System & _sys
virtual System & system() override
Get the reference to the libMesh system.
NumericVector< Number > * solutionUDotDot() override
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) override
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
NumericVector< Number > * solutionUDot() override
virtual const NumericVector< Number > & getVector(TagID tag_id) const override
const NumericVector< Number > * solutionUDotOld() const override
const NumericVector< Number > * solutionUDot() const override
virtual TagID residualVectorTag() const override
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag) override
Get a raw SparseMatrix.
virtual ~DisplacedSystem()
virtual libMesh::System & sys()
virtual void disassociateMatrixFromTag(TagID tag) override
Disassociate any matrix that is associated with a given tag.
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED) override
Registers that the solution state state is needed.
const NumericVector< Number > * solutionUDotDotOld() const override
virtual Number & duDotDotDu() override
virtual NumericVector< Number > & serializedSolution() override
Returns a reference to a serialized version of the solution vector for this subproblem.
virtual NumericVector< Number > & getVector(TagID tag_id) override
Get a raw NumericVector by tag.
virtual TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
virtual void disassociateDefaultVectorTags() override
Disassociate the vectors associated with the default vector tags of this system.
DisplacedSystem(DisplacedSystem &&)=delete
NumericVector< Number > * solutionPreviousNewton() override
virtual void augmentSparsity(libMesh::SparsityPattern::Graph &, std::vector< dof_id_type > &, std::vector< dof_id_type > &) override
This is an empty function since the displaced system doesn't have a matrix! All sparsity pattern modi...
virtual NumericVector< Number > & residualCopy() override
Return the residual copy from the NonlinearSystem.
virtual TagID timeVectorTag() const override
Ideally, we should not need this API.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Class for containing MooseEnum item information.
Base class for a system (of equations)
Definition SystemBase.h:87
virtual NumericVector< Number > & residualCopy()
Definition SystemBase.h:445
virtual void addVariableToZeroOnJacobian(std::string var_name)
Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.
Definition SystemBase.C:181
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
Definition SystemBase.C:201
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual void addVariableToZeroOnResidual(std::string var_name)
Adds this variable to the list of variables to be zeroed during each residual evaluation.
Definition SystemBase.C:175
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition SystemBase.h:338
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition SystemBase.C:923
virtual NumericVector< Number > * solutionUDot()
Definition SystemBase.h:280
virtual void augmentSendList(std::vector< dof_id_type > &send_list)
Will modify the send_list to add all of the extra ghosted dofs for this system.
Definition SystemBase.C:453
virtual TagID residualVectorTag() const
Definition SystemBase.h:326
virtual void addDotVectors()
Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition SystemBase.C:932
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
Registers that the solution state state is needed.
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
virtual NumericVector< Number > & residualGhosted()
Definition SystemBase.h:449
virtual void initSolutionState()
Initializes the solution state.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition SystemBase.C:980
virtual void disassociateDefaultVectorTags()
Disassociate the vectors associated with the default vector tags of this system.
virtual NumericVector< Number > * solutionUDotOld()
Definition SystemBase.h:282
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition SystemBase.C:992
virtual const Number & duDotDu(unsigned int var_num=0) const
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
virtual const std::string & name() const
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition SystemBase.h:379
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition SystemBase.h:311
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
virtual std::vector< Number > & duDotDus()
Definition SystemBase.h:275
virtual void disassociateDefaultMatrixTags()
Disassociate the matrices associated with the default matrix tags of this system.
virtual TagID systemMatrixTag() const
Return the Matrix Tag ID for System.
Definition SystemBase.h:316
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older,...
NumericVector< Number > & solution()
Definition SystemBase.h:203
virtual NumericVector< Number > * solutionUDotDotOld()
Definition SystemBase.h:283
virtual Number & duDotDotDu()
Definition SystemBase.h:276
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
Definition SystemBase.h:331
virtual NumericVector< Number > * solutionUDotDot()
Definition SystemBase.h:281
virtual TagID nonTimeVectorTag() const
Definition SystemBase.h:321
virtual NumericVector< Number > & serializedSolution()
Returns a reference to a serialized version of the solution vector for this subproblem.
SolutionIterationType
Definition MooseTypes.h:270
VarKindType
Framework-wide stuff.
Definition MooseTypes.h:769
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...