The Analysis hierarchy
Table of Contents
The Analysis Group
The TPZAnalysis hierarchy is where whole workflow for performing Finite Element Analysis in NeoPZ is defined.
This hierarchy is responsible for coordinating the interaction between all the other classes involved in a simulation, such as TPZCompMesh, TPZStructMatrix and TPZSolver.
For the FEM analysis of equation systems, one can use the TPZLinearAnalysis class, described here. For the analysis of eigenvalue problems, one can use the TPZEigenAnalysis, described here.
The TPZAnalysis class
The TPZAnalysis class is the base of its hierarchy. Its attributions include (but are not limited to)
Renumbering the equations in order to optimize the bandwidth
Choosing the storage format of the global matrix (TPZStructMatrix)
Choosing the solver to be used (TPZSolver)
Coordinating the assemble process
Coordinating the solving process
Coordinating numerical post-processing on the calculated solution
Coordinating graphical post-processing of the results
Note
The TPZAnalysis class has a fTime attribute which is mainly used for post processing. However, anyone interested in creating a derived class for a transient problem may find it usefl.
Further TPZAnalysis documentation
-
class TPZAnalysis : public TPZSavable
Abstract class defining the interface for performing a Finite Element Analysis.
Subclassed by TPZEigenAnalysis, TPZLinearAnalysis
Constructors
-
TPZAnalysis()
Create an empty TPZAnalysis object.
-
TPZAnalysis(TPZCompMesh *mesh, bool mustOptimizeBandwidth = true, std::ostream &out = std::cout)
Create an TPZAnalysis object from one mesh pointer.
-
TPZAnalysis(TPZAutoPointer<TPZCompMesh> mesh, bool mustOptimizeBandwidth = true, std::ostream &out = std::cout)
Create an TPZAnalysis object from one mesh auto pointer object.
MainFEM
Main methods of the TPZAnalysis for controlling a FEM simulation.
-
virtual void Assemble() = 0
Assemble the stiffness matrix and load vector.
-
virtual void Solve() = 0
Solve the system.
-
virtual void Run(std::ostream &out = std::cout)
Calls all the needed steps for running the simulation.
By default, it will run Assemble and Solve methods. Can be overloaded in child classes for customizing behaviour (i.e., creating a time-stepping scheme).
-
inline TPZSolutionMatrix &Solution()
Returns the solution matrix.
-
virtual void LoadSolution()
Load the solution into the computable grid.
-
inline virtual void LoadSolution(const TPZFMatrix<STATE> &sol)
Load the solution into the computable mesh considering sol as Solution vector of the analysis.
Utils
-
template<class TVar>
TPZMatrixSolver<TVar> *BuildPreconditioner(EPrecond preconditioner, bool overlap) Define the type of preconditioner used.
This method will create the stiffness matrix but without assembling
-
void CleanUp()
deletes all data structures
-
void OptimizeBandwidth()
Sets the computer connection block number from the graphical connections block number otimization.
-
int HighestDimension()
Returns the dimension of the material which has the highest dimension.
-
void Resequence(int firstel = -1)
Recompute the node sequence.
-
int ComputeNumberofLoadCases()
Determine the number of load cases from the material objects and return its value.
It modifies the TPZMatLoadCases instances so they have the same number of load cases. The number of load cases is the maximum value of load cases of all material objects.
GettersSetters
-
inline TPZCompMesh *Mesh() const
Returns the pointer to the computational mesh.
-
virtual void SetCompMesh(TPZCompMesh *mesh, bool mustOptimizeBandwidth)
Set the computational mesh of the analysis.
-
inline void SetRenumber(TPZAutoPointer<TPZRenumbering> renumber)
Change the renumbering scheme.
-
inline TPZAutoPointer<TPZStructMatrix> StructMatrix()
Returns a reference to the structural matrix.
-
void SetStructuralMatrix(TPZAutoPointer<TPZStructMatrix> strmatrix)
Set structural matrix.
-
void SetStructuralMatrix(TPZStructMatrix &strmatrix)
Set structural matrix for analysis(makes a copy)
PostFEM
FEM Post-processing (non-graphical) methods
-
void PrintVectorByElement(std::ostream &out, TPZFMatrix<STATE> &vec, REAL tol = 1.e-10)
Print the residual vector for those elements with entry above a given tolerance.
-
TPZVec<STATE> Integrate(const std::string &varname, const std::set<int> &matids)
Integrate the postprocessed variable name over the elements included in the set matids.
-
void SetExact(std::function<void(const TPZVec<REAL> &loc, TPZVec<STATE> &result, TPZFMatrix<STATE> &deriv)> f, int pOrder = 1)
Sets an exact solution in all the materials of the associated mesh.
-
virtual void PostProcess(TPZVec<REAL> &loc, std::ostream &out = std::cout)
Compute the local error over all elements and global errors in several norms and print out.
-
virtual void PostProcessError(TPZVec<REAL>&, bool store_error = true, std::ostream &out = std::cout)
Compute the local error over all elements and global errors in several norms and print out without calculating the errors of the variables for hdiv spaces.
Graphical
Methods related to graphical output.
-
void ShowShape(const std::string &plotfile, TPZVec<int64_t> &equationindices)
Graphic of the solution as V3DGrap visualization.
-
void ShowShape(const std::string &plotfile, TPZVec<int64_t> &equationindices, int matid, const TPZVec<std::string> &varname)
Graphic of the solution as V3DGrap visualization.
-
virtual void DefineGraphMesh(int dimension, const TPZVec<std::string> &scalnames, const TPZVec<std::string> &vecnames, const std::string &plotfile)
Define GrapMesh as V3D, DX, MV or VTK depending on extension of the file.
-
virtual void DefineGraphMesh(int dimension, const TPZVec<std::string> &scalnames, const TPZVec<std::string> &vecnames, const TPZVec<std::string> &tensnames, const std::string &plotfile)
Define GrapMesh as VTK with tensorial names depending on extension of the file.
-
virtual void DefineGraphMesh(int dimension, const std::set<int> &matids, const TPZVec<std::string> &scalnames, const TPZVec<std::string> &vecnames, const std::string &plotfile)
Define GrapMesh as V3D, DX, MV or VTK depending on extension of the file.
-
virtual void DefineGraphMesh(int dimension, const std::set<int> &matids, const TPZVec<std::string> &scalnames, const TPZVec<std::string> &vecnames, const TPZVec<std::string> &tensnames, const std::string &plotfile)
Define GrapMesh as VTK with tensorial names depending on extension of the file.
-
virtual void CloseGraphMesh()
Clean the GrapMesh vector.
-
inline TPZGraphMesh *GraphMesh(int dimension)
Defines the postprocessing parameters for the graphical grid.
-
inline void SetStep(int step)
Set the step for post processing.
-
inline int GetStep() const
Get the step for post processing.
-
virtual void PostProcess(int resolution)
Draw solution over mesh for all dimensions.
-
virtual void PostProcess(int resolution, int dimension)
Draw solution over mesh by dimension
-
void IdentifyPostProcessingMatIds(int dimension, std::set<int> &matids)
Fill mat ids with materials with provided dimension wich are not boundary conditinos or interface
-
TPZAnalysis()
Basic steps for running a FEM analysis
This section is under construction.
Customising your FEM analysis
This section is under construction.
Numerical post-processing
This section is under construction.
Graphical post-processing
This section is under construction.