OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
cbs.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 cbs_h
36 #define cbs_h
37 
38 #include "fluidmodel.h"
39 #include "sparselinsystemnm.h"
40 #include "sparsemtrx.h"
41 #include "primaryfield.h"
42 //<RESTRICTED_SECTION>
43 #include "materialinterface.h"
44 //</RESTRICTED_SECTION>
45 
46 #include "unknownnumberingscheme.h"
47 
49 
50 #define _IFT_CBS_Name "cbs"
51 #define _IFT_CBS_deltat "deltat"
52 #define _IFT_CBS_mindeltat "mindeltat"
53 #define _IFT_CBS_cmflag "cmflag"
54 #define _IFT_CBS_theta1 "theta1"
55 #define _IFT_CBS_theta2 "theta2"
56 #define _IFT_CBS_scaleflag "scaleflag"
57 #define _IFT_CBS_lscale "lscale"
58 #define _IFT_CBS_uscale "uscale"
59 #define _IFT_CBS_dscale "dscale"
60 #define _IFT_CBS_miflag "miflag"
61 
62 
63 namespace oofem {
64 
67 {
68 public:
69  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
70 };
71 
74 {
75 public:
76  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
77 };
78 
81 {
82 public:
83  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
84 };
85 
88 {
89 public:
90  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
91 };
92 
95 {
96 public:
97  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
98 };
99 
102 {
103 public:
104  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
105 };
106 
109 {
110 public:
111  virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const;
112  virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const;
113 };
114 
115 
120 {
121 protected:
123  int numEqs;
124 
125 public:
126  VelocityEquationNumbering(bool prescribed) : UnknownNumberingScheme(), prescribed(prescribed), numEqs(0) { }
127 
128  virtual bool isDefault() const { return !prescribed; }
129  virtual int giveDofEquationNumber(Dof *dof) const {
130  DofIDItem id = dof->giveDofID();
131  if ( id == V_u || id == V_v || id == V_w ) {
132  return prescribed ? dof->__givePrescribedEquationNumber() : dof->__giveEquationNumber();
133  }
134 
135  return 0;
136  }
137  virtual int giveRequiredNumberOfDomainEquation() const { return numEqs; }
138 
139  int askNewEquationNumber() { return ++numEqs; }
140 };
141 
146 {
147 protected:
149  int numEqs;
150 
151 public:
152  PressureEquationNumbering(bool prescribed) : UnknownNumberingScheme(), prescribed(prescribed), numEqs(0) { }
153 
154  virtual bool isDefault() const { return !prescribed; }
155  virtual int giveDofEquationNumber(Dof *dof) const {
156  DofIDItem id = dof->giveDofID();
157  if ( id == P_f ) {
158  return prescribed ? dof->__givePrescribedEquationNumber() : dof->__giveEquationNumber();
159  }
160 
161  return 0;
162  }
163  virtual int giveRequiredNumberOfDomainEquation() const { return numEqs; }
164 
165  int askNewEquationNumber() { return ++numEqs; }
166 };
167 
171 class CBS : public FluidModel
172 {
173 protected:
175  std :: unique_ptr< SparseLinearSystemNM > nMethod;
176 
179 
180  std :: unique_ptr< SparseMtrx > lhs;
188 
192  std :: unique_ptr< SparseMtrx > mss;
193 
195  double deltaT, minDeltaT;
197  double theta1, theta2;
198 
199  int initFlag;
202 
207 
210  double lscale;
212  double uscale;
214  double dscale;
216  double Re;
217 
218  //<RESTRICTED_SECTION>
219  // material interface representation for multicomponent flows
220  std :: unique_ptr< MaterialInterface > materialInterface;
221  //</RESTRICTED_SECTION>
222 public:
223  CBS(int i, EngngModel * _master = NULL);
224  virtual ~CBS();
225 
226  virtual void solveYourselfAt(TimeStep *tStep);
227 
228  virtual void updateYourself(TimeStep *tStep);
229 
230  virtual double giveUnknownComponent(ValueModeType type, TimeStep *tStep, Domain *d, Dof *dof);
231  virtual double giveReynoldsNumber();
232  double giveTheta1();
233  double giveTheta2();
234  double giveTractionPressure(Dof *dof);
235 
236  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode);
237  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode);
238 
239  virtual void updateDomainLinks();
240 
241  virtual TimeStep *giveNextStep();
242  virtual TimeStep *giveSolutionStepWhenIcApply(bool force = false);
243  virtual NumericalMethod *giveNumericalMethod(MetaStep *mStep);
244 
245  virtual IRResultType initializeFrom(InputRecord *ir);
246 
247  virtual int checkConsistency();
248  // identification
249  virtual const char *giveClassName() const { return "CBS"; }
250  virtual const char *giveInputRecordName() const { return _IFT_CBS_Name; }
251  virtual fMode giveFormulation() { return TL; }
252 
253  virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep);
254 
255  virtual int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num);
256 
257  virtual int giveNewEquationNumber(int domain, DofIDItem);
258  virtual int giveNewPrescribedEquationNumber(int domain, DofIDItem);
259 
260  virtual bool giveEquationScalingFlag() { return equationScalingFlag; }
261  virtual double giveVariableScale(VarScaleType varId);
262 
263 protected:
270  void updateInternalState(TimeStep *tStep);
271  void applyIC(TimeStep *tStep);
272 };
273 } // end namespace oofem
274 #endif // cbs_h
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
FloatArray prescribedTractionPressure
Definition: cbs.h:186
VelocityEquationNumbering vnum
Definition: cbs.h:203
Class and object Domain.
Definition: domain.h:115
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:87
double theta2
Definition: cbs.h:197
std::unique_ptr< MaterialInterface > materialInterface
Definition: cbs.h:220
Class representing meta step.
Definition: metastep.h:62
Total Lagrange.
Definition: fmode.h:44
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:80
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
PressureEquationNumbering(bool prescribed)
Definition: cbs.h:152
VelocityEquationNumbering vnumPrescribed
Definition: cbs.h:204
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual bool isDefault() const
Returns true, if receiver is the default engngModel equation numbering scheme; This is useful for som...
Definition: cbs.h:128
PrimaryField VelocityField
Velocity field.
Definition: cbs.h:184
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
Definition: cbs.h:163
VarScaleType
Type determining the scale corresponding to particular variable.
Definition: varscaletype.h:40
Base class for fluid problems.
Definition: fluidmodel.h:46
This base class is an abstraction for numerical algorithm.
Definition: nummet.h:80
PressureEquationNumbering pnumPrescribed
Definition: cbs.h:206
double dscale
Density scale.
Definition: cbs.h:214
Abstract base class for all finite elements.
Definition: element.h:145
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
double Re
Reynolds number.
Definition: cbs.h:216
virtual bool isDefault() const
Returns true, if receiver is the default engngModel equation numbering scheme; This is useful for som...
Definition: cbs.h:154
Class implementing an array of integers.
Definition: intarray.h:61
virtual int __givePrescribedEquationNumber()=0
Returns prescribed equation number of receiver.
std::unique_ptr< SparseMtrx > lhs
Definition: cbs.h:180
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
Definition: cbs.h:137
double uscale
Velocity scale.
Definition: cbs.h:212
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:94
FloatArray deltaAuxVelocity
Definition: cbs.h:185
Callback class for assembling specific types of vectors.
FloatArray nodalPrescribedTractionPressureConnectivity
Definition: cbs.h:187
Callback class for assembling specific types of matrices.
virtual const char * giveInputRecordName() const
Definition: cbs.h:250
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
Definition: cbs.h:129
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
Specialized numbering scheme for CBS algorithm, since it needs velocities separately.
Definition: cbs.h:119
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
Definition: dof.h:276
std::unique_ptr< SparseMtrx > mss
Sparse consistent mass.
Definition: cbs.h:192
Specialized numbering scheme for CBS algorithm, since it needs pressures separately.
Definition: cbs.h:145
This class represents CBS algorithm for solving incompressible Navier-Stokes equations.
Definition: cbs.h:171
bool equationScalingFlag
Definition: cbs.h:208
virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const
Default implementation takes all the DOF IDs.
Class representing vector of real numbers.
Definition: floatarray.h:82
Callback class for assembling CBS pressure matrices.
Definition: cbs.h:108
PressureEquationNumbering pnum
Definition: cbs.h:205
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:73
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
std::unique_ptr< SparseLinearSystemNM > nMethod
Numerical method used to solve the problem.
Definition: cbs.h:175
double lscale
Length scale.
Definition: cbs.h:210
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:60
fMode
Type representing the type of formulation (total or updated) of non-linear computation.
Definition: fmode.h:42
LinSystSolverType solverType
Definition: cbs.h:177
virtual fMode giveFormulation()
Indicates type of non linear computation (total or updated formulation).
Definition: cbs.h:251
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:101
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:66
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
FloatArray mm
Lumped mass matrix.
Definition: cbs.h:190
VelocityEquationNumbering(bool prescribed)
Definition: cbs.h:126
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual bool giveEquationScalingFlag()
Returns the Equation scaling flag, which is used to indicate that governing equation(s) are scaled...
Definition: cbs.h:260
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
double minDeltaT
Definition: cbs.h:195
#define _IFT_CBS_Name
Definition: cbs.h:50
int consistentMassFlag
Consistent mass flag.
Definition: cbs.h:201
PrimaryField PressureField
Pressure field.
Definition: cbs.h:182
Class representing solution step.
Definition: timestep.h:80
int initFlag
Definition: cbs.h:199
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
Definition: cbs.h:155
virtual const char * giveClassName() const
Returns class name of the receiver.
Definition: cbs.h:249
SparseMtrxType sparseMtrxType
Definition: cbs.h:178

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