https://mooseframework.inl.gov
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
15 class DisplacedProblem;
16 namespace libMesh
17 {
18 class System;
19 }
20 
22 {
23 public:
24  DisplacedSystem(DisplacedSystem &&) = delete;
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 
73  virtual void disassociateVectorFromTag(TagID tag) override
74  {
76  }
77 
78  virtual void disassociateDefaultVectorTags() override
79  {
81  }
82 
83  virtual void associateMatrixToTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override
84  {
86  }
87 
88  virtual void disassociateMatrixFromTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override
89  {
91  }
92 
93  virtual void disassociateMatrixFromTag(TagID tag) override
94  {
96  }
97 
98  virtual void disassociateDefaultMatrixTags() override
99  {
101  }
102 
103  virtual NumericVector<Number> & getVector(const std::string & name) override;
104  virtual const NumericVector<Number> & getVector(const std::string & name) const override;
105 
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 
121  {
123  }
125  {
127  }
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  }
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;
222  const unsigned int state,
224  virtual const NumericVector<Number> &
225  solutionState(const unsigned int state,
226  Moose::SolutionIterationType iteration_type =
227  Moose::SolutionIterationType::Time) const override;
228  virtual void needSolutionState(
229  const unsigned int state,
231  virtual bool hasSolutionState(const unsigned int state,
232  Moose::SolutionIterationType iteration_type =
233  Moose::SolutionIterationType::Time) const override;
234 
236  {
237  return _undisplaced_system.getMatrix(tag);
238  }
239  virtual const libMesh::SparseMatrix<Number> & getMatrix(TagID tag) const override
240  {
241  return _undisplaced_system.getMatrix(tag);
242  }
243 
244  virtual libMesh::System & sys() { return _sys; }
245 
246  virtual System & system() override;
247  virtual const System & system() const override;
248 
249  virtual void compute(ExecFlagType) override {}
250 
251 protected:
253  {
254  return _undisplaced_system.solution();
255  }
256 
259 };
260 
261 inline void
263 {
265 }
266 
267 inline NumericVector<Number> &
268 DisplacedSystem::solutionState(const unsigned int state,
269  const Moose::SolutionIterationType iteration_type)
270 {
271  return _undisplaced_system.solutionState(state, iteration_type);
272 }
273 
274 inline const NumericVector<Number> &
275 DisplacedSystem::solutionState(const unsigned int state,
276  const Moose::SolutionIterationType iteration_type) const
277 {
278  return _undisplaced_system.solutionState(state, iteration_type);
279 }
280 
281 inline void
282 DisplacedSystem::needSolutionState(const unsigned int state,
283  const Moose::SolutionIterationType iteration_type)
284 {
285  _undisplaced_system.needSolutionState(state, iteration_type);
286 }
287 
288 inline bool
289 DisplacedSystem::hasSolutionState(const unsigned int state,
290  const Moose::SolutionIterationType iteration_type) const
291 {
292  return _undisplaced_system.hasSolutionState(state, iteration_type);
293 }
294 
295 inline const Number &
296 DisplacedSystem::duDotDu(const unsigned int var_num) const
297 {
298  return _undisplaced_system.duDotDu(var_num);
299 }
virtual const NumericVector< Number > & getVector(TagID tag_id) const override
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Registers that the solution state state is needed.
Definition: SystemBase.C:1428
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual const Number & duDotDu(unsigned int var_num=0) const override
DisplacedSystem(DisplacedSystem &&)=delete
virtual NumericVector< Number > & residualCopy() override
Return the residual copy from the NonlinearSystem.
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
const NumericVector< Number > * solutionUDotDotOld() const 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&#39;t have a matrix! All sparsity pattern modi...
virtual NumericVector< Number > & residualCopy()
Definition: SystemBase.h:427
unsigned int TagID
Definition: MooseTypes.h:210
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed) override
Zero out the solution for the list of variables passed in.
NumericVector< Number > & solution()
Definition: SystemBase.h:195
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag) override
Disassociate a given vector from a given tag.
virtual void initSolutionState()
Initializes the solution state.
Definition: SystemBase.C:1354
virtual void disassociateDefaultVectorTags()
Disassociate the vectors associated with the default vector tags of this system.
Definition: SystemBase.C:998
NumericVector< Number > * solutionPreviousNewton() override
virtual bool hasMatrix(TagID tag_id) const override
Check if the tagged matrix exists in the system.
libMesh::System & _sys
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:964
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).
Definition: SystemBase.C:1419
virtual bool hasVector(TagID tag_id) const override
Check if the tagged vector exists in the system.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag) override
Associate a matrix to a tag.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual Number & duDotDotDu() override
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag) override
Get a raw SparseMatrix.
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:255
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1059
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, etc).
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:84
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const Number & duDotDotDu() const override
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1071
NumericVector< Number > * solutionUDotOld() 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).
virtual void initSolutionState() override
Initializes the solution state.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag) override
Associate a vector for a given tag.
virtual const std::string & name() const
Definition: SystemBase.C:1330
NumericVector< Number > & solutionInternal() const override
Internal getter for solution owned by libMesh.
virtual NumericVector< Number > & serializedSolution()
Returns a reference to a serialized version of the solution vector for this subproblem.
Definition: SystemBase.C:1613
virtual void disassociateVectorFromTag(TagID tag) override
Disassociate any vector that is associated with a given tag.
virtual Number & duDotDotDu()
Definition: SystemBase.h:248
virtual const Number & duDotDu(unsigned int var_num=0) const
Definition: SystemBase.C:1668
NumericVector< Number > * solutionUDot() override
virtual void disassociateDefaultVectorTags() override
Disassociate the vectors associated with the default vector tags of this system.
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.
SystemBase & _undisplaced_system
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:252
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:714
virtual TagID timeVectorTag() const override
Ideally, we should not need this API.
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:254
NumericVector< Number > * solutionUDotDot() override
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:283
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) override
Registers that the solution state state is needed.
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:293
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
virtual void addDotVectors()
Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.
Definition: SystemBase.C:1600
virtual void addVariableToZeroOnResidual(std::string var_name) override
Adds this variable to the list of variables to be zeroed during each residual evaluation.
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, etc).
Definition: SystemBase.h:1081
virtual std::set< TagID > defaultVectorTags() const override
Get the default vector tags associated with this system.
virtual TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
virtual System & system() override
Get the reference to the libMesh system.
virtual TagID systemMatrixTag() const
Return the Matrix Tag ID for System.
Definition: SystemBase.h:288
const NumericVector< Number > * solutionUDot() const override
virtual TagID residualVectorTag() const
Definition: SystemBase.h:298
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition: SystemBase.h:310
virtual TagID residualVectorTag() const override
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
DisplacedSystem & operator=(DisplacedSystem &&)=delete
virtual libMesh::System & sys()
virtual void addVariableToZeroOnJacobian(std::string var_name) override
Adds this variable to the list of variables to be zeroed during each jacobian evaluation.
NumericVector< Number > * solutionUDotDotOld() override
virtual void addDotVectors() override
Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
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:173
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
const NumericVector< Number > * solutionUDotOld() const override
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag) override
Disassociate a matrix from a tag.
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
Definition: SystemBase.h:303
virtual NumericVector< Number > & residualGhosted() override
virtual ~DisplacedSystem()
virtual std::vector< Number > & duDotDus()
Definition: SystemBase.h:247
virtual void compute(ExecFlagType) override
Compute time derivatives, auxiliary variables, etc.
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:179
Real Number
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:253
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:444
virtual NumericVector< Number > & residualGhosted()
Definition: SystemBase.h:431
virtual const libMesh::SparseMatrix< Number > & getMatrix(TagID tag) const override
Get a raw SparseMatrix.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916
virtual NumericVector< Number > & serializedSolution() override
Returns a reference to a serialized version of the solution vector for this subproblem.
virtual void disassociateDefaultMatrixTags()
Disassociate the matrices associated with the default matrix tags of this system. ...
Definition: SystemBase.C:1093
virtual NumericVector< Number > & getVector(TagID tag_id) override
Get a raw NumericVector by tag.
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:199
const NumericVector< Number > * solutionPreviousNewton() const override
virtual void disassociateDefaultMatrixTags() override
Disassociate the matrices associated with the default matrix tags of this system. ...
virtual std::set< TagID > defaultMatrixTags() const override
Get the default matrix tags associted with this system.
virtual void disassociateMatrixFromTag(TagID tag) override
Disassociate any matrix that is associated with a given tag.
virtual std::vector< Number > & duDotDus() override
SolutionIterationType
Definition: MooseTypes.h:241
virtual TagID nonTimeVectorTag() const override
const NumericVector< Number > * solutionUDotDot() const override