OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
leplic.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 leplic_h
36 #define leplic_h
37 
38 #include "materialinterface.h"
39 #include "floatarray.h"
40 #include "mathfem.h"
41 #include "interface.h"
42 
44 
45 #define _IFT_LEPLIC_refVol "refvol"
46 
47 
48 namespace oofem {
49 class LEPlic;
50 class Polygon;
51 class Element;
52 
59 {
60 protected:
63  double vof, temp_vof;
65  double p, temp_p;
68 
69 public:
70  LEPlicElementInterface() : permanentVofFlag(false), vof(0.), temp_vof(0.) { }
75  virtual double computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag) = 0;
78  virtual void formMaterialVolumePoly(Polygon &matvolpoly, LEPlic *matInterface,
79  const FloatArray &normal, const double p, bool updFlag) = 0;
81  virtual void formVolumeInterfacePoly(Polygon &matvolpoly, LEPlic *matInterface,
82  const FloatArray &normal, const double p, bool updFlag) = 0;
84  virtual double truncateMatVolume(const Polygon &matvolpoly, double &volume) = 0;
86  virtual void giveElementCenter(LEPlic *mat_interface, FloatArray &center, bool updFlag) = 0;
88  virtual void formMyVolumePoly(Polygon &myPoly, LEPlic *mat_interface, bool updFlag) = 0;
90  virtual double computeMyVolume(LEPlic *matInterface, bool updFlag) = 0;
92  bool isBoundary();
94  virtual Element *giveElement() = 0;
96  virtual double computeCriticalLEPlicTimeStep(TimeStep *tStep) = 0;
98 
99  void setTempLineConstant(double tp) { temp_p = tp; }
100  void setTempInterfaceNormal(FloatArray tg) { temp_normal = std::move(tg); }
101  void setTempVolumeFraction(double v) {
102  if ( !permanentVofFlag ) {
103  temp_vof = v;
104  }
105  }
106  void setPermanentVolumeFraction(double v) {
107  temp_vof = vof = v;
108  permanentVofFlag = true;
109  }
110  void addTempVolumeFraction(double v) {
111  if ( !permanentVofFlag ) {
112  temp_vof += v;
113  if ( temp_vof > 1.0 ) {
114  temp_vof = 1.0;
115  }
116  }
117  }
118  double giveVolumeFraction() { return vof; }
119  double giveTempVolumeFraction() { return temp_vof; }
121  double giveTempLineConstant() { return temp_p; }
122  void updateYourself(TimeStep *tStep) {
123  vof = temp_vof;
124  p = temp_p;
125  normal = temp_normal;
126  }
127 
136  contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
144  contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
145 };
146 
153 class LEPlic : public MaterialInterface
154 {
155 protected:
161 public:
169  LEPlic(int n, Domain * d) : MaterialInterface(n, d) {
170  orig_reference_fluid_volume = 0.0;
171  }
172 
173  virtual void updatePosition(TimeStep *tStep);
174  virtual void updateYourself(TimeStep *tStep) { }
175  virtual void giveMaterialMixtureAt(FloatArray &answer, FloatArray &position);
176  virtual void giveElementMaterialMixture(FloatArray &answer, int ielem);
177  virtual double giveNodalScalarRepresentation(int);
178  virtual double computeCriticalTimeStep(TimeStep *tStep);
179 
183  void giveUpdatedCoordinate(FloatArray &answer, int num) {
184  answer.resize(2);
185  answer.at(1) = updated_XCoords.at(num);
186  answer.at(2) = updated_YCoords.at(num);
187  }
188 
189  double giveUpdatedXCoordinate(int num) { return updated_XCoords.at(num); }
190  double giveUpdatedYCoordinate(int num) { return updated_YCoords.at(num); }
191 
192  virtual IRResultType initializeFrom(InputRecord *ir);
193  virtual void giveInputRecord(DynamicInputRecord &input);
194 
195  // identification
196  virtual const char *giveClassName() const { return "LEPlic"; }
197 
198 protected:
199  void doLagrangianPhase(TimeStep *tStep);
200  void doInterfaceReconstruction(TimeStep *tStep, bool coord_upd, bool temp_vof);
201  void doInterfaceRemapping(TimeStep *tStep);
202  void doCellDLS(FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag);
203  void findCellLineConstant(double &p, FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag);
204 
205 
207  {
208 protected:
212  double target_vof;
213  bool upd;
214 public:
215  computeLEPLICVolumeFractionWrapper(LEPlicElementInterface * i, LEPlic * mi, const FloatArray & n, const double target_vof_val, bool upd_val) :
216  iface(i), minterf(mi), normal(n), target_vof(target_vof_val), upd(upd_val) { }
217  void setNormal(FloatArray n) { normal = std::move(n); }
218  double eval(double x) { return fabs(iface->computeLEPLICVolumeFraction(normal, x, minterf, upd) - target_vof); }
219  };
220 };
221 } // end namespace oofem
222 #endif // leplic_h
double orig_reference_fluid_volume
Definition: leplic.h:160
contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores context of receiver into given stream.
Definition: leplic.C:86
void giveUpdatedCoordinate(FloatArray &answer, int num)
Returns updated nodal positions.
Definition: leplic.h:183
Element interface for LEPlic class representing Lagrangian-Eulerian (moving) material interface...
Definition: leplic.h:58
Class and object Domain.
Definition: domain.h:115
virtual void formVolumeInterfacePoly(Polygon &matvolpoly, LEPlic *matInterface, const FloatArray &normal, const double p, bool updFlag)=0
Assembles receiver material polygon based solely on given interface line.
virtual double computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag)=0
Computes corresponding volume fraction to given interface position.
virtual Element * giveElement()=0
Return number of receiver's element.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
void addTempVolumeFraction(double v)
Definition: leplic.h:110
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual double computeCriticalLEPlicTimeStep(TimeStep *tStep)=0
Computes critical time step.
void setPermanentVolumeFraction(double v)
Definition: leplic.h:106
double giveUpdatedYCoordinate(int num)
Definition: leplic.h:190
void setTempInterfaceNormal(FloatArray tg)
Definition: leplic.h:100
Abstract base class for all finite elements.
Definition: element.h:145
void giveTempInterfaceNormal(FloatArray &n)
Definition: leplic.h:120
LEPlic(int n, Domain *d)
Constructor.
Definition: leplic.h:169
FloatArray updated_XCoords
Array used to store updated x-coordinates of nodes as moved along streamlines.
Definition: leplic.h:157
void updateYourself(TimeStep *tStep)
Definition: leplic.h:122
virtual double computeMyVolume(LEPlic *matInterface, bool updFlag)=0
Computes the volume of receiver.
Abstract base class representing (moving) material interfaces.
virtual void giveElementCenter(LEPlic *mat_interface, FloatArray &center, bool updFlag)=0
Computes the receiver center (in updated Lagrangian configuration).
computeLEPLICVolumeFractionWrapper(LEPlicElementInterface *i, LEPlic *mi, const FloatArray &n, const double target_vof_val, bool upd_val)
Definition: leplic.h:215
Abstract base class representing Lagrangian-Eulerian (moving) material interfaces.
Definition: leplic.h:153
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: leplic.h:174
Class representing 2D polygon.
Definition: geotoolbox.h:91
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void setTempLineConstant(double tp)
Definition: leplic.h:99
void setTempVolumeFraction(double v)
Definition: leplic.h:101
virtual double truncateMatVolume(const Polygon &matvolpoly, double &volume)=0
Truncates given material polygon to receiver.
Class representing the general Input Record.
Definition: inputrecord.h:101
double giveUpdatedXCoordinate(int num)
Definition: leplic.h:189
Class Interface.
Definition: interface.h:82
Class representing the a dynamic Input Record.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
FloatArray updated_YCoords
Array used to store updated y-coordinates of nodes as moved along streamlines.
Definition: leplic.h:159
contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores context of receiver from given stream.
Definition: leplic.C:107
double vof
Volume fraction of reference fluid in element.
Definition: leplic.h:63
virtual void formMaterialVolumePoly(Polygon &matvolpoly, LEPlic *matInterface, const FloatArray &normal, const double p, bool updFlag)=0
Assembles the true element material polygon (takes receiver vof into accout).
double p
Line constant of line segment representing interface.
Definition: leplic.h:65
virtual void formMyVolumePoly(Polygon &myPoly, LEPlic *mat_interface, bool updFlag)=0
Assembles receiver volume.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual const char * giveClassName() const
Definition: leplic.h:196
FloatArray normal
Interface segment normal.
Definition: leplic.h:67
Class representing solution step.
Definition: timestep.h:80
bool isBoundary()
Returns true if cell is boundary.
Definition: leplic.C:54
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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