www.mooseframework.org
DisplacedSystem.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 ExplicitSystem;
19 template <typename>
22 }
23 
25 {
26 public:
28  SystemBase & undisplaced_system,
29  const std::string & name,
30  Moose::VarKindType var_kind);
31  virtual ~DisplacedSystem();
32 
33  virtual void init() override;
34 
35  virtual NumericVector<Number> & getVector(TagID tag_id) override
36  {
37  return _undisplaced_system.getVector(tag_id);
38  }
39  virtual const NumericVector<Number> & getVector(TagID tag_id) const override
40  {
41  return _undisplaced_system.getVector(tag_id);
42  }
43 
45 
46  virtual TagID systemMatrixTag() override { return _undisplaced_system.systemMatrixTag(); }
47 
48  virtual TagID timeVectorTag() override { return _undisplaced_system.timeVectorTag(); }
49 
51 
52  virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag) override
53  {
55  }
56 
57  virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag) override
58  {
60  }
61 
62  virtual void disassociateAllTaggedVectors() override
63  {
65  }
66 
67  virtual void associateMatrixToTag(SparseMatrix<Number> & matrix, TagID tag) override
68  {
70  }
71 
72  virtual void disassociateMatrixFromTag(SparseMatrix<Number> & matrix, TagID tag) override
73  {
75  }
76 
77  virtual void disassociateAllTaggedMatrices() override
78  {
80  }
81 
82  virtual NumericVector<Number> & getVector(const std::string & name) override;
83 
84  virtual NumericVector<Number> & serializedSolution() override
85  {
87  }
88 
89  const NumericVector<Number> * const & currentSolution() const override
90  {
92  }
93 
94  NumericVector<Number> & solution() override { return _undisplaced_system.solution(); }
95  NumericVector<Number> & solutionOld() override;
96  NumericVector<Number> & solutionOlder() override;
97  NumericVector<Number> * solutionPreviousNewton() override { return NULL; }
98 
99  const NumericVector<Number> & solution() const override { return _undisplaced_system.solution(); }
100  const NumericVector<Number> & solutionOld() const override;
101  const NumericVector<Number> & solutionOlder() const override;
102  const NumericVector<Number> * solutionPreviousNewton() const override { return NULL; }
103 
104  NumericVector<Number> * solutionUDot() override { return _undisplaced_system.solutionUDot(); }
105  NumericVector<Number> * solutionUDotDot() override
106  {
108  }
109  NumericVector<Number> * solutionUDotOld() override
110  {
112  }
113  NumericVector<Number> * solutionUDotDotOld() override
114  {
116  }
117  const NumericVector<Number> * solutionUDot() const override
118  {
120  }
121  const NumericVector<Number> * solutionUDotDot() const override
122  {
124  }
125  const NumericVector<Number> * solutionUDotOld() const override
126  {
128  }
129  const NumericVector<Number> * solutionUDotDotOld() const override
130  {
132  }
133 
134  virtual Number & duDotDu() override { return _undisplaced_system.duDotDu(); }
135  virtual Number & duDotDotDu() override { return _undisplaced_system.duDotDotDu(); }
136  virtual const Number & duDotDu() const override { return _undisplaced_system.duDotDu(); }
137  virtual const Number & duDotDotDu() const override { return _undisplaced_system.duDotDotDu(); }
138 
143  virtual NumericVector<Number> & residualCopy() override
144  {
146  }
147  virtual NumericVector<Number> & residualGhosted() override
148  {
150  }
151 
152  virtual void augmentSendList(std::vector<dof_id_type> & send_list) override
153  {
155  }
156 
161  virtual void augmentSparsity(SparsityPattern::Graph & /*sparsity*/,
162  std::vector<dof_id_type> & /*n_nz*/,
163  std::vector<dof_id_type> & /*n_oz*/) override
164  {
165  }
166 
171  virtual void addVariableToZeroOnResidual(std::string var_name) override
172  {
174  }
175 
180  virtual void addVariableToZeroOnJacobian(std::string var_name) override
181  {
183  }
184 
188  virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed) override
189  {
190  _undisplaced_system.zeroVariables(vars_to_be_zeroed);
191  }
192 
193  virtual bool hasVector(TagID tag_id) const override
194  {
195  return _undisplaced_system.hasVector(tag_id);
196  }
197 
198  virtual bool hasMatrix(TagID tag_id) const override
199  {
200  return _undisplaced_system.hasMatrix(tag_id);
201  }
202 
203  virtual SparseMatrix<Number> & getMatrix(TagID tag) override
204  {
205  return _undisplaced_system.getMatrix(tag);
206  }
207  virtual const SparseMatrix<Number> & getMatrix(TagID tag) const override
208  {
209  return _undisplaced_system.getMatrix(tag);
210  }
211 
212  virtual TransientExplicitSystem & sys() { return _sys; }
213 
214  virtual System & system() override;
215  virtual const System & system() const override;
216 
218  void addTimeIntegrator(std::shared_ptr<TimeIntegrator> ti) override;
219 
220 protected:
223 };
224 
virtual const NumericVector< Number > & getVector(TagID tag_id) const override
Get a raw NumericVector.
DisplacedSystem(DisplacedProblem &problem, SystemBase &undisplaced_system, const std::string &name, Moose::VarKindType var_kind)
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.C:805
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
TransientExplicitSystem & _sys
virtual TagID residualVectorTag() override
virtual NumericVector< Number > * solutionUDot()=0
const NumericVector< Number > & solution() const override
virtual void augmentSparsity(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 void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:784
virtual TagID systemMatrixTag()
Return the Matrix Tag ID for System.
Definition: SystemBase.C:721
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:701
const NumericVector< Number > * solutionUDotDotOld() const override
virtual NumericVector< Number > & residualCopy()
Definition: SystemBase.h:320
unsigned int TagID
Definition: MooseTypes.h:162
virtual TransientExplicitSystem & sys()
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 disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag) override
Associate a vector for a given tag.
NumericVector< Number > & solutionOlder() override
virtual Number & duDotDu() override
NumericVector< Number > * solutionPreviousNewton() override
virtual bool hasMatrix(TagID tag_id) const override
Check if the tagged matrix exists in the system.
virtual void disassociateAllTaggedVectors() override
Disassociate all vectors, and then hasVector() will return false.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:773
virtual bool hasVector(TagID tag_id) const override
Check if the tagged vector exists in the system.
virtual NumericVector< Number > * solutionUDotDotOld()=0
virtual Number & duDotDotDu() override
virtual const SparseMatrix< Number > & getMatrix(TagID tag) const override
Get a raw SparseMatrix.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:92
virtual void disassociateAllTaggedMatrices() override
Clear all tagged matrices.
virtual TagID nonTimeVectorTag()
Definition: SystemBase.C:728
virtual const Number & duDotDotDu() const override
NumericVector< Number > * solutionUDotOld() override
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:1088
virtual TagID timeVectorTag() override
Ideally, we should not need this API.
void addTimeIntegrator(std::shared_ptr< TimeIntegrator > ti) override
virtual Number & duDotDu()
Definition: SystemBase.h:168
virtual TagID timeVectorTag()
Ideally, we should not need this API.
Definition: SystemBase.C:707
virtual Number & duDotDotDu()
Definition: SystemBase.h:169
NumericVector< Number > * solutionUDot() override
virtual void disassociateAllTaggedVectors()
Disassociate all vectors, and then hasVector() will return false.
Definition: SystemBase.C:798
virtual void disassociateAllTaggedMatrices()
Clear all tagged matrices.
Definition: SystemBase.C:919
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 void addTimeIntegrator(const std::string &, const std::string &, InputParameters)
Definition: SystemBase.h:721
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
virtual const Number & duDotDu() const override
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
associate a matirx to a tag
Definition: SystemBase.C:835
NumericVector< Number > * solutionUDotDot() override
TransientSystem< ExplicitSystem > TransientExplicitSystem
virtual void addVariableToZeroOnResidual(std::string var_name) override
Adds this variable to the list of variables to be zeroed during each residual evaluation.
virtual TagID nonTimeVectorTag() override
virtual System & system() override
Get the reference to the libMesh system.
const NumericVector< Number > * solutionUDot() const override
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag) override
disassociate a matirx from a tag
virtual NumericVector< Number > & serializedSolution()=0
Returns a reference to a serialized version of the solution vector for this subproblem.
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
disassociate a matirx from a tag
Definition: SystemBase.C:847
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag) override
associate a matirx to a tag
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
NumericVector< Number > & solutionOld() override
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:178
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:811
const NumericVector< Number > * solutionUDotOld() const override
virtual NumericVector< Number > & residualGhosted() override
virtual ~DisplacedSystem()
virtual NumericVector< Number > & solution()=0
virtual SparseMatrix< Number > & getMatrix(TagID tag) override
Get a raw SparseMatrix.
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:184
virtual NumericVector< Number > * solutionUDotOld()=0
virtual NumericVector< Number > * solutionUDotDot()=0
virtual void init() override
Initialize the system.
virtual TagID systemMatrixTag() override
Return the Matrix Tag ID for System.
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:430
virtual NumericVector< Number > & residualGhosted()
Definition: SystemBase.h:324
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:751
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.
virtual TagID residualVectorTag()
Definition: SystemBase.C:735
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:190
const NumericVector< Number > * solutionPreviousNewton() const override
NumericVector< Number > & solution() override
const NumericVector< Number > * solutionUDotDot() const override