OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
combinedzzsiee.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/combinedzzsiee.h"
36 #include "domain.h"
37 #include "element.h"
38 #include "connectivitytable.h"
39 #include "mathfem.h"
40 #include "errorestimatortype.h"
41 #include "classfactory.h"
42 
43 namespace oofem {
44 #define CZZSI_ZERO_INDICATOR_TOL 1.e-3
45 
46 REGISTER_ErrorEstimator(CombinedZZSIErrorEstimator, EET_CZZSI);
47 
48 void
50 {
52  zzee.setDomain(d);
53  siee.setDomain(d);
54  this->giveRemeshingCrit()->setDomain(d);
55 }
56 
57 
58 int
60 {
61  int result = zzee.estimateError(mode, tStep);
62  result += siee.estimateError(mode, tStep);
63  return result;
64 }
65 
66 double
68 {
69  this->estimateError(equilibratedEM, tStep);
70  if ( type == indicatorET ) {
71  return siee.giveElementError(type, elem, tStep);
72  } else {
73  return zzee.giveElementError(type, elem, tStep);
74  }
75 }
76 
77 double
79 {
80  return zzee.giveValue(type, tStep);
81 }
82 
85 {
86  if ( !this->rc ) {
87  this->rc.reset( new CombinedZZSIRemeshingCriteria(1, this) );
88  }
89 
90  return this->rc.get();
91 }
92 
95 {
96  zzee.initializeFrom(ir);
97  siee.initializeFrom(ir);
98 
99  return this->giveRemeshingCrit()->initializeFrom(ir);
100 }
101 
102 
103 
104 
106  zzrc(n, e), dirc(n, e)
107 { }
108 
109 double
111 {
112  double indicatorVal, currDensity;
113  double proposedDensity;
114  this->estimateMeshDensities(tStep);
115 
116  dirc.giveNodeChar(num, tStep, indicatorVal, currDensity);
117  if ( indicatorVal > dirc.giveMinIndicatorLimit() ) {
118  return dirc.giveRequiredDofManDensity(num, tStep, relative);
119  } else if ( fabs(indicatorVal) > CZZSI_ZERO_INDICATOR_TOL ) {
120  //return zzrc.giveRequiredDofManDensity (num, tStep, relative);
121  // transition between dirc and zzrc
122  proposedDensity = zzrc.giveRequiredDofManDensity(num, tStep, relative);
123  proposedDensity = min(proposedDensity, currDensity);
124  proposedDensity = max( proposedDensity, dirc.giveMinIndicatorDensity() );
125  if ( relative ) {
126  return proposedDensity / currDensity;
127  } else {
128  return proposedDensity;
129  }
130  } else {
131  return zzrc.giveRequiredDofManDensity(num, tStep, relative);
132  }
133 }
134 
135 
138 {
139  RemeshingStrategy s1, s2;
140  this->estimateMeshDensities(tStep);
141 
142  s1 = zzrc.giveRemeshingStrategy(tStep);
143  s2 = dirc.giveRemeshingStrategy(tStep);
144 
145  //if ((s1 == RemeshingFromPreviousState_RS) || (s2 == RemeshingFromPreviousState_RS)) return RemeshingFromPreviousState_RS;
146  if ( ( s1 == RemeshingFromPreviousState_RS ) || ( s2 == RemeshingFromPreviousState_RS ) ) {
148  } else if ( ( s1 == RemeshingFromCurrentState_RS ) || ( s2 == RemeshingFromCurrentState_RS ) ) {
150  } else {
151  return NoRemeshing_RS;
152  }
153 }
154 
155 int
157 {
160  return 1;
161 }
162 
165 {
166  IRResultType result = zzrc.initializeFrom(ir);
167  if ( result != IRRT_OK ) {
168  return result;
169  }
170  return dirc.initializeFrom(ir);
171 }
172 
173 
174 double
176 {
177  int isize;
179  const IntArray *con;
180  double density = 0.0;
181 
182  con = ct->giveDofManConnectivityArray(num);
183  isize = con->giveSize();
184 
185  for ( int i = 1; i <= isize; i++ ) {
186  Element *element = domain->giveElement( con->at(i) );
187 
188  if ( i == 1 ) {
189  density = element->computeMeanSize();
190  } else {
191  density = min( density, element->computeMeanSize() );
192  }
193  }
194 
195  return density;
196 }
197 
198 
199 void
201 {
203  zzrc.setDomain(d);
204  dirc.setDomain(d);
205 }
206 } // end namespace oofem
void setDomain(Domain *d)
Sets Domain; should also re-initialize attributes if necessary.
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.
virtual int estimateError(EE_ErrorMode mode, TimeStep *tStep)
Estimates the error on associated domain at given time step.
Class and object Domain.
Definition: domain.h:115
CombinedZZSIRemeshingCriteria(int n, ErrorEstimator *e)
Constructor.
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
double computeMeanSize()
Computes the size of the element defined as its length.
Definition: element.C:1078
virtual double giveRequiredDofManDensity(int num, TimeStep *tStep, int relative=0)
Returns the required mesh size n given dof manager.
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 void setDomain(Domain *d)
Sets Domain; should also re-initialize attributes if necessary.
virtual int estimateMeshDensities(TimeStep *tStep)
Estimates the nodal densities.
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
ConnectivityTable * giveConnectivityTable()
Returns receiver&#39;s associated connectivity table.
Definition: domain.C:1170
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Abstract base class for all finite elements.
Definition: element.h:145
virtual double giveDofManDensity(int num)
Returns existing mesh size for given dof manager.
EE_ErrorType
Type characterizing different type of element errors.
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
#define CZZSI_ZERO_INDICATOR_TOL
The class represent the corresponding remeshing criteria to CombinedZZSIErrorEstimator.
virtual RemeshingStrategy giveRemeshingStrategy(TimeStep *tStep)
Determines, if the remeshing is needed, and if needed, the type of strategy used. ...
virtual int estimateMeshDensities(TimeStep *tStep)
Estimates the nodal densities.
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
virtual double giveValue(EE_ValueType type, TimeStep *tStep)
Returns the characteristic value of given type.
virtual RemeshingStrategy giveRemeshingStrategy(TimeStep *tStep)
Determines, if the remeshing is needed, and if needed, the type of strategy used. ...
virtual RemeshingStrategy giveRemeshingStrategy(TimeStep *tStep)
Determines, if the remeshing is needed, and if needed, the type of strategy used. ...
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
virtual void setDomain(Domain *d)
Sets associated Domain.
virtual double giveRequiredDofManDensity(int num, TimeStep *tStep, int relative=0)
Returns the required mesh size n given dof manager.
virtual void setDomain(Domain *d)
Sets associated Domain.
Class representing connectivity table.
virtual double giveValue(EE_ValueType type, TimeStep *tStep)
Returns the characteristic value of given type.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: femcmpnn.C:89
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
The base class for all error estimation or error indicator algorithms.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
RemeshingStrategy
Type representing the remeshing strategy.
Definition: remeshingcrit.h:50
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
const IntArray * giveDofManConnectivityArray(int dofman)
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
virtual int estimateMeshDensities(TimeStep *tStep)
Estimates the nodal densities.
Combined ZZ and ScalarIndicator EE.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int estimateError(EE_ErrorMode mode, TimeStep *tStep)
Estimates the error on associated domain at given time step.
double giveMinIndicatorLimit()
Returns the minimum indicator limit.
virtual RemeshingCriteria * giveRemeshingCrit()
Returns reference to associated remeshing criteria.
void giveNodeChar(int inode, TimeStep *tStep, double &indicatorVal, double &currDensity)
EE_ValueType
Type characterizing different type of errors.
virtual double giveRequiredDofManDensity(int num, TimeStep *tStep, int relative=0)
Returns the required mesh size n given dof manager.
int min(int i, int j)
Returns smaller value from two given decimals.
Definition: mathfem.h:59
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void setDomain(Domain *d)
Sets associated Domain.
Definition: femcmpnn.h:105
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:27 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011