65 #define TRSUPG_ZERO_VOF 1.e-8 167 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
173 for (
int i = 1; i <= 3; i++ ) {
174 for (
int j = 1; j <= 3; j++ ) {
176 _val = n.
at(i) * n.
at(j) * rho * dV;
177 answer.
at(2 * i - 1, 2 * j - 1) += _val;
178 answer.
at(2 * i, 2 * j) += _val;
181 u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
182 v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
183 answer.
at(2 * i - 1, 2 * j - 1) += ( u *
b [ i - 1 ] + v *
c [ j - 1 ] ) * n.
at(j) * rho *
t_supg * dV;
184 answer.
at(2 * i, 2 * j) += ( u *
b [ i - 1 ] + v *
c [ j - 1 ] ) * n.
at(j) * rho *
t_supg * dV;
199 double dudx, dudy, dvdx, dvdy, _u, _v;
204 dudx =
b [ 0 ] * u.
at(1) +
b [ 1 ] * u.
at(3) +
b [ 2 ] * u.
at(5);
205 dudy =
c [ 0 ] * u.
at(1) +
c [ 1 ] * u.
at(3) +
c [ 2 ] * u.
at(5);
206 dvdx =
b [ 0 ] * u.
at(2) +
b [ 1 ] * u.
at(4) +
b [ 2 ] * u.
at(6);
207 dvdy =
c [ 0 ] * u.
at(2) +
c [ 1 ] * u.
at(4) +
c [ 2 ] * u.
at(6);
210 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
216 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
217 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
220 for (
int i = 1; i <= 3; i++ ) {
221 answer.
at(2 * i - 1) += rho * n.
at(i) * ( _u * dudx + _v * dudy ) * dV;
222 answer.
at(2 * i) += rho * n.
at(i) * ( _u * dvdx + _v * dvdy ) * dV;
226 for (
int i = 1; i <= 3; i++ ) {
227 answer.
at(2 * i - 1) += ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( _u * dudx + _v * dudy ) * rho *
t_supg * dV;
228 answer.
at(2 * i) += ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( _u * dvdx + _v * dvdy ) * rho *
t_supg * dV;
245 int w_dof_addr, u_dof_addr, dij;
248 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
254 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
255 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
258 for (
int i = 1; i <= 2; i++ ) {
259 for (
int k = 1; k <= 3; k++ ) {
260 for (
int j = 1; j <= 2; j++ ) {
261 for (
int m = 1; m <= 3; m++ ) {
262 w_dof_addr = ( k - 1 ) * 2 + i;
263 u_dof_addr = ( m - 1 ) * 2 + j;
266 answer.
at(w_dof_addr, u_dof_addr) += dV * rho * n.
at(k) * ( dij * _u *
b [ m - 1 ] + dij * _v *
c [ m - 1 ] );
273 for (
int i = 1; i <= 2; i++ ) {
274 for (
int k = 1; k <= 3; k++ ) {
275 for (
int j = 1; j <= 2; j++ ) {
276 for (
int m = 1; m <= 3; m++ ) {
277 w_dof_addr = ( k - 1 ) * 2 + i;
278 u_dof_addr = ( m - 1 ) * 2 + j;
281 answer.
at(w_dof_addr, u_dof_addr) += dV *
t_supg * rho *
282 ( _u *
b [ k - 1 ] + _v *
c [ k - 1 ] ) * ( dij * _u *
b [ m - 1 ] + dij * _v *
c [ m - 1 ] );
307 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
321 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
322 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
324 for (
int i = 1; i <= 3; i++ ) {
325 answer.
at(2 * i - 1) -=
t_supg * ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( stress.
at(1) / _r ) * dV / Re;
326 answer.
at(2 * i) -=
t_supg * ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( stress.
at(4) / _r ) * dV / Re;
350 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
369 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
370 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
372 for (
int i = 1; i <= 3; i++ ) {
373 for (
int j = 1; j <= 6; j++ ) {
377 answer.
at(2 * i - 1, j) -=
t_supg * ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( _db.
at(1, j) / _r ) * dV;
378 answer.
at(2 * i, j) -=
t_supg * ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) * ( _db.
at(4, j) / _r ) * dV;
386 answer.
times(1. / Re);
400 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
406 for (
int i = 1; i <= 3; i++ ) {
407 for (
int j = 1; j <= 3; j++ ) {
408 answer.
at(2 * i - 1, j) -=
b [ i - 1 ] * n.
at(j) * dV;
409 answer.
at(2 * i, j) -=
c [ i - 1 ] * n.
at(j) * dV;
411 answer.
at(2 * i - 1, j) -= n.
at(i) * n.
at(j) * dV / _r;
416 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
417 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
418 for (
int i = 1; i <= 3; i++ ) {
419 for (
int j = 1; j <= 3; j++ ) {
420 answer.
at(2 * i - 1, j) += ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) *
b [ j - 1 ] * dV *
t_supg;
421 answer.
at(2 * i, j) += ( _u *
b [ i - 1 ] + _v *
c [ i - 1 ] ) *
c [ j - 1 ] * dV *
t_supg;
436 b [ 0 ],
c [ 0 ],
b [ 1 ], c [ 1 ], b [ 2 ], c [ 2 ]
439 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
444 for (
int i = 1; i <= 6; i++ ) {
445 for (
int j = 1; j <= 6; j++ ) {
446 answer.
at(i, j) += dV *
t_lsic * rho * n [ i - 1 ] * n [ j - 1 ];
462 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
467 for (
int i = 1; i <= 3; i++ ) {
468 for (
int j = 1; j <= 3; j++ ) {
469 answer.
at(j, 2 * i - 1) +=
b [ i - 1 ] * n.
at(j) * dV;
470 answer.
at(j, 2 * i) +=
c [ i - 1 ] * n.
at(j) * dV;
472 answer.
at(i, 1 + ( j - 1 ) * 2) += n.
at(i) * n.
at(j) * dV / _r;
483 double dudx, dudy, dvdx, dvdy, _u, _v;
491 dudx =
b [ 0 ] * u.
at(1) +
b [ 1 ] * u.
at(3) +
b [ 2 ] * u.
at(5);
492 dudy =
c [ 0 ] * u.
at(1) +
c [ 1 ] * u.
at(3) +
c [ 2 ] * u.
at(5);
493 dvdx =
b [ 0 ] * u.
at(2) +
b [ 1 ] * u.
at(4) +
b [ 2 ] * u.
at(6);
494 dvdy =
c [ 0 ] * u.
at(2) +
c [ 1 ] * u.
at(4) +
c [ 2 ] * u.
at(6);
496 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
501 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
502 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
504 for (
int i = 1; i <= 3; i++ ) {
505 answer.
at(i) +=
t_pspg * dV * (
b [ i - 1 ] * ( _u * dudx + _v * dudy ) +
c [ i - 1 ] * ( _u * dvdx + _v * dvdy ) );
517 int w_dof_addr, u_dof_addr, d1j, d2j, km1, mm1;
524 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
529 _u = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
530 _v = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
532 for (
int k = 1; k <= 3; k++ ) {
534 for (
int j = 1; j <= 2; j++ ) {
535 for (
int m = 1; m <= 3; m++ ) {
537 u_dof_addr = ( m - 1 ) * 2 + j;
541 answer.
at(w_dof_addr, u_dof_addr) +=
t_pspg * dV * (
b [ km1 ] * ( _u * d1j *
b [ mm1 ] + _v * d1j *
c [ mm1 ] ) +
c [ km1 ] * ( _u * d2j *
b [ mm1 ] + _v * d2j *
c [ mm1 ] ) );
563 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
571 stress.
times(1. / Re);
572 for (
int i = 1; i <= 3; i++ ) {
573 answer.
at(i) -=
t_pspg * (
b [ i - 1 ] * stress.
at(1) +
c [ i - 1 ] * stress.
at(4) ) * dV / rho / _r;
593 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
597 double rho = mat->
give(
'd', gp);
605 for (
int i = 1; i <= 3; i++ ) {
606 for (
int j = 1; j <= 6; j++ ) {
607 answer.
at(i, j) -=
t_pspg * (
b [ i - 1 ] * ( _db.
at(1, j) / _r ) +
c [ i - 1 ] * ( _db.
at(4, j) / _r ) ) * dV / rho;
613 answer.
times(1. / Re);
629 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
634 for (
int i = 1; i <= 3; i++ ) {
635 for (
int j = 1; j <= 3; j++ ) {
636 answer.
at(i, 2 * j - 1) +=
t_pspg * dV *
b [ i - 1 ] * n.
at(j);
637 answer.
at(i, 2 * j) +=
t_pspg * dV *
c [ i - 1 ] * n.
at(j);
650 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
653 double rho = mat->
give(
'd', gp);
657 for (
int i = 1; i <= 3; i++ ) {
658 for (
int j = 1; j <= 3; j++ ) {
659 answer.
at(i, j) +=
t_pspg * dV * (
b [ i - 1 ] *
b [ j - 1 ] +
c [ i - 1 ] *
c [ j - 1 ] ) / rho;
665 #ifdef TR1_2D_SUPG2_DEBUG 671 for (
int i = 1; i <= 3; i++ ) {
672 for (
int j = 1; j <= 3; j++ ) {
673 if ( fabs( ( answer.
at(i, j) - test.at(i, j) ) / test.at(i, j) ) >= 1.e-8 ) {
674 OOFEM_ERROR(
"test failure (err=%e)", ( answer.
at(i, j) - test.at(i, j) ) / test.at(i, j));
697 for (
int i = 1; i <= nLoads; i++ ) {
701 load->computeComponentArrayAt(gVector, tStep, VM_Total);
703 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
707 double coeff = rho * dV;
709 u = nV.
at(1) * un.
at(1) + nV.
at(2) * un.
at(3) + nV.
at(3) * un.
at(5);
710 v = nV.
at(1) * un.
at(2) + nV.
at(2) * un.
at(4) + nV.
at(3) * un.
at(6);
712 answer.
at(1) += coeff * ( gVector.
at(1) * ( nV.
at(1) +
t_supg * (
b [ 0 ] * u +
c [ 0 ] * v ) ) );
713 answer.
at(2) += coeff * ( gVector.
at(2) * ( nV.
at(1) +
t_supg * (
b [ 0 ] * u +
c [ 0 ] * v ) ) );
714 answer.
at(3) += coeff * ( gVector.
at(1) * ( nV.
at(2) +
t_supg * (
b [ 1 ] * u +
c [ 1 ] * v ) ) );
715 answer.
at(4) += coeff * ( gVector.
at(2) * ( nV.
at(2) +
t_supg * (
b [ 1 ] * u +
c [ 1 ] * v ) ) );
716 answer.
at(5) += coeff * ( gVector.
at(1) * ( nV.
at(3) +
t_supg * (
b [ 2 ] * u +
c [ 2 ] * v ) ) );
717 answer.
at(6) += coeff * ( gVector.
at(2) * ( nV.
at(3) +
t_supg * (
b [ 2 ] * u +
c [ 2 ] * v ) ) );
725 int n1, n2, code, sid;
726 double tx, ty, l, side_r;
736 n2 = ( n1 == 3 ? 1 : n1 + 1 );
740 l = sqrt(tx * tx + ty * ty);
749 for (
int i = 1; i <= numLoads; i++ ) {
762 answer.
at( ( n1 - 1 ) * 2 + 1 ) += t.
at(1) * side_r * l / 2.;
763 answer.
at(n1 * 2) += t.
at(2) * side_r * l / 2.;
765 answer.
at( ( n2 - 1 ) * 2 + 1 ) += t.
at(1) * side_r * l / 2.;
766 answer.
at(n2 * 2) += t.
at(2) * side_r * l / 2.;
785 for (
int i = 1; i <= nLoads; i++ ) {
791 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
794 double coeff =
t_pspg * dV;
796 answer.
at(1) += coeff * (
b [ 0 ] * gVector.
at(1) +
c [ 0 ] * gVector.
at(2) );
797 answer.
at(2) += coeff * (
b [ 1 ] * gVector.
at(1) +
c [ 1 ] * gVector.
at(2) );
798 answer.
at(3) += coeff * (
b [ 2 ] * gVector.
at(1) +
c [ 2 ] * gVector.
at(2) );
813 int i, j, k, l, w_dof_addr, u_dof_addr, ip, ifluid;
814 double __g_norm, __gamma_norm, __gammav_norm, __beta_norm, __betav_norm, __c_norm, __e_norm, __k_norm, __Re;
815 double __t_p1, __t_p2, __t_p3, __t_pv1, __t_pv2, __t_pv3;
816 double nu, nu0, nu1, usum, vsum, rho, dV, u1, u2;
829 nu =
vof * nu0 + ( 1. -
vof ) * nu1;
835 usum = un.
at(1) + un.
at(3) + un.
at(5);
836 vsum = un.
at(2) + un.
at(4) + un.
at(6);
842 double ar3 =
area / 3.0;
844 __tmp.
at(1, 1) = __tmp.
at(1, 2) = __tmp.
at(1, 3) =
b [ 0 ] * ar3;
845 __tmp.
at(3, 1) = __tmp.
at(3, 2) = __tmp.
at(3, 3) =
b [ 1 ] * ar3;
846 __tmp.
at(5, 1) = __tmp.
at(5, 2) = __tmp.
at(5, 3) =
b [ 2 ] * ar3;
848 __tmp.
at(2, 1) = __tmp.
at(2, 2) = __tmp.
at(2, 3) =
c [ 0 ] * ar3;
849 __tmp.
at(4, 1) = __tmp.
at(4, 2) = __tmp.
at(4, 3) =
c [ 1 ] * ar3;
850 __tmp.
at(6, 1) = __tmp.
at(6, 2) = __tmp.
at(6, 3) =
c [ 2 ] * ar3;
856 for ( k = 1; k <= 3; k++ ) {
857 for ( l = 1; l <= 3; l++ ) {
858 __tmp.
at(k, l * 2 - 1) = ar3 *
b [ k - 1 ] * ( usum *
b [ l - 1 ] + vsum *
c [ l - 1 ] );
859 __tmp.
at(k, l * 2) = ar3 *
c [ k - 1 ] * ( usum *
b [ l - 1 ] + vsum *
c [ l - 1 ] );
869 __tmp.
at(1, 1) = __tmp.
at(1, 3) = __tmp.
at(1, 5) = ar3 *
b [ 0 ];
870 __tmp.
at(1, 2) = __tmp.
at(1, 4) = __tmp.
at(1, 6) = ar3 *
c [ 0 ];
871 __tmp.
at(2, 1) = __tmp.
at(2, 3) = __tmp.
at(2, 5) = ar3 * b [ 1 ];
872 __tmp.
at(2, 2) = __tmp.
at(2, 4) = __tmp.
at(2, 6) = ar3 * c [ 1 ];
873 __tmp.
at(3, 1) = __tmp.
at(3, 3) = __tmp.
at(3, 5) = ar3 * b [ 2 ];
874 __tmp.
at(3, 2) = __tmp.
at(3, 4) = __tmp.
at(3, 6) = ar3 * c [ 2 ];
882 for ( ifluid = 0; ifluid < 2; ifluid++ ) {
888 u1 = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
889 u2 = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
890 for ( i = 1; i <= 2; i++ ) {
891 for ( k = 1; k <= 3; k++ ) {
892 for ( l = 1; l <= 3; l++ ) {
893 w_dof_addr = ( k - 1 ) * 2 + i;
894 u_dof_addr = ( l - 1 ) * 2 + i;
895 __tmp.
at(w_dof_addr, u_dof_addr) += rho * dV * n.
at(k) * ( u1 * b [ l - 1 ] + u2 * c [ l - 1 ] );
907 b [ 0 ], c [ 0 ], b [ 1 ], c [ 1 ], b [ 2 ], c [ 2 ]
909 for ( ifluid = 0; ifluid < 2; ifluid++ ) {
914 for ( i = 1; i <= 6; i++ ) {
915 for ( j = 1; j <= 6; j++ ) {
916 __tmp.
at(i, j) += dV * rho * __n [ i - 1 ] * __n [ j - 1 ];
927 for ( ifluid = 0; ifluid < 2; ifluid++ ) {
933 u1 = n.
at(1) * un.
at(1) + n.
at(2) * un.
at(3) + n.
at(3) * un.
at(5);
934 u2 = n.
at(1) * un.
at(2) + n.
at(2) * un.
at(4) + n.
at(3) * un.
at(6);
935 for ( k = 1; k <= 3; k++ ) {
936 for ( l = 1; l <= 3; l++ ) {
937 __tmp.
at(k * 2 - 1, l * 2 - 1) += rho * dV * ( u1 * b [ k - 1 ] + u2 * c [ k - 1 ] ) * ( u1 * b [ l - 1 ] + u2 * c [ l - 1 ] );
938 __tmp.
at(k * 2, l * 2) += rho * dV * ( u1 * b [ k - 1 ] + u2 * c [ k - 1 ] ) * ( u1 * b [ l - 1 ] + u2 * c [ l - 1 ] );
945 double u_1, u_2, vnorm = 0.;
947 for ( i = 1; i <= 3; i++ ) {
949 u_1 = u.
at( ( im1 ) * 2 + 1 );
950 u_2 = u.
at( ( im1 ) * 2 + 2 );
951 vnorm =
max( vnorm, sqrt(u_1 * u_1 + u_2 * u_2) );
954 if ( vnorm == 0.0 ) {
958 this->
t_supg = 1. / sqrt( 1. / ( t_sugn2 * t_sugn2 ) );
962 __Re = vnorm * vnorm * __c_norm / __k_norm / nu;
964 __t_p1 = __g_norm / __gamma_norm;
966 __t_p3 = __t_p1 * __Re;
967 this->
t_pspg = 1. / sqrt( 1. / ( __t_p1 * __t_p1 ) + 1. / ( __t_p2 * __t_p2 ) + 1. / ( __t_p3 * __t_p3 ) );
970 __t_pv2 = __t_pv1 * __gammav_norm / __betav_norm;
971 __t_pv3 = __t_pv1 * __Re;
972 this->
t_supg = 1. / sqrt( 1. / ( __t_pv1 * __t_pv1 ) + 1. / ( __t_pv2 * __t_pv2 ) + 1. / ( __t_pv3 * __t_pv3 ) );
974 this->
t_lsic = __c_norm / __e_norm;
979 double h_ugn, sum = 0.0, vnorm, t_sugn1, t_sugn2, t_sugn3, u_1, u_2, z, Re_ugn;
980 double dscale, uscale, lscale, tscale, dt;
1004 nu =
vof * nu0 + ( 1. -
vof ) * nu1;
1009 for (
int i = 1; i <= 3; i++ ) {
1011 sum += fabs(u.
at( ( im1 ) * 2 + 1 ) * b [ im1 ] / lscale + u.
at(im1 * 2 + 2) * c [ im1 ] / lscale);
1020 for (
int i = 1; i <= 3; i++ ) {
1022 u_1 = u.
at( ( im1 ) * 2 + 1 );
1023 u_2 = u.
at( ( im1 ) * 2 + 2 );
1024 vnorm =
max( vnorm, sqrt(u_1 * u_1 + u_2 * u_2) );
1027 if ( ( vnorm == 0.0 ) || ( sum < vnorm * 1e-10 ) ) {
1031 this->
t_supg = 1. / sqrt( 1. / ( t_sugn2 * t_sugn2 ) );
1035 h_ugn = 2.0 * vnorm / sum;
1038 t_sugn3 = h_ugn * h_ugn / 4.0 / nu;
1040 this->
t_supg = 1. / sqrt( 1. / ( t_sugn1 * t_sugn1 ) + 1. / ( t_sugn2 * t_sugn2 ) + 1. / ( t_sugn3 * t_sugn3 ) );
1043 Re_ugn = vnorm * h_ugn / ( 2. * nu );
1044 z = ( Re_ugn <= 3. ) ? Re_ugn / 3. : 1.0;
1045 this->
t_lsic = h_ugn * vnorm * z / 2.0;
1053 this->
t_supg *= uscale / lscale;
1054 this->
t_pspg *= 1. / ( lscale * dscale );
1055 this->
t_lsic *= ( dscale * uscale ) / ( lscale * lscale );
1090 for (
int i = 1; i <= 3; i++ ) {
1137 if ( answer > 1.000000001 ) {
1138 OOFEM_WARNING(
"VOF fraction out of bounds, vof = %e\n", answer);
1157 for (
int i = 1; i <= 3; i++ ) {
1183 double nx = normal.
at(1), ny = normal.
at(2), x, y;
1189 for (
int i = 1; i <= 3; i++ ) {
1198 if ( ( nx * x + ny * y + p ) >= 0. ) {
1199 nodeIn [ i - 1 ] =
true;
1201 nodeIn [ i - 1 ] =
false;
1205 if ( nodeIn [ 0 ] && nodeIn [ 1 ] && nodeIn [ 2 ] ) {
1206 for (
int i = 1; i <= 3; i++ ) {
1220 }
else if ( !( nodeIn [ 0 ] || nodeIn [ 1 ] || nodeIn [ 2 ] ) ) {
1223 for (
int i = 1; i <= 3; i++ ) {
1224 next = i < 3 ? i + 1 : 1;
1225 if ( nodeIn [ i - 1 ] ) {
1231 this->
giveNode(i)->giveCoordinate(2) );
1237 if ( nodeIn [ next - 1 ] ^ nodeIn [ i - 1 ] ) {
1251 double s, sd = nx * tx + ny * ty;
1252 if ( fabs(sd) > 1.e-10 ) {
1253 s = ( -p - ( nx * x + ny * y ) ) / sd;
1258 if ( nodeIn [ i - 1 ] ) {
1296 double nx = normal.
at(1), ny = normal.
at(2), x, y;
1300 rfPoints = sfPoints = 0;
1301 referenceFluidPoly.
clear();
1302 secondFluidPoly.
clear();
1304 for (
int i = 1; i <= 3; i++ ) {
1308 if ( ( nx * x + ny * y + p ) >= 0. ) {
1309 nodeIn [ i - 1 ] =
true;
1311 nodeIn [ i - 1 ] =
false;
1315 if ( nodeIn [ 0 ] && nodeIn [ 1 ] && nodeIn [ 2 ] ) {
1316 for (
int i = 1; i <= 3; i++ ) {
1326 }
else if ( !( nodeIn [ 0 ] || nodeIn [ 1 ] || nodeIn [ 2 ] ) ) {
1327 for (
int i = 1; i <= 3; i++ ) {
1338 for (
int i = 1; i <= 3; i++ ) {
1339 next = i < 3 ? i + 1 : 1;
1340 if ( nodeIn [ i - 1 ] ) {
1342 this->
giveNode(i)->giveCoordinate(2) );
1348 this->
giveNode(i)->giveCoordinate(2) );
1354 if ( nodeIn [ next - 1 ] ^ nodeIn [ i - 1 ] ) {
1361 double s, sd = nx * tx + ny * ty;
1362 if ( fabs(sd) > 1.e-10 ) {
1363 s = ( -p - ( nx * x + ny * y ) ) / sd;
1371 if ( nodeIn [ i - 1 ] ) {
1401 g.
clip(clip, me, matvolpoly);
1403 EASValsSetColor(
gc [ 0 ].getActiveCrackColor() );
1409 return volume /
area;
1420 for (
int i = 1; i <= 3; i++ ) {
1438 double x1, x2, x3, y1, y2, y3;
1447 return 0.5 * ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 );
1461 for (
int i = 1; i <= 3; i++ ) {
1466 for (
int i = 1; i <= 3; i++ ) {
1472 center.
times(1. / 3.);
1483 for (
int i = 0; i < 2; i++ ) {
1488 for (
int i = 1; i <= 3; i++ ) {
1497 for (
int i = 1; i <= 3; i++ ) {
1518 for (
int i = 0; i < 2; i++ ) {
1519 if ( c [ i ] == 3 ) {
1521 approx = & triaApprox;
1522 }
else if ( c [ i ] == 4 ) {
1524 approx = & quadApprox;
1525 }
else if ( c [ i ] == 0 ) {
1528 OOFEM_ERROR(
"cannot set up integration domain for %d vertex polygon", c [ i ]);
1532 vcoords [ i ].reserve( c [ i ] );
1553 gp->setSubPatchCoordinates( gp->giveNaturalCoordinates() );
1554 gp->setNaturalCoordinates(lc);
1560 double dV, __area = 0.0;
1561 for (
int ifluid = 0; ifluid < 2; ifluid++ ) {
1601 return n1 * r1 + n2 * r2 + n3 * r3;
1618 return _r * det * weight;
1628 _b.
at(1, 1) =
b [ 0 ];
1630 _b.
at(1, 3) =
b [ 1 ];
1632 _b.
at(1, 5) =
b [ 2 ];
1634 _b.
at(2, 1) = 1. / _r;
1636 _b.
at(2, 3) = 1. / _r;
1638 _b.
at(2, 5) = 1. / _r;
1641 _b.
at(3, 2) =
c [ 0 ];
1643 _b.
at(3, 4) =
c [ 1 ];
1645 _b.
at(3, 6) =
c [ 2 ];
1646 _b.
at(4, 1) =
c [ 0 ];
1647 _b.
at(4, 2) =
b [ 0 ];
1648 _b.
at(4, 3) =
c [ 1 ];
1649 _b.
at(4, 4) =
b [ 1 ];
1650 _b.
at(4, 5) =
c [ 2 ];
1651 _b.
at(4, 6) =
b [ 2 ];
1778 EASValsSetEdgeFlag(
true);
1790 go = CreateTriangle3D(p);
1791 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
1792 EGAttachObject(go, ( EObjectP )
this);
1793 EMAddGraphicsToModel(ESIModel(), go);
1798 int i, indx, result = 0;
1851 if ( result != 3 ) {
1857 s [ 0 ] = v1.
at(indx);
1858 s [ 1 ] = v2.
at(indx);
1859 s [ 2 ] = v3.
at(indx);
1862 for ( i = 0; i < 3; i++ ) {
1870 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
1871 EGWithMaskChangeAttributes(LAYER_MASK, tr);
1872 EMAddGraphicsToModel(ESIModel(), tr);
1876 for ( i = 0; i < 3; i++ ) {
1879 p [ i ].z = s [ i ] * landScale;
1885 EASValsSetFillStyle(FILL_SOLID);
1886 tr = CreateTriangle3D(p);
1887 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | FILL_MASK | LAYER_MASK, tr);
1890 EASValsSetFillStyle(FILL_SOLID);
1891 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
1892 EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
1895 EMAddGraphicsToModel(ESIModel(), tr);
CrossSection * giveCrossSection()
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
void computeNMtrx(FloatArray &answer, GaussPoint *gp)
integrationDomain
Used by integrator class to supply integration points for proper domain to be integrated (Area...
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void giveUpdatedCoordinate(FloatArray &answer, int num)
Returns updated nodal positions.
EPixel getStandardSparseProfileColor()
IntArray * giveBoundaryLoadArray()
Returns array containing load numbers of boundary loads acting on element.
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
ScalarAlgorithmType getScalarAlgo()
virtual void computeDiffusionDerivativeTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes diffusion derivative terms for mass conservation equation.
#define FMElement_PrescribedTractionBC
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Abstract base class for all fluid materials.
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Wrapper around cell with vertex coordinates stored in FloatArray**.
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep)
Returns internal state variable (like stress,strain) at node of element in Reduced form...
double computeVolume() const
const FloatArray & giveSubPatchCoordinates()
Returns local sub-patch coordinates of the receiver.
#define _IFT_Tr1SUPG_pvof
bcGeomType
Type representing the geometric character of loading.
double & at(int i)
Coefficient access function.
int max(int i, int j)
Returns bigger value form two given decimals.
virtual void computeLSICStabilizationTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes SLIC stabilization term for momentum balance equation(s).
virtual void computeAdvectionDerivativeTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes the derivative of advection terms for momentum balance equations(s) with respect to nodal ve...
#define OOFEG_RAW_GEOMETRY_LAYER
void setPermanentVolumeFraction(double v)
virtual void formMyVolumePoly(Polygon &myPoly, LEPlic *mat_interface, bool updFlag)
Assembles receiver volume.
Base class for fluid problems.
EPixel getElementEdgeColor()
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
IntArray boundarySides
Array of boundary sides.
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
double giveUpdatedYCoordinate(int num)
virtual void computeDiffusionTerm_MC(FloatArray &answer, TimeStep *tStep)
Computes diffusion terms for mass conservation equation.
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
void computeNVector(FloatArray &answer, GaussPoint *gp)
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes boundary condition value - its components values at given time.
std::vector< FloatArray > vcoords[2]
virtual void computePressureTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes pressure terms for momentum balance equations(s).
virtual double giveCoordinate(int i)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
MatResponseMode
Describes the character of characteristic material matrix.
virtual void computePressureTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes pressure terms for mass conservation equation.
void updateVolumePolygons(Polygon &referenceFluidPoly, Polygon &secondFluidPoly, int &rfPoints, int &sfPoints, const FloatArray &normal, const double p, bool updFlag)
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
const FloatArray * getCoords() const
double giveTimeIncrement()
Returns solution step associated time increment.
EPixel getDeformedElementColor()
Class representing a general abstraction for finite element interpolation class.
virtual void formMaterialVolumePoly(Polygon &matvolpoly, LEPlic *matInterface, const FloatArray &normal, const double p, bool updFlag)
Assembles the true element material polygon (takes receiver vof into accout).
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property 'aProperty'.
InternalStateType giveIntVarType()
virtual void computeAccelerationTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes acceleration terms for mass conservation equation.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
double giveNaturalCoordinate(int i) const
Returns i-th natural element coordinate of receiver.
virtual void updateStabilizationCoeffs(TimeStep *tStep)
Updates the stabilization coefficients used for CBS and SUPG algorithms.
Class representing a 2d triangular linear interpolation based on area coordinates.
virtual void computeDeviatoricStressVector(FloatArray &stress_dev, double &epsp_vol, GaussPoint *gp, const FloatArray &eps, double pressure, TimeStep *tStep)
Computes the deviatoric stress vector and volumetric strain rate from given deviatoric strain and pre...
Abstract base class representing a boundary load (force, momentum, ...) that acts directly on a bound...
virtual ~TR1_2D_SUPG2_AXI()
virtual void computeAdvectionTerm_MC(FloatArray &answer, TimeStep *tStep)
Computes advection terms for mass conservation equation.
virtual void computeVectorOfVelocities(ValueModeType mode, TimeStep *tStep, FloatArray &velocities)
virtual double giveVariableScale(VarScaleType varId)
Returns the scale factor for given variable type.
virtual void initGeometry()
int material
Number of associated material.
void updateIntegrationRules()
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
void clip(Polygon &result, const Polygon &a, const Polygon &b)
void times(double f)
Multiplies receiver by factor f.
virtual void computeAdvectionDerivativeTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes the derivative of advection terms for mass conservation equation with respect to nodal veloc...
double t_supg
Stabilization coefficients, updated for each solution step in updateStabilizationCoeffs() ...
Wrapper around element definition to provide FEICellGeometry interface.
IntArray * giveBodyLoadArray()
Returns array containing load numbers of loads acting on element.
virtual void computeLinearAdvectionTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes the linear advection term for mass conservation equation.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
IntArray bodyLoadArray
Array containing indexes of loads (body loads and boundary loads are kept separately), that apply on receiver.
virtual void computeDiffusionTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes diffusion terms for momentum balance equations(s).
Class representing the special graph constructed from two polygons that is used to perform boolean op...
virtual int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Default implementation using Newton's method to find the local coordinates.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
virtual void computeBCRhsTerm_MC(FloatArray &answer, TimeStep *tStep)
Computes Rhs terms due to boundary conditions.
virtual double truncateMatVolume(const Polygon &matvolpoly, double &volume)
Truncates given material polygon to receiver.
virtual double computeCriticalTimeStep(TimeStep *tStep)
Computes the critical time increment.
virtual void computeBCRhsTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes Rhs terms due to boundary conditions.
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
InternalStateMode giveIntVarMode()
virtual double computeMyVolume(LEPlic *matInterface, bool updFlag)
Computes the volume of receiver.
virtual void computeDeviatoricStress(FloatArray &answer, GaussPoint *gp, TimeStep *)
double computeRadiusAt(GaussPoint *gp)
Abstract base class representing Lagrangian-Eulerian (moving) material interfaces.
virtual void computeDiffusionDerivativeTerm_MB(FloatMatrix &answer, MatResponseMode mode, TimeStep *tStep)
Computes the derivative of diffusion terms for momentum balance equations(s) with respect to nodal ve...
Class representing vector of real numbers.
void computeBMtrx(FloatMatrix &answer, GaussPoint *gp)
virtual double computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag)
Computes corresponding volume fraction to given interface position.
Class representing 2D polygon.
Implementation of matrix containing floating point numbers.
double computeFrobeniusNorm() const
Computes the Frobenius norm of the receiver.
IRResultType
Type defining the return values of InputRecord reading operations.
#define _IFT_Tr1SUPG2_mat0
void setCoords(double x, double y)
double giveVolumeFraction()
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
#define _IFT_Tr1SUPG2_mat1
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 void computeAdvectionTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes nonlinear advection terms for momentum balance equations(s).
double giveUpdatedXCoordinate(int num)
virtual void formVolumeInterfacePoly(Polygon &matvolpoly, LEPlic *matInterface, const FloatArray &normal, const double p, bool updFlag)
Assembles receiver material polygon based solely on given interface line.
void zero()
Zeroes all coefficients of receiver.
virtual bcGeomType giveBCGeoType() const
Returns geometry character of boundary condition.
Polygon myPoly[2]
myPoly[0] Occupied by reference fluid.
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
IntArray boundaryCodes
Boundary sides codes.
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
virtual void computeAccelerationTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes acceleration terms (generalized mass matrix with stabilization terms) for momentum balance e...
void times(double s)
Multiplies receiver with scalar.
int mat[2]
mat[0] reference fluid mat[1] second fluid
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
Material * _giveMaterial(int indx)
Class representing vertex.
double vof
Volume fraction of reference fluid in element.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
void zero()
Zeroes all coefficient of receiver.
void updateFringeTableMinMax(double *s, int size)
Class representing 2d linear triangular element for solving incompressible fluid with SUPG solver...
#define OOFEG_DEBUG_LAYER
Load is base abstract class for all loads.
double p
Line constant of line segment representing interface.
Class representing a 2d isoparametric linear interpolation based on natural coordinates for quadrilat...
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
GraphicObj * draw(oofegGraphicContext &, bool filled, int layer=OOFEG_DEBUG_LAYER)
int giveSize() const
Returns the size of receiver.
TR1_2D_SUPG2_AXI(int n, Domain *d)
double computeVolumeAroundID(GaussPoint *gp, integrationDomain id, const std::vector< FloatArray > &idpoly)
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual bcValType giveBCValType() const
Returns receiver load type.
virtual void giveElementCenter(LEPlic *mat_interface, FloatArray ¢er, bool updFlag)
Computes the receiver center (in updated Lagrangian configuration).
Node * giveNode(int i) const
Returns reference to the i-th node of element.
virtual void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
Computes components values of load at given point - global coordinates (coordinates given)...
Load * giveLoad(int n)
Service for accessing particular domain load.
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
IntArray boundaryLoadArray
FloatArray normal
Interface segment normal.
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep)
Returns internal state variable (like stress,strain) at node of element in Reduced form...
Class representing solution step.
int numberOfDofMans
Number of dofmanagers.
InternalStateMode
Determines the mode of internal variable.
void add(const FloatArray &src)
Adds array src to receiver.
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates global coordinates from given local ones.
virtual void computePressureTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes pressure terms for mass conservation equation.
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Class representing Gaussian-quadrature integration rule.
void resize(int s)
Resizes receiver towards requested size.
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Adds the product .
virtual void giveDeviatoricStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)=0
Computes the deviatoric stiffness; .