83 answer = {V_u, V_v, V_w, P_f};
137 for (
int i = 1; i <= 4; i++ ) {
138 answer.
at(1, 3 * i - 2) = u.
at(1) * dn.
at(i, 1) + u.
at(2) * dn.
at(i, 2) + u.
at(3) * dn.
at(i, 3);
139 answer.
at(2, 3 * i - 1) = u.
at(1) * dn.
at(i, 1) + u.
at(2) * dn.
at(i, 2) + u.
at(3) * dn.
at(i, 3);
140 answer.
at(3, 3 * i - 0) = u.
at(1) * dn.
at(i, 1) + u.
at(2) * dn.
at(i, 2) + u.
at(3) * dn.
at(i, 3);
161 for (
int i = 1; i <= 4; i++ ) {
162 um.
at(1, i) = u.
at(3 * i - 2);
163 um.
at(2, i) = u.
at(3 * i - 1);
164 um.
at(3, i) = u.
at(3 * i - 0);
180 for (
int i = 1; i <= 4; i++ ) {
181 answer.
at(1, 3 * i - 2) = dn.
at(i, 1);
182 answer.
at(2, 3 * i - 1) = dn.
at(i, 2);
183 answer.
at(3, 3 * i - 0) = dn.
at(i, 3);
185 answer.
at(4, 3 * i - 1) = dn.
at(i, 3);
186 answer.
at(4, 3 * i - 0) = dn.
at(i, 2);
188 answer.
at(5, 3 * i - 2) = dn.
at(i, 3);
189 answer.
at(5, 3 * i - 0) = dn.
at(i, 1);
191 answer.
at(6, 3 * i - 2) = dn.
at(i, 2);
192 answer.
at(6, 3 * i - 1) = dn.
at(i, 1);
205 for (
int i = 1; i <= 4; i++ ) {
206 answer.
at(1, 3 * i - 2) = dn.
at(i, 1);
207 answer.
at(1, 3 * i - 1) = dn.
at(i, 2);
208 answer.
at(1, 3 * i - 0) = dn.
at(i, 3);
221 answer.
at(1, 1) = n.
at(1);
222 answer.
at(1, 2) = n.
at(2);
223 answer.
at(1, 3) = n.
at(3);
224 answer.
at(1, 4) = n.
at(4);
244 double h_ugn, sum = 0.0, vnorm, t_sugn1, t_sugn2, t_sugn3, u_1, u_2, u_3, z, Re_ugn;
245 double dscale, uscale, lscale, tscale, dt;
266 GaussPoint *gp_first = iRule->getIntegrationPoint(0);
270 for (
auto *gp: *iRule ) {
276 sum *= ( 1. / lscale / iRule->giveNumberOfIntegrationPoints() );
288 u_1 = u.
at( ( im1 ) * nsd + 1 );
289 u_2 = u.
at( ( im1 ) * nsd + 2 );
291 u_3 = u.
at( ( im1 ) * nsd + 3 );
296 vnorm =
max( vnorm, sqrt(u_1 * u_1 + u_2 * u_2 + u_3 * u_3) );
299 if ( ( vnorm == 0.0 ) || ( sum < vnorm * 1e-10 ) ) {
303 this->
t_supg = 1. / sqrt( 1. / ( t_sugn2 * t_sugn2 ) );
307 h_ugn = 2.0 * vnorm / sum;
310 t_sugn3 = h_ugn * h_ugn / 4.0 / nu;
312 this->
t_supg = 1. / sqrt( 1. / ( t_sugn1 * t_sugn1 ) + 1. / ( t_sugn2 * t_sugn2 ) + 1. / ( t_sugn3 * t_sugn3 ) );
315 Re_ugn = vnorm * h_ugn / ( 2. * nu );
316 z = ( Re_ugn <= 3. ) ? Re_ugn / 3. : 1.0;
317 this->
t_lsic = h_ugn * vnorm * z / 2.0;
325 this->
t_supg *= uscale / lscale;
326 this->
t_pspg *= 1. / ( lscale * dscale );
327 this->
t_lsic *= ( dscale * uscale ) / ( lscale * lscale );
349 double vn1 = sqrt( u.
at(1) * u.
at(1) + u.
at(2) * u.
at(2) + u.
at(3) * u.
at(3) );
350 double vn2 = sqrt( u.
at(4) * u.
at(4) + u.
at(5) * u.
at(5) + u.
at(6) * u.
at(6) );
351 double vn3 = sqrt( u.
at(7) * u.
at(7) + u.
at(8) * u.
at(8) + u.
at(9) * u.
at(9) );
352 double vn4 = sqrt( u.
at(10) * u.
at(10) + u.
at(11) * u.
at(11) + u.
at(12) * u.
at(12) );
353 double veln =
max( vn1,
max( vn2,
max(vn3, vn4) ) );
356 Node *inode, *jnode, *knode, *lnode;
358 for (
int l = 1; l <= 4; l++ ) {
359 int i = ( l > 3 ) ? 1 : l + 1;
360 int j = ( i > 3 ) ? 1 : i + 1;
361 int k = ( j > 3 ) ? 1 : j + 1;
382 return 0.5 * ln * ln * Re;
391 double determinant, weight, volume;
396 volume = determinant * weight;
405 double answer = 0.0,
norm, dV, vol = 0.0;
411 for (
int i = 1; i <= 4; i++ ) {
454 for (
int i = 1; i <= 4; i++ ) {
459 return ( voff.at(1) - voff.at(2) );
468 int neg = 0, pos = 0, zero = 0, si = 0;
472 for (
double ifi: fi ) {
475 }
else if ( ifi < 0. ) {
486 }
else if ( pos == 0 ) {
490 }
else if ( zero == 4 ) {
498 if (
max(pos, neg) == 3 ) {
500 for (
int i = 1; i <= 4; i++ ) {
501 if ( ( pos > neg ) && ( fi.at(i) < 0.0 ) ) {
506 if ( ( pos < neg ) && ( fi.at(i) >= 0.0 ) ) {
519 double t, xi [ 3 ], yi [ 3 ], zi [ 3 ];
521 for (
int i = 0; i < 3; i++ ) {
522 ii = ( si + i ) % 4 + 1;
523 t = fi.at(si) / ( fi.at(si) - fi.at(ii) );
530 double __vol = fabs( ( 1. / 6. ) * ( ( x1 - xi [ 0 ] ) * ( ( yi [ 1 ] - yi [ 0 ] ) * ( zi [ 2 ] - zi [ 0 ] ) - ( zi [ 1 ] - zi [ 0 ] ) * ( yi [ 2 ] - yi [ 0 ] ) ) +
531 ( y1 - yi [ 0 ] ) * ( ( zi [ 1 ] - zi [ 0 ] ) * ( xi [ 2 ] - xi [ 0 ] ) - ( xi [ 1 ] - xi [ 0 ] ) * ( zi [ 2 ] - zi [ 0 ] ) ) +
532 ( z1 - zi [ 0 ] ) * ( ( xi [ 1 ] - xi [ 0 ] ) * ( yi [ 2 ] - yi [ 0 ] ) - ( yi [ 1 ] - yi [ 0 ] ) * ( xi [ 2 ] - xi [ 0 ] ) ) ) );
536 if ( ( fabs(__vol) - vol ) < 0.0000001 ) {
537 __vol =
sgn(__vol) * vol;
540 if ( ( __vol < 0 ) || ( fabs(__vol) / vol > 1.0000001 ) ) {
546 answer.
at(2) =
min(fabs(__vol) / vol, 1.0);
547 answer.
at(1) = 1.0 - answer.
at(2);
550 answer.
at(1) =
min(fabs(__vol) / vol, 1.0);
551 answer.
at(2) = 1.0 - answer.
at(1);
556 }
else if (
max(pos, neg) == 2 ) {
560 for (
int i = 1; i <= 4; i++ ) {
561 if ( fi.at(i) >= 0.0 ) {
573 double p1i_x [ 3 ], p1i_y [ 3 ], p1i_z [ 3 ];
574 double p2i_x [ 3 ], p2i_y [ 3 ], p2i_z [ 3 ];
587 for (
int i = 0; i < 3; i++ ) {
588 ii = ( p1 + i ) % 4 + 1;
589 if ( ( ii == p2 ) || ( ii == p1 ) ) {
593 t = fi.at(p1) / ( fi.at(p1) - fi.at(ii) );
598 t = fi.at(p2) / ( fi.at(p2) - fi.at(ii) );
606 double __v1 = ( ( p2i_x [ 0 ] - p1i_x [ 0 ] ) * ( p1i_y [ 1 ] - p1i_y [ 0 ] ) * ( p1i_z [ 2 ] - p1i_z [ 0 ] ) -
607 ( p2i_x [ 0 ] - p1i_x [ 0 ] ) * ( p1i_y [ 2 ] - p1i_y [ 0 ] ) * ( p1i_z [ 1 ] - p1i_z [ 0 ] ) +
608 ( p1i_x [ 2 ] - p1i_x [ 0 ] ) * ( p2i_y [ 0 ] - p1i_y [ 0 ] ) * ( p1i_z [ 1 ] - p1i_z [ 0 ] ) -
609 ( p1i_x [ 1 ] - p1i_x [ 0 ] ) * ( p2i_y [ 0 ] - p1i_y [ 0 ] ) * ( p1i_z [ 2 ] - p1i_z [ 0 ] ) +
610 ( p1i_x [ 1 ] - p1i_x [ 0 ] ) * ( p1i_y [ 2 ] - p1i_y [ 0 ] ) * ( p2i_z [ 0 ] - p1i_z [ 0 ] ) -
611 ( p1i_x [ 2 ] - p1i_x [ 0 ] ) * ( p1i_y [ 1 ] - p1i_y [ 0 ] ) * ( p2i_z [ 0 ] - p1i_z [ 0 ] ) ) / 6.0;
613 double __v2 = ( ( p2i_x [ 0 ] - p1i_x [ 1 ] ) * ( p1i_y [ 2 ] - p1i_y [ 1 ] ) * ( p2i_z [ 1 ] - p1i_z [ 1 ] ) -
614 ( p2i_x [ 0 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 6.0;
627 double __vol = fabs(__v1) + fabs(__v2) + fabs(__v3);
630 if ( ( __vol < 0 ) || ( fabs(__vol) / vol > 1.0000001 ) ) {
634 answer.
at(1) =
min(fabs(__vol) / vol, 1.0);
635 answer.
at(2) = 1.0 - answer.
at(1);
660 EASValsSetEdgeFlag(
true);
662 EASValsSetFillStyle(FILL_SOLID);
677 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
678 EGAttachObject(go, ( EObjectP )
this);
679 EMAddGraphicsToModel(ESIModel(), go);
CrossSection * giveCrossSection()
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
IntArray dofManArray
Array containing dofmanager numbers.
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Computes vector product (or cross product) of vectors given as parameters, , and stores the result in...
virtual double LS_PCS_computeVolume()
Returns receiver's volume.
Domain * domain
Link to domain object, useful for communicating with other FEM components.
virtual void computeUDotGradUMatrix(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep)
double & at(int i)
Coefficient access function.
double giveLevelSetDofManValue(int i)
Returns level set value in specific node.
int max(int i, int j)
Returns bigger value form two given decimals.
double sgn(double i)
Returns the signum of given value (if value is < 0 returns -1, otherwise returns 1) ...
#define OOFEG_RAW_GEOMETRY_LAYER
Element interface for LevelSetPCS class representing level-set like material interface.
static FEI3dTetLin interpolation
virtual int giveNumberOfSpatialDimensions()
Base class for fluid problems.
EPixel getElementEdgeColor()
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual void computeDivUMatrix(FloatMatrix &answer, GaussPoint *gp)
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
virtual void computeDivTauMatrix(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep)
virtual int computeNumberOfDofs()
Computes or simply returns total number of element's local DOFs.
Tet1_3D_SUPG(int n, Domain *d)
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
virtual void computeGradPMatrix(FloatMatrix &answer, GaussPoint *gp)
virtual double giveCoordinate(int i)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
This abstract class represent a general base element class for fluid dynamic problems.
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be a - b.
double giveTimeIncrement()
Returns solution step associated time increment.
virtual void computeGradUMatrix(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep)
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
virtual void LS_PCS_computeVOFFractions(FloatArray &answer, FloatArray &fi)
Returns VOF fractions for each material on element according to nodal values of level set function (p...
virtual void computeVectorOfVelocities(ValueModeType mode, TimeStep *tStep, FloatArray &velocities)
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
virtual double giveVariableScale(VarScaleType varId)
Returns the scale factor for given variable type.
virtual void computeNuMatrix(FloatMatrix &answer, GaussPoint *gp)
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
double t_supg
Stabilization coefficients, updated for each solution step in updateStabilizationCoeffs() ...
Wrapper around element definition to provide FEICellGeometry interface.
virtual double computeCriticalTimeStep(TimeStep *tStep)
Computes the critical time increment.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
double at(int i, int j) const
Coefficient access function.
virtual void computeNpMatrix(FloatMatrix &answer, GaussPoint *gp)
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
void beNMatrixOf(const FloatArray &n, int nsd)
Assigns the receiver to be a repeated diagonal matrix.
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
virtual void LS_PCS_computedN(FloatMatrix &answer)
Returns gradient of shape functions.
Abstract base class representing Level Set representation of material interfaces. ...
virtual void updateStabilizationCoeffs(TimeStep *tStep)
Updates the stabilization coefficients used for CBS and SUPG algorithms.
double norm(const FloatArray &x)
virtual void computeBMatrix(FloatMatrix &anwer, GaussPoint *gp)
double computeNorm() const
Computes the norm (or length) of the vector.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual double LS_PCS_computeF(LevelSetPCS *, TimeStep *)
Evaluates F in level set equation of the form where for interface position driven by flow with speed...
void times(double s)
Multiplies receiver with scalar.
void beTranspositionOf(const FloatMatrix &src)
Assigns to the receiver the transposition of parameter.
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
virtual FloatArray * giveCoordinates()
void zero()
Zeroes all coefficient of receiver.
InterfaceType
Enumerative type, used to identify interface type.
int min(int i, int j)
Returns smaller value from two given decimals.
virtual double LS_PCS_computeS(LevelSetPCS *, TimeStep *)
Evaluates S in level set equation of the form where .
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class implementing node in finite element mesh.
double normalize()
Normalizes receiver.
Node * giveNode(int i) const
Returns reference to the i-th node of element.
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Class representing integration point in finite element program.
Class representing solution step.
int numberOfDofMans
Number of dofmanagers.
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Class representing Gaussian-quadrature integration rule.
void resize(int s)
Resizes receiver towards requested size.