OOFEM 3.0
Loading...
Searching...
No Matches
adaptlinearstatic.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 "remeshingcrit.h"
37#include "mesherinterface.h"
38#include "errorestimator.h"
39#include "domain.h"
40#include "classfactory.h"
41#include "contextioerr.h"
42#include "outputmanager.h"
43
44namespace oofem {
46
47void
48AdaptiveLinearStatic :: updateYourself(TimeStep *tStep)
49{
50 LinearStatic :: updateYourself(tStep);
51 // perform error evaluation
52 // evaluate error of the reached solution
53 this->defaultErrEstimator->estimateError(temporaryEM, tStep);
54 // this->defaultErrEstimator->estimateError (equilibratedEM, this->giveCurrentStep());
55 RemeshingStrategy strategy = this->defaultErrEstimator->giveRemeshingCrit()->giveRemeshingStrategy(tStep);
56
57 if ( strategy == NoRemeshing_RS ) {
58 return;
59 } else {
60 // do remeshing
61 std :: unique_ptr< MesherInterface >mesher( classFactory.createMesherInterface( meshPackage, this->giveDomain(1) ) );
62 Domain *newDomain;
63
64 MesherInterface :: returnCode result =
65 mesher->createMesh(tStep, 1, this->giveDomain(1)->giveSerialNumber() + 1, & newDomain);
66
67 if ( result == MesherInterface :: MI_OK ) { } else if ( result == MesherInterface :: MI_NEEDS_EXTERNAL_ACTION ) {
68 // terminate step
69 //this->terminate( tStep );
70 //this->terminateAnalysis();
71 //exit(1);
72 } else {
73 OOFEM_ERROR("createMesh failed");
74 }
75 }
76}
77
78
79void
80AdaptiveLinearStatic :: printOutputAt(FILE *file, TimeStep *tStep)
81{
82 if ( !this->giveDomain(1)->giveOutputManager()->testTimeStepOutput(tStep) ) {
83 return;
84 }
85
86 LinearStatic :: printOutputAt(file, tStep);
87 fprintf(file, "\nRelative error estimate: %5.2f%%\n", this->defaultErrEstimator->giveValue(relativeErrorEstimateEEV, tStep) * 100.0);
88}
89
90
91int
92AdaptiveLinearStatic :: initializeAdaptive(int tStepNumber)
93{
94 /*
95 * Due to linear character of the problem,
96 * the whole analysis is restarted from beginning.
97 * The solution steps represent the adaptive steps and for each adaptive step
98 * new domain with corresponding domainSerNum is generated.
99 */
100 int result = 1;
101 /*
102 * this -> initStepIncrements();
103 *
104 * int sernum = tStepNumber + 1;
105 * printf ("\nrestoring domain %d.%d\n", 1, sernum);
106 * Domain* dNew = new Domain (1, sernum, this);
107 * FILE* domainInputFile;
108 * this->giveDomainFile (&domainInputFile, 1, sernum, contextMode_read);
109 * if (!dNew -> instanciateYourself(domainInputFile)) OOFEM_ERROR("domain Instanciation failed");
110 * fclose (domainInputFile);
111 *
112 * printf ("\ndeleting old domain\n");
113 * delete domainList->at(1);
114 * domainList->put(1, dNew);
115 *
116 * // init equation numbering
117 * this->forceEquationNumbering();
118 *
119 * // set time step
120 * this->giveCurrentStep()->setTime(tStepNumber+1);
121 *
122 * // init equation numbering
123 * // this->forceEquationNumbering();
124 * this->giveNumericalMethod(giveCurrentStep())->setDomain (dNew);
125 * this->ee->setDomain (dNew);
126 */
127 return result;
128}
129
130
131void AdaptiveLinearStatic :: restoreContext(DataStream &stream, ContextMode mode)
132{
133 LinearStatic :: restoreContext(stream, mode);
134}
135
136void
137AdaptiveLinearStatic :: initializeFrom(InputRecord &ir)
138{
139 LinearStatic :: initializeFrom(ir);
140
141 int meshPackageId = 0;
143
144 if ( meshPackageId == 1 ) {
145 meshPackage = MPT_TARGE2;
146 } else if ( meshPackageId == 2 ) {
147 meshPackage = MPT_FREEM;
148 } else {
149 meshPackage = MPT_T3D;
150 }
151}
152
153
154void
155AdaptiveLinearStatic :: updateDomainLinks()
156{
157 LinearStatic :: updateDomainLinks();
158 // associate ee to possibly newly restored mesh
159 this->defaultErrEstimator->setDomain( this->giveDomain(1) );
160}
161} // end namespace oofem
#define _IFT_AdaptiveLinearStatic_meshpackage
#define REGISTER_EngngModel(class)
MeshPackageType meshPackage
Meshing package used for refinements.
Domain * giveDomain(int n)
Definition engngm.C:1936
std::unique_ptr< ErrorEstimator > defaultErrEstimator
Error estimator. Useful for adaptivity, or simply printing errors output.
Definition engngm.h:285
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
long ContextMode
Definition contextmode.h:43
RemeshingStrategy
Type representing the remeshing strategy.
@ NoRemeshing_RS
ClassFactory & classFactory
@ relativeErrorEstimateEEV

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