forked from idaholab/moose
/
DisplacedSystem.h
225 lines (189 loc) · 7 KB
/
DisplacedSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "SystemBase.h"
// Forward declarations
class DisplacedProblem;
namespace libMesh
{
class ExplicitSystem;
template <typename>
class TransientSystem;
typedef TransientSystem<ExplicitSystem> TransientExplicitSystem;
}
class DisplacedSystem : public SystemBase
{
public:
DisplacedSystem(DisplacedProblem & problem,
SystemBase & undisplaced_system,
const std::string & name,
Moose::VarKindType var_kind);
virtual ~DisplacedSystem();
virtual NumericVector<Number> & getVector(TagID tag_id) override
{
return _undisplaced_system.getVector(tag_id);
}
virtual const NumericVector<Number> & getVector(TagID tag_id) const override
{
return _undisplaced_system.getVector(tag_id);
}
virtual TagID residualVectorTag() override { return _undisplaced_system.residualVectorTag(); }
virtual TagID systemMatrixTag() override { return _undisplaced_system.systemMatrixTag(); }
virtual TagID timeVectorTag() override { return _undisplaced_system.timeVectorTag(); }
virtual TagID nonTimeVectorTag() override { return _undisplaced_system.nonTimeVectorTag(); }
virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag) override
{
_undisplaced_system.associateVectorToTag(vec, tag);
}
virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag) override
{
_undisplaced_system.disassociateVectorFromTag(vec, tag);
}
virtual void disassociateAllTaggedVectors() override
{
_undisplaced_system.disassociateAllTaggedVectors();
}
virtual void associateMatrixToTag(SparseMatrix<Number> & matrix, TagID tag) override
{
_undisplaced_system.associateMatrixToTag(matrix, tag);
}
virtual void disassociateMatrixFromTag(SparseMatrix<Number> & matrix, TagID tag) override
{
_undisplaced_system.disassociateMatrixFromTag(matrix, tag);
}
virtual void disassociateAllTaggedMatrices() override
{
_undisplaced_system.disassociateAllTaggedMatrices();
}
virtual NumericVector<Number> & getVector(const std::string & name) override;
virtual NumericVector<Number> & serializedSolution() override
{
return _undisplaced_system.serializedSolution();
}
const NumericVector<Number> * const & currentSolution() const override
{
return _undisplaced_system.currentSolution();
}
NumericVector<Number> * solutionPreviousNewton() override { return nullptr; }
const NumericVector<Number> * solutionPreviousNewton() const override { return nullptr; }
NumericVector<Number> * solutionUDot() override { return _undisplaced_system.solutionUDot(); }
NumericVector<Number> * solutionUDotDot() override
{
return _undisplaced_system.solutionUDotDot();
}
NumericVector<Number> * solutionUDotOld() override
{
return _undisplaced_system.solutionUDotOld();
}
NumericVector<Number> * solutionUDotDotOld() override
{
return _undisplaced_system.solutionUDotDotOld();
}
const NumericVector<Number> * solutionUDot() const override
{
return _undisplaced_system.solutionUDot();
}
const NumericVector<Number> * solutionUDotDot() const override
{
return _undisplaced_system.solutionUDotDot();
}
const NumericVector<Number> * solutionUDotOld() const override
{
return _undisplaced_system.solutionUDotOld();
}
const NumericVector<Number> * solutionUDotDotOld() const override
{
return _undisplaced_system.solutionUDotDotOld();
}
virtual Number & duDotDu() override { return _undisplaced_system.duDotDu(); }
virtual Number & duDotDotDu() override { return _undisplaced_system.duDotDotDu(); }
virtual const Number & duDotDu() const override { return _undisplaced_system.duDotDu(); }
virtual const Number & duDotDotDu() const override { return _undisplaced_system.duDotDotDu(); }
/**
* Return the residual copy from the NonlinearSystem
* @return Residual copy
*/
virtual NumericVector<Number> & residualCopy() override
{
return _undisplaced_system.residualCopy();
}
virtual NumericVector<Number> & residualGhosted() override
{
return _undisplaced_system.residualGhosted();
}
virtual void augmentSendList(std::vector<dof_id_type> & send_list) override
{
_undisplaced_system.augmentSendList(send_list);
}
/**
* This is an empty function since the displaced system doesn't have a matrix!
* All sparsity pattern modification will be taken care of by the undisplaced system directly
*/
virtual void augmentSparsity(SparsityPattern::Graph & /*sparsity*/,
std::vector<dof_id_type> & /*n_nz*/,
std::vector<dof_id_type> & /*n_oz*/) override
{
}
/**
* Adds this variable to the list of variables to be zeroed during each residual evaluation.
* @param var_name The name of the variable to be zeroed.
*/
virtual void addVariableToZeroOnResidual(std::string var_name) override
{
_undisplaced_system.addVariableToZeroOnResidual(var_name);
}
/**
* Adds this variable to the list of variables to be zeroed during each jacobian evaluation.
* @param var_name The name of the variable to be zeroed.
*/
virtual void addVariableToZeroOnJacobian(std::string var_name) override
{
_undisplaced_system.addVariableToZeroOnJacobian(var_name);
}
/**
* Zero out the solution for the list of variables passed in.
*/
virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed) override
{
_undisplaced_system.zeroVariables(vars_to_be_zeroed);
}
virtual bool hasVector(TagID tag_id) const override
{
return _undisplaced_system.hasVector(tag_id);
}
virtual bool hasMatrix(TagID tag_id) const override
{
return _undisplaced_system.hasMatrix(tag_id);
}
virtual SparseMatrix<Number> & getMatrix(TagID tag) override
{
return _undisplaced_system.getMatrix(tag);
}
virtual const SparseMatrix<Number> & getMatrix(TagID tag) const override
{
return _undisplaced_system.getMatrix(tag);
}
virtual TransientExplicitSystem & sys() { return _sys; }
virtual System & system() override;
virtual const System & system() const override;
using SystemBase::addTimeIntegrator;
void addTimeIntegrator(std::shared_ptr<TimeIntegrator> ti) override;
protected:
NumericVector<Number> & solutionInternal() override { return _undisplaced_system.solution(); }
NumericVector<Number> & solutionOldInternal() override;
NumericVector<Number> & solutionOlderInternal() override;
const NumericVector<Number> & solutionInternal() const override
{
return _undisplaced_system.solution();
}
const NumericVector<Number> & solutionOldInternal() const override;
const NumericVector<Number> & solutionOlderInternal() const override;
SystemBase & _undisplaced_system;
TransientExplicitSystem & _sys;
};