NeoPZ
|
Implements analysis procedures with hp adaptivity. Analysis. More...
#include <pzanalysiserror.h>
Public Member Functions | |
TPZAnalysisError (TPZCompMesh *mesh, std::ostream &out) | |
Object constructors. More... | |
~TPZAnalysisError () | |
Delete objects. More... | |
void | SetAdaptivityParameters (REAL EtaAdmissible, int64_t NIterations) |
Set the parameters which will govern the adaptive process. More... | |
void | hp_Adaptive_Mesh_Design (std::ostream &out, REAL &EtaAdmissible) |
Run the algorithm of the fast hp adaptive finite element mesh design. More... | |
void | GetSingularElements (TPZStack< TPZCompElSide > &listel) |
Search the element whith contain this point. More... | |
void | ZoomInSingularity (REAL csi, TPZCompElSide elside, REAL singularity_order=0.9) |
Calculate pn and hn parameters for the elements neighbours to the element with contain the singular point. More... | |
void | HPAdapt (REAL CurrentEtaAdmissible, std::ostream &out) |
Run one iteration of HP adaptivity. More... | |
REAL | MaximLocalError () |
Returns the maximal local error of the elements of the mesh. More... | |
REAL | h_Parameter (TPZCompEl *cel) |
Calculate the h parameter of the element. More... | |
void | MathematicaPlot () |
Plot to the aproximated solution of the FEM with Mathematica package. More... | |
void | EvaluateError (REAL CurrentEtaAdmissible, bool store_error, std::ostream &out) |
Compute the list of errors of all elements and also the admissible error for any element in the grid. More... | |
Public Member Functions inherited from TPZAnalysis | |
TPZAnalysis (TPZCompMesh *mesh, bool mustOptimizeBandwidth=true, std::ostream &out=std::cout) | |
Create an TPZAnalysis object from one mesh pointer. More... | |
TPZAnalysis (TPZAutoPointer< TPZCompMesh > mesh, bool mustOptimizeBandwidth=true, std::ostream &out=std::cout) | |
Create an TPZAnalysis object from one mesh auto pointer object. More... | |
void | SetGuiInterface (TPZAutoPointer< TPZGuiInterface > gui) |
Defines gui interface object. More... | |
TPZAutoPointer< TPZGuiInterface > | GetGuiInterface () const |
Gets gui interface object. More... | |
bool | AmIKilled () |
Returns if the process was canceled through gui interface. More... | |
virtual void | SetCompMesh (TPZCompMesh *mesh, bool mustOptimizeBandwidth) |
Set the computational mesh of the analysis. More... | |
TPZAnalysis () | |
Create an empty TPZAnalysis object. More... | |
void | Write (TPZStream &buf, int withclassid) const override |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true. More... | |
void | Read (TPZStream &buf, void *context) override |
read objects from the stream More... | |
virtual | ~TPZAnalysis (void) |
Destructor: deletes all protected dynamic allocated objects. More... | |
void | CleanUp () |
deletes all data structures More... | |
void | SetRenumber (TPZAutoPointer< TPZRenumbering > renumber) |
Change the renumbering scheme. More... | |
void | OptimizeBandwidth () |
Sets the computer connection block number from the graphical connections block number otimization. More... | |
int | HighestDimension () |
Returns the dimension of the material which has the highest dimension. More... | |
void | Resequence (int firstel=-1) |
Recompute the node sequence. More... | |
int | ComputeNumberofLoadCases () |
Determine the number of load cases from the material objects and return its value. More... | |
virtual void | Assemble () |
Assemble the stiffness matrix and load vector. More... | |
virtual void | AssembleResidual () |
Assemble the load vector. More... | |
virtual void | Solve () |
Invert the stiffness matrix. More... | |
TPZFMatrix< STATE > & | Rhs () |
Returns the load vector. More... | |
TPZFMatrix< STATE > & | Solution () |
Returns the solution matrix. More... | |
TPZCompMesh * | Mesh () const |
Returns the pointer to the computational mesh. More... | |
TPZAutoPointer< TPZStructMatrix > | StructMatrix () |
Returns a reference to the structural matrix. More... | |
TPZMatrixSolver< STATE > * | BuildPreconditioner (EPrecond preconditioner, bool overlap) |
Define the type of preconditioner used. More... | |
void | SetStep (int step) |
ste the step for post processing More... | |
void | SetThreadsForError (int nthreads) |
int | GetStep () |
void | SetTime (REAL time) |
Sets time will be used in dx files. More... | |
REAL | GetTime () |
Gets time used in dx files. More... | |
void | ShowShape (const std::string &plotfile, TPZVec< int64_t > &equationindices) |
Graphic of the solution as V3DGrap visualization. More... | |
void | ShowShape (const std::string &plotfile, TPZVec< int64_t > &equationindices, int matid, const TPZVec< std::string > &varname) |
Graphic of the solution as V3DGrap visualization. More... | |
void | LoadShape (double dx, double dy, int64_t numelem, TPZConnect *nod) |
Make assembling and clean the load and solution vectors. More... | |
virtual void | Run (std::ostream &out=std::cout) |
Calls the appropriate sequence of methods to build a solution or a time stepping sequence. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
virtual void | CloseGraphMesh () |
Clean the GrapMesh vector. More... | |
TPZGraphMesh * | GraphMesh (int dimension) |
Defines the postprocessing parameters for the graphical grid. More... | |
virtual void | PostProcess (int resolution) |
Draw solution over mesh for all dimensions. More... | |
virtual void | PostProcess (int resolution, int dimension) |
Draw solution over mesh by dimension. More... | |
void | IdentifyPostProcessingMatIds (int dimension, std::set< int > &matids) |
Fill mat ids with materials with provided dimension wich are not boundary conditinos or interface. More... | |
virtual void | LoadSolution () |
Load the solution into the computable grid. More... | |
virtual void | LoadSolution (const TPZFMatrix< STATE > &sol) |
Load the solution into the computable mesh considering sol as Solution vector of the analysis. More... | |
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. More... | |
void | SetExact (std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &result, TPZFMatrix< STATE > &deriv)> f) |
Sets the pointer of the exact solution function. More... | |
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. More... | |
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. More... | |
virtual void | PostProcessErrorSerial (TPZVec< REAL > &, bool store_error=true, std::ostream &out=std::cout) |
virtual void | PostProcessErrorParallel (TPZVec< REAL > &, bool store_error=true, std::ostream &out=std::cout) |
void | CreateListOfCompElsToComputeError (TPZAdmChunkVector< TPZCompEl *> &elvec) |
void | Print (const std::string &name, std::ostream &out) |
Print connect and solution information. More... | |
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. More... | |
TPZMatrixSolver< STATE > & | Solver () |
Get the solver matrix. More... | |
void | AnimateRun (int64_t num_iter, int steps, TPZVec< std::string > &scalnames, TPZVec< std::string > &vecnames, const std::string &plotfile) |
Run and print the solution step by step. More... | |
void | SetSolver (TPZMatrixSolver< STATE > &solver) |
Set solver matrix. More... | |
void | SetStructuralMatrix (TPZAutoPointer< TPZStructMatrix > strmatrix) |
Set structural matrix as auto pointer for analysis. More... | |
void | SetStructuralMatrix (TPZStructMatrix &strmatrix) |
Set structural matrix for analysis. More... | |
int | ClassId () const override |
Define the class id associated with the class. More... | |
virtual void | DefineElementTable (int dimension, TPZVec< int64_t > &GeoElIds, TPZVec< REAL > &points) |
Fill the computational element vector to post processing depending over geometric mesh defined. More... | |
virtual void | SetTableVariableNames (TPZVec< std::string > varnames) |
Sets the names of the variables into the data structure for post processing. More... | |
virtual void | PrePostProcessTable (std::ostream &out_file) |
Prepare data to print post processing and print coordinates. More... | |
virtual void | PostProcessTable (std::ostream &out_file) |
Print the solution related with the computational element vector in post process. More... | |
void | PostProcessTable (TPZFMatrix< REAL > &pos, std::ostream &out=std::cout) |
Compute and print the local error over all elements in data structure of post process, also compute global errors in several norms. More... | |
Public Member Functions inherited from TPZSavable | |
TPZSavable () | |
virtual | ~TPZSavable () |
virtual std::list< std::map< std::string, uint64_t > > | VersionHistory () const |
virtual std::pair< std::string, uint64_t > | Version () const |
virtual bool | Compare (TPZSavable *copy, bool override=false) |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
virtual bool | Compare (TPZSavable *copy, bool override=false) const |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
Public Member Functions inherited from TPZRegisterClassId | |
template<typename T > | |
TPZRegisterClassId (int(T::*)() const) | |
TPZRegisterClassId ()=default | |
Private Member Functions | |
void | PlotLocal (int64_t iter, REAL CurrentEtaAdmissible, std::ostream &out) |
Postprocess the intermediate solutions. More... | |
void | ExpandConnected (TPZStack< TPZCompElSide > &singel) |
Private Attributes | |
TPZManVector< int64_t > | fElIndexes |
Indexes of the elements vector. More... | |
TPZManVector< REAL > | fElErrors |
Vector with error values by elements. More... | |
TPZStack< TPZCompElSide > | fSingular |
REAL | fTotalError |
REAL | fAdmissibleError |
REAL | fEtaAdmissible |
int64_t | fNIterations |
Number of iterations. More... | |
Additional Inherited Members | |
Public Types inherited from TPZAnalysis | |
enum | EPrecond { EJacobi, EBlockJacobi, EElement, ENodeCentered } |
Preconditioners which can be created by objects of this class. More... | |
Static Public Member Functions inherited from TPZSavable | |
static std::set< TPZRestoreClassBase * > & | RestoreClassSet () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::map< int, TPZRestore_t > & | ClassIdMap () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::pair< std::string, uint64_t > | NeoPZVersion () |
static void | Register (TPZRestoreClassBase *restore) |
static void | RegisterClassId (int classid, TPZRestore_t fun) |
static TPZSavable * | CreateInstance (const int &classId) |
Public Attributes inherited from TPZAnalysis | |
std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &result, TPZFMatrix< STATE > &deriv)> | fExact |
Pointer to Exact solution function, it is necessary to calculating errors. More... | |
Protected Attributes inherited from TPZAnalysis | |
TPZGeoMesh * | fGeoMesh |
Geometric Mesh. More... | |
TPZCompMesh * | fCompMesh |
Computational mesh. More... | |
TPZGraphMesh * | fGraphMesh [3] |
Graphical mesh. More... | |
TPZFMatrix< STATE > | fRhs |
Load vector. More... | |
TPZFMatrix< STATE > | fSolution |
Solution vector. More... | |
TPZMatrixSolver< STATE > * | fSolver |
Type of solver to be applied. More... | |
TPZVec< std::string > | fScalarNames [3] |
Scalar variables names - to post process. More... | |
TPZVec< std::string > | fVectorNames [3] |
Vectorial variables names - to post process. More... | |
TPZVec< std::string > | fTensorNames [3] |
Tensorial variables names - to post process. More... | |
int | fStep |
Time step. More... | |
REAL | fTime |
Time variable which is used in dx output. More... | |
int | fNthreadsError |
Number of threads to be used for post-processing error. More... | |
TPZAutoPointer< TPZStructMatrix > | fStructMatrix |
Structural matrix. More... | |
TPZAutoPointer< TPZRenumbering > | fRenumber |
Renumbering scheme. More... | |
TPZAutoPointer< TPZGuiInterface > | fGuiInterface |
Pointer for gui interface object. More... | |
TTablePostProcess | fTable |
Implements analysis procedures with hp adaptivity. Analysis.
Definition at line 22 of file pzanalysiserror.h.
TPZAnalysisError::TPZAnalysisError | ( | TPZCompMesh * | mesh, |
std::ostream & | out | ||
) |
Object constructors.
Definition at line 31 of file pzanalysiserror.cpp.
|
inline |
Delete objects.
Definition at line 41 of file pzanalysiserror.h.
References EvaluateError(), ExpandConnected(), GetSingularElements(), h_Parameter(), hp_Adaptive_Mesh_Design(), HPAdapt(), MathematicaPlot(), MaximLocalError(), PlotLocal(), SetAdaptivityParameters(), and ZoomInSingularity().
void TPZAnalysisError::EvaluateError | ( | REAL | CurrentEtaAdmissible, |
bool | store_error, | ||
std::ostream & | out | ||
) |
Compute the list of errors of all elements and also the admissible error for any element in the grid.
Is called from HPAdapt()
Definition at line 529 of file pzanalysiserror.cpp.
References TPZCompMesh::ElementSolution(), TPZCompMesh::ElementVec(), TPZCompEl::EvaluateError(), TPZCompMesh::EvaluateError(), fAdmissibleError, fElErrors, fElIndexes, TPZAnalysis::fExact, TPZVec< T >::Fill(), fTotalError, TPZMaterial::Id(), TPZCompEl::Material(), TPZAnalysis::Mesh(), TPZVec< T >::NElements(), TPZChunkVector< T, EXP >::NElements(), NullFunction(), numel, TPZFMatrix< TVar >::Redim(), TPZManVector< T, NumExtAlloc >::Resize(), and sqrt.
Referenced by HPAdapt(), PlotLocal(), and ~TPZAnalysisError().
|
private |
Definition at line 572 of file pzanalysiserror.cpp.
References TPZCompElSide::Element(), TPZGeoElSide::EqualLevelCompElementList(), TPZGeoElSide::Exists(), TPZCompElSide::Exists(), TPZVec< T >::NElements(), TPZStack< T, NumExtAlloc >::Pop(), TPZStack< T, NumExtAlloc >::Push(), TPZCompElSide::Reference(), and TPZManVector< T, NumExtAlloc >::Resize().
Referenced by ZoomInSingularity(), and ~TPZAnalysisError().
void TPZAnalysisError::GetSingularElements | ( | TPZStack< TPZCompElSide > & | listel | ) |
Search the element whith contain this point.
Definition at line 148 of file pzanalysiserror.cpp.
Referenced by ~TPZAnalysisError().
REAL TPZAnalysisError::h_Parameter | ( | TPZCompEl * | cel | ) |
Calculate the h parameter of the element.
Definition at line 382 of file pzanalysiserror.cpp.
References TPZGeoNode::Coord(), h, TPZGeoEl::NCornerNodes(), TPZGeoEl::NodePtr(), NullFunction(), pow(), TPZCompEl::Reference(), sqrt, and val().
Referenced by MathematicaPlot(), and ~TPZAnalysisError().
void TPZAnalysisError::hp_Adaptive_Mesh_Design | ( | std::ostream & | out, |
REAL & | EtaAdmissible | ||
) |
Run the algorithm of the fast hp adaptive finite element mesh design.
Definition at line 40 of file pzanalysiserror.cpp.
References TPZCompMesh::AdjustBoundaryElements(), arq(), ECholesky, TPZCompMesh::EvaluateError(), TPZAnalysis::fCompMesh, fEtaAdmissible, TPZAnalysis::fExact, TPZVec< T >::Fill(), fNIterations, HPAdapt(), TPZAnalysis::Mesh(), TPZVec< T >::NElements(), TPZCompMesh::NEquations(), TPZAnalysis::OptimizeBandwidth(), PlotLocal(), pow(), PZError, TPZManVector< T, NumExtAlloc >::Resize(), TPZAnalysis::Run(), TPZStepSolver< TVar >::SetDirect(), TPZAnalysis::SetSolver(), TPZAnalysis::SetStructuralMatrix(), TPZMatrixSolver< TVar >::ShareMatrix(), TPZAnalysis::Solver(), and sqrt.
Referenced by ~TPZAnalysisError().
void TPZAnalysisError::HPAdapt | ( | REAL | CurrentEtaAdmissible, |
std::ostream & | out | ||
) |
Run one iteration of HP adaptivity.
Definition at line 290 of file pzanalysiserror.cpp.
References arq(), TPZInterpolatedElement::Divide(), TPZInterpolatedElement::EffectiveSideOrder(), TPZCompMesh::ElementVec(), EvaluateError(), fabs, fAdmissibleError, fElErrors, fElIndexes, fSingular, TPZMaterial::Id(), TPZGeoEl::Id(), TPZCompEl::Index(), log, TPZCompEl::Material(), TPZAnalysis::Mesh(), TPZVec< T >::NElements(), TPZGeoEl::NSides(), pow(), TPZInterpolatedElement::PRefine(), PZError, TPZCompEl::Reference(), test::res, TPZManVector< T, NumExtAlloc >::Resize(), pzgeom::tol, TPZGeoEl::X(), and ZoomInSingularity().
Referenced by hp_Adaptive_Mesh_Design(), and ~TPZAnalysisError().
void TPZAnalysisError::MathematicaPlot | ( | ) |
Plot to the aproximated solution of the FEM with Mathematica package.
jorge 2017 - I think it's unnecessary, because if node is created its exists always
Definition at line 412 of file pzanalysiserror.cpp.
References TPZCompMesh::Block(), TPZCompMesh::ConnectVec(), TPZGeoNode::Coord(), TPZGeoMesh::ElementVec(), fabs, TPZAnalysis::fCompMesh, h, h_Parameter(), TPZGeoNode::Id(), TPZGeoEl::MaterialId(), TPZGeoMesh::NElements(), TPZGeoMesh::NNodes(), TPZGeoEl::NodePtr(), TPZGeoMesh::NodeVec(), TPZBlock< TVar >::Position(), TPZCompMesh::Reference(), TPZGeoEl::Reference(), TPZConnect::SequenceNumber(), and TPZCompMesh::Solution().
Referenced by ~TPZAnalysisError().
REAL TPZAnalysisError::MaximLocalError | ( | ) |
Returns the maximal local error of the elements of the mesh.
Referenced by ~TPZAnalysisError().
|
private |
Postprocess the intermediate solutions.
Definition at line 119 of file pzanalysiserror.cpp.
References TPZAnalysis::DefineGraphMesh(), EvaluateError(), TPZAnalysis::PostProcess(), and TPZManVector< T, NumExtAlloc >::Resize().
Referenced by hp_Adaptive_Mesh_Design(), and ~TPZAnalysisError().
void TPZAnalysisError::SetAdaptivityParameters | ( | REAL | EtaAdmissible, |
int64_t | NIterations | ||
) |
Set the parameters which will govern the adaptive process.
Definition at line 34 of file pzanalysiserror.cpp.
References arq(), fEtaAdmissible, and fNIterations.
Referenced by ~TPZAnalysisError().
void TPZAnalysisError::ZoomInSingularity | ( | REAL | csi, |
TPZCompElSide | elside, | ||
REAL | singularity_order = 0.9 |
||
) |
Calculate pn and hn parameters for the elements neighbours to the element with contain the singular point.
elside | Computational element and side to zoom |
csi | determines the number of layers of refinement |
singularity_order | determines the strength of the singularity |
Take the next element and its interpolation order from the stack
Cast the element to an interpolated element if possible
If the element is not interpolated, nothing to do
Set the interpolation order of the current element to curporder
Identify the subelements along the side and push them on the stack
Definition at line 152 of file pzanalysiserror.cpp.
References TPZInterpolatedElement::Divide(), TPZCompElSide::Element(), TPZGeoElSide::Exists(), TPZCompElSide::Exists(), ExpandConnected(), fSingular, TPZGeoElSide::GetSubElements2(), TPZCompEl::Index(), log, TPZVec< T >::NElements(), TPZStack< T, NumExtAlloc >::Pop(), pow(), TPZInterpolatedElement::PRefine(), TPZStack< T, NumExtAlloc >::Push(), TPZGeoElSide::Reference(), and TPZCompElSide::Reference().
Referenced by HPAdapt(), and ~TPZAnalysisError().
|
private |
Definition at line 31 of file pzanalysiserror.h.
Referenced by EvaluateError(), and HPAdapt().
|
private |
Vector with error values by elements.
Definition at line 27 of file pzanalysiserror.h.
Referenced by EvaluateError(), and HPAdapt().
|
private |
Indexes of the elements vector.
Definition at line 25 of file pzanalysiserror.h.
Referenced by EvaluateError(), and HPAdapt().
|
private |
Definition at line 33 of file pzanalysiserror.h.
Referenced by hp_Adaptive_Mesh_Design(), and SetAdaptivityParameters().
|
private |
Number of iterations.
Definition at line 35 of file pzanalysiserror.h.
Referenced by hp_Adaptive_Mesh_Design(), and SetAdaptivityParameters().
|
private |
Definition at line 28 of file pzanalysiserror.h.
Referenced by HPAdapt(), and ZoomInSingularity().
|
private |
Total error computed
Definition at line 30 of file pzanalysiserror.h.
Referenced by EvaluateError().