Line data Source code
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 : 21 : class DisplacedSystem : public SystemBase 22 : { 23 : public: 24 : DisplacedSystem(DisplacedSystem &&) = delete; 25 : DisplacedSystem & operator=(DisplacedSystem &&) = delete; 26 : 27 : DisplacedSystem(DisplacedProblem & problem, 28 : FEProblemBase & fe_problem, 29 : SystemBase & undisplaced_system, 30 : const std::string & name, 31 : Moose::VarKindType var_kind); 32 : virtual ~DisplacedSystem(); 33 : 34 70361384 : virtual NumericVector<Number> & getVector(TagID tag_id) override 35 : { 36 70361384 : return _undisplaced_system.getVector(tag_id); 37 : } 38 0 : virtual const NumericVector<Number> & getVector(TagID tag_id) const override 39 : { 40 0 : return _undisplaced_system.getVector(tag_id); 41 : } 42 : 43 0 : virtual TagID residualVectorTag() const override 44 : { 45 0 : return _undisplaced_system.residualVectorTag(); 46 : } 47 : 48 0 : virtual TagID systemMatrixTag() const override { return _undisplaced_system.systemMatrixTag(); } 49 : 50 43 : virtual TagID timeVectorTag() const override { return _undisplaced_system.timeVectorTag(); } 51 : 52 86 : virtual TagID nonTimeVectorTag() const override { return _undisplaced_system.nonTimeVectorTag(); } 53 : 54 0 : virtual std::set<TagID> defaultVectorTags() const override 55 : { 56 0 : return _undisplaced_system.defaultVectorTags(); 57 : } 58 0 : virtual std::set<TagID> defaultMatrixTags() const override 59 : { 60 0 : return _undisplaced_system.defaultMatrixTags(); 61 : } 62 : 63 0 : virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag) override 64 : { 65 0 : _undisplaced_system.associateVectorToTag(vec, tag); 66 0 : } 67 : 68 0 : virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag) override 69 : { 70 0 : _undisplaced_system.disassociateVectorFromTag(vec, tag); 71 0 : } 72 : 73 0 : virtual void disassociateVectorFromTag(TagID tag) override 74 : { 75 0 : _undisplaced_system.disassociateVectorFromTag(tag); 76 0 : } 77 : 78 0 : virtual void disassociateDefaultVectorTags() override 79 : { 80 0 : _undisplaced_system.disassociateDefaultVectorTags(); 81 0 : } 82 : 83 0 : virtual void associateMatrixToTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override 84 : { 85 0 : _undisplaced_system.associateMatrixToTag(matrix, tag); 86 0 : } 87 : 88 0 : virtual void disassociateMatrixFromTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override 89 : { 90 0 : _undisplaced_system.disassociateMatrixFromTag(matrix, tag); 91 0 : } 92 : 93 0 : virtual void disassociateMatrixFromTag(TagID tag) override 94 : { 95 0 : _undisplaced_system.disassociateMatrixFromTag(tag); 96 0 : } 97 : 98 0 : virtual void disassociateDefaultMatrixTags() override 99 : { 100 0 : _undisplaced_system.disassociateDefaultMatrixTags(); 101 0 : } 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 0 : virtual NumericVector<Number> & serializedSolution() override 107 : { 108 0 : return _undisplaced_system.serializedSolution(); 109 : } 110 : 111 3681874 : const NumericVector<Number> * const & currentSolution() const override 112 : { 113 3681874 : return _undisplaced_system.currentSolution(); 114 : } 115 : 116 0 : NumericVector<Number> * solutionPreviousNewton() override { return nullptr; } 117 0 : const NumericVector<Number> * solutionPreviousNewton() const override { return nullptr; } 118 : 119 2192004 : NumericVector<Number> * solutionUDot() override { return _undisplaced_system.solutionUDot(); } 120 4400 : NumericVector<Number> * solutionUDotDot() override 121 : { 122 4400 : return _undisplaced_system.solutionUDotDot(); 123 : } 124 70680 : NumericVector<Number> * solutionUDotOld() override 125 : { 126 70680 : return _undisplaced_system.solutionUDotOld(); 127 : } 128 70680 : NumericVector<Number> * solutionUDotDotOld() override 129 : { 130 70680 : return _undisplaced_system.solutionUDotDotOld(); 131 : } 132 441 : const NumericVector<Number> * solutionUDot() const override 133 : { 134 441 : return _undisplaced_system.solutionUDot(); 135 : } 136 441 : const NumericVector<Number> * solutionUDotDot() const override 137 : { 138 441 : return _undisplaced_system.solutionUDotDot(); 139 : } 140 441 : const NumericVector<Number> * solutionUDotOld() const override 141 : { 142 441 : return _undisplaced_system.solutionUDotOld(); 143 : } 144 441 : const NumericVector<Number> * solutionUDotDotOld() const override 145 : { 146 441 : return _undisplaced_system.solutionUDotDotOld(); 147 : } 148 : 149 0 : virtual std::vector<Number> & duDotDus() override { return _undisplaced_system.duDotDus(); } 150 0 : virtual Number & duDotDotDu() override { return _undisplaced_system.duDotDotDu(); } 151 : virtual const Number & duDotDu(unsigned int var_num = 0) const override; 152 441 : virtual const Number & duDotDotDu() const override { return _undisplaced_system.duDotDotDu(); } 153 : 154 0 : virtual void addDotVectors() override { _undisplaced_system.addDotVectors(); } 155 : 156 : /** 157 : * Return the residual copy from the NonlinearSystem 158 : * @return Residual copy 159 : */ 160 0 : virtual NumericVector<Number> & residualCopy() override 161 : { 162 0 : return _undisplaced_system.residualCopy(); 163 : } 164 12 : virtual NumericVector<Number> & residualGhosted() override 165 : { 166 12 : return _undisplaced_system.residualGhosted(); 167 : } 168 : 169 3922 : virtual void augmentSendList(std::vector<dof_id_type> & send_list) override 170 : { 171 3922 : _undisplaced_system.augmentSendList(send_list); 172 3922 : } 173 : 174 : /** 175 : * This is an empty function since the displaced system doesn't have a matrix! 176 : * All sparsity pattern modification will be taken care of by the undisplaced system directly 177 : */ 178 0 : virtual void augmentSparsity(libMesh::SparsityPattern::Graph & /*sparsity*/, 179 : std::vector<dof_id_type> & /*n_nz*/, 180 : std::vector<dof_id_type> & /*n_oz*/) override 181 : { 182 0 : } 183 : 184 : /** 185 : * Adds this variable to the list of variables to be zeroed during each residual evaluation. 186 : * @param var_name The name of the variable to be zeroed. 187 : */ 188 0 : virtual void addVariableToZeroOnResidual(std::string var_name) override 189 : { 190 0 : _undisplaced_system.addVariableToZeroOnResidual(var_name); 191 0 : } 192 : 193 : /** 194 : * Adds this variable to the list of variables to be zeroed during each jacobian evaluation. 195 : * @param var_name The name of the variable to be zeroed. 196 : */ 197 0 : virtual void addVariableToZeroOnJacobian(std::string var_name) override 198 : { 199 0 : _undisplaced_system.addVariableToZeroOnJacobian(var_name); 200 0 : } 201 : 202 : /** 203 : * Zero out the solution for the list of variables passed in. 204 : */ 205 0 : virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed) override 206 : { 207 0 : _undisplaced_system.zeroVariables(vars_to_be_zeroed); 208 0 : } 209 : 210 103407011 : virtual bool hasVector(TagID tag_id) const override 211 : { 212 103407011 : return _undisplaced_system.hasVector(tag_id); 213 : } 214 : 215 2949217 : virtual bool hasMatrix(TagID tag_id) const override 216 : { 217 2949217 : return _undisplaced_system.hasMatrix(tag_id); 218 : } 219 : 220 : virtual void initSolutionState() override; 221 : virtual NumericVector<Number> & solutionState( 222 : const unsigned int state, 223 : Moose::SolutionIterationType iteration_type = Moose::SolutionIterationType::Time) override; 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, 230 : Moose::SolutionIterationType iteration_type = Moose::SolutionIterationType::Time) override; 231 : virtual bool hasSolutionState(const unsigned int state, 232 : Moose::SolutionIterationType iteration_type = 233 : Moose::SolutionIterationType::Time) const override; 234 : 235 17017473 : virtual libMesh::SparseMatrix<Number> & getMatrix(TagID tag) override 236 : { 237 17017473 : return _undisplaced_system.getMatrix(tag); 238 : } 239 0 : virtual const libMesh::SparseMatrix<Number> & getMatrix(TagID tag) const override 240 : { 241 0 : return _undisplaced_system.getMatrix(tag); 242 : } 243 : 244 1101985 : virtual libMesh::System & sys() { return _sys; } 245 : 246 : virtual System & system() override; 247 : virtual const System & system() const override; 248 : 249 0 : virtual void compute(ExecFlagType) override {} 250 : 251 : protected: 252 0 : NumericVector<Number> & solutionInternal() const override 253 : { 254 0 : return _undisplaced_system.solution(); 255 : } 256 : 257 : SystemBase & _undisplaced_system; 258 : libMesh::System & _sys; 259 : }; 260 : 261 : inline void 262 4102 : DisplacedSystem::initSolutionState() 263 : { 264 4102 : _undisplaced_system.initSolutionState(); 265 4102 : } 266 : 267 : inline NumericVector<Number> & 268 40563 : DisplacedSystem::solutionState(const unsigned int state, 269 : const Moose::SolutionIterationType iteration_type) 270 : { 271 40563 : return _undisplaced_system.solutionState(state, iteration_type); 272 : } 273 : 274 : inline const NumericVector<Number> & 275 0 : DisplacedSystem::solutionState(const unsigned int state, 276 : const Moose::SolutionIterationType iteration_type) const 277 : { 278 0 : return _undisplaced_system.solutionState(state, iteration_type); 279 : } 280 : 281 : inline void 282 47 : DisplacedSystem::needSolutionState(const unsigned int state, 283 : const Moose::SolutionIterationType iteration_type) 284 : { 285 47 : _undisplaced_system.needSolutionState(state, iteration_type); 286 47 : } 287 : 288 : inline bool 289 0 : DisplacedSystem::hasSolutionState(const unsigned int state, 290 : const Moose::SolutionIterationType iteration_type) const 291 : { 292 0 : return _undisplaced_system.hasSolutionState(state, iteration_type); 293 : } 294 : 295 : inline const Number & 296 6344825 : DisplacedSystem::duDotDu(const unsigned int var_num) const 297 : { 298 6344825 : return _undisplaced_system.duDotDu(var_num); 299 : }