OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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
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"
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
66namespace oofem {
71{
72public:
73 void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override;
74};
75
80{
81protected:
82 double deltaT;
83
84public:
86
87 void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override;
88 void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const override;
89};
90
95{
96 void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override;
97 void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const override;
98};
99
104{
105 void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override;
106 void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const override;
107};
108
113{
114public:
115 void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const override;
116 void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds = nullptr) const override;
117};
118
124class PFEM : public EngngModel
125{
126protected:
128 std :: unique_ptr< SparseLinearSystemNM > nMethod;
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;
161
166
169
176
185
186public:
187 PFEM(int i, EngngModel *_master = nullptr) :
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
206 }
207 ~PFEM() { }
208
209 void solveYourselfAt(TimeStep *) override;
216 void updateYourself(TimeStep *tStep) override;
217
218 double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof) override;
219
220 void saveContext(DataStream &stream, ContextMode mode) override;
221 void restoreContext(DataStream &stream, ContextMode mode) override;
222
223 TimeStep *giveNextStep() override;
224 TimeStep *giveSolutionStepWhenIcApply(bool force = false) override;
226
230 void preInitializeNextStep() override;
231
232 //equation numbering using PressureNumberingScheme
233 int forceEquationNumbering(int id) override;
234
235 int requiresUnknownsDictionaryUpdate() override { return true; }
236
237
239 void initializeFrom(InputRecord &ir) override;
240
241 // consistency check
242 int checkConsistency() override; // returns nonzero if o.k.
243 // identification
244 const char *giveClassName() const override { return "PFEM"; }
245 fMode giveFormulation() override { return AL; }
246 // fMode giveFormulation() { return TL; }
247
255 void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *atTime) override;
256
257 int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num) override;
258
259 int giveNewEquationNumber(int domain, DofIDItem) override;
260 int giveNewPrescribedEquationNumber(int domain, DofIDItem) override;
261
262 int giveUnknownDictHashIndx(ValueModeType mode, TimeStep *stepN) override; // { return ( int ) mode; }
263 void updateDofUnknownsDictionary(DofManager *inode, TimeStep *tStep) override;
264
271
278
279protected:
288 void applyIC(TimeStep *);
291};
292} // end namespace oofem
293#endif // pfem_h
virtual int forceEquationNumbering()
Definition engngm.C:534
EngngModel(int i, EngngModel *_master=NULL)
Definition engngm.C:99
int ndomains
Number of receiver domains.
Definition engngm.h:215
void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const override
Default implementation takes all the DOF IDs.
Definition pfem.C:107
void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override
Definition pfem.C:87
PFEMCorrectionRhsAssembler(double deltaT)
Definition pfem.h:85
void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const override
Default implementation takes all the DOF IDs.
Definition pfem.C:126
void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override
Definition pfem.C:115
void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override
Definition pfem.C:133
void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const override
Default implementation takes all the DOF IDs.
Definition pfem.C:144
void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const override
Definition pfem.C:151
void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const override
Definition pfem.C:157
void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override
Definition pfem.C:70
std ::unique_ptr< SparseLinearSystemNM > nMethod
Numerical method used to solve the problem.
Definition pfem.h:128
int giveAssociatedMaterialNumber()
Returns number of material to be associated with created elements.
Definition pfem.h:273
FloatArray AuxVelocity
Array of auxiliary velocities used during computation.
Definition pfem.h:147
void applyIC(TimeStep *)
Initializes velocity and pressure fields in the first step with prescribed values.
Definition pfem.C:773
void solveYourselfAt(TimeStep *) override
Definition pfem.C:389
void saveContext(DataStream &stream, ContextMode mode) override
Definition pfem.C:707
void updateInternalState(TimeStep *)
Definition pfem.C:610
void updateDofUnknownsDictionaryVelocities(DofManager *inode, TimeStep *tStep)
Writes velocities into the dof unknown dictionaries.
Definition pfem.C:683
int giveUnknownDictHashIndx(ValueModeType mode, TimeStep *stepN) override
Definition pfem.C:626
int maxiter
Max number of iterations.
Definition pfem.h:160
bool printVolumeReport
Flag for volume report.
Definition pfem.h:165
int checkConsistency() override
Definition pfem.C:726
LinSystSolverType solverType
Used solver type for linear system of equations.
Definition pfem.h:130
void updateDofUnknownsDictionaryPressure(DofManager *inode, TimeStep *tStep)
Writes pressures into the dof unknown dictionaries.
Definition pfem.C:667
double domainVolume
Area or volume of the fluid domain, which can be controlled.
Definition pfem.h:163
AuxVelocityNumberingScheme avns
Auxiliary Velocity numbering.
Definition pfem.h:180
fMode giveFormulation() override
Definition pfem.h:245
int associatedCrossSection
Number of cross section to associate with created elements.
Definition pfem.h:171
PFEM(int i, EngngModel *_master=nullptr)
Definition pfem.h:187
PressureNumberingScheme pns
Pressure numbering.
Definition pfem.h:178
void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *atTime) override
Definition pfem.C:743
double deltaT
Time step length.
Definition pfem.h:150
SparseMtrxType sparseMtrxType
Used type of sparse matrix.
Definition pfem.h:132
FloatArray avLhs
Left-hand side matrix for the auxiliary velocity equations.
Definition pfem.h:135
int giveAssociatedCrossSectionNumber()
Returns number of cross section to be associated with created elements.
Definition pfem.h:275
double rtolv
Convergence tolerance.
Definition pfem.h:158
const char * giveClassName() const override
Returns class name of the receiver.
Definition pfem.h:244
void deactivateTooCloseParticles()
Deactivates particles upon the particalRemovalRatio.
Definition pfem.C:882
int giveNewEquationNumber(int domain, DofIDItem) override
Definition pfem.C:834
TimeStep * giveSolutionStepWhenIcApply(bool force=false) override
Definition pfem.C:288
VelocityNumberingScheme vns
Velocity numbering.
Definition pfem.h:182
PrimaryField VelocityField
Velocity field.
Definition pfem.h:145
int discretizationScheme
Explicit or implicit time discretization.
Definition pfem.h:168
std ::unique_ptr< SparseMtrx > pLhs
Left-hand side matrix for the pressure equations.
Definition pfem.h:137
TimeStep * giveNextStep() override
Returns next time step (next to current step) of receiver.
Definition pfem.C:340
FloatArray vLhs
Left-hand side matrix for the velocity equations.
Definition pfem.h:139
int associatedMaterial
Number of material to associate with created elements.
Definition pfem.h:173
double minDeltaT
Minimal value of time step.
Definition pfem.h:152
double rtolp
Definition pfem.h:158
int associatedPressureBC
Number of pressure boundary condition to be prescribed on free surface.
Definition pfem.h:175
void preInitializeNextStep() override
Definition pfem.C:301
double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof) override
Definition pfem.C:257
void updateYourself(TimeStep *tStep) override
Definition pfem.C:599
int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num) override
Definition pfem.C:857
void initializeFrom(InputRecord &ir) override
Initialization from given input record.
Definition pfem.C:213
PrimaryField PressureField
Pressure field.
Definition pfem.h:143
int giveNewPrescribedEquationNumber(int domain, DofIDItem) override
Definition pfem.C:846
double alphaShapeCoef
Value of alpha coefficient for the boundary recognition.
Definition pfem.h:154
void updateDofUnknownsDictionary(DofManager *inode, TimeStep *tStep) override
Definition pfem.C:639
int giveAssociatedPressureBC()
Returns number of zero pressure boundary condition to be prescribed on free surface.
Definition pfem.h:277
NumericalMethod * giveNumericalMethod(MetaStep *) override
Returns reference to receiver's numerical method.
Definition pfem.C:163
int requiresUnknownsDictionaryUpdate() override
Definition pfem.h:235
double particleRemovalRatio
Element side ratio for the removal of the close partices.
Definition pfem.h:156
void restoreContext(DataStream &stream, ContextMode mode) override
Definition pfem.C:717
void resetEquationNumberings()
Resets the equation numberings as the mesh is recreated in each time step.
Definition pfem.C:873
VelocityNumberingScheme prescribedVns
Prescribed velocity numbering.
Definition pfem.h:184
long ContextMode
Definition contextmode.h:43
fMode
Definition fmode.h:42
@ AL
Updated Lagrange.
Definition fmode.h:45

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