OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
scalarerrorindicator.C
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 #include "../sm/ErrorEstimators/scalarerrorindicator.h"
36 #include "../sm/ErrorEstimators/directerrorindicatorrc.h"
37 #include "element.h"
38 #include "integrationrule.h"
39 #include "gausspoint.h"
40 #include "mathfem.h"
41 #include "errorestimatortype.h"
42 #include "classfactory.h"
43 
44 namespace oofem {
45 REGISTER_ErrorEstimator(ScalarErrorIndicator, EET_SEI);
46 
47 int
49 {
50  if ( indicatorType == 1 ) {
51  if ( mode == equilibratedEM ) {
52  varType = IST_PrincipalDamageTensor;
53  } else {
54  varType = IST_PrincipalDamageTempTensor;
55  }
56  }
57 
58  return 1;
59 }
60 
61 double
63 {
64  FloatArray val;
65  int result = 1;
66  double sval, maxVal = 0.0;
67 
68  if ( type != indicatorET ) {
69  return 0.0;
70  }
71 
72  if ( this->skipRegion( elem->giveRegionNumber() ) ) {
73  return 0.0;
74  }
75 
76  for ( GaussPoint *gp: *elem->giveDefaultIntegrationRulePtr() ) {
77  result = elem->giveIPValue(val, gp, varType, tStep);
78  if ( result ) {
79  sval = val.computeNorm();
80  if ( gp->giveNumber() == 1 ) {
81  maxVal = sval;
82  } else {
83  maxVal = max(maxVal, sval);
84  }
85  }
86  }
87 
88  return maxVal;
89 }
90 
91 
94 {
95  IRResultType result; // Required by IR_GIVE_FIELD macro
96 
98 
100  if ( indicatorType != 1 ) {
101  OOFEM_ERROR("usupported varType");
102  }
103 
104  return this->giveRemeshingCrit()->initializeFrom(ir);
105 }
106 
109 {
110  if ( !this->rc ) {
111  this->rc.reset( new DirectErrorIndicatorRC(1, this) );
112  }
113 
114  return this->rc.get();
115 }
116 } // end namespace oofem
The base class for all remeshing criteria.
Definition: remeshingcrit.h:61
virtual int estimateError(EE_ErrorMode mode, TimeStep *tStep)
Estimates the error on associated domain at given time step.
int giveRegionNumber()
Definition: element.C:507
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
Definition: element.C:1257
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
virtual RemeshingCriteria * giveRemeshingCrit()
Returns reference to associated remeshing criteria.
REGISTER_ErrorEstimator(CombinedZZSIErrorEstimator, EET_CZZSI)
std::unique_ptr< RemeshingCriteria > rc
int max(int i, int j)
Returns bigger value form two given decimals.
Definition: mathfem.h:71
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
#define _IFT_ScalarErrorIndicator_vartype
Abstract base class for all finite elements.
Definition: element.h:145
EE_ErrorType
Type characterizing different type of element errors.
The class is an implementation of "direct" remeshing criteria, which maps the error indication...
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
InternalStateType varType
Corresponding internal state type.
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: femcmpnn.C:89
Scalar Error Indicator.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Class representing vector of real numbers.
Definition: floatarray.h:82
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
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
bool skipRegion(int reg)
Returns nonzero if region has been skipped in error estimation (user option).
Class representing the general Input Record.
Definition: inputrecord.h:101
int indicatorType
Type of internal variable to be indicator (type for temp and nontemp version).
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80

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:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011