OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
huertaerrorestimator.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #ifndef huertaerrorestimator_h
36 #define huertaerrorestimator_h
37 
38 #include "../sm/refinedelement.h"
39 #include "../sm/refinedmesh.h"
40 #include "errorestimator.h"
41 #include "interface.h"
42 #include "floatarray.h"
43 #include "statecountertype.h"
44 #include "remeshingcrit.h"
45 
46 #include <vector>
47 
49 
50 #define _IFT_HuertaErrorEstimator_Name "huerta"
51 #define _IFT_HuertaErrorEstimator_normtype "normtype"
52 #define _IFT_HuertaErrorEstimator_refinelevel "refinelevel"
53 #define _IFT_HuertaErrorEstimator_requirederror "requirederror"
54 #define _IFT_HuertaErrorEstimator_skipsteps "skipsteps"
55 #define _IFT_HuertaErrorEstimator_initialskipsteps "initialskipsteps"
56 #define _IFT_HuertaErrorEstimator_werror "werror"
57 #define _IFT_HuertaErrorEstimator_perfectCSect "perCSect"
58 #define _IFT_HuertaErrorEstimator_impCSect "impCSect"
59 #define _IFT_HuertaErrorEstimator_impPos "imppos"
60 #define _IFT_HuertaErrorEstimator_exact "exact"
61 
62 
64 
65 #define _IFT_HuertaRemeshingCriteria_requirederror "requirederror"
66 #define _IFT_HuertaRemeshingCriteria_minelemsize "minelemsize"
67 #define _IFT_HuertaRemeshingCriteria_noremesh "noremesh"
68 #define _IFT_HuertaRemeshingCriteria_werror "werror"
69 #define _IFT_HuertaRemeshingCriteria_refinecoeff "refinecoeff"
70 
71 
73 
74 #define _IFT_HuertaErrorEstimatorInterface_coords "coords"
75 
76 
77 namespace oofem {
78 class Element;
79 class GaussPoint;
80 
96 {
97 public:
102 
103 protected:
105  double globalENorm;
107  double globalWENorm;
109  double globalUNorm;
123  std :: vector< RefinedElement >refinedElementList;
131  bool wError;
132 
133  double lastError;
135 
136 public:
138  HuertaErrorEstimator(int n, Domain * d) : ErrorEstimator(n, d), eNorms(0), primaryUnknownError(0),
139  refinedElementList(), refinedMesh()
140  {
141  eeType = EET_HEE;
142  stateCounter = 0;
143  normType = EnergyNorm;
144  refineLevel = 1;
145  mode = HEE_linear;
146  wError = false;
147  lastError = -1.0;
148  stepsToSkip = skippedSteps = initialSkipSteps = 0;
149  }
150 
152  virtual ~HuertaErrorEstimator() { }
153 
157  int giveRefinementLevel() { return this->refineLevel; }
158 
159  virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep);
160 
161  virtual double giveValue(EE_ValueType type, TimeStep *tStep);
162 
163  virtual int estimateError(EE_ErrorMode err_mode, TimeStep *tStep);
164 
166 
168 
169  virtual const char *giveInputRecordName() const { return NULL; }
170  virtual const char *giveClassName() const { return "HuertaErrorEstimator"; }
171 
173 
174  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
175  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
176 
177 private:
181  void buildRefinedMesh();
182 
190  void solveRefinedElementProblem(int elemId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
191  TimeStep *tStep);
199  void solveRefinedPatchProblem(int nodeId, IntArray &localNodeIdArray,
200  IntArray &globalNodeIdArray, TimeStep *tStep);
207  void solveRefinedWholeProblem(IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep);
216  void extractVectorFrom(Element *element, FloatArray &vector, FloatArray &answer, int dofs, TimeStep *tStep);
217 
218  void setupRefinedProblemProlog(const char *problemName, int problemId, IntArray &localNodeIdArray,
219  int nodes, int elems, int csects, int mats, int loads, int funcs,
220  IntArray &controlNode, IntArray &controlDof, TimeStep *tStep);
221  void setupRefinedProblemEpilog1(int csects, int mats, int loads, int nlbarriers);
222  void setupRefinedProblemEpilog2(int tfuncs);
223 };
224 
225 
231 {
232 public:
234  enum SetupMode { CountMode = 0, NodeMode = 1, ElemMode = 2, BCMode = 3 };
235 
236 public:
239 
240  virtual void HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId,
241  IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
243  int &localNodeId, int &localElemId, int &localBcId,
244  IntArray &controlNode, IntArray &controlDof,
246 
247  virtual void HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer) = 0;
248 
249 protected:
250  void setupRefinedElementProblem1D(Element *element, RefinedElement *refinedElement,
251  int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
253  FloatArray **corner, FloatArray &midNode,
254  int &localNodeId, int &localElemId, int &localBcId,
255  IntArray &controlNode, IntArray &controlDof,
256  HuertaErrorEstimator :: AnalysisMode aMode, const char *edgetype);
257 
258  void setupRefinedElementProblem2D(Element *element, RefinedElement *refinedElement,
259  int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
261  FloatArray **corner, FloatArray *midSide, FloatArray &midNode,
262  int &localNodeId, int &localElemId, int &localBcId,
263  IntArray &controlNode, IntArray &controlDof,
264  HuertaErrorEstimator :: AnalysisMode aMode, const char *quadtype);
265 
266  void setupRefinedElementProblem3D(Element *element, RefinedElement *refinedElement,
267  int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
269  FloatArray **corner, FloatArray *midSide, FloatArray *midFace, FloatArray &midNode,
270  int &localNodeId, int &localElemId, int &localBcId,
271  int hexaSideNode [ 1 ] [ 3 ], int hexaFaceNode [ 1 ] [ 3 ],
272  IntArray &controlNode, IntArray &controlDof,
273  HuertaErrorEstimator :: AnalysisMode aMode, const char *hexatype);
274 };
275 
276 
286 {
287 public:
289  enum HuertaRemeshingCriteriaModeType { primaryUnknownBased };
290 
291 protected:
303  double minElemSize;
305  double refineCoeff;
307  bool noRemesh;
309  bool wError;
310 
311 public:
316 
317  virtual double giveRequiredDofManDensity(int num, TimeStep *tStep, int relative = 0);
318  virtual double giveDofManDensity(int num);
319  virtual RemeshingStrategy giveRemeshingStrategy(TimeStep *tStep);
320  virtual int estimateMeshDensities(TimeStep *tStep);
322 
323  virtual const char *giveInputRecordName() const { return NULL; }
324  virtual const char *giveClassName() const { return "HuertaErrorEstimator"; }
325 };
326 
327 } // end namespace oofem
328 #endif // huertaerrorestimator_h
HuertaRemeshingCriteriaModeType
Mode of receiver, allows to use it in more general situations.
void setupRefinedProblemEpilog1(int csects, int mats, int loads, int nlbarriers)
The base class for all remeshing criteria.
Definition: remeshingcrit.h:61
The class representing Huerta remeshing criteria.
void extractVectorFrom(Element *element, FloatArray &vector, FloatArray &answer, int dofs, TimeStep *tStep)
Extracts nodal vector from global vector for each dof of all element nodes.
RefinedMesh refinedMesh
Mesh refinement.
Class and object Domain.
Definition: domain.h:115
std::vector< RefinedElement > refinedElementList
Fine mesh.
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
void solveRefinedWholeProblem(IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined whole problem.
virtual int estimateError(EE_ErrorMode err_mode, TimeStep *tStep)
Estimates the error on associated domain at given time step.
HuertaRemeshingCriteriaModeType mode
Mode of receiver.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
double globalWENorm
Global weighted error norm.
long StateCounterType
StateCounterType type used to indicate solution state.
double globalErrorEstimate
Global error estimate (relative)
virtual const char * giveInputRecordName() const
StateCounterType stateCounter
Actual values (densities) state counter.
Abstract base class for all finite elements.
Definition: element.h:145
EE_ErrorType
Type characterizing different type of element errors.
virtual const char * giveClassName() const
virtual ~HuertaRemeshingCriteria()
Destructor.
Class implementing an array of integers.
Definition: intarray.h:61
void solveRefinedPatchProblem(int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined patch problem.
double requiredError
Required error to obtain.
StateCounterType stateCounter
Actual state counter.
NormType normType
Type of norm used.
int giveRefinementLevel()
Returns refinement level.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
bool wError
Weighted error flag.
The element interface corresponding to HuertaErrorEstimator.
bool wError
Weighted error flag.
virtual RemeshingCriteria * giveRemeshingCrit()
Returns reference to associated remeshing criteria.
AnalysisMode mode
Linear analysis flag.
virtual const char * giveClassName() const
void solveRefinedElementProblem(int elemId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined element problem.
void setupRefinedProblemEpilog2(int tfuncs)
void setupRefinedProblemProlog(const char *problemName, int problemId, IntArray &localNodeIdArray, int nodes, int elems, int csects, int mats, int loads, int funcs, IntArray &controlNode, IntArray &controlDof, TimeStep *tStep)
FloatArray nodalDensities
Array of nodal mesh densities.
double globalENorm
Global error norm.
FloatArray primaryUnknownError
Primary unknown nodal error.
The base class for all error estimation or error indicator algorithms.
virtual const char * giveInputRecordName() const
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual double giveValue(EE_ValueType type, TimeStep *tStep)
Returns the characteristic value of given type.
RemeshingStrategy
Type representing the remeshing strategy.
Definition: remeshingcrit.h:50
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void buildRefinedMesh()
Builds refined mesh.
EE_ErrorMode
Type determining whether temporary or equilibrated variables are used for error evaluation.
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
ErrorEstimatorType eeType
FloatArray eNorms
Cache storing element norms.
double minElemSize
Minimum element size alloved.
HuertaErrorEstimator(int n, Domain *d)
Constructor.
Class representing the general Input Record.
Definition: inputrecord.h:101
double refineCoeff
Refinement coefficient.
Class Interface.
Definition: interface.h:82
virtual ~HuertaErrorEstimator()
Destructor.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
EE_ValueType
Type characterizing different type of errors.
double requiredError
Required error to obtain.
the oofem namespace is to define a context or scope in which all oofem names are defined.
RemeshingStrategy remeshingStrategy
Remeshing strategy proposed.
The implementation of Zienkiewicz Zhu Error Estimator.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
double globalUNorm
Global norm of primary unknown.
int refineLevel
Refinement level.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011