OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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
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
43namespace oofem {
44#define CZZSI_ZERO_INDICATOR_TOL 1.e-3
45
47
48void
49CombinedZZSIErrorEstimator :: setDomain(Domain *d)
50{
51 FEMComponent :: setDomain(d);
52 zzee.setDomain(d);
53 siee.setDomain(d);
54 this->giveRemeshingCrit()->setDomain(d);
55}
56
57
58int
59CombinedZZSIErrorEstimator :: estimateError(EE_ErrorMode mode, TimeStep *tStep)
60{
61 int result = zzee.estimateError(mode, tStep);
62 result += siee.estimateError(mode, tStep);
63 return result;
64}
65
66double
67CombinedZZSIErrorEstimator :: giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
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
77double
78CombinedZZSIErrorEstimator :: giveValue(EE_ValueType type, TimeStep *tStep)
79{
80 return zzee.giveValue(type, tStep);
81}
82
84CombinedZZSIErrorEstimator :: giveRemeshingCrit()
85{
86 if ( !this->rc ) {
87 this->rc = std::make_unique<CombinedZZSIRemeshingCriteria>(1, this);
88 }
89
90 return this->rc.get();
91}
92
93void
94CombinedZZSIErrorEstimator :: initializeFrom(InputRecord &ir)
95{
96 zzee.initializeFrom(ir);
97 siee.initializeFrom(ir);
98
99 return this->giveRemeshingCrit()->initializeFrom(ir);
100}
101
102
103
104
105CombinedZZSIRemeshingCriteria :: CombinedZZSIRemeshingCriteria(int n, ErrorEstimator *e) : RemeshingCriteria(n, e),
106 zzrc(n, e), dirc(n, e)
107{ }
108
109double
110CombinedZZSIRemeshingCriteria :: giveRequiredDofManDensity(int num, TimeStep *tStep, int relative)
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
137CombinedZZSIRemeshingCriteria :: giveRemeshingStrategy(TimeStep *tStep)
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;
148 } else if ( ( s1 == RemeshingFromCurrentState_RS ) || ( s2 == RemeshingFromCurrentState_RS ) ) {
150 } else {
151 return NoRemeshing_RS;
152 }
153}
154
155int
156CombinedZZSIRemeshingCriteria :: estimateMeshDensities(TimeStep *tStep)
157{
158 zzrc.estimateMeshDensities(tStep);
159 dirc.estimateMeshDensities(tStep);
160 return 1;
161}
162
163void
164CombinedZZSIRemeshingCriteria :: initializeFrom(InputRecord &ir)
165{
166 zzrc.initializeFrom(ir);
167 dirc.initializeFrom(ir);
168}
169
170
171double
172CombinedZZSIRemeshingCriteria :: giveDofManDensity(int num)
173{
174 int isize;
175 ConnectivityTable *ct = domain->giveConnectivityTable();
176 const IntArray *con;
177 double density = 0.0;
178
179 con = ct->giveDofManConnectivityArray(num);
180 isize = con->giveSize();
181
182 for ( int i = 1; i <= isize; i++ ) {
183 Element *element = domain->giveElement( con->at(i) );
184
185 if ( i == 1 ) {
186 density = element->computeMeanSize();
187 } else {
188 density = min( density, element->computeMeanSize() );
189 }
190 }
191
192 return density;
193}
194
195
196void
197CombinedZZSIRemeshingCriteria :: setDomain(Domain *d)
198{
199 FEMComponent :: setDomain(d);
200 zzrc.setDomain(d);
201 dirc.setDomain(d);
202}
203} // end namespace oofem
#define REGISTER_ErrorEstimator(class, type)
int estimateError(EE_ErrorMode mode, TimeStep *tStep) override
RemeshingCriteria * giveRemeshingCrit() override
int estimateMeshDensities(TimeStep *tStep) override
const IntArray * giveDofManConnectivityArray(int dofman)
double computeMeanSize()
Definition element.C:1100
std ::unique_ptr< RemeshingCriteria > rc
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
RemeshingCriteria(int n, ErrorEstimator *e)
Constructor.
#define CZZSI_ZERO_INDICATOR_TOL
FloatArrayF< N > min(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
@ equilibratedEM
FloatArrayF< N > max(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
RemeshingStrategy
Type representing the remeshing strategy.
@ RemeshingFromPreviousState_RS
@ RemeshingFromCurrentState_RS
@ NoRemeshing_RS
@ EET_CZZSI
Combined ZZ and ScalarIndicator EE.

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011