OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
pfem.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 pfem_h
36 #define pfem_h
37 
38 #include "engngm.h"
39 #include "sparselinsystemnm.h"
40 #include "sparsemtrx.h"
41 #include "primaryfield.h"
43 #include "pfemnumberingschemes.h"
44 #include "materialinterface.h"
45 #include "assemblercallback.h"
46 
47 
49 
50 #define _IFT_PFEM_Name "pfem"
51 #define _IFT_PFEM_deltat "deltat"
52 #define _IFT_PFEM_mindeltat "mindeltat"
53 #define _IFT_PFEM_alphashapecoef "alphashapecoef"
54 #define _IFT_PFEM_particalRemovalRatio "removalratio"
55 #define _IFT_PFEM_printVolumeReport "volumereport"
56 #define _IFT_PFEM_discretizationScheme "scheme"
57 #define _IFT_PFEM_associatedMaterial "material"
58 #define _IFT_PFEM_associatedCrossSection "cs"
59 #define _IFT_PFEM_pressureBC "pressure"
60 #define _IFT_PFEM_rtolv "rtolv"
61 #define _IFT_PFEM_rtolp "rtolp"
62 #define _IFT_PFEM_maxiter "maxiter"
63 
65 
66 namespace oofem {
71 {
72 public:
73  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
74 };
75 
80 {
81 protected:
82  double deltaT;
83 
84 public:
85  PFEMCorrectionRhsAssembler(double deltaT) : VectorAssembler(), deltaT(deltaT) {}
86 
87  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
88  virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const;
89 };
90 
95 {
96  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
97  virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const;
98 };
99 
104 {
105  virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const;
106  virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const;
107 };
108 
113 {
114 public:
115  virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const;
116  virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const;
117 };
118 
124 class PFEM : public EngngModel
125 {
126 protected:
133 
137  std :: unique_ptr< SparseMtrx >pLhs;
140 
141  // TODO: consider using DofDistributedPrimaryField for pressure and velocity
148 
150  double deltaT;
152  double minDeltaT;
158  double rtolv, rtolp;
160  int maxiter;
161 
163  double domainVolume;
166 
169 
176 
185 
186 public:
187  PFEM(int i, EngngModel *_master = NULL) :
188  EngngModel(i, _master)
189  , avLhs()
190  , pLhs()
191  , vLhs()
192  , PressureField(this, 1, FT_Pressure, 1)
193  , VelocityField(this, 1, FT_Velocity, 1)
194  , pns()
195  , vns(false)
196  , prescribedVns(true)
197  {
198  ndomains = 1;
199  nMethod = NULL;
200  domainVolume = 0.0;
201  printVolumeReport = false;
202  discretizationScheme = 1; // implicit iterative scheme is default
203  associatedCrossSection = 0;
204  associatedMaterial = 0;
205  associatedPressureBC = 0;
206  }
207  ~PFEM() { }
208 
209  void solveYourselfAt(TimeStep *);
216  virtual void updateYourself(TimeStep *tStep);
217 
218  double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof);
219 
220  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode);
221  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode);
222 
223  TimeStep *giveNextStep();
224  TimeStep *giveSolutionStepWhenIcApply();
225  NumericalMethod *giveNumericalMethod(MetaStep *);
226 
230  virtual void preInitializeNextStep();
231 
232  //equation numbering using PressureNumberingScheme
233  virtual int forceEquationNumbering(int id);
234 
235  virtual int requiresUnknownsDictionaryUpdate() { return true; }
236 
237 
239  IRResultType initializeFrom(InputRecord *ir);
240 
241  // consistency check
242  virtual int checkConsistency(); // returns nonzero if o.k.
243  // identification
244  const char *giveClassName() const { return "PFEM"; }
245  fMode giveFormulation() { return AL; }
246  // fMode giveFormulation() { return TL; }
247 
255  virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *atTime);
256 
257  virtual int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num);
258 
259  virtual int giveNewEquationNumber(int domain, DofIDItem);
260  virtual int giveNewPrescribedEquationNumber(int domain, DofIDItem);
261 
262  virtual int giveUnknownDictHashIndx(ValueModeType mode, TimeStep *stepN); // { return ( int ) mode; }
263  virtual void updateDofUnknownsDictionary(DofManager *inode, TimeStep *tStep);
264 
266  void updateDofUnknownsDictionaryPressure(DofManager *inode, TimeStep *tStep);
268  void updateDofUnknownsDictionaryVelocities(DofManager *inode, TimeStep *tStep);
270  void resetEquationNumberings();
271 
273  int giveAssociatedMaterialNumber() { return associatedMaterial; }
275  int giveAssociatedCrossSectionNumber() { return associatedCrossSection; }
277  int giveAssociatedPressureBC() { return associatedPressureBC; }
278 
279 protected:
286  void updateInternalState(TimeStep *);
288  void applyIC(TimeStep *);
290  void deactivateTooCloseParticles();
291 };
292 } // end namespace oofem
293 #endif // pfem_h
double domainVolume
Area or volume of the fluid domain, which can be controlled.
Definition: pfem.h:163
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
int giveAssociatedCrossSectionNumber()
Returns number of cross section to be associated with created elements.
Definition: pfem.h:275
PrimaryField PressureField
Pressure field.
Definition: pfem.h:143
Implementation of callback class for assembling right-hand side vector of laplacian multiplied by vel...
Definition: pfem.h:94
Implementation of callback class for assembling right-hand side of velocity equations.
Definition: pfem.h:79
int discretizationScheme
Explicit or implicit time discretization.
Definition: pfem.h:168
const char * giveClassName() const
Returns class name of the receiver.
Definition: pfem.h:244
int associatedMaterial
Number of material to associate with created elements.
Definition: pfem.h:173
Class and object Domain.
Definition: domain.h:115
Velocity numbering scheme for PFEM purposes.
PFEMCorrectionRhsAssembler(double deltaT)
Definition: pfem.h:85
Class representing meta step.
Definition: metastep.h:62
Numbering scheme that takes into account only pressure DOFs in PFEM problems.
int giveAssociatedMaterialNumber()
Returns number of material to be associated with created elements.
Definition: pfem.h:273
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
Callback class for assembling pressure laplacian matrix.
Definition: pfem.h:112
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
This base class is an abstraction for all numerical methods solving sparse linear system of equations...
Updated Lagrange.
Definition: fmode.h:45
This class represents PFEM method for solving incompressible Navier-Stokes equations.
Definition: pfem.h:124
PFEM(int i, EngngModel *_master=NULL)
Definition: pfem.h:187
This base class is an abstraction for numerical algorithm.
Definition: nummet.h:80
~PFEM()
Definition: pfem.h:207
Implementation of callback class for assembling right-hand side of pressure equations.
Definition: pfem.h:70
Abstract base class for all finite elements.
Definition: element.h:145
SparseLinearSystemNM * nMethod
Numerical method used to solve the problem.
Definition: pfem.h:128
Base class for dof managers.
Definition: dofmanager.h:113
PrimaryField VelocityField
Velocity field.
Definition: pfem.h:145
SparseMtrxType sparseMtrxType
Used type of sparse matrix.
Definition: pfem.h:132
Class implementing an array of integers.
Definition: intarray.h:61
Implementation of callback class for assembling right-hand side vector of mass matrix multiplied by v...
Definition: pfem.h:103
double alphaShapeCoef
Value of alpha coefficient for the boundary recognition.
Definition: pfem.h:154
double particleRemovalRatio
Element side ratio for the removal of the close partices.
Definition: pfem.h:156
double deltaT
Time step length.
Definition: pfem.h:150
double minDeltaT
Minimal value of time step.
Definition: pfem.h:152
Callback class for assembling specific types of vectors.
Callback class for assembling specific types of matrices.
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
int giveAssociatedPressureBC()
Returns number of zero pressure boundary condition to be prescribed on free surface.
Definition: pfem.h:277
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
FloatArray vLhs
Left-hand side matrix for the velocity equations.
Definition: pfem.h:139
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
LinSystSolverType solverType
Used solver type for linear system of equations.
Definition: pfem.h:130
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: pfem.C:69
fMode giveFormulation()
Indicates type of non linear computation (total or updated formulation).
Definition: pfem.h:245
FloatArray avLhs
Left-hand side matrix for the auxiliary velocity equations.
Definition: pfem.h:135
VelocityNumberingScheme vns
Velocity numbering.
Definition: pfem.h:182
PressureNumberingScheme pns
Pressure numbering.
Definition: pfem.h:178
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
int associatedPressureBC
Number of pressure boundary condition to be prescribed on free surface.
Definition: pfem.h:175
virtual int requiresUnknownsDictionaryUpdate()
Indicates if EngngModel requires Dofs dictionaries to be updated.
Definition: pfem.h:235
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
VelocityNumberingScheme prescribedVns
Prescribed velocity numbering.
Definition: pfem.h:184
Class representing the general Input Record.
Definition: inputrecord.h:101
Numbering scheme for auxiliary velocity in PFEM problems.
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
double rtolv
Convergence tolerance.
Definition: pfem.h:158
std::unique_ptr< SparseMtrx > pLhs
Left-hand side matrix for the pressure equations.
Definition: pfem.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.
bool printVolumeReport
Flag for volume report.
Definition: pfem.h:165
FloatArray AuxVelocity
Array of auxiliary velocities used during computation.
Definition: pfem.h:147
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
int maxiter
Max number of iterations.
Definition: pfem.h:160
AuxVelocityNumberingScheme avns
Auxiliary Velocity numbering.
Definition: pfem.h:180
int associatedCrossSection
Number of cross section to associate with created elements.
Definition: pfem.h:171
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011