16 template<
class TRANSIENTCLASS>
19 template<
class TRANSIENTCLASS>
31 template<
class TRANSIENTCLASS>
36 template<
class TRANSIENTCLASS>
40 if ( (InitialSol.
Rows() != nrows) || (InitialSol.
Cols() != ncols) ){
41 PZError <<
"ERROR! " << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ << std::endl;
48 template<
class TRANSIENTCLASS>
55 template<
class TRANSIENTCLASS>
98 laststate = this->
fRhs;
109 this->
fRhs += laststate;
115 const int niter = 100;
124 REAL norm =
Norm(prevsol);
125 out <<
"Iteracao n : " << (iter+1) <<
" : norma da solucao |Delta(Un)|: " << norm << std::endl;
144 REAL steadynorm =
Norm(prevsol);
145 std::cout <<
"*********** Steady state error at iteration " << this->
fCurrentIter <<
" = " << steadynorm <<
"\n\n";
148 std::cout <<
"Steady state solution achieved\n\n";
159 template<
class TRANSIENTCLASS>
162 std::map<int, TPZMaterial * >::iterator matit;
165 if(!matit->second)
continue;
173 template<
class TRANSIENTCLASS>
176 std::map<int, TPZMaterial * >::iterator matit;
179 if(!matit->second)
continue;
187 template<
class TRANSIENTCLASS>
190 std::map<int, TPZMaterial * >::iterator matit;
193 if(!matit->second)
continue;
201 template<
class TRANSIENTCLASS>
204 std::map<int, TPZMaterial * >::iterator matit;
207 if(!matit->second)
continue;
215 template<
class TRANSIENTCLASS>
218 std::map<int, TPZMaterial * >::iterator matit;
221 if(!matit->second)
continue;
229 template<
class TRANSIENTCLASS>
232 std::map<int, TPZMaterial * >::iterator matit;
235 if(!matit->second)
continue;
243 template<
class TRANSIENTCLASS>
246 std::map<int, TPZMaterial * >::iterator matit;
249 if(!matit->second)
continue;
257 template<
class TRANSIENTCLASS>
264 template<
class TRANSIENTCLASS>
268 out <<
"\nSOLUTION #" << this->
GetCurrentIter() <<
" AT TIME = " << T << std::endl;
270 out <<
"\n***************************************\n" << std::endl;
273 template<
class TRANSIENTCLASS>
276 cout <<
"TPZTransientAnalysis::Assemble lacking definition for Assemble fCompMesh "<< (
void *)
fCompMesh 278 << __FILE__ <<
" line " << __LINE__ << endl;
300 std::cout << __PRETTY_FUNCTION__ <<
" @ " << __LINE__ <<
" Error! StrMatrix must be created using" 301 <<
" methodTPZTransientAnalysis::ComputeLinearTangentMatrix()" 302 <<
" when (this->fIsLinearProblem == true)\n";
310 template<
class TRANSIENTCLASS>
320 template<
class TRANSIENTCLASS>
329 template<
class TRANSIENTCLASS>
332 cout <<
"TPZTransientAnalysis::Assemble lacking definition for Assemble fCompMesh "<< (
void *)
fCompMesh 334 << __FILE__ <<
" line " << __LINE__ << endl;
347 template<
class TRANSIENTCLASS>
388 REAL steadynorm =
Norm(prevsol);
389 std::cout <<
"*********** Steady state error at iteration " << (this->
fCurrentIter) <<
" = " << steadynorm <<
"\n\n";
392 std::cout <<
"Steady state solution achieved\n\n";
403 template<
class TRANSIENTCLASS>
408 template<
class TRANSIENTCLASS>
414 template<
class TRANSIENTCLASS>
418 std::pair< TPZFMatrix<STATE>, STATE > mypair;
423 ofstream file(
"currentsol.txt");
431 #ifndef STATE_COMPLEX TPZMatrixSolver< STATE > * fSolver
Type of solver to be applied.
void SetSaveSolution(int SaveFrequency)
Defines to save solution vector with SaveFrequency frequency.
static double gTime
Static attribute storing the current time of simulation.
void CheckConvergence(TConv &obj, TPZFMatrix< STATE > &state, TPZFMatrix< STATE > &range, TPZVec< REAL > &coefs)
Implements a general procedure to check whether the class TConv implements a consistente tangent matr...
Contains the TPZNonLinearPoisson3d class.
REAL fNewtonTol
Tolerance of Newton's method.
void SetFluxOnly()
Sets all materials to compute only the flux contributions - used in the explicit scheme.
virtual void Solve()
Invert the stiffness matrix.
TPZFMatrix< STATE > fSolution
Solution vector.
void SetExplicit()
Sets all materials in temporal scheme as an explicit Euler.
Contains the TPZTransientMaterial class which implements an implicit Euler time integrator.
virtual void UpdateFrom(TPZAutoPointer< TPZMatrix< TVar > > matrix) override
Updates the values of the current matrix based on the values of the matrix.
void SetTimeStep(REAL TimeStep)
Define time step DeltaT.
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
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) ...
virtual void PostProcess(int resolution)
See base class for comments.
REAL LineSearch(const TPZFMatrix< STATE > &Wn, TPZFMatrix< STATE > DeltaW, TPZFMatrix< STATE > &NextW, REAL tol, int niter)
Implements a golden section line search.
~TPZTransientAnalysis()
Default destructor.
virtual int Zero()
Zeroes the matrix.
TPZCompMesh * fCompMesh
Computational mesh.
void SetLastState()
Sets all materials in LastState.
TPZCompMesh * Mesh() const
Returns the pointer to the computational mesh.
virtual void RunTransient(std::ostream &out=std::cout, bool FromBegining=true, bool linesearch=true)
Executes a Newton's method for the solution of the implicit in time equation.
void ComputeLinearTangentMatrix()
Computes linear tangent matrix for linear problems.
Contains the TPZStructMatrixOR class which responsible for a interface among Matrix and Finite Elemen...
void SaveCurrentSolutionVec()
If fSaveSolutionVecFrequency != 0, save current solution vector in fSavedSolutionVec attribute...
Contains the TPZMatPoisson3d class.
virtual void Assemble()
Assemble flux vector and jacobian matrix.
void ComputeFluxOnly()
Computes the only the flux contribution for the explicit scheme.
Contains the TPZFStructMatrix class which implements Full Structural Matrices.
TPZFMatrix< STATE > & Solution()
Returns the solution matrix.
virtual void RunExplicit(std::ostream &out=std::cout, bool FromBegining=true)
Solves a explicit Euler's scheme in time.
void SetAllMaterialsDeltaT()
Sets all materials the time step.
int Zero() override
Makes Zero all the elements.
Contains the TPZSpStructMatrix class which implements sparse structural matrices. ...
int fCurrentIter
Current iteration. Variable allowing to restart the simulation.
virtual void LoadSolution()
Load the solution into the computable grid.
void SetLastState()
Set material to compute only Integral[- un/deltaT * v, Omega].
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
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.
virtual void SetMatrix(TPZAutoPointer< TPZMatrix< TVar > > Refmat)
Sets a matrix to the current object.
int64_t Rows() const
Returns number of rows.
Implements an implicit Euler time integrator. The Material Classes Material.
void SetConvergence(int niter, REAL eps, bool ForceAllSteps=true)
Defines max number of steps and steady state convergence tolerance.
Contains TPZSequenceSolver class which defines sequence solvers.
virtual void LoadSolution()
Load the solution into the computable grid.
Contains the TPZBurger class which implements a linear convection equation using a burger flux...
virtual void PostProcess(int resolution)
Draw solution over mesh for all dimensions.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
void SetCurrentState()
Sets all materials in CurrentState.
void SetMassMatrix()
Set material to compute ek = Integral[phi_i phi_j, Omega]/deltaT.
std::map< int,TPZMaterial *> & MaterialVec()
Returns a reference to the material pointers vector.
Contains TPZTransientAnalysis class which implements a simple manner to perform transient simulations...
int fNIter
Number of iterations counting from fCurrentIter to fCurrentIter+fNIter.
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.
void SetExplicit()
Sets integral scheme as an explicit Euler.
bool fIsLinearProblem
Flag indicating whether the problem is linear or not.
int fDXResolution
Resolution of DX mesh.
TPZAutoPointer< TPZStructMatrix > fStructMatrix
Structural matrix.
REAL fSteadyTol
Tolerance to consider the problem solution as steady state.
This class implements a very simple interface from PZ kernel to GUI. Module: Common.
Implements computational mesh. Computational Mesh.
int GetCurrentIter()
Returns current iteration.
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
REAL fTimeStep
Simulation time step.
int64_t Cols() const
Returns number of cols.
Derived class from TPZAnalysis implements non linear analysis (Newton's method). Analysis.
virtual void Print(std::ostream &out) const
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's method.
void ComputeMassMatrix()
Computes the mass matrix for the explicit scheme.
TPZFMatrix< STATE > fRhs
Load vector.
void SetSaveFrequency(int SaveFrequency, int resolution)
Defines properties of DX file.
Contains the implementation of the CheckConvergence function.
void SetInitialSolution(TPZFMatrix< STATE > &InitialSol)
Sets problem initial solution.
TPZFMatrix< STATE > & Solution()
Access the solution vector.
REAL fTime
Time variable which is used in dx output.
void SetFluxOnly()
Set material to compute ef = Linear Form - Bilinear Form(u) = F -ku.
void SetMassMatrix()
Sets all materials to compute the mass matrix - used in the explicit scheme.
int fNewtonMaxIter
Max iteration number of Newton's method.
#define PZError
Defines the output device to error messages and the DebugStop() function.
TPZTransientAnalysis(TPZCompMesh *mesh, bool IsLinear=false, std::ostream &out=std::cout)
Constructor.
void SetCurrentState()
Set material to compute Integral[un+1/deltaT * v, Omega] + Bilinear Form = Linear Form...