NeoPZ
pzeuleranalysis.cpp
Go to the documentation of this file.
1 
6 #ifndef STATE_COMPLEX
7 
8 #include "pzeuleranalysis.h"
9 #include "pzerror.h"
10 #include "TPZCompElDisc.h"
11 #include "pzfstrmatrix.h"
13 #include "TPBSpStructMatrix.h"
14 #include "pzbdstrmatrix.h"
15 
16 #include "tpzoutofrange.h"
17 #include <time.h>
18 #include "pzlog.h"
19 #include "TPZFileStream.h"
20 
21 #ifdef LOG4CXX
22 
23 static LoggerPtr logger(Logger::getLogger("pz.converge"));
24 #endif
25 
26 using namespace std;
27 
29 TPZAnalysis(), fFlowCompMesh(NULL),
30 fRhsLast(),
31 fNewtonEps(1e-9), fNewtonMaxIter(10),
32 fTimeIntEps(1e-8), fTimeIntMaxIter(100),
33 fEvolCFL(0), fpBlockDiag(NULL),fHasFrontalPreconditioner(0)
34 {
35 
36 }
37 
39 TPZAnalysis(mesh, true, out), fFlowCompMesh(mesh),
40 fRhsLast(),
41 fNewtonEps(1e-9), fNewtonMaxIter(10),
42 fTimeIntEps(1e-8), fTimeIntMaxIter(100),
44 {
45 
46 }
47 
49 {
50 }
51 
53 {
56 }
57 
59 {
62 }
63 
65 {
67 }
68 
69 void TPZEulerAnalysis::UpdateSolAndRhs(TPZFMatrix<STATE> & deltaSol, REAL & epsilon)
70 {
71  REAL initEpsilon = epsilon;
72  int outofrange = 0;
73  try
74  {
75  fSolution += deltaSol;
77  AssembleRhs();
78  epsilon = Norm(fRhs);
79  }
80  catch(TPZOutofRange obj)
81  {
82  outofrange = 1;
83  fSolution -= deltaSol;
84  epsilon = initEpsilon;
86  }
87 
88  if(epsilon > initEpsilon)
89  {
90  fSolution -= deltaSol;
92  /*int resultlin = */
93  LineSearch(initEpsilon ,fSolution, deltaSol);
94  fSolution += deltaSol;
96  epsilon = Norm(fRhs);
97  }
98 
99  if(outofrange)
100  {
101  /*int resultlin = */LineSearch(initEpsilon ,fSolution, deltaSol);
102  fSolution += deltaSol;
104  epsilon = Norm(fRhs);
105  fFlowCompMesh->ScaleCFL(.5);
106  }
107 }
108 
110 {
111 
112 #ifdef RESTART_ZEROED
113  fSolution.Zero();
114 #else
115  // The last state should be copied to the advanced
116  // state vector.
117  // These are in fact the same storage, so that the
118  // memory desn't need to be copied.
119 #endif
120 }
121 
123 {
124  fRhsLast.Zero();
126  SetLastState();
127  fStructMatrix->Assemble(fRhsLast,NULL);
128  // TPZStructMatrix::Assemble(fRhsLast, *fFlowCompMesh);
130  UpdateHistory();
131 }
132 
134 {
135  // enabling the flux evaluation type
137  TPZFMatrix<STATE> Flux;
138  Flux.Redim(fCompMesh->NEquations(),1);
139  Flux.Zero();
140  // contribution of last state
141  SetLastState();
142  fStructMatrix->Assemble(Flux,NULL);
143  // TPZStructMatrix::Assemble(Flux, *fFlowCompMesh);
144 
145  // constribution of adv state
147  fStructMatrix->Assemble(Flux,NULL);
148  // TPZStructMatrix::Assemble(Flux, *fFlowCompMesh);
149 
150  // reseting the residual type to residual
152 
153  return Norm(Flux);
154 }
155 
157 {
158  if(!fCompMesh)
159  {
160  PZError << "TPZEulerAnalysis::Assemble Error: No Computational Mesh\n";
161  // return;
162  DebugStop();
163  }
164 
165  if(!fStructMatrix)
166  {
167  PZError << "TPZEulerAnalysis::Assemble Error: No Structural Matrix\n";
168  DebugStop();
169  // return;
170  }
171 
172  if(!fSolver)
173  {
174  PZError << "TPZEulerAnalysis::Assemble Error: No Solver\n";
175  DebugStop();
176  // return;
177  }
178 
179  // contributing referring to the last state
180  fRhs = fRhsLast;
181 
182  TPZAutoPointer<TPZMatrix<STATE> > pTangentMatrix = fSolver->Matrix();
183 
184  if(!pTangentMatrix || dynamic_cast<TPZParFrontStructMatrix <TPZFrontNonSym<STATE> > *>(fStructMatrix.operator->()))
185  {
186  pTangentMatrix = fStructMatrix->CreateAssemble(fRhs,NULL);
187  fSolver->SetMatrix(pTangentMatrix);
188  }
189  else
190  {
191  if(!pTangentMatrix)
192  {
193  PZError << "TPZEulerAnalysis::Assemble Error: No Structural Matrix\n";
194  DebugStop();
195  // return;
196 
197  }
198 
199  pTangentMatrix->Zero();
200 
201  // Contributing referring to the advanced state
202  // (n+1 index)
203  fStructMatrix->Assemble(pTangentMatrix, fRhs,NULL);
204  }
205 
206  if(fpBlockDiag)
207  {
208  fpBlockDiag->Zero();
209  //fpBlockDiag->SetIsDecomposed(0); // Zero already makes it
210  fpBlockDiag->BuildFromMatrix(pTangentMatrix);
211  }
212 }
213 
215 {
216  if(!fCompMesh) return;
217 
218  // Contributing referring to the last state (n index)
219  fRhs = fRhsLast;
220 
221  // Contributing referring to the advanced state
222  // (n+1 index)
223  fStructMatrix->Assemble(fRhs,NULL);
224  // TPZStructMatrix::Assemble(fRhs, *fFlowCompMesh);
225 
226 }
227 
228 //ofstream eulerout("Matrizes.out");
229 
231  int numeq = fCompMesh->NEquations();
232  if(fRhs.Rows() != numeq ) return 0;
233 
234  TPZFMatrix<STATE> rhs(fRhs);
235 
236  fSolver->Solve(rhs, delSol);
237 
238  if(residual)
239  { // verifying the inversion of the linear system
240  residual->Redim(numeq,1);
241  }
242 
243  return 1;
244 }
245 
246 int TPZEulerAnalysis::RunNewton(REAL & epsilon, int & numIter)
247 {
248  TPZFMatrix<STATE> delSol(fRhs.Rows(),1);
249 
250  int i = 0;
251  REAL res;// residual of linear invertion.
252  epsilon = fNewtonEps * REAL(2.);// ensuring the loop will be
253  // performed at least once.
254 
255  TPZFMatrix<STATE> residual;
256  // REAL res1,res2 = 0.;
258  {
260  StrMatrix.SetQuiet(1);
261  TPZMatrix<STATE> *front = StrMatrix.CreateAssemble(fRhs,NULL);
262  TPZStepSolver<STATE> FrontSolver;
263  FrontSolver.SetDirect(ELU);
264  FrontSolver.SetMatrix(front);
265  TPZStepSolver<STATE> *step = dynamic_cast<TPZStepSolver<STATE> *>(fSolver);
266  step->SetPreconditioner(FrontSolver);
267  }
268 
269  while(i < fNewtonMaxIter && epsilon > fNewtonEps)
270  {
271  // Linearizes the system with the newest iterative solution
272  Assemble();
273  if(i==0)
274  {
275  epsilon = Norm(fRhs);
276  cout << "\tEntry NonLinEpsilon:" << epsilon << endl;
277  }
278 
279  //Solves the linearized system
280  fTotalNewton++;
281  if(Solve(res, &residual, delSol) == 0) return 0;
282 
283  // Updates the solution, attempts to update Rhs (vector only) and
284  // returns the nonlinear residual (epsilon).
285  // According to the initial and final values of epsilon, the
286  // method may perform a line search.
287  UpdateSolAndRhs(delSol, epsilon);
288 
289  cout << "\tNonLinEpsilon:" << epsilon << endl;
290  i++;
291  }
292 
293 #ifdef LOG4CXX
294  {
295  std::stringstream sout;
296  sout << "Numero de iteracoes de Newton " << i;
297  LOGPZ_DEBUG(logger,sout.str().c_str());
298  }
299 #endif
300  numIter = i;
301 
302  if(epsilon > fNewtonEps)return 0;
303  return 1;
304 }
305 
306 TPZDXGraphMesh * TPZEulerAnalysis::PrepareDXMesh(const std::string &dxout, int dxRes)
307 {
308  TPZVec<std::string> scalar(4),vector(0);
309  scalar[0] = "density";
310  scalar[1] = "pressure";
311  scalar[2] = "normvelocity";
312  scalar[3] = "Mach";
313 
314 
316  int dim = mat->Dimension();
317  //ResetReference(Mesh());//retira refer�ncias para criar graph consistente
318  if (!mat) {
319  DebugStop();
320  }
321  std::set<int> matids;
322  matids.insert(mat->Id());
323  TPZDXGraphMesh * graph = new TPZDXGraphMesh (Mesh(),dim,matids,scalar,vector);
324  //SetReference(Mesh());//recupera as refer�ncias retiradas
325  //ofstream *dxout = new ofstream("ConsLaw.dx");
326  //cout << "\nDX output file : ConsLaw.dx\n";
327  graph->SetFileName(dxout);
328  //int resolution = 2;
329  graph->SetResolution(dxRes);
330  graph->DrawMesh(dim);
331 
332  return graph;
333 }
334 
335 void TPZEulerAnalysis::Run(std::ostream &out, const std::string & dxout, int dxRes)
336 {
337  // this analysis loop encloses several calls
338  // to Newton's linearizations, updating the
339  // time step.
340 
341  this->fTotalNewton = 0;
342  out << "\nBeginning time integration";
343 
344  time_t startTime_t = time(NULL);
345 
346  TPZDXGraphMesh * graph = PrepareDXMesh(dxout, dxRes);
347  int numIterDX = 1;
348 
349  REAL epsilon_Newton/*, epsilon_Global*/;
350  int numIter_Newton/*, numIter_Global*/;
351  REAL epsilon, lastEpsilon=0;
352 
353  int i = 0;
354  epsilon = 2. * fTimeIntEps;
355 
356 #ifdef RESTART_ZEROED
357  fSolution->Zero();
358 #else
359  // the history equals the solution
360  // nothing must be done.
361 #endif
362 
363  // evaluates the time step based on the solution
364  // (last Sol, since Curr sol equals it)
365  REAL nextTimeStep = ComputeTimeStep();
366  REAL AccumTime = 0.;
367 
368  // Buffers the contribution of the last state
370 
371  out << "iter\ttime\teps(dU/dt)\tNewtonEps=\tnNewtonIter\n";
372 
373  while(i < fTimeIntMaxIter && epsilon > fTimeIntEps)
374  {
375  if(i%numIterDX==0)
376  {
377  graph->DrawSolution(i,AccumTime);
378  graph->Out().flush();
379  // increases the accumulated time and
380  AccumTime += nextTimeStep;
381  }
382 
383  // Solves the nonlinear system, updates the solution,
384  // history and last state assemble buffer.
385  /*int newtonreturn = */
386  RunNewton(epsilon_Newton, numIter_Newton);
387 
388  // resetting the forcing function for iterations greater than the 1st
390 
391  // buffering the contribution to the RHS
393 
394  // zeroes the fSolution vector if necessary
395  UpdateHistory();
396 
397  // evaluates the norm of fluxes across interfaces
398  epsilon = EvaluateFluxEpsilon();
399 
400  // computing the time step
401  nextTimeStep = ComputeTimeStep();
402 
403  CFLControl(lastEpsilon, epsilon, epsilon_Newton, nextTimeStep);
404 
405 #ifdef LOG4CXX
406  if(logger->isDebugEnabled())
407  {
408  std::stringstream sout;
409  sout << "iteration " << i << "Du/Dt " << epsilon << " Total Newton " << fTotalNewton;
410  LOGPZ_DEBUG(logger,sout.str().c_str());
411  }
412 #endif
413  // output
414  {
415  out << "\n" << i
416  << "\t" << AccumTime
417  << "\t" << epsilon
418  << "\t" << epsilon_Newton
419  << "\t" << numIter_Newton;
420 
421  cout << "iter:" << i
422  << "\ttime:" << AccumTime
423  << "\t eps(dU/dt)=" << epsilon
424  << "\t |NewtonEps=" << epsilon_Newton
425  << "\t nIter=" << numIter_Newton << endl;
426  }
427  i++;
428  }
429 #ifdef LOG4CXX
430  {
431  std::stringstream sout;
432  sout << "Total number of newton iterations " << this->fTotalNewton;
433  LOGPZ_DEBUG(logger,sout.str().c_str());
434 
435  }
436 #endif
437 
438  fSolver->ResetMatrix(); // deletes the memory allocated
439  // for the storage of the tangent matrix.
440 
441  graph->DrawSolution(i,AccumTime);
442  graph->Out().flush();
443 
444  delete graph;
445 
446  time_t endTime_t = time(NULL);
447 
448  out << "\nElapsed time in seconds: " << (endTime_t - startTime_t) << endl;
449 
450  cout << "\nElapsed time in seconds: " << (endTime_t - startTime_t) << endl;
451 
452 
453 }
454 
455 void TPZEulerAnalysis::CFLControl(REAL & lastEpsilon, REAL & epsilon, REAL & epsilon_Newton, REAL & timeStep)
456 {
457  // CFL control based on Flux reduction
458  if((lastEpsilon>0. && epsilon>0.) && fEvolCFL >= 1)
459  {
460  fFlowCompMesh->ScaleCFL(lastEpsilon/epsilon);
461  timeStep *= lastEpsilon/epsilon;
462  }
463 
464  // CFL control based on Nonlinear invertion
465  if(epsilon_Newton < fNewtonEps && fEvolCFL >= 2)
466  {
467  fFlowCompMesh->ScaleCFL(2.);
468  timeStep *= 2.;
469  }
470 
471  if(epsilon_Newton > fNewtonEps && fEvolCFL >= 3)
472  {
473  fFlowCompMesh->ScaleCFL(.5);
474  timeStep *= .5;
475  }
476 
477  lastEpsilon = epsilon;
478 }
479 
480 
482 {
483  return fFlowCompMesh->ComputeTimeStep();
484 }
485 
486 void TPZEulerAnalysis::SetNewtonCriteria(REAL epsilon, int maxIter)
487 {
488  fNewtonEps = epsilon;
489  fNewtonMaxIter = maxIter;
490 }
491 
492 void TPZEulerAnalysis::SetTimeIntCriteria(REAL epsilon, int maxIter)
493 {
494  fTimeIntEps = epsilon;
495  fTimeIntMaxIter = maxIter;
496 }
497 
499 {
500  fEvolCFL = EvolCFL;
501 }
502 
504 {
505  fpBlockDiag = blockDiag;
506 }
507 
508 void TPZEulerAnalysis::WriteCMesh( const char * str)
509 {
510  TPZFileStream fstr;
511  fstr.OpenWrite(str);
512  fGeoMesh->Write(fstr,1);
513  fFlowCompMesh->Write(fstr,1);
514 }
515 
516 
518 {
519  REAL smallestincr = 1.e-3;
520  REAL dist = 0.;
521  REAL incr = 1.0;
522  TPZFMatrix<STATE> solution;
524  AssembleRhs();
525  REAL preverr = Norm(fRhs);
526  REAL error;
527  dist += incr;
528  while (fabs(incr) > smallestincr) {
529  solution = sol0;
530  solution += (direction *(STATE)dist);
531  fFlowCompMesh->LoadSolution(solution);
532  try
533  {
534  AssembleRhs();
535  error = Norm(fRhs);
536  }
537  catch(TPZOutofRange obj)
538  {
539  error = 2*preverr+2.;
540  }
541  if (error < preverr && fabs(dist - 1.0) < 1.e-9) {
542  incr = 0.;
543  }
544  else if (error < preverr && dist < 1.00 && dist > 0.) {
545  dist += incr;
546  preverr = error;
547  }
548  else
549  {
550  dist -= incr;
551  incr *= 0.1;
552  dist += incr;
553  }
554  }
555  dist -= incr;
556  if (dist <= 0.) {
557  cout << "TPBNonLinearAnalysis improper search direction\n";
558  direction *= smallestincr;
559  }
560  else {
561  direction *= dist;
562  if (fabs(dist - 1.) > smallestincr) {
563  // cout << "MaxDescent scale = " << dist << endl;
564  // cout.flush();
565  }
566  }
568  if(dist > 0.) return 1;
569  else return 0;
570 }
571 
572 
573 
578 {
579  int iel;
580  //int numel = 0;
581  int nelem = fCompMesh->NElements();
583 
585  TPZFNMatrix<64,STATE> diff(8,8);
586  // REAL diffnorm;
587 
588  for(iel=0; iel < nelem; iel++) {
589  TPZCompEl *el = elementvec[iel];
590  if(!el) continue;
591  el->CalcStiff(ek1,ef1);
592  el->CalcResidual(ef2);
593  diff =ef1.fMat;
594  diff -= ef2.fMat;
595  // diffnorm = Norm(diff);
596  }
597 }
598 
599 
603 void TPZEulerAnalysis::SetGMResFront(REAL tol, int numiter, int numvectors)
604 {
606  strfront.SetQuiet(1);
607  TPZMatrix<STATE> *front = strfront.CreateAssemble(fRhs,NULL);
608 
609  TPZStepSolver<STATE> FrontSolver;
610  FrontSolver.SetDirect(ELU);
611  FrontSolver.SetMatrix(front);
612 
613 
614  TPZSpStructMatrix StrMatrix(Mesh());
615  //TPZFStructMatrix StrMatrix(cmesh);
616  SetStructuralMatrix(StrMatrix);
617 
618  TPZMatrix<STATE> * mat = StrMatrix.Create();
620  Solver.SetGMRES(numiter,
621  numvectors,
622  FrontSolver,
623  tol,
624  0);
625  Solver.SetMatrix(mat);
626  SetSolver(Solver);
628 
629 }
630 
631 
636 {
638  StrMatrix->SetQuiet(1);
639  // TPZMatrix<REAL> *front = StrMatrix.CreateAssemble(fRhs);
640  SetStructuralMatrix(StrMatrix);
641  TPZStepSolver<STATE> FrontSolver;
642  FrontSolver.SetDirect(ELU);
643  // FrontSolver.SetMatrix(front);
644  SetSolver(FrontSolver);
646 }
647 
648 
652 void TPZEulerAnalysis::SetGMResBlock(REAL tol, int numiter, int numvec)
653 {
654  TPZSpStructMatrix StrMatrix(Mesh());
655  //TPZFStructMatrix StrMatrix(cmesh);
656  SetStructuralMatrix(StrMatrix);
657 
658  TPZMatrix<STATE> * mat = StrMatrix.Create();
659  TPZBlockDiagonalStructMatrix strBlockDiag(Mesh());
661  TPZBlockDiagonal<STATE> * block = new TPZBlockDiagonal<STATE>();//blockDiag.Create();
662  strBlockDiag.AssembleBlockDiagonal(*block); // just to initialize structure
663  Pre.SetMatrix(block);
664  Pre.SetDirect(ELU);
666  Solver.SetGMRES(numiter,
667  numvec,
668  Pre,
669  tol,
670  0);
671  Solver.SetMatrix(mat);
672  SetSolver(Solver);
675 
676 }
677 #endif
void CompareRhs()
Trying difference between two times.
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
TPZMatrixSolver< STATE > * fSolver
Type of solver to be applied.
Definition: pzanalysis.h:52
REAL fTimeIntEps
Stop criteria for time integration loops.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
REAL ComputeTimeStep()
Computes the current time step for the mesh.
virtual void AssembleRhs()
Assembles the right hand side vector.
void ResetMatrix() override
Resets current object.
Definition: pzsolve.cpp:50
virtual void SetFileName(const std::string &filename)
Sets the name of the output file.
Definition: pzdxmesh.cpp:418
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
std::ostream & Out()
Definition: pzgraphmesh.h:80
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
virtual void Run(std::ostream &out, const std::string &dxout, int dxRes)
See declaration in the base class.
Implements Block Diagonal Structural Matrices. Structural Matrix.
Definition: pzbdstrmatrix.h:21
TPZFMatrix< STATE > fSolution
Solution vector.
Definition: pzanalysis.h:50
TPZFMatrix< STATE > fRhsLast
Vector to hold the contribution of last state to the rhs.
virtual void Assemble()
Assembles the stiffness matrix.
This class is used as an exception thrown on an outofrange condition.
Definition: tpzoutofrange.h:24
void SetPreconditioner(TPZSolver< TVar > &solve)
Define the preconditioner as a solver object.
Implements the interface of the graphmesh to the OpenDX graphics package. Post processing.
Definition: pzdxmesh.h:17
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
Definition: pzcmesh.cpp:721
void UpdateSolAndRhs(TPZFMatrix< STATE > &deltaSol, REAL &epsilon)
Adds deltaSol to the last solution and stores it as the current solution, preparing it to contribute ...
void ScaleCFL(REAL scale)
Scales the CFL of all materials.
void WriteCMesh(const char *str)
Writes the computational mesh onto disk.
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Definition: pzelmat.h:41
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgmesh.cpp:1505
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
TPZCompMesh * fCompMesh
Computational mesh.
Definition: pzanalysis.h:44
int LineSearch(REAL &residual, TPZFMatrix< STATE > &sol0, TPZFMatrix< STATE > &dir)
This method will search for the solution which minimizes the residual.
TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Returns a pointer to TPZMatrix.
void OpenWrite(const std::string &fileName)
Defines PZError.
void BuildFromMatrix(TPZMatrix< TVar > &matrix)
Builds a block from matrix.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
Definition: pzcompel.h:794
TPZCompMesh * Mesh() const
Returns the pointer to the computational mesh.
Definition: pzanalysis.h:180
virtual void Solve(const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual=0)=0
Solves the system of linear equations.
virtual int Dimension() const =0
Returns the integrable dimension of the material.
int RunNewton(REAL &epsilon, int &numIter)
Implements the Newton&#39;s method.
void SetContributionTime(TPZContributeTime time)
Informs the Analysis class the time at which the current solution in the computational mesh belongs ...
int fTotalNewton
Total number of newton iterations during this run.
void BufferLastStateAssemble()
Buffers the assemblage of the rhs with respect to the last state.
REAL EvaluateFluxEpsilon()
Evaluates the flux part of the residual for convergence check.
Implements a chunk vector with free store administration. Utility.
Definition: TPZStream.h:39
int fEvolCFL
Indicates whether the CFL is to evolute or not.
REAL fNewtonEps
Stop criteria for the Newton loops.
void SetEvolCFL(int EvolCFL)
Indicates whether the CFL is to evolute or not.
TPZMatrixSolver< STATE > & Solver()
Get the solver matrix.
Definition: pzanalysis.h:367
virtual TPZMatrix< STATE > * Create() override
void SetGMResBlock(REAL tol, int numiter, int numvec)
Set to solve with GMRes algorithm for block diagonal matrix.
Contains the TPZFStructMatrix class which implements Full Structural Matrices.
Contains the TPZBlockDiagonalStructMatrix class which implements Block Diagonal Structural Matrices...
void error(char *string)
Definition: testShape.cc:7
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
void SetResolution(int res)
Sets resolution.
Definition: pzgraphmesh.h:86
Computational mesh with additional data for CFD problems. Computational Mesh.
Definition: pzflowcmesh.h:27
void SetFrontalSolver()
Set to solve with Frontal method.
TPZMaterial * GetFlowMaterial()
Returns the first flow material in the mesh.
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
void LoadSolution(const TPZFMatrix< STATE > &sol)
Given the solution of the global system of equations, computes and stores the solution for the restri...
Definition: pzcmesh.cpp:441
void SetTimeIntCriteria(REAL epsilon, int maxIter)
Settings for the time integration method.
static const double tol
Definition: pzgeoprism.cpp:23
Implements the sequence of actions to perform a finite element analysis. Analysis.
Definition: pzanalysis.h:32
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
virtual void DrawSolution(TPZBlock< REAL > &Sol)
Draw solution as dx file.
Definition: pzdxmesh.cpp:384
Implements reading from and writing to an ascii file. Persistency.
Definition: TPZFileStream.h:15
int fNewtonMaxIter
Maxime iterations for iterative Newton loops.
void SetContributionTime(TPZContributeTime time)
Informs the time at which the current solution in the computational mesh belongs, so that the materia...
Contains TPZEulerAnalysis class which implements an analysis procedure for compressible Euler flow si...
void SetGMResFront(REAL tol, int numiter, int numvectors)
Set to solve with GMRes algorithm.
TPZGeoMesh * fGeoMesh
Geometric Mesh.
Definition: pzanalysis.h:42
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
Definition: pzmatrix.h:52
void SetBlockDiagonalPrecond(TPZBlockDiagonal< STATE > *blockDiag)
Informs a block diagonal to be used as preconditioning.
virtual void SetMatrix(TPZAutoPointer< TPZMatrix< TVar > > Refmat)
Sets a matrix to the current object.
Definition: pzsolve.h:115
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
void SetResidualType(TPZResidualType type)
Sets the kind of residual to be computed.
string res
Definition: test.py:151
Responsible for a interface among Finite Element Package and Matrices package to frontal method...
~TPZEulerAnalysis()
Simple destructor.
TPZFlowCompMesh * fFlowCompMesh
Stores a pointer to the computational flow mesh.
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
REAL ComputeTimeStep()
Defines the time step for each material in the mesh.
void UpdateHistory()
After a call to UpdateSolution, this method shifts the history in one solution, so that the current s...
void SetFlowforcingFunction(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets the forcing funtion for all fluid materials in the mesh.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
virtual void DrawMesh(int numcases)
Draw mesh as dx file.
Definition: pzdxmesh.cpp:93
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
TPZDXGraphMesh * PrepareDXMesh(const std::string &dxout, int dxRes)
Prepares the DX graph mesh.
Contains the TPBSpStructMatrix class which assembles on the pair equations.
int Zero() override
Zeroes all the elements of the matrix.
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
Definition: pzvec_extras.h:124
TPZAutoPointer< TPZStructMatrix > fStructMatrix
Structural matrix.
Definition: pzanalysis.h:68
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
Definition: pzcompel.cpp:610
void CFLControl(REAL &lastEpsilon, REAL &epsilon, REAL &epsilon_Newton, REAL &timeStep)
Evaluates the CFL control based on the newest residual norm (epsilon) and last residual norm (lastEps...
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
Definition: pzsolve.h:138
int fHasFrontalPreconditioner
Indication if a frontal matrix is being used as a preconditioner.
int Id() const
Definition: TPZMaterial.h:170
virtual void Solve()
Invert the stiffness matrix.
Implements Sparse Structural Matrices. Structural Matrix.
int fTimeIntMaxIter
Maxime iterations for iterative time integration loops.
Contains the TPZOutofRange class.
void SetDirect(const DecomposeType decomp)
TPZBlockDiagonal< STATE > * fpBlockDiag
Preconditioner.
TPZFMatrix< STATE > fRhs
Load vector.
Definition: pzanalysis.h:48
void SetLastState()
Sets the solution vector to be the one representing the Current State (Wn) or the last explicit solut...
Is a structural matrix with parallel techniques included. Structural Matrix Frontal.
void AssembleBlockDiagonal(TPZBlockDiagonal< STATE > &block)
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZContributeTime
Indicates which term is put in the right hand side and tangent matrix.
Definition: pzconslaw.h:47
void SetNewtonCriteria(REAL epsilon, int maxIter)
Settings for the Newton&#39;s method.
TPZEulerAnalysis()
Default constructor.
Contains the TPZParFrontStructMatrix class which is a structural matrix with parallel techniques incl...
void SetAdvancedState()
Sets the solution vector to be the one representing the Advanced State (Wn+1) or the advanced implici...
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
void SetGMRES(const int64_t numiterations, const int numvectors, const TPZMatrixSolver< TVar > &pre, const REAL tol, const int64_t FromCurrent)
obj
Definition: test.py:225
This class implements a reference counter mechanism to administer a dynamically allocated object...