OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 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"
47
48namespace oofem {
49class LEPlic;
50class Polygon;
51class Element;
52
59{
60protected:
63 double vof, temp_vof;
65 double p, temp_p;
68
69public:
70 LEPlicElementInterface() : permanentVofFlag(false), vof(0.), temp_vof(0.), p(0.), temp_p(0.) { }
75
76 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 }
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; }
123 vof = temp_vof;
124 p = temp_p;
126 }
127
134 void saveContext(DataStream &stream, ContextMode mode);
140 void restoreContext(DataStream &stream, ContextMode mode);
141};
142
150{
151protected:
157public:
165 LEPlic(int n, Domain * d) : MaterialInterface(n, d) {
167 }
168
169 void updatePosition(TimeStep *tStep) override;
170 void updateYourself(TimeStep *tStep) override { }
171 void giveMaterialMixtureAt(FloatArray &answer, FloatArray &position) override;
172 void giveElementMaterialMixture(FloatArray &answer, int ielem) override;
173 double giveNodalScalarRepresentation(int) override;
174 double computeCriticalTimeStep(TimeStep *tStep) override;
175
179 void giveUpdatedCoordinate(FloatArray &answer, int num) {
180 answer.resize(2);
181 answer.at(1) = updated_XCoords.at(num);
182 answer.at(2) = updated_YCoords.at(num);
183 }
184
185 double giveUpdatedXCoordinate(int num) { return updated_XCoords.at(num); }
186 double giveUpdatedYCoordinate(int num) { return updated_YCoords.at(num); }
187
188 void initializeFrom(InputRecord &ir) override;
189 void giveInputRecord(DynamicInputRecord &input) override;
190
191 // identification
192 const char *giveClassName() const override { return "LEPlic"; }
193
194protected:
195 void doLagrangianPhase(TimeStep *tStep);
196 void doInterfaceReconstruction(TimeStep *tStep, bool coord_upd, bool temp_vof);
197 void doInterfaceRemapping(TimeStep *tStep);
198 void doCellDLS(FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag);
199 void findCellLineConstant(double &p, FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag);
200
201
203 {
204protected:
209 bool upd;
210public:
211 computeLEPLICVolumeFractionWrapper(LEPlicElementInterface * i, LEPlic * mi, const FloatArray & n, const double target_vof_val, bool upd_val) :
212 iface(i), minterf(mi), normal(n), target_vof(target_vof_val), upd(upd_val) { }
213 void setNormal(FloatArray n) { normal = std::move(n); }
214 double eval(double x) { return fabs(iface->computeLEPLICVolumeFraction(normal, x, minterf, upd) - target_vof); }
215 };
216};
217} // end namespace oofem
218#endif // leplic_h
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Interface()
Constructor.
Definition interface.h:86
bool isBoundary()
Returns true if cell is boundary.
Definition leplic.C:54
virtual Element * giveElement()=0
Return number of receiver's element.
void updateYourself(TimeStep *tStep)
Definition leplic.h:122
void saveContext(DataStream &stream, ContextMode mode)
Definition leplic.C:86
FloatArray normal
Interface segment normal.
Definition leplic.h:67
void restoreContext(DataStream &stream, ContextMode mode)
Definition leplic.C:104
virtual double computeMyVolume(LEPlic *matInterface, bool updFlag)=0
Computes the volume of receiver.
void setPermanentVolumeFraction(double v)
Definition leplic.h:106
void setTempLineConstant(double tp)
Definition leplic.h:99
void addTempVolumeFraction(double v)
Definition leplic.h:110
virtual double computeCriticalLEPlicTimeStep(TimeStep *tStep)=0
Computes critical time step.
double p
Line constant of line segment representing interface.
Definition leplic.h:65
void setTempInterfaceNormal(FloatArray tg)
Definition leplic.h:100
virtual double truncateMatVolume(const Polygon &matvolpoly, double &volume)=0
Truncates given material polygon to receiver.
void giveTempInterfaceNormal(FloatArray &n)
Definition leplic.h:120
virtual void formMyVolumePoly(Polygon &myPoly, LEPlic *mat_interface, bool updFlag)=0
Assembles receiver volume.
void setTempVolumeFraction(double v)
Definition leplic.h:101
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 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 vof
Volume fraction of reference fluid in element.
Definition leplic.h:63
virtual void giveElementCenter(LEPlic *mat_interface, FloatArray &center, bool updFlag)=0
Computes the receiver center (in updated Lagrangian configuration).
virtual double computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag)=0
Computes corresponding volume fraction to given interface position.
computeLEPLICVolumeFractionWrapper(LEPlicElementInterface *i, LEPlic *mi, const FloatArray &n, const double target_vof_val, bool upd_val)
Definition leplic.h:211
void giveElementMaterialMixture(FloatArray &answer, int ielem) override
Definition leplic.C:689
void doInterfaceReconstruction(TimeStep *tStep, bool coord_upd, bool temp_vof)
Definition leplic.C:231
double orig_reference_fluid_volume
Definition leplic.h:156
double giveUpdatedXCoordinate(int num)
Definition leplic.h:185
void giveUpdatedCoordinate(FloatArray &answer, int num)
Definition leplic.h:179
double computeCriticalTimeStep(TimeStep *tStep) override
Definition leplic.C:650
LEPlic(int n, Domain *d)
Definition leplic.h:165
void doInterfaceRemapping(TimeStep *tStep)
Definition leplic.C:257
void findCellLineConstant(double &p, FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag)
Definition leplic.C:533
void doLagrangianPhase(TimeStep *tStep)
Definition leplic.C:152
FloatArray updated_YCoords
Array used to store updated y-coordinates of nodes as moved along streamlines.
Definition leplic.h:155
double giveNodalScalarRepresentation(int) override
Definition leplic.C:704
void doCellDLS(FloatArray &fvgrad, int ie, bool coord_upd, bool temp_vof_flag)
Definition leplic.C:431
void giveMaterialMixtureAt(FloatArray &answer, FloatArray &position) override
Definition leplic.C:665
void initializeFrom(InputRecord &ir) override
Definition leplic.C:635
void updateYourself(TimeStep *tStep) override
Definition leplic.h:170
const char * giveClassName() const override
Definition leplic.h:192
void giveInputRecord(DynamicInputRecord &input) override
Definition leplic.C:643
double giveUpdatedYCoordinate(int num)
Definition leplic.h:186
FloatArray updated_XCoords
Array used to store updated x-coordinates of nodes as moved along streamlines.
Definition leplic.h:153
void updatePosition(TimeStep *tStep) override
Definition leplic.C:128
MaterialInterface(int n, Domain *d)
long ContextMode
Definition contextmode.h:43
Definition CSG.h:186

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