OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
levelsetpcs.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 levelsetpcs_h
36 #define levelsetpcs_h
37 
38 #include "materialinterface.h"
39 #include "geotoolbox.h"
40 #include "interface.h"
41 
42 #include <vector>
43 
45 
46 #define _IFT_LevelSetPCS_levelSetValues "levelset"
47 #define _IFT_LevelSetPCS_refmatpoly_x "refmatpolyx"
48 #define _IFT_LevelSetPCS_refmatpoly_y "refmatpolyy"
49 #define _IFT_LevelSetPCS_reinit_dt "rdt"
50 #define _IFT_LevelSetPCS_reinit_err "rerr"
51 #define _IFT_LevelSetPCS_reinit_alg "lsra"
52 #define _IFT_LevelSetPCS_nsd "nsd"
53 #define _IFT_LevelSetPCS_ci1 "ci1"
54 #define _IFT_LevelSetPCS_ci2 "ci2"
55 
56 
57 
58 namespace oofem {
59 #define LevelSetPCS_CACHE_ELEMENT_VOF 0
60 
61 class LevelSetPCS;
62 
69 {
70 public:
72 
74 
75 
81  virtual double LS_PCS_computeF(LevelSetPCS *ls, TimeStep *tStep) = 0;
82 
86  virtual void LS_PCS_computedN(FloatMatrix &answer) = 0;
88  virtual double LS_PCS_computeVolume() = 0;
89 
96  virtual double LS_PCS_computeS(LevelSetPCS *ls, TimeStep *tStep) = 0;
97 
102  virtual void LS_PCS_computeVOFFractions(FloatArray &answer, FloatArray &fi) = 0;
104 };
105 
115 {
116 protected:
119  enum PCSEqType { PCS_levelSetUpdate, PCS_levelSetRedistance };
123  int ci1, ci2;
124 
128  double reinit_dt;
131  double reinit_err;
133  int nsd;
135  long int levelSetVersion;
136 
137 #ifdef LevelSetPCS_CACHE_ELEMENT_VOF
138  std :: vector< FloatArray >elemVof;
140 #endif
141 
142 public:
149  LevelSetPCS(int n, Domain * d) : MaterialInterface(n, d) {
150  initialRefMatFlag = false;
151  reinit_dt_flag = false;
152  levelSetVersion = 0;
153  }
154 
155  virtual void initialize();
156  virtual void updatePosition(TimeStep *tStep);
157  virtual void updateYourself(TimeStep *tStep) { previousLevelSetValues = levelSetValues; }
158  virtual double computeCriticalTimeStep(TimeStep *tStep);
159  virtual IRResultType initializeFrom(InputRecord *ir);
160  virtual void giveInputRecord(DynamicInputRecord &input);
161  virtual void reinitialization(TimeStep *tStep);
162 
163  virtual void giveMaterialMixtureAt(FloatArray &answer, FloatArray &position);
164  virtual void giveElementMaterialMixture(FloatArray &answer, int ielem);
165  virtual double giveNodalScalarRepresentation(int i) { return levelSetValues.at(i); }
166 
168  double giveLevelSetDofManValue(int i) { return levelSetValues.at(i); }
169 
170  // identification
171  virtual const char *giveClassName() const { return "LevelSetPCS"; }
172 
173  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
174  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
175 
176 protected:
177  void pcs_stage1(FloatArray &ls, FloatArray &fs, FloatArray &w, TimeStep *tStep, PCSEqType t);
178  double evalElemFContribution(PCSEqType t, int ie, TimeStep *tStep);
179  double evalElemfContribution(PCSEqType t, int ie, TimeStep *tStep);
180 
185  void redistance(TimeStep *tStep);
186 
190  void FMMReinitialization(FloatArray &ls);
192 };
193 } // end namespace oofem
194 #endif // levelsetpcs_h
int nsd
number of spatial dimensions.
Definition: levelsetpcs.h:133
Class and object Domain.
Definition: domain.h:115
virtual double LS_PCS_computeF(LevelSetPCS *ls, TimeStep *tStep)=0
Evaluates F in level set equation of the form where for interface position driven by flow with speed...
std::vector< FloatArray > elemVof
Definition: levelsetpcs.h:138
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
double giveLevelSetDofManValue(int i)
Returns level set value in specific node.
Definition: levelsetpcs.h:168
Element interface for LevelSetPCS class representing level-set like material interface.
Definition: levelsetpcs.h:68
long int levelSetVersion
Level set values version.
Definition: levelsetpcs.h:135
double reinit_err
Reinitialization error limit.
Definition: levelsetpcs.h:131
virtual double giveNodalScalarRepresentation(int i)
Returns scalar value representation of material Interface at given point.
Definition: levelsetpcs.h:165
virtual void LS_PCS_computeVOFFractions(FloatArray &answer, FloatArray &fi)=0
Returns VOF fractions for each material on element according to nodal values of level set function (p...
int reinit_alg
Type of reinitialization algorithm to use.
Definition: levelsetpcs.h:126
Abstract base class representing (moving) material interfaces.
virtual double LS_PCS_computeS(LevelSetPCS *ls, TimeStep *tStep)=0
Evaluates S in level set equation of the form where .
double reinit_dt
Time step used in reinitialization of LS (if apply).
Definition: levelsetpcs.h:128
LevelSetPCS(int n, Domain *d)
Constructor.
Definition: levelsetpcs.h:149
Class representing vector of real numbers.
Definition: floatarray.h:82
Class representing 2D polygon.
Definition: geotoolbox.h:91
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
Polygon initialRefMatVol
Definition: levelsetpcs.h:120
Abstract base class representing Level Set representation of material interfaces. ...
Definition: levelsetpcs.h:114
long int elemVofLevelSetVersion
Definition: levelsetpcs.h:139
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
virtual void LS_PCS_computedN(FloatMatrix &answer)=0
Returns gradient of shape functions.
Class representing the a dynamic Input Record.
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: levelsetpcs.h:157
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual double LS_PCS_computeVolume()=0
Returns receiver&#39;s volume.
the oofem namespace is to define a context or scope in which all oofem names are defined.
FloatArray previousLevelSetValues
Definition: levelsetpcs.h:118
Class representing solution step.
Definition: timestep.h:80
virtual const char * giveClassName() const
Definition: levelsetpcs.h:171

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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011