NeoPZ
pztransientanalysis.h
Go to the documentation of this file.
1 
6 #ifndef TRANSIENTANALH
7 #define TRANSIENTANALH
8 
9 #include "pzanalysis.h"
10 #include "pznonlinanalysis.h"
11 #include "pzcompel.h"
12 #include "pzfmatrix.h"
13 #include "pzvec.h"
14 #include <iostream>
15 #include <list>
16 
17 class TPZCompMesh;
18 
19 class TPZFStructMatrix;
20 
29 template<class TRANSIENTCLASS>
31 
32 public:
33 
35  static double gTime;
36 
38  double GetgTime(){ return gTime; }
39 
45  TPZTransientAnalysis(TPZCompMesh *mesh, bool IsLinear = false, std::ostream &out = std::cout);
46 
49 
51  virtual void Assemble();
52 
54  virtual void RunTransient(std::ostream &out = std::cout, bool FromBegining = true, bool linesearch = true);
55 
57  virtual void RunExplicit(std::ostream &out = std::cout, bool FromBegining = true);
58 
60  virtual void PostProcess(int resolution){ TPZAnalysis::PostProcess(resolution);}
61 
63  virtual void PostProcess(int resolution, int dimension);
64 
66  virtual void PostProcess(TPZVec<REAL> &loc, std::ostream &out = std::cout);
67 
69  void SetConvergence(int niter, REAL eps, bool ForceAllSteps = true);
70 
72  void SetSaveFrequency(int SaveFrequency, int resolution);
73 
76  void SetSaveSolution(int SaveFrequency);
77 
79  std::list< std::pair<TPZFMatrix<STATE>, STATE> > & GetSavedSolutions();
80 
82  void SetNewtonConvergence(int niter, REAL eps);
83 
85  REAL & TimeStep();
86 
88  void SetInitialSolution(TPZFMatrix<STATE> & InitialSol);
89 
92 
94  int GetCurrentIter();
95 
96 protected:
97 
101 
103  REAL fTimeStep;
104 
107 
109  int fNIter;
110 
113 
116 
121 
125 
128  std::list< std::pair< TPZFMatrix<STATE>, STATE> > fSavedSolutionVec;
129 
131  void SaveCurrentSolutionVec();
132 
135 
138 
140  void SetImplicit();
141 
143  void SetExplicit();
144 
146  void SetLastState();
147 
149  void SetCurrentState();
150 
152  void SetMassMatrix();
153 
155  void SetFluxOnly();
156 
158  void SetAllMaterialsDeltaT();
159 
162 
164  void ComputeMassMatrix();
165 
167  void ComputeFluxOnly();
168 
169 };
170 
171 template<class TRANSIENTCLASS>
172 inline void TPZTransientAnalysis< TRANSIENTCLASS >::SetConvergence(int niter, REAL eps, bool ForceAllSteps){
173  this->fNIter = niter;
174  this->fSteadyTol = eps;
175  this->fForceAllSteps = ForceAllSteps;
176 }
177 
178 template<class TRANSIENTCLASS>
179 inline void TPZTransientAnalysis< TRANSIENTCLASS >::SetSaveFrequency(int SaveFrequency, int resolution){
180  this->fSaveFrequency = SaveFrequency;
181  this->fDXResolution = resolution;
182 }
183 
184 template<class TRANSIENTCLASS>
186  this->fNewtonMaxIter = niter;
187  this->fNewtonTol = eps;
188 }
189 
190 template<class TRANSIENTCLASS>
192  return this->fTimeStep;
193 }
194 
195 template<class TRANSIENTCLASS>
197  return this->fCurrentIter;
198 }
199 
200 #endif
void SetSaveSolution(int SaveFrequency)
Defines to save solution vector with SaveFrequency frequency.
static double gTime
Static attribute storing the current time of simulation.
REAL fNewtonTol
Tolerance of Newton&#39;s method.
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
void SetFluxOnly()
Sets all materials to compute only the flux contributions - used in the explicit scheme.
double GetgTime()
Method for gTime attribute access.
void SetExplicit()
Sets all materials in temporal scheme as an explicit Euler.
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
std::list< std::pair< TPZFMatrix< STATE >, STATE > > fSavedSolutionVec
Attribute to store solution vectors during process. Pair of (solution vec, simulation time) ...
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Templated vector implementation.
virtual void PostProcess(int resolution)
See base class for comments.
~TPZTransientAnalysis()
Default destructor.
void SetLastState()
Sets all materials in LastState.
virtual void RunTransient(std::ostream &out=std::cout, bool FromBegining=true, bool linesearch=true)
Executes a Newton&#39;s method for the solution of the implicit in time equation.
void ComputeLinearTangentMatrix()
Computes linear tangent matrix for linear problems.
void SaveCurrentSolutionVec()
If fSaveSolutionVecFrequency != 0, save current solution vector in fSavedSolutionVec attribute...
virtual void Assemble()
Assemble flux vector and jacobian matrix.
void ComputeFluxOnly()
Computes the only the flux contribution for the explicit scheme.
virtual void RunExplicit(std::ostream &out=std::cout, bool FromBegining=true)
Solves a explicit Euler&#39;s scheme in time.
void SetAllMaterialsDeltaT()
Sets all materials the time step.
int fCurrentIter
Current iteration. Variable allowing to restart the simulation.
Contains TPZMatrixclass which implements full matrix (using column major representation).
int fSaveSolutionVecFrequency
Frequency which solution vector must be saved.
REAL & TimeStep()
Access to time step attribute.
Implements a very simple manner to perform transient simulations. Analysis.
void SetImplicit()
Sets all materials in temporal scheme as an implicit Euler.
void SetConvergence(int niter, REAL eps, bool ForceAllSteps=true)
Defines max number of steps and steady state convergence tolerance.
virtual void PostProcess(int resolution)
Draw solution over mesh for all dimensions.
void SetCurrentState()
Sets all materials in CurrentState.
int fNIter
Number of iterations counting from fCurrentIter to fCurrentIter+fNIter.
Implements Full Structural Matrices. Structural Matrix.
Definition: pzfstrmatrix.h:19
void SetInitialSolutionAsZero()
Sets problem initial solution as zero.
std::list< std::pair< TPZFMatrix< STATE >, STATE > > & GetSavedSolutions()
Access to saved solution. Pair of (solution vec, simulation time)
int fSaveFrequency
Frequency which solution must be saved in DX file.
bool fIsLinearProblem
Flag indicating whether the problem is linear or not.
int fDXResolution
Resolution of DX mesh.
REAL fSteadyTol
Tolerance to consider the problem solution as steady state.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
int GetCurrentIter()
Returns current iteration.
REAL fTimeStep
Simulation time step.
Derived class from TPZAnalysis implements non linear analysis (Newton&#39;s method). Analysis.
bool fForceAllSteps
Flag indicating whether all steps must be performed even if tolerance is achieved.
void SetNewtonConvergence(int niter, REAL eps)
Defines max number of steps and error convergence tolerance for Newton&#39;s method.
void ComputeMassMatrix()
Computes the mass matrix for the explicit scheme.
void SetSaveFrequency(int SaveFrequency, int resolution)
Defines properties of DX file.
void SetInitialSolution(TPZFMatrix< STATE > &InitialSol)
Sets problem initial solution.
void SetMassMatrix()
Sets all materials to compute the mass matrix - used in the explicit scheme.
int fNewtonMaxIter
Max iteration number of Newton&#39;s method.
TPZTransientAnalysis(TPZCompMesh *mesh, bool IsLinear=false, std::ostream &out=std::cout)
Constructor.
Contains TPZNonLinearAnalysis class which implements the non linear analysis.