OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
supg.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 supg_h
36 #define supg_h
37 
38 #include "fluidmodel.h"
39 #include "sparsemtrxtype.h"
40 #include "sparselinsystemnm.h"
41 #include "primaryfield.h"
42 #include "materialinterface.h"
43 #include "assemblercallback.h"
44 
45 #include <memory>
46 
48 
49 #define _IFT_SUPG_Name "supg"
50 #define _IFT_SUPG_deltat "deltat"
51 #define _IFT_SUPG_deltatFunction "deltatltf"
52 #define _IFT_SUPG_cmflag "cmflag"
53 #define _IFT_SUPG_alpha "alpha"
54 #define _IFT_SUPG_scaleflag "scaleflag"
55 #define _IFT_SUPG_lscale "lscale"
56 #define _IFT_SUPG_uscale "uscale"
57 #define _IFT_SUPG_dscale "dscale"
58 #define _IFT_SUPG_miflag "miflag"
59 #define _IFT_SUPG_rtolv "rtolv"
60 #define _IFT_SUPG_atolv "atolv"
61 #define _IFT_SUPG_maxiter "maxiter"
62 #define _IFT_SUPG_stopmaxiter "stopmaxiter"
63 #define _IFT_SUPG_fsflag "fsflag"
64 
65 
66 namespace oofem {
67 class SparseMtrx;
68 class SparseNonLinearSystemNM;
69 
75 {
76 protected:
77  double lscale, dscale, uscale;
78 
79 public:
80  SUPGInternalForceAssembler(double l, double d, double u);
81  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
82 };
83 
89 {
90 protected:
92  double lscale, dscale, uscale;
93  double alpha;
94 
95 public:
96  SUPGTangentAssembler(MatResponseMode m, double l, double d, double u, double a);
97  virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const;
98 };
99 
104 class SUPG : public FluidModel
105 {
106 protected:
108  std :: unique_ptr< SparseLinearSystemNM >nMethod;
109 
112 
113  std :: unique_ptr< SparseMtrx > lhs;
114  std :: unique_ptr< PrimaryField > VelocityPressureField;
115  //PrimaryField VelocityField;
116  FloatArray accelerationVector; //, previousAccelerationVector;
118 
121 
123  double deltaT;
124  int deltaTF;
126  double atolv, rtolv;
128  int maxiter;
135  double alpha;
136 
137  int initFlag;
139 
141  // length, velocity, and density scales
142  double lscale, uscale, dscale;
144  double Re;
145 
146  // material interface representation for multicomponent flows
147  std :: unique_ptr< MaterialInterface > materialInterface;
148  // map of active dofmans for problems with free surface and only one fluid considered
149  // IntArray __DofManActivityMask;
150  // free surface flag -> we solve free surface problem by single reference fluid
151  // int fsflag;
152 
153 public:
154  SUPG(int i, EngngModel * _master = NULL);
155  virtual ~SUPG();
156 
157  virtual void solveYourselfAt(TimeStep *tStep);
158  virtual void updateYourself(TimeStep *tStep);
159 
160  virtual double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof);
161  virtual void updateComponent(TimeStep *tStep, NumericalCmpn cmpn, Domain *d);
162  virtual double giveReynoldsNumber();
163 
164  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode);
165  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode);
166 
167  virtual void updateDomainLinks();
168 
169  virtual TimeStep *giveNextStep();
170  virtual TimeStep *giveSolutionStepWhenIcApply(bool force = false);
171  virtual NumericalMethod *giveNumericalMethod(MetaStep *mStep);
172 
173  virtual IRResultType initializeFrom(InputRecord *ir);
174 
175  virtual int checkConsistency();
176  // identification
177  virtual const char *giveClassName() const { return "SUPG"; }
178  virtual const char *giveInputRecordName() const { return _IFT_SUPG_Name; }
179 
180  virtual fMode giveFormulation() { return TL; }
181 
182  virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep);
183 
184  virtual int requiresUnknownsDictionaryUpdate() { return renumberFlag; }
185 
186  virtual bool giveEquationScalingFlag() { return equationScalingFlag; }
187  virtual double giveVariableScale(VarScaleType varId);
188 
189  virtual void updateDofUnknownsDictionary(DofManager *dman, TimeStep *tStep);
190  virtual int giveUnknownDictHashIndx(ValueModeType mode, TimeStep *tStep);
191 
192  virtual MaterialInterface *giveMaterialInterface(int n) { return materialInterface.get(); }
193 
194 
195 protected:
196  void updateInternalState(TimeStep *tStep);
197  void applyIC(TimeStep *tStep);
198  void evaluateElementStabilizationCoeffs(TimeStep *tStep);
199  void updateElementsForNewInterfacePosition(TimeStep *tStep);
200 
201  void updateDofUnknownsDictionary_predictor(TimeStep *tStep);
202  void updateDofUnknownsDictionary_corrector(TimeStep *tStep);
203 
204  void updateSolutionVectors(FloatArray &solutionVector, FloatArray &accelerationVector, FloatArray &incrementalSolutionVector, TimeStep *tStep);
205  void updateSolutionVectors_predictor(FloatArray &solutionVector, FloatArray &accelerationVector, TimeStep *tStep);
206 
207  //void initDofManActivityMap ();
208  //void updateDofManActivityMap (TimeStep* tStep);
209  void updateDofManVals(TimeStep *tStep);
210  //void imposeAmbientPressureInOuterNodes(SparseMtrx* lhs, FloatArray* rhs, TimeStep* tStep);
211  //void __debug(TimeStep* tStep);
212 };
213 } // end namespace oofem
214 #endif // supg_h
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
Class and object Domain.
Definition: domain.h:115
virtual MaterialInterface * giveMaterialInterface(int n)
Returns material interface representation for given domain.
Definition: supg.h:192
SparseMtrxType sparseMtrxType
Definition: supg.h:111
LinSystSolverType solverType
Definition: supg.h:110
Class representing meta step.
Definition: metastep.h:62
Total Lagrange.
Definition: fmode.h:44
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
FloatArray internalForces
Definition: supg.h:119
std::unique_ptr< SparseMtrx > lhs
Definition: supg.h:113
virtual int requiresUnknownsDictionaryUpdate()
Indicates if EngngModel requires Dofs dictionaries to be updated.
Definition: supg.h:184
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
VarScaleType
Type determining the scale corresponding to particular variable.
Definition: varscaletype.h:40
virtual const char * giveInputRecordName() const
Definition: supg.h:178
int consistentMassFlag
Definition: supg.h:138
Base class for fluid problems.
Definition: fluidmodel.h:46
std::unique_ptr< SparseLinearSystemNM > nMethod
Numerical method used to solve the problem.
Definition: supg.h:108
This base class is an abstraction for numerical algorithm.
Definition: nummet.h:80
bool equationScalingFlag
Definition: supg.h:140
#define _IFT_SUPG_Name
Definition: supg.h:49
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
MatResponseMode
Describes the character of characteristic material matrix.
int maxiter
Max number of iterations.
Definition: supg.h:128
FloatArray eNorm
Definition: supg.h:120
Callback class for assembling specific types of vectors.
double uscale
Definition: supg.h:142
double Re
Reynolds number.
Definition: supg.h:144
NumericalCmpn
Type representing numerical component.
Definition: numericalcmpn.h:46
std::unique_ptr< PrimaryField > VelocityPressureField
Definition: supg.h:114
Callback class for assembling specific types of matrices.
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
Abstract base class representing (moving) material interfaces.
double rtolv
Definition: supg.h:126
bool stopmaxiter
Flag if set to true (default), then when max number of iteration reached, computation stops otherwise...
Definition: supg.h:133
virtual fMode giveFormulation()
Indicates type of non linear computation (total or updated formulation).
Definition: supg.h:180
MatResponseMode rmode
Definition: supg.h:91
This class represents transient incompressible flow problem.
Definition: supg.h:104
FloatArray accelerationVector
Definition: supg.h:116
Callback class for assembling SUPG tangent matrices.
Definition: supg.h:88
virtual const char * giveClassName() const
Returns class name of the receiver.
Definition: supg.h:177
Callback class for assembling SUPG internal forces.
Definition: supg.h:74
int deltaTF
Definition: supg.h:124
Class representing vector of real numbers.
Definition: floatarray.h:82
std::unique_ptr< MaterialInterface > materialInterface
Definition: supg.h:147
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: supg.C:68
Class representing the general Input Record.
Definition: inputrecord.h:101
fMode
Type representing the type of formulation (total or updated) of non-linear computation.
Definition: fmode.h:42
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
int initFlag
Definition: supg.h:137
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
the oofem namespace is to define a context or scope in which all oofem names are defined.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
double alpha
Integration constant.
Definition: supg.h:135
Class representing solution step.
Definition: timestep.h:80
virtual bool giveEquationScalingFlag()
Returns the Equation scaling flag, which is used to indicate that governing equation(s) are scaled...
Definition: supg.h:186
double deltaT
Definition: supg.h:123
SUPGInternalForceAssembler(double l, double d, double u)
Definition: supg.C:64
FloatArray incrementalSolutionVector
Definition: supg.h:117

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