OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
tr1_2d_supg.C
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 #include "tr1_2d_supg.h"
36 #include "fei2dtrlin.h"
37 #include "fluidmodel.h"
38 #include "node.h"
39 #include "material.h"
40 #include "gausspoint.h"
41 #include "gaussintegrationrule.h"
42 #include "floatmatrix.h"
43 #include "floatarray.h"
44 #include "intarray.h"
45 #include "domain.h"
46 #include "mathfem.h"
47 #include "engngm.h"
48 #include "fluiddynamicmaterial.h"
49 #include "fluidcrosssection.h"
50 #include "load.h"
51 #include "timestep.h"
52 #include "boundaryload.h"
53 #include "geotoolbox.h"
54 #include "materialinterface.h"
55 #include "contextioerr.h"
56 #include "reinforcement.h"
57 #include "crosssection.h"
58 #include "dynamicinputrecord.h"
59 #include "classfactory.h"
60 
61 #ifdef __OOFEG
62  #include "oofeggraphiccontext.h"
63  #include "connectivitytable.h"
64 #endif
65 
66 namespace oofem {
67 #define TRSUPG_ZERO_VOF 1.e-8
68 
69 REGISTER_Element(TR1_2D_SUPG);
70 
71 FEI2dTrLin TR1_2D_SUPG :: interp(1, 2);
72 
75 {
76  numberOfDofMans = 3;
77 }
78 
80 { }
81 
82 int
84 {
85  return 9;
86 }
87 
88 void
90 {
91  answer = {V_u, V_v, P_f};
92 }
93 
96 
99 {
100  IRResultType result; // Required by IR_GIVE_FIELD macro
101 
102  this->vof = 0.0;
104  if ( vof > 0.0 ) {
106  this->temp_vof = vof;
107  } else {
108  this->vof = 0.0;
110  this->temp_vof = this->vof;
111  }
112 
113  result = SUPGElement :: initializeFrom(ir);
114  if ( result != IRRT_OK ) {
115  return result;
116  }
117  this->initGeometry();
118  return IRRT_OK;
119 }
120 
121 
122 void
124 {
126  if ( this->permanentVofFlag ) {
127  input.setField(this->vof, _IFT_Tr1SUPG_pvof);
128  } else {
129  input.setField(this->vof, _IFT_Tr1SUPG_vof);
130  }
131 }
132 
133 
134 void
136 // Sets up the array containing the four Gauss points of the receiver.
137 {
138  if ( integrationRulesArray.size() == 0 ) {
139  integrationRulesArray.resize(1);
140  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 3) );
142  }
143 }
144 
145 
146 void
148 {
149  answer.resize(6, 6);
150  answer.zero();
151  FloatArray un;
152  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
153 
154  double ar6 = rho * area / 6.0;
155  double ar12 = rho * area / 12.0;
156  double usum, vsum, coeff;
157 
158  /* consistent mass */
159 
160  answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = ar6;
161  answer.at(4, 4) = answer.at(5, 5) = answer.at(6, 6) = ar6;
162 
163  answer.at(1, 3) = answer.at(1, 5) = ar12;
164  answer.at(3, 1) = answer.at(3, 5) = ar12;
165  answer.at(5, 1) = answer.at(5, 3) = ar12;
166 
167  answer.at(2, 4) = answer.at(2, 6) = ar12;
168  answer.at(4, 2) = answer.at(4, 6) = ar12;
169  answer.at(6, 2) = answer.at(6, 4) = ar12;
170 
171  /* SUPG stabilization term */
172  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
173 
174  usum = un.at(1) + un.at(3) + un.at(5);
175  vsum = un.at(2) + un.at(4) + un.at(6);
176  coeff = rho * t_supg * area / 12.;
177 
178  answer.at(1, 1) += coeff * ( b [ 0 ] * ( usum + un.at(1) ) + c [ 0 ] * ( vsum + un.at(2) ) );
179  answer.at(1, 3) += coeff * ( b [ 0 ] * ( usum + un.at(3) ) + c [ 0 ] * ( vsum + un.at(4) ) );
180  answer.at(1, 5) += coeff * ( b [ 0 ] * ( usum + un.at(5) ) + c [ 0 ] * ( vsum + un.at(6) ) );
181 
182  answer.at(2, 2) += coeff * ( b [ 0 ] * ( usum + un.at(1) ) + c [ 0 ] * ( vsum + un.at(2) ) );
183  answer.at(2, 4) += coeff * ( b [ 0 ] * ( usum + un.at(3) ) + c [ 0 ] * ( vsum + un.at(4) ) );
184  answer.at(2, 6) += coeff * ( b [ 0 ] * ( usum + un.at(5) ) + c [ 0 ] * ( vsum + un.at(6) ) );
185 
186  answer.at(3, 1) += coeff * ( b [ 1 ] * ( usum + un.at(1) ) + c [ 1 ] * ( vsum + un.at(2) ) );
187  answer.at(3, 3) += coeff * ( b [ 1 ] * ( usum + un.at(3) ) + c [ 1 ] * ( vsum + un.at(4) ) );
188  answer.at(3, 5) += coeff * ( b [ 1 ] * ( usum + un.at(5) ) + c [ 1 ] * ( vsum + un.at(6) ) );
189 
190  answer.at(4, 2) += coeff * ( b [ 1 ] * ( usum + un.at(1) ) + c [ 1 ] * ( vsum + un.at(2) ) );
191  answer.at(4, 4) += coeff * ( b [ 1 ] * ( usum + un.at(3) ) + c [ 1 ] * ( vsum + un.at(4) ) );
192  answer.at(4, 6) += coeff * ( b [ 1 ] * ( usum + un.at(5) ) + c [ 1 ] * ( vsum + un.at(6) ) );
193 
194  answer.at(5, 1) += coeff * ( b [ 2 ] * ( usum + un.at(1) ) + c [ 2 ] * ( vsum + un.at(2) ) );
195  answer.at(5, 3) += coeff * ( b [ 2 ] * ( usum + un.at(3) ) + c [ 2 ] * ( vsum + un.at(4) ) );
196  answer.at(5, 5) += coeff * ( b [ 2 ] * ( usum + un.at(5) ) + c [ 2 ] * ( vsum + un.at(6) ) );
197 
198  answer.at(6, 2) += coeff * ( b [ 2 ] * ( usum + un.at(1) ) + c [ 2 ] * ( vsum + un.at(2) ) );
199  answer.at(6, 4) += coeff * ( b [ 2 ] * ( usum + un.at(3) ) + c [ 2 ] * ( vsum + un.at(4) ) );
200  answer.at(6, 6) += coeff * ( b [ 2 ] * ( usum + un.at(5) ) + c [ 2 ] * ( vsum + un.at(6) ) );
201 }
202 
203 
204 void
206 {
207  answer.resize(6);
208  answer.zero();
209 
210  FloatArray u, un;
211  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
212  double dudx, dudy, dvdx, dvdy, usum, vsum, coeff;
213  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
214  this->computeVectorOfVelocities(VM_Total, tStep, u);
215 
216  dudx = b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5);
217  dudy = c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5);
218  dvdx = b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6);
219  dvdy = c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6);
220 
221  usum = un.at(1) + un.at(3) + un.at(5);
222  vsum = un.at(2) + un.at(4) + un.at(6);
223  coeff = rho * area / 12.0;
224 
225  // standard galerkin term
226  answer.at(1) = coeff * ( dudx * ( usum + un.at(1) ) + dudy * ( vsum + un.at(2) ) );
227  answer.at(3) = coeff * ( dudx * ( usum + un.at(3) ) + dudy * ( vsum + un.at(4) ) );
228  answer.at(5) = coeff * ( dudx * ( usum + un.at(5) ) + dudy * ( vsum + un.at(6) ) );
229  answer.at(2) = coeff * ( dvdx * ( usum + un.at(1) ) + dvdy * ( vsum + un.at(2) ) );
230  answer.at(4) = coeff * ( dvdx * ( usum + un.at(3) ) + dvdy * ( vsum + un.at(4) ) );
231  answer.at(6) = coeff * ( dvdx * ( usum + un.at(5) ) + dvdy * ( vsum + un.at(6) ) );
232 
233  // supg stabilization term
234  coeff = t_supg * rho * area / 12.0;
235  double u1u1 = usum * usum + un.at(1) * un.at(1) + un.at(3) * un.at(3) + un.at(5) * un.at(5);
236  double u1u2 = usum * vsum + un.at(1) * un.at(2) + un.at(3) * un.at(4) + un.at(5) * un.at(6);
237  double u2u2 = vsum * vsum + un.at(2) * un.at(2) + un.at(4) * un.at(4) + un.at(6) * un.at(6);
238  answer.at(1) += coeff * ( b [ 0 ] * ( dudx * u1u1 + dudy * u1u2 ) + c [ 0 ] * ( dudx * u1u2 + dudy * u2u2 ) );
239  answer.at(3) += coeff * ( b [ 1 ] * ( dudx * u1u1 + dudy * u1u2 ) + c [ 1 ] * ( dudx * u1u2 + dudy * u2u2 ) );
240  answer.at(5) += coeff * ( b [ 2 ] * ( dudx * u1u1 + dudy * u1u2 ) + c [ 2 ] * ( dudx * u1u2 + dudy * u2u2 ) );
241 
242  answer.at(2) += coeff * ( b [ 0 ] * ( dvdx * u1u1 + dvdy * u1u2 ) + c [ 0 ] * ( dvdx * u1u2 + dvdy * u2u2 ) );
243  answer.at(4) += coeff * ( b [ 1 ] * ( dvdx * u1u1 + dvdy * u1u2 ) + c [ 1 ] * ( dvdx * u1u2 + dvdy * u2u2 ) );
244  answer.at(6) += coeff * ( b [ 2 ] * ( dvdx * u1u1 + dvdy * u1u2 ) + c [ 2 ] * ( dvdx * u1u2 + dvdy * u2u2 ) );
245 }
246 
247 
248 void
250 {
251  answer.resize(6, 6);
252  answer.zero();
253 
254  FloatArray u, un;
255  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
256  this->computeVectorOfVelocities(VM_Total, tStep, u);
257  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
258 
259  double dudx [ 2 ] [ 2 ], usum [ 2 ];
260  double coeff, ar12 = area / 12.;
261  int w_dof_addr, u_dof_addr, d1j, d2j, dij;
262 
263  dudx [ 0 ] [ 0 ] = b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5);
264  dudx [ 0 ] [ 1 ] = c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5);
265  dudx [ 1 ] [ 0 ] = b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6);
266  dudx [ 1 ] [ 1 ] = c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6);
267  usum [ 0 ] = un.at(1) + un.at(3) + un.at(5);
268  usum [ 1 ] = un.at(2) + un.at(4) + un.at(6);
269 
270  // dN(v)/dv
271  for ( int i = 1; i <= 2; i++ ) { // test function index
272  for ( int k = 1; k <= 3; k++ ) { // nodal val of function w
273  for ( int j = 1; j <= 2; j++ ) { // velocity vector component
274  for ( int m = 1; m <= 3; m++ ) { // nodal components
275  w_dof_addr = ( k - 1 ) * 2 + i;
276  u_dof_addr = ( m - 1 ) * 2 + j;
277  d1j = ( j == 1 );
278  d2j = ( j == 2 );
279  dij = ( i == j );
280  coeff = ( m == k ) ? area / 6. : area / 12.;
281  answer.at(w_dof_addr, u_dof_addr) = rho * ( 0.0 * d1j * dudx [ i - 1 ] [ 0 ] * coeff + dij * b [ m - 1 ] * ar12 * ( usum [ 0 ] + un.at( ( k - 1 ) * 2 + 1 ) ) +
282  0.0 * d2j * dudx [ i - 1 ] [ 1 ] * coeff + dij * c [ m - 1 ] * ar12 * ( usum [ 1 ] + un.at( ( k - 1 ) * 2 + 2 ) ) );
283  }
284  }
285  }
286  }
287 
288  // stabilization term dN_delta/du
289  for ( int i = 1; i <= 2; i++ ) { // test function index
290  for ( int k = 1; k <= 3; k++ ) { // nodal val of function w
291  for ( int j = 1; j <= 2; j++ ) { // velocity vector component
292  for ( int m = 1; m <= 3; m++ ) { // nodal components
293  w_dof_addr = ( k - 1 ) * 2 + i;
294  u_dof_addr = ( m - 1 ) * 2 + j;
295  d1j = ( j == 1 );
296  d2j = ( j == 2 );
297  dij = ( i == j );
298  answer.at(w_dof_addr, u_dof_addr) += t_supg * rho *
299  (
300  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
301  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
302  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
303  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
304 
305  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
306  dij * b [ k - 1 ] * b [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 0 ] + un.at(1) * un.at(1) + un.at(3) * un.at(3) + un.at(5) * un.at(5) ) +
307  0.0 * d2j * b [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
308  dij * b [ k - 1 ] * c [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 1 ] + un.at(1) * un.at(2) + un.at(3) * un.at(4) + un.at(5) * un.at(6) ) +
309 
310  0.0 * d1j * c [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
311  dij * c [ k - 1 ] * b [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 1 ] + un.at(1) * un.at(2) + un.at(3) * un.at(4) + un.at(5) * un.at(6) ) +
312  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
313  dij * c [ k - 1 ] * c [ m - 1 ] * ar12 * ( usum [ 1 ] * usum [ 1 ] + un.at(2) * un.at(2) + un.at(4) * un.at(4) + un.at(6) * un.at(6) )
314  );
315  }
316  }
317  }
318  }
319 }
320 
321 
322 void
324 {
325  answer.resize(6);
326  answer.zero();
327  FloatArray u, eps(3), stress;
328  double Re = static_cast< FluidModel * >( domain->giveEngngModel() )->giveReynoldsNumber();
329 
330  this->computeVectorOfVelocities(VM_Total, tStep, u);
331 
332  eps.at(1) = ( b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5) );
333  eps.at(2) = ( c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6) );
334  eps.at(3) = ( b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6) + c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5) );
335  static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->computeDeviatoricStressVector(
336  stress, integrationRulesArray [ 0 ]->getIntegrationPoint(0), eps, tStep);
337  stress.times(1. / Re);
338 
339  // \int dNu/dxj \Tau_ij
340  answer.resize(6);
341  for ( int i = 0; i < 3; i++ ) {
342  //rh1p(1,lok) = -geome(7,ia)*( sigxx(ia)*geome(lok,ia) + sigxy(ia)*geome(lok1,ia) )*0.5d+00;
343  //rh1p(2,lok) = -geome(7,ia)*( sigxy(ia)*geome(lok,ia) + sigyy(ia)*geome(lok1,ia) )*0.5d+00;
344  answer.at( ( i ) * 2 + 1 ) = area * ( stress.at(1) * b [ i ] + stress.at(3) * c [ i ] );
345  answer.at( ( i + 1 ) * 2 ) = area * ( stress.at(3) * b [ i ] + stress.at(2) * c [ i ] );
346  }
347 }
348 
349 
350 void
352 {
353  FloatMatrix _db, _d, _b(3, 6);
354  double Re = static_cast< FluidModel * >( domain->giveEngngModel() )->giveReynoldsNumber();
355 
356  _b.at(1, 1) = b [ 0 ];
357  _b.at(1, 2) = 0.;
358  _b.at(1, 3) = b [ 1 ];
359  _b.at(1, 4) = 0.;
360  _b.at(1, 5) = b [ 2 ];
361  _b.at(1, 6) = 0.;
362  _b.at(2, 1) = 0.;
363  _b.at(2, 2) = c [ 0 ];
364  _b.at(2, 3) = 0.;
365  _b.at(2, 4) = c [ 1 ];
366  _b.at(2, 5) = 0.;
367  _b.at(2, 6) = c [ 2 ];
368  _b.at(3, 1) = c [ 0 ];
369  _b.at(3, 2) = b [ 0 ];
370  _b.at(3, 3) = c [ 1 ];
371  _b.at(3, 4) = b [ 1 ];
372  _b.at(3, 5) = c [ 2 ];
373  _b.at(3, 6) = b [ 2 ];
374 
375  static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->giveDeviatoricStiffnessMatrix(
376  _d, mode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep);
377  _db.beProductOf(_d, _b);
378  answer.resize(6, 6);
379  answer.zero();
380  answer.plusProductUnsym(_b, _db, area); //answer.plusProduct (_b,_db,area);
381  answer.times(1. / Re);
382 }
383 
384 void
386 {
387  answer.resize(6, 3);
388  answer.zero();
389  FloatArray p, un;
390  double usum, vsum;
391  double ar3 = area / 3.0, coeff;
392 
393  this->computeVectorOfPressures(VM_Total, tStep, p);
394 
395  // G matrix
396  answer.at(1, 1) = answer.at(1, 2) = answer.at(1, 3) = -b [ 0 ] * ar3;
397  answer.at(3, 1) = answer.at(3, 2) = answer.at(3, 3) = -b [ 1 ] * ar3;
398  answer.at(5, 1) = answer.at(5, 2) = answer.at(5, 3) = -b [ 2 ] * ar3;
399 
400  answer.at(2, 1) = answer.at(2, 2) = answer.at(2, 3) = -c [ 0 ] * ar3;
401  answer.at(4, 1) = answer.at(4, 2) = answer.at(4, 3) = -c [ 1 ] * ar3;
402  answer.at(6, 1) = answer.at(6, 2) = answer.at(6, 3) = -c [ 2 ] * ar3;
403 
404  // stabilization term (G_\delta mtrx)
405  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
406  usum = un.at(1) + un.at(3) + un.at(5);
407  vsum = un.at(2) + un.at(4) + un.at(6);
408  coeff = ar3 * t_supg;
409 
410  answer.at(1, 1) += coeff * ( usum * b [ 0 ] * b [ 0 ] + vsum * c [ 0 ] * b [ 0 ] );
411  answer.at(1, 2) += coeff * ( usum * b [ 0 ] * b [ 1 ] + vsum * c [ 0 ] * b [ 1 ] );
412  answer.at(1, 3) += coeff * ( usum * b [ 0 ] * b [ 2 ] + vsum * c [ 0 ] * b [ 2 ] );
413 
414  answer.at(3, 1) += coeff * ( usum * b [ 1 ] * b [ 0 ] + vsum * c [ 1 ] * b [ 0 ] );
415  answer.at(3, 2) += coeff * ( usum * b [ 1 ] * b [ 1 ] + vsum * c [ 1 ] * b [ 1 ] );
416  answer.at(3, 3) += coeff * ( usum * b [ 1 ] * b [ 2 ] + vsum * c [ 1 ] * b [ 2 ] );
417 
418  answer.at(5, 1) += coeff * ( usum * b [ 2 ] * b [ 0 ] + vsum * c [ 2 ] * b [ 0 ] );
419  answer.at(5, 2) += coeff * ( usum * b [ 2 ] * b [ 1 ] + vsum * c [ 2 ] * b [ 1 ] );
420  answer.at(5, 3) += coeff * ( usum * b [ 2 ] * b [ 2 ] + vsum * c [ 2 ] * b [ 2 ] );
421 
422  answer.at(2, 1) += coeff * ( usum * b [ 0 ] * c [ 0 ] + vsum * c [ 0 ] * c [ 0 ] );
423  answer.at(2, 2) += coeff * ( usum * b [ 0 ] * c [ 1 ] + vsum * c [ 0 ] * c [ 1 ] );
424  answer.at(2, 3) += coeff * ( usum * b [ 0 ] * c [ 2 ] + vsum * c [ 0 ] * c [ 2 ] );
425 
426  answer.at(4, 1) += coeff * ( usum * b [ 1 ] * c [ 0 ] + vsum * c [ 1 ] * c [ 0 ] );
427  answer.at(4, 2) += coeff * ( usum * b [ 1 ] * c [ 1 ] + vsum * c [ 1 ] * c [ 1 ] );
428  answer.at(4, 3) += coeff * ( usum * b [ 1 ] * c [ 2 ] + vsum * c [ 1 ] * c [ 2 ] );
429 
430  answer.at(6, 1) += coeff * ( usum * b [ 2 ] * c [ 0 ] + vsum * c [ 2 ] * c [ 0 ] );
431  answer.at(6, 2) += coeff * ( usum * b [ 2 ] * c [ 1 ] + vsum * c [ 2 ] * c [ 1 ] );
432  answer.at(6, 3) += coeff * ( usum * b [ 2 ] * c [ 2 ] + vsum * c [ 2 ] * c [ 2 ] );
433 }
434 
435 
436 void
438 {
439  answer.resize(6, 6);
440  answer.zero();
441  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
442  double coeff = area * t_lsic * rho;
443  double n[] = {
444  b [ 0 ], c [ 0 ], b [ 1 ], c [ 1 ], b [ 2 ], c [ 2 ]
445  };
446 
447  for ( int i = 1; i <= 6; i++ ) {
448  for ( int j = 1; j <= 6; j++ ) {
449  answer.at(i, j) = coeff * n [ i - 1 ] * n [ j - 1 ];
450  }
451  }
452 }
453 
454 
455 void
457 {
458  answer.resize(3, 6);
459  answer.zero();
460  double ar3 = area / 3.0;
461 
462  // G^T matrix
463  answer.at(1, 1) = answer.at(2, 1) = answer.at(3, 1) = b [ 0 ] * ar3;
464  answer.at(1, 3) = answer.at(2, 3) = answer.at(3, 3) = b [ 1 ] * ar3;
465  answer.at(1, 5) = answer.at(2, 5) = answer.at(3, 5) = b [ 2 ] * ar3;
466 
467  answer.at(1, 2) = answer.at(2, 2) = answer.at(3, 2) = c [ 0 ] * ar3;
468  answer.at(1, 4) = answer.at(2, 4) = answer.at(3, 4) = c [ 1 ] * ar3;
469  answer.at(1, 6) = answer.at(2, 6) = answer.at(3, 6) = c [ 2 ] * ar3;
470 }
471 
472 void
474 {
475  // N_epsilon (due to PSPG stabilization)
476  double coeff = t_pspg * area / 3.0;
477  double dudx, dudy, dvdx, dvdy, usum, vsum;
478  FloatArray u, un;
479 
480  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
481  this->computeVectorOfVelocities(VM_Total, tStep, u);
482 
483  dudx = b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5);
484  dudy = c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5);
485  dvdx = b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6);
486  dvdy = c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6);
487 
488  usum = un.at(1) + un.at(3) + un.at(5);
489  vsum = un.at(2) + un.at(4) + un.at(6);
490 
491  answer.resize(3);
492 
493  answer.at(1) = coeff * ( b [ 0 ] * ( dudx * usum + dudy * vsum ) + c [ 0 ] * ( dvdx * usum + dvdy * vsum ) );
494  answer.at(2) = coeff * ( b [ 1 ] * ( dudx * usum + dudy * vsum ) + c [ 1 ] * ( dvdx * usum + dvdy * vsum ) );
495  answer.at(3) = coeff * ( b [ 2 ] * ( dudx * usum + dudy * vsum ) + c [ 2 ] * ( dvdx * usum + dvdy * vsum ) );
496 }
497 
498 
499 void
501 {
502  answer.resize(3, 6);
503  answer.zero();
504  int w_dof_addr, u_dof_addr, d1j, d2j, km1, mm1;
505  FloatArray u, un;
506 
507  this->computeVectorOfVelocities(VM_Total, tStep, u);
508  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
509 
510  double dudx [ 2 ] [ 2 ], usum [ 2 ];
511  double coeff;
512 
513  dudx [ 0 ] [ 0 ] = b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5);
514  dudx [ 0 ] [ 1 ] = c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5);
515  dudx [ 1 ] [ 0 ] = b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6);
516  dudx [ 1 ] [ 1 ] = c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6);
517  usum [ 0 ] = un.at(1) + un.at(3) + un.at(5);
518  usum [ 1 ] = un.at(2) + un.at(4) + un.at(6);
519 
520  // dN_epsilon(v)/dv
521  coeff = t_pspg * area / 3.;
522  for ( int k = 1; k <= 3; k++ ) { // nodal val of function w
523  km1 = k - 1;
524  for ( int j = 1; j <= 2; j++ ) { // velocity vector component
525  for ( int m = 1; m <= 3; m++ ) { // nodal components
526  w_dof_addr = k;
527  u_dof_addr = ( m - 1 ) * 2 + j;
528  mm1 = m - 1;
529  d1j = ( j == 1 );
530  d2j = ( j == 2 );
531  answer.at(w_dof_addr, u_dof_addr) = coeff * ( 0.0 * d1j * b [ km1 ] * dudx [ 0 ] [ 0 ] + d1j * b [ km1 ] * b [ mm1 ] * usum [ 0 ] +
532  0.0 * d2j * b [ km1 ] * dudx [ 0 ] [ 1 ] + d1j * b [ km1 ] * c [ mm1 ] * usum [ 1 ] +
533  0.0 * d1j * c [ km1 ] * dudx [ 1 ] [ 0 ] + d2j * c [ km1 ] * b [ mm1 ] * usum [ 0 ] +
534  0.0 * d2j * c [ km1 ] * dudx [ 1 ] [ 1 ] + d2j * c [ km1 ] * c [ mm1 ] * usum [ 1 ] );
535  }
536  }
537  }
538 }
539 
540 void
542 {
543  answer.resize(3, 6);
544  answer.zero();
545  double coeff = t_pspg * area / 3.0;
546  // M_\epsilon
547 
548  answer.at(1, 1) = answer.at(1, 3) = answer.at(1, 5) = coeff * b [ 0 ];
549  answer.at(1, 2) = answer.at(1, 4) = answer.at(1, 6) = coeff * c [ 0 ];
550  answer.at(2, 1) = answer.at(2, 3) = answer.at(2, 5) = coeff * b [ 1 ];
551  answer.at(2, 2) = answer.at(2, 4) = answer.at(2, 6) = coeff * c [ 1 ];
552  answer.at(3, 1) = answer.at(3, 3) = answer.at(3, 5) = coeff * b [ 2 ];
553  answer.at(3, 2) = answer.at(3, 4) = answer.at(3, 6) = coeff * c [ 2 ];
554 }
555 
556 void
558 {
559  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
560  double coeff = t_pspg * area / rho;
561  answer.resize(3, 3);
562 
563 
564  for ( int i = 1; i <= 3; i++ ) {
565  for ( int j = 1; j <= 3; j++ ) {
566  answer.at(i, j) = coeff * ( b [ i - 1 ] * b [ j - 1 ] + c [ i - 1 ] * c [ j - 1 ] );
567  }
568  }
569 }
570 
571 
572 void
574 {
575  int node1, node2, node3;
576  int d1 = 1;
577  int d2 = 1;
578  int d3 = 1;
579  double l, t1, t2, _t1, _t2;
580  double beta;
581 
582  answer.resize(6, 6);
583  answer.zero();
584  //beta
585  //area
586  BoundaryLoad *edgeLoad = static_cast< BoundaryLoad * >(load);
587  beta = edgeLoad->giveProperty('a', tStep);
588  node1 = side;
589  node2 = ( node1 == 3 ? 1 : node1 + 1 );
590 
591  node3 = ( node2 == 3 ? 1 : node2 + 1 );
592 
593  switch ( node3 ) {
594  case 1:
595  d1 = 0;
596  case 2:
597  d2 = 0;
598  case 3:
599  d3 = 0;
600  }
601 
602  _t1 = giveNode(node2)->giveCoordinate(1) - giveNode(node1)->giveCoordinate(1);
603  _t2 = giveNode(node2)->giveCoordinate(2) - giveNode(node1)->giveCoordinate(2);
604  l = sqrt(_t1 * _t1 + _t2 * _t2);
605 
606  t1 = _t1 / l;
607  t2 = _t2 / l;
608 
609  double t11 = t1 * t1;
610  double t12 = t1 * t2;
611  double t22 = t2 * t2;
612 
613  double d12 = d1 * d2;
614  double d13 = d1 * d3;
615  double d23 = d2 * d3;
616 
617  answer.at(1, 1) = ( l / 3 ) * beta * d1 * t11;
618  answer.at(1, 2) = ( l / 3 ) * beta * d1 * t12;
619  answer.at(2, 1) = ( l / 3 ) * beta * d1 * t12;
620  answer.at(2, 2) = ( l / 3 ) * beta * d1 * t22;
621 
622  answer.at(1, 3) = ( l / 6 ) * beta * d12 * t11;
623  answer.at(1, 4) = ( l / 6 ) * beta * d12 * t12;
624  answer.at(2, 3) = ( l / 6 ) * beta * d12 * t12;
625  answer.at(2, 4) = ( l / 6 ) * beta * d12 * t22;
626 
627  answer.at(1, 5) = ( l / 6 ) * beta * d13 * t11;
628  answer.at(1, 6) = ( l / 6 ) * beta * d13 * t12;
629  answer.at(2, 5) = ( l / 6 ) * beta * d13 * t12;
630  answer.at(2, 6) = ( l / 6 ) * beta * d13 * t22;
631 
632  answer.at(3, 1) = ( l / 6 ) * beta * d12 * t11;
633  answer.at(3, 2) = ( l / 6 ) * beta * d12 * t12;
634  answer.at(4, 1) = ( l / 6 ) * beta * d12 * t12;
635  answer.at(4, 2) = ( l / 6 ) * beta * d12 * t22;
636 
637  answer.at(3, 3) = ( l / 3 ) * beta * d2 * t11;
638  answer.at(3, 4) = ( l / 3 ) * beta * d2 * t12;
639  answer.at(4, 3) = ( l / 3 ) * beta * d2 * t12;
640  answer.at(4, 4) = ( l / 3 ) * beta * d2 * t22;
641 
642  answer.at(3, 5) = ( l / 6 ) * beta * d23 * t11;
643  answer.at(3, 6) = ( l / 6 ) * beta * d23 * t12;
644  answer.at(4, 5) = ( l / 6 ) * beta * d23 * t12;
645  answer.at(4, 6) = ( l / 6 ) * beta * d23 * t22;
646 
647  answer.at(5, 1) = ( l / 6 ) * beta * d13 * t11;
648  answer.at(5, 2) = ( l / 6 ) * beta * d13 * t12;
649  answer.at(6, 1) = ( l / 6 ) * beta * d13 * t12;
650  answer.at(6, 2) = ( l / 6 ) * beta * d13 * t22;
651 
652  answer.at(5, 3) = ( l / 6 ) * beta * d23 * t11;
653  answer.at(5, 4) = ( l / 6 ) * beta * d23 * t12;
654  answer.at(6, 3) = ( l / 6 ) * beta * d23 * t12;
655  answer.at(6, 4) = ( l / 6 ) * beta * d23 * t22;
656 
657  answer.at(5, 5) = ( l / 3 ) * beta * d3 * t11;
658  answer.at(5, 6) = ( l / 3 ) * beta * d3 * t12;
659  answer.at(6, 5) = ( l / 3 ) * beta * d3 * t12;
660  answer.at(6, 6) = ( l / 3 ) * beta * d3 * t22;
661 
662  //answer.negated();
663 }
664 
665 
666 void
668 {
669  int node1, node2, node3;
670  int d1 = 1;
671  int d2 = 1;
672  int d3 = 1;
673  double l, n1, n2, _t1, _t2;
674  double alpha;
675 
676  answer.resize(6, 6);
677  answer.zero();
678 
679  BoundaryLoad *edgeLoad = static_cast< BoundaryLoad * >(load);
680  alpha = edgeLoad->giveProperty('a', tStep);
681  node1 = side;
682  node2 = ( node1 == 3 ? 1 : node1 + 1 );
683 
684  node3 = ( node2 == 3 ? 1 : node2 + 1 );
685 
686  switch ( node3 ) {
687  case 1:
688  d1 = 0;
689  case 2:
690  d2 = 0;
691  case 3:
692  d3 = 0;
693  }
694 
695  _t1 = giveNode(node2)->giveCoordinate(1) - giveNode(node1)->giveCoordinate(1);
696  _t2 = giveNode(node2)->giveCoordinate(2) - giveNode(node1)->giveCoordinate(2);
697  l = sqrt(_t1 * _t1 + _t2 * _t2);
698 
699  n1 = _t2 / l;
700  n2 = -_t1 / l;
701 
702  double n11 = n1 * n1;
703  double n12 = n1 * n2;
704  double n22 = n2 * n2;
705 
706  double d12 = d1 * d2;
707  double d13 = d1 * d3;
708  double d23 = d2 * d3;
709 
710  answer.at(1, 1) = ( l / 3 ) * ( 1 / alpha ) * d1 * n11;
711  answer.at(1, 2) = ( l / 3 ) * ( 1 / alpha ) * d1 * n12;
712  answer.at(2, 1) = ( l / 3 ) * ( 1 / alpha ) * d1 * n12;
713  answer.at(2, 2) = ( l / 3 ) * ( 1 / alpha ) * d1 * n22;
714 
715  answer.at(1, 3) = ( l / 6 ) * ( 1 / alpha ) * d12 * n11;
716  answer.at(1, 4) = ( l / 6 ) * ( 1 / alpha ) * d12 * n12;
717  answer.at(2, 3) = ( l / 6 ) * ( 1 / alpha ) * d12 * n12;
718  answer.at(2, 4) = ( l / 6 ) * ( 1 / alpha ) * d12 * n22;
719 
720  answer.at(1, 5) = ( l / 6 ) * ( 1 / alpha ) * d13 * n11;
721  answer.at(1, 6) = ( l / 6 ) * ( 1 / alpha ) * d13 * n12;
722  answer.at(2, 5) = ( l / 6 ) * ( 1 / alpha ) * d13 * n12;
723  answer.at(2, 6) = ( l / 6 ) * ( 1 / alpha ) * d13 * n22;
724 
725  answer.at(3, 1) = ( l / 6 ) * ( 1 / alpha ) * d12 * n11;
726  answer.at(3, 2) = ( l / 6 ) * ( 1 / alpha ) * d12 * n12;
727  answer.at(4, 1) = ( l / 6 ) * ( 1 / alpha ) * d12 * n12;
728  answer.at(4, 2) = ( l / 6 ) * ( 1 / alpha ) * d12 * n22;
729 
730  answer.at(3, 3) = ( l / 3 ) * ( 1 / alpha ) * d2 * n11;
731  answer.at(3, 4) = ( l / 3 ) * ( 1 / alpha ) * d2 * n12;
732  answer.at(4, 3) = ( l / 3 ) * ( 1 / alpha ) * d2 * n12;
733  answer.at(4, 4) = ( l / 3 ) * ( 1 / alpha ) * d2 * n22;
734 
735  answer.at(3, 5) = ( l / 6 ) * ( 1 / alpha ) * d23 * n11;
736  answer.at(3, 6) = ( l / 6 ) * ( 1 / alpha ) * d23 * n12;
737  answer.at(4, 5) = ( l / 6 ) * ( 1 / alpha ) * d23 * n12;
738  answer.at(4, 6) = ( l / 6 ) * ( 1 / alpha ) * d23 * n22;
739 
740  answer.at(5, 1) = ( l / 6 ) * ( 1 / alpha ) * d13 * n11;
741  answer.at(5, 2) = ( l / 6 ) * ( 1 / alpha ) * d13 * n12;
742  answer.at(6, 1) = ( l / 6 ) * ( 1 / alpha ) * d13 * n12;
743  answer.at(6, 2) = ( l / 6 ) * ( 1 / alpha ) * d13 * n22;
744 
745  answer.at(5, 3) = ( l / 6 ) * ( 1 / alpha ) * d23 * n11;
746  answer.at(5, 4) = ( l / 6 ) * ( 1 / alpha ) * d23 * n12;
747  answer.at(6, 3) = ( l / 6 ) * ( 1 / alpha ) * d23 * n12;
748  answer.at(6, 4) = ( l / 6 ) * ( 1 / alpha ) * d23 * n22;
749 
750  answer.at(5, 5) = ( l / 3 ) * ( 1 / alpha ) * d3 * n11;
751  answer.at(5, 6) = ( l / 3 ) * ( 1 / alpha ) * d3 * n12;
752  answer.at(6, 5) = ( l / 3 ) * ( 1 / alpha ) * d3 * n12;
753  answer.at(6, 6) = ( l / 3 ) * ( 1 / alpha ) * d3 * n22;
754 
755  //answer.negated();
756 }
757 
758 void
760 {
761  int node1, node2, node3;
762  int d1 = 1;
763  int d2 = 1;
764  int d3 = 1;
765  double l, n1, n2, t1, t2;
766 
767  answer.resize(6, 3);
768  answer.zero();
769  //beta
770  //area
771  node1 = side;
772  node2 = ( node1 == 3 ? 1 : node1 + 1 );
773 
774  node3 = ( node2 == 3 ? 1 : node2 + 1 );
775 
776  switch ( node3 ) {
777  case 1:
778  d1 = 0;
779  case 2:
780  d2 = 0;
781  case 3:
782  d3 = 0;
783  }
784 
785 
786  t1 = giveNode(node2)->giveCoordinate(1) - giveNode(node1)->giveCoordinate(1);
787  t2 = giveNode(node2)->giveCoordinate(2) - giveNode(node1)->giveCoordinate(2);
788  l = sqrt(t1 * t1 + t2 * t2);
789 
790  n1 = t2 / l;
791  n2 = -t1 / l;
792 
793  answer.at(1, 1) = ( l / 3 ) * d1 * d1 * n1;
794  answer.at(1, 2) = ( l / 6 ) * d1 * d2 * n1;
795  answer.at(1, 3) = ( l / 6 ) * d1 * d3 * n1;
796  answer.at(2, 1) = ( l / 3 ) * d1 * d1 * n2;
797  answer.at(2, 2) = ( l / 6 ) * d1 * d2 * n2;
798  answer.at(2, 3) = ( l / 6 ) * d1 * d3 * n2;
799 
800  answer.at(3, 1) = ( l / 6 ) * d2 * d1 * n1;
801  answer.at(3, 2) = ( l / 3 ) * d2 * d2 * n1;
802  answer.at(3, 3) = ( l / 6 ) * d2 * d3 * n1;
803  answer.at(4, 1) = ( l / 6 ) * d2 * d1 * n2;
804  answer.at(4, 2) = ( l / 3 ) * d2 * d2 * n2;
805  answer.at(4, 3) = ( l / 6 ) * d2 * d3 * n2;
806 
807  answer.at(5, 1) = ( l / 6 ) * d3 * d1 * n1;
808  answer.at(5, 2) = ( l / 6 ) * d3 * d2 * n1;
809  answer.at(5, 3) = ( l / 3 ) * d3 * d3 * n1;
810  answer.at(6, 1) = ( l / 6 ) * d3 * d1 * n2;
811  answer.at(6, 2) = ( l / 6 ) * d3 * d2 * n2;
812  answer.at(6, 3) = ( l / 3 ) * d3 * d3 * n2;
813 
814  answer.negated();
815 }
816 
817 void
819 {
820  double coeffx, coeffy, usum [ 2 ];
821  FloatArray un;
822 
823  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
824 
825 
826  usum [ 0 ] = un.at(1) + un.at(3) + un.at(5);
827  usum [ 1 ] = un.at(2) + un.at(4) + un.at(6);
828  Reinforcement *reinfload = dynamic_cast< Reinforcement * >(load);
829  double kx = reinfload->givePermeability()->at(1);
830  double ky = reinfload->givePermeability()->at(2);
831  double mu_0 = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->
832  giveEffectiveViscosity( integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep );
833  coeffx = area * mu_0 / ( 12.0 * kx );
834  coeffy = area * mu_0 / ( 12.0 * ky );
835  for ( int i = 1; i <= 3; i++ ) {
836  answer.at(2 * i - 1, 2 * i - 1) -= coeffx;
837  answer.at(2 * i, 2 * i) -= coeffy;
838  for ( int j = 1; j <= 3; j++ ) {
839  answer.at(2 * i - 1, 2 * j - 1) -= coeffx * ( 1.0 + 4.0 * t_supg * ( b [ i - 1 ] * usum [ 0 ] + c [ i - 1 ] * usum [ 1 ] ) );
840  answer.at(2 * i, 2 * j) -= coeffy * ( 1.0 + 4.0 * t_supg * ( b [ i - 1 ] * usum [ 0 ] + c [ i - 1 ] * usum [ 1 ] ) ); //pozor na b[i], c[i]!!!
841  }
842  }
843 }
844 
845 void
847 {
848  double coeffx, coeffy;
849 
850  Reinforcement *reinfload = dynamic_cast< Reinforcement * >(load);
851  double kx = reinfload->givePermeability()->at(1);
852  double ky = reinfload->givePermeability()->at(2);
853  double mu_0 = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->
854  giveEffectiveViscosity( integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep );
855  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
856  coeffx = area * mu_0 / ( 3.0 * kx * rho );
857  coeffy = area * mu_0 / ( 3.0 * ky * rho );
858  for ( int i = 1; i <= 3; i++ ) {
859  for ( int j = 1; j <= 3; j++ ) {
860  answer.at(i, 2 * j - 1) -= coeffx * t_pspg * b [ i - 1 ];
861  answer.at(i, 2 * j) -= coeffy * t_pspg * c [ i - 1 ];
862  }
863  }
864 }
865 
866 void
868 {
869  answer.resize(6);
870  answer.zero();
871 
872  double usum [ 2 ];
873  bcGeomType ltype;
874  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
875  FloatArray un, gVector;
876 
877  // add body load (gravity) termms
878  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
879 
880 
881  usum [ 0 ] = un.at(1) + un.at(3) + un.at(5);
882  usum [ 1 ] = un.at(2) + un.at(4) + un.at(6);
883  double coeff = rho * area / 3.0;
884  int nLoads = this->giveBodyLoadArray()->giveSize();
885  for ( int i = 1; i <= nLoads; i++ ) {
886  Load *load = domain->giveLoad( bodyLoadArray.at(i) );
887  ltype = load->giveBCGeoType();
888  if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ForceLoadBVT ) ) {
889  load->computeComponentArrayAt(gVector, tStep, VM_Total);
890  if ( gVector.giveSize() ) {
891  answer.at(1) += coeff * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 0 ] * usum [ 0 ] + c [ 0 ] * usum [ 1 ] ) ) );
892  answer.at(2) += coeff * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 0 ] * usum [ 0 ] + c [ 0 ] * usum [ 1 ] ) ) );
893  answer.at(3) += coeff * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 1 ] * usum [ 0 ] + c [ 1 ] * usum [ 1 ] ) ) );
894  answer.at(4) += coeff * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 1 ] * usum [ 0 ] + c [ 1 ] * usum [ 1 ] ) ) );
895  answer.at(5) += coeff * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 2 ] * usum [ 0 ] + c [ 2 ] * usum [ 1 ] ) ) );
896  answer.at(6) += coeff * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 2 ] * usum [ 0 ] + c [ 2 ] * usum [ 1 ] ) ) );
897  }
898  }
899 
900  if ( ltype == BodyLoadBGT && load->giveBCValType() == ReinforceBVT ) {
901  Reinforcement *rload = dynamic_cast< Reinforcement * >( domain->giveLoad( bodyLoadArray.at(i) ) );
902  double phi = rload->givePorosity();
903  double alpha = rload->giveshapefactor();
904  double kx = rload->givePermeability()->at(1);
905  double ky = rload->givePermeability()->at(2);
906  double tau_0 = static_cast< FluidCrossSection * >( this->giveCrossSection() )->
907  giveFluidMaterial()->give( YieldStress, integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
908  gVector.resize(2);
909  gVector.at(1) = tau_0 * sqrt(kx * phi) / ( kx * alpha );
910  gVector.at(2) = tau_0 * sqrt(ky * phi) / ( ky * alpha );
911 
912  answer.at(1) -= area * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 0 ] * usum [ 0 ] + c [ 0 ] * usum [ 1 ] ) ) );
913  answer.at(2) -= area * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 0 ] * usum [ 0 ] + c [ 0 ] * usum [ 1 ] ) ) );
914  answer.at(3) -= area * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 1 ] * usum [ 0 ] + c [ 1 ] * usum [ 1 ] ) ) );
915  answer.at(4) -= area * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 1 ] * usum [ 0 ] + c [ 1 ] * usum [ 1 ] ) ) );
916  answer.at(5) -= area * ( gVector.at(1) * ( 1.0 + t_supg * ( b [ 2 ] * usum [ 0 ] + c [ 2 ] * usum [ 1 ] ) ) );
917  answer.at(6) -= area * ( gVector.at(2) * ( 1.0 + t_supg * ( b [ 2 ] * usum [ 0 ] + c [ 2 ] * usum [ 1 ] ) ) );
918  }
919  }
920 
921  // loop over sides
922  int n1, n2;
923  double tx, ty, l;
924 
925  if ( true ) {
926  FloatArray t, coords(1);
927  // integrate tractions
928 
929  // if no traction bc applied but side marked as with traction load
930  // then zero traction is assumed !!!
931 
932  // loop over boundary load array
933  int numLoads = this->giveBoundaryLoadArray()->giveSize() / 2;
934  for ( int i = 1; i <= numLoads; i++ ) {
935  int n = boundaryLoadArray.at(1 + ( i - 1 ) * 2);
936  int id = boundaryLoadArray.at(i * 2);
937 
938  n1 = id;
939  n2 = ( n1 == 3 ? 1 : n1 + 1 );
940 
941  tx = giveNode(n2)->giveCoordinate(1) - giveNode(n1)->giveCoordinate(1);
942  ty = giveNode(n2)->giveCoordinate(2) - giveNode(n1)->giveCoordinate(2);
943  l = sqrt(tx * tx + ty * ty);
944 
945  auto load = dynamic_cast< BoundaryLoad * >( domain->giveLoad(n) );
946  auto loadtype = load->giveType();
947  if ( loadtype == TransmissionBC ) {
948  load->computeValueAt(t, tStep, coords, VM_Total);
949 
950  // here it is assumed constant traction, one point integration only
951  // n1 (u,v)
952  answer.at( ( n1 - 1 ) * 2 + 1 ) += t.at(1) * l / 2.;
953  answer.at(n1 * 2) += t.at(2) * l / 2.;
954  // n2 (u,v)
955  answer.at( ( n2 - 1 ) * 2 + 1 ) += t.at(1) * l / 2.;
956  answer.at(n2 * 2) += t.at(2) * l / 2.;
957 
958  //answer.at(n1)+= (t.at(1)*nx + t.at(2)*ny) * l/2.;
959  //answer.at(n2)+= (t.at(1)*nx + t.at(2)*ny) * l/2.;
960  }
961  }
962  }
963 }
964 
965 void
967 {
968  int nLoads;
969  double coeff;
970  FloatArray gVector;
971 
972  answer.resize(3);
973  answer.zero();
974  coeff = t_pspg * area;
975  nLoads = this->giveBodyLoadArray()->giveSize();
976  for ( int i = 1; i <= nLoads; i++ ) {
977  Load *load = domain->giveLoad( bodyLoadArray.at(i) );
978  bcGeomType ltype = load->giveBCGeoType();
979  if ( ltype == BodyLoadBGT && load->giveBCValType() == ForceLoadBVT ) {
980  load->computeComponentArrayAt(gVector, tStep, VM_Total);
981  if ( gVector.giveSize() ) {
982  answer.at(1) += coeff * ( b [ 0 ] * gVector.at(1) + c [ 0 ] * gVector.at(2) );
983  answer.at(2) += coeff * ( b [ 1 ] * gVector.at(1) + c [ 1 ] * gVector.at(2) );
984  answer.at(3) += coeff * ( b [ 2 ] * gVector.at(1) + c [ 2 ] * gVector.at(2) );
985  }
986  }
987 
988  if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ReinforceBVT ) ) {
989  Reinforcement *rload = dynamic_cast< Reinforcement * >( domain->giveLoad( bodyLoadArray.at(i) ) );
990  double phi = rload->givePorosity();
991  double alpha = rload->giveshapefactor();
992  double kx = rload->givePermeability()->at(1);
993  double ky = rload->givePermeability()->at(2);
994  double tau_0 = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->
995  give( YieldStress, integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
996  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->
997  giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
998 
999  gVector.resize(2);
1000  gVector.at(1) = tau_0 * sqrt(kx * phi) / ( kx * alpha * rho );
1001  gVector.at(2) = tau_0 * sqrt(ky * phi) / ( ky * alpha * rho );
1002 
1003  answer.at(1) -= coeff * ( b [ 0 ] * gVector.at(1) + c [ 0 ] * gVector.at(2) );
1004  answer.at(2) -= coeff * ( b [ 1 ] * gVector.at(1) + c [ 1 ] * gVector.at(2) );
1005  answer.at(3) -= coeff * ( b [ 2 ] * gVector.at(1) + c [ 2 ] * gVector.at(2) );
1006  }
1007  }
1008 }
1009 
1010 void
1012 {
1013  if ( type != ExternalForcesVector ) {
1014  answer.clear();
1015  return;
1016  }
1017 
1018  FloatArray un;
1019  double coeff;
1020 
1021  // compute averaged viscosity based on rule of mixture
1022  GaussPoint *gp;
1023  if ( integrationRulesArray [ 0 ]->giveNumberOfIntegrationPoints() ) {
1024  gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
1025  } else {
1026  gp = integrationRulesArray [ 1 ]->getIntegrationPoint(0);
1027  }
1028 
1029  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->
1030  giveDensity( gp );
1031 
1032  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), un);
1033 
1034  double u1sum = un.at(1) + un.at(3) + un.at(5);
1035  double u2sum = un.at(2) + un.at(4) + un.at(6);
1036 
1037  answer.resize(9);
1038 
1039  if ( load->giveBCValType() == ForceLoadBVT ) {
1040  FloatArray gVector;
1041  load->computeComponentArrayAt(gVector, tStep, VM_Total);
1042 
1043  // MB
1044  coeff = rho * area / 3.0;
1045  answer.at(1) = coeff * gVector.at(1) * ( 1.0 + t_supg * ( b [ 0 ] * u1sum + c [ 0 ] * u2sum ) );
1046  answer.at(2) = coeff * gVector.at(2) * ( 1.0 + t_supg * ( b [ 0 ] * u1sum + c [ 0 ] * u2sum ) );
1047  answer.at(4) = coeff * gVector.at(1) * ( 1.0 + t_supg * ( b [ 1 ] * u1sum + c [ 1 ] * u2sum ) );
1048  answer.at(5) = coeff * gVector.at(2) * ( 1.0 + t_supg * ( b [ 1 ] * u1sum + c [ 1 ] * u2sum ) );
1049  answer.at(7) = coeff * gVector.at(1) * ( 1.0 + t_supg * ( b [ 2 ] * u1sum + c [ 2 ] * u2sum ) );
1050  answer.at(8) = coeff * gVector.at(2) * ( 1.0 + t_supg * ( b [ 2 ] * u1sum + c [ 2 ] * u2sum ) );
1051 
1052  // MC
1053  coeff = t_pspg * area;
1054  answer.at(3) = coeff * ( b [ 0 ] * gVector.at(1) + c [ 0 ] * gVector.at(2) );
1055  answer.at(6) = coeff * ( b [ 1 ] * gVector.at(1) + c [ 1 ] * gVector.at(2) );
1056  answer.at(9) = coeff * ( b [ 2 ] * gVector.at(1) + c [ 2 ] * gVector.at(2) );
1057 
1058  } else if ( load->giveBCValType() == ReinforceBVT ) {
1059  Reinforcement *rload = dynamic_cast< Reinforcement * >( load );
1060  FloatArray t;
1061  double phi = rload->givePorosity();
1062  double alpha = rload->giveshapefactor();
1063  double kx = rload->givePermeability()->at(1);
1064  double ky = rload->givePermeability()->at(2);
1065  double tau_0 = static_cast< FluidCrossSection * >( this->giveCrossSection() )->
1066  giveFluidMaterial()->give( YieldStress, gp );
1067 
1068  t.resize(2);
1069  t.at(1) = tau_0 * sqrt(kx * phi) / ( kx * alpha );
1070  t.at(2) = tau_0 * sqrt(ky * phi) / ( ky * alpha );
1071 
1072  // MB
1073  answer.at(1) = area * t.at(1) * ( 1.0 + t_supg * ( b [ 0 ] * u1sum + c [ 0 ] * u2sum ) );
1074  answer.at(2) = area * t.at(2) * ( 1.0 + t_supg * ( b [ 0 ] * u1sum + c [ 0 ] * u2sum ) );
1075  answer.at(4) = area * t.at(1) * ( 1.0 + t_supg * ( b [ 1 ] * u1sum + c [ 1 ] * u2sum ) );
1076  answer.at(5) = area * t.at(2) * ( 1.0 + t_supg * ( b [ 1 ] * u1sum + c [ 1 ] * u2sum ) );
1077  answer.at(7) = area * t.at(1) * ( 1.0 + t_supg * ( b [ 2 ] * u1sum + c [ 2 ] * u2sum ) );
1078  answer.at(8) = area * t.at(2) * ( 1.0 + t_supg * ( b [ 2 ] * u1sum + c [ 2 ] * u2sum ) );
1079 
1080  // MC
1081  coeff = t_pspg * area / rho;
1082  answer.at(3) = coeff * ( b [ 0 ] * t.at(1) + c [ 0 ] * t.at(2) );
1083  answer.at(6) = coeff * ( b [ 1 ] * t.at(1) + c [ 1 ] * t.at(2) );
1084  answer.at(9) = coeff * ( b [ 2 ] * t.at(1) + c [ 2 ] * t.at(2) );
1085  }
1086 }
1087 
1088 void
1090 {
1091  //TR1_2D_SUPG :: updateStabilizationCoeffs (tStep);
1092 #if 0
1093  int i, j, k, m, km1, mm1, d1j, d2j, dij, w_dof_addr, u_dof_addr;
1094  double __g_norm, __gamma_norm, __gammav_norm, __beta_norm, __betav_norm, __c_norm, __ctilda_norm, __e_norm, __k_norm, __Re;
1095  double __t_p1, __t_p2, __t_p3, __t_s1, __t_s2, __t_s3;
1096  double nu, rho;
1097  double dudx [ 2 ] [ 2 ], usum [ 2 ];
1098  FloatArray u, un, a;
1099 
1100  // compute averaged viscosity based on rule of mixture
1101  GaussPoint *gp;
1102  if ( integrationRulesArray [ 0 ]->giveNumberOfIntegrationPoints() ) {
1103  gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
1104  } else {
1105  gp = integrationRulesArray [ 1 ]->getIntegrationPoint(0);
1106  }
1107 
1108  nu = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->
1109  giveCharacteristicValue( MRM_Viscosity, gp, tStep->givePreviousStep() );
1110  rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
1111 
1112  //this -> computeVectorOfVelocities(VM_Total,tStep->givePreviousStep(),un) ;
1113  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), u);
1114  this->computeVectorOfVelocities(VM_Acceleration, tStep->givePreviousStep(), a);
1115 
1116  un = u;
1117  usum [ 0 ] = un.at(1) + un.at(3) + un.at(5);
1118  usum [ 1 ] = un.at(2) + un.at(4) + un.at(6);
1119 
1120  FloatMatrix __tmp;
1121  FloatArray __tmpvec, n;
1122  // assemble g matrix
1123  __tmp.resize(6, 3);
1124  double ar3 = area / 3.0;
1125 
1126  __tmp.at(1, 1) = __tmp.at(1, 2) = __tmp.at(1, 3) = b [ 0 ] * ar3;
1127  __tmp.at(3, 1) = __tmp.at(3, 2) = __tmp.at(3, 3) = b [ 1 ] * ar3;
1128  __tmp.at(5, 1) = __tmp.at(5, 2) = __tmp.at(5, 3) = b [ 2 ] * ar3;
1129 
1130  __tmp.at(2, 1) = __tmp.at(2, 2) = __tmp.at(2, 3) = c [ 0 ] * ar3;
1131  __tmp.at(4, 1) = __tmp.at(4, 2) = __tmp.at(4, 3) = c [ 1 ] * ar3;
1132  __tmp.at(6, 1) = __tmp.at(6, 2) = __tmp.at(6, 3) = c [ 2 ] * ar3;
1133 
1134  __g_norm = __tmp.computeFrobeniusNorm();
1135 
1136  // assemble \gamma matrix (advectionTerm of mass conservation eq)
1137  __tmp.resize(3, 6);
1138  dudx [ 0 ] [ 0 ] = b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5);
1139  dudx [ 0 ] [ 1 ] = c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5);
1140  dudx [ 1 ] [ 0 ] = b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6);
1141  dudx [ 1 ] [ 1 ] = c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6);
1142 
1143 
1144  // dN_epsilon(v)/dv
1145  double coeff = area / 3.;
1146  for ( k = 1; k <= 3; k++ ) { // nodal val of function w
1147  km1 = k - 1;
1148  for ( j = 1; j <= 2; j++ ) { // velocity vector component
1149  for ( m = 1; m <= 3; m++ ) { // nodal components
1150  w_dof_addr = k;
1151  u_dof_addr = ( m - 1 ) * 2 + j;
1152  mm1 = m - 1;
1153  d1j = ( j == 1 );
1154  d2j = ( j == 2 );
1155  __tmp.at(w_dof_addr, u_dof_addr) = coeff * ( 0.0 * d1j * b [ km1 ] * dudx [ 0 ] [ 0 ] + d1j * b [ km1 ] * b [ mm1 ] * usum [ 0 ] +
1156  0.0 * d2j * b [ km1 ] * dudx [ 0 ] [ 1 ] + d1j * b [ km1 ] * c [ mm1 ] * usum [ 1 ] +
1157  0.0 * d1j * c [ km1 ] * dudx [ 1 ] [ 0 ] + d2j * c [ km1 ] * b [ mm1 ] * usum [ 0 ] +
1158  0.0 * d2j * c [ km1 ] * dudx [ 1 ] [ 1 ] + d2j * c [ km1 ] * c [ mm1 ] * usum [ 1 ] );
1159  }
1160  }
1161  }
1162 
1163  __gamma_norm = __tmp.computeFrobeniusNorm();
1164  __tmpvec.beProductOf(__tmp, u);
1165  __gammav_norm = __tmpvec.computeNorm();
1166  // compute beta mtrx (acceleration term of mass conservation eq)
1167  __tmp.resize(3, 6);
1168  __tmp.zero();
1169  __tmp.at(1, 1) = __tmp.at(1, 3) = __tmp.at(1, 5) = ar3 * b [ 0 ];
1170  __tmp.at(1, 2) = __tmp.at(1, 4) = __tmp.at(1, 6) = ar3 * c [ 0 ];
1171  __tmp.at(2, 1) = __tmp.at(2, 3) = __tmp.at(2, 5) = ar3 * b [ 1 ];
1172  __tmp.at(2, 2) = __tmp.at(2, 4) = __tmp.at(2, 6) = ar3 * c [ 1 ];
1173  __tmp.at(3, 1) = __tmp.at(3, 3) = __tmp.at(3, 5) = ar3 * b [ 2 ];
1174  __tmp.at(3, 2) = __tmp.at(3, 4) = __tmp.at(3, 6) = ar3 * c [ 2 ];
1175  __beta_norm = __tmp.computeFrobeniusNorm();
1176  __tmpvec.beProductOf(__tmp, a);
1177  __betav_norm = __tmpvec.computeNorm();
1178  // compute c mtrx (advection term of momentum balance)
1179  // standard galerkin term
1180  __tmp.resize(6, 6);
1181  __tmp.zero();
1182 
1183  for ( i = 1; i <= 2; i++ ) { // test function index
1184  for ( k = 1; k <= 3; k++ ) { // nodal val of function w
1185  for ( j = 1; j <= 2; j++ ) { // velocity vector component
1186  for ( m = 1; m <= 3; m++ ) { // nodal components
1187  w_dof_addr = ( k - 1 ) * 2 + i;
1188  u_dof_addr = ( m - 1 ) * 2 + j;
1189  d1j = ( j == 1 );
1190  d2j = ( j == 2 );
1191  dij = ( i == j );
1192  coeff = ( m == k ) ? area / 6. : area / 12.;
1193  __tmp.at(w_dof_addr, u_dof_addr) = rho * ( 0.0 * d1j * dudx [ i - 1 ] [ 0 ] * coeff + dij * b [ m - 1 ] * ( area / 12. ) * ( usum [ 0 ] + un.at( ( k - 1 ) * 2 + 1 ) ) +
1194  0.0 * d2j * dudx [ i - 1 ] [ 1 ] * coeff + dij * c [ m - 1 ] * ( area / 12. ) * ( usum [ 1 ] + un.at( ( k - 1 ) * 2 + 2 ) ) );
1195  }
1196  }
1197  }
1198  }
1199 
1200  __c_norm = __tmp.computeFrobeniusNorm();
1201  // compute ctilda mtrx (stabilization acceleration term of momentum balance)
1202  __tmp.resize(6, 6);
1203  __tmp.zero();
1204  coeff = rho * area / 12.;
1205 
1206  __tmp.at(1, 1) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(1) ) + c [ 0 ] * ( usum [ 1 ] + un.at(2) ) );
1207  __tmp.at(1, 3) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(3) ) + c [ 0 ] * ( usum [ 1 ] + un.at(4) ) );
1208  __tmp.at(1, 5) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(5) ) + c [ 0 ] * ( usum [ 1 ] + un.at(6) ) );
1209 
1210  __tmp.at(2, 2) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(1) ) + c [ 0 ] * ( usum [ 1 ] + un.at(2) ) );
1211  __tmp.at(2, 4) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(3) ) + c [ 0 ] * ( usum [ 1 ] + un.at(4) ) );
1212  __tmp.at(2, 6) = coeff * ( b [ 0 ] * ( usum [ 0 ] + un.at(5) ) + c [ 0 ] * ( usum [ 1 ] + un.at(6) ) );
1213 
1214  __tmp.at(3, 1) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(1) ) + c [ 1 ] * ( usum [ 1 ] + un.at(2) ) );
1215  __tmp.at(3, 3) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(3) ) + c [ 1 ] * ( usum [ 1 ] + un.at(4) ) );
1216  __tmp.at(3, 5) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(5) ) + c [ 1 ] * ( usum [ 1 ] + un.at(6) ) );
1217 
1218  __tmp.at(4, 2) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(1) ) + c [ 1 ] * ( usum [ 1 ] + un.at(2) ) );
1219  __tmp.at(4, 4) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(3) ) + c [ 1 ] * ( usum [ 1 ] + un.at(4) ) );
1220  __tmp.at(4, 6) = coeff * ( b [ 1 ] * ( usum [ 0 ] + un.at(5) ) + c [ 1 ] * ( usum [ 1 ] + un.at(6) ) );
1221 
1222  __tmp.at(5, 1) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(1) ) + c [ 2 ] * ( usum [ 1 ] + un.at(2) ) );
1223  __tmp.at(5, 3) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(3) ) + c [ 2 ] * ( usum [ 1 ] + un.at(4) ) );
1224  __tmp.at(5, 5) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(5) ) + c [ 2 ] * ( usum [ 1 ] + un.at(6) ) );
1225 
1226  __tmp.at(6, 2) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(1) ) + c [ 2 ] * ( usum [ 1 ] + un.at(2) ) );
1227  __tmp.at(6, 4) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(3) ) + c [ 2 ] * ( usum [ 1 ] + un.at(4) ) );
1228  __tmp.at(6, 6) = coeff * ( b [ 2 ] * ( usum [ 0 ] + un.at(5) ) + c [ 2 ] * ( usum [ 1 ] + un.at(6) ) );
1229 
1230  __ctilda_norm = __tmp.computeFrobeniusNorm();
1231 
1232  // compute e mtrx (advection term of momentum balance)
1233  __tmp.resize(6, 6);
1234  __tmp.zero();
1235  double __n[] = {
1236  b [ 0 ], c [ 0 ], b [ 1 ], c [ 1 ], b [ 2 ], c [ 2 ]
1237  };
1238 
1239  for ( i = 1; i <= 6; i++ ) {
1240  for ( j = 1; j <= 6; j++ ) {
1241  __tmp.at(i, j) = coeff * __n [ i - 1 ] * __n [ j - 1 ];
1242  }
1243  }
1244 
1245  __e_norm = __tmp.computeFrobeniusNorm();
1246  // compute element level Reynolds number
1247  // compute k~ norm first
1248  __tmp.resize(6, 6);
1249  __tmp.zero();
1250  FloatMatrix _b(3, 6), _d, _db;
1251  double ar12 = area / 12.;
1252  for ( i = 1; i <= 2; i++ ) { // test function index
1253  for ( k = 1; k <= 3; k++ ) { // nodal val of function w
1254  for ( j = 1; j <= 2; j++ ) { // velocity vector component
1255  for ( m = 1; m <= 3; m++ ) { // nodal components
1256  w_dof_addr = ( k - 1 ) * 2 + i;
1257  u_dof_addr = ( m - 1 ) * 2 + j;
1258  d1j = ( j == 1 );
1259  d2j = ( j == 2 );
1260  dij = ( i == j );
1261  __tmp.at(w_dof_addr, u_dof_addr) += rho *
1262  (
1263  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
1264  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
1265  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
1266  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
1267 
1268  0.0 * d1j * b [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
1269  dij * b [ k - 1 ] * b [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 0 ] + un.at(1) * un.at(1) + un.at(3) * un.at(3) + un.at(5) * un.at(5) ) +
1270  0.0 * d2j * b [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 0 ] + un.at( ( m - 1 ) * 2 + 1 ) ) +
1271  dij * b [ k - 1 ] * c [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 1 ] + un.at(1) * un.at(2) + un.at(3) * un.at(4) + un.at(5) * un.at(6) ) +
1272 
1273  0.0 * d1j * c [ k - 1 ] * dudx [ i - 1 ] [ 0 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
1274  dij * c [ k - 1 ] * b [ m - 1 ] * ar12 * ( usum [ 0 ] * usum [ 1 ] + un.at(1) * un.at(2) + un.at(3) * un.at(4) + un.at(5) * un.at(6) ) +
1275  0.0 * d2j * c [ k - 1 ] * dudx [ i - 1 ] [ 1 ] * ar12 * ( usum [ 1 ] + un.at( ( m - 1 ) * 2 + 2 ) ) +
1276  dij * c [ k - 1 ] * c [ m - 1 ] * ar12 * ( usum [ 1 ] * usum [ 1 ] + un.at(2) * un.at(2) + un.at(4) * un.at(4) + un.at(6) * un.at(6) )
1277  );
1278  }
1279  }
1280  }
1281  }
1282 
1283  __k_norm = __tmp.computeFrobeniusNorm();
1284  double u_1, u_2, vnorm = 0.;
1285  int im1;
1286  for ( i = 1; i <= 3; i++ ) {
1287  im1 = i - 1;
1288  u_1 = u.at( ( im1 ) * 2 + 1 );
1289  u_2 = u.at( ( im1 ) * 2 + 2 );
1290  vnorm = max( vnorm, sqrt(u_1 * u_1 + u_2 * u_2) );
1291  }
1292 
1293  if ( vnorm == 0.0 ) {
1294  //t_sugn1 = inf;
1295  double t_sugn2 = tStep->giveTimeIncrement() / 2.0;
1296  //t_sugn3 = inf;
1297  this->t_supg = 1. / sqrt( 1. / ( t_sugn2 * t_sugn2 ) );
1298  this->t_pspg = this->t_supg;
1299  this->t_lsic = 0.0;
1300  //printf ("%e %e\n",this->t_supg,this->t_pspg);
1301  } else {
1302  __Re = vnorm * vnorm * __c_norm / __k_norm / nu;
1303 
1304  __t_p1 = __g_norm / __gamma_norm;
1305  __t_p2 = tStep->giveTimeIncrement() * __g_norm / 2.0 / __beta_norm;
1306  __t_p3 = __t_p1 * __Re;
1307  this->t_pspg = 1. / sqrt( 1. / ( __t_p1 * __t_p1 ) + 1. / ( __t_p2 * __t_p2 ) + 1. / ( __t_p3 * __t_p3 ) );
1308 
1309 
1310  __t_s1 = __c_norm / __k_norm;
1311  __t_s2 = tStep->giveTimeIncrement() * __c_norm / __ctilda_norm / 2.0;
1312  __t_s3 = __t_s1 * __Re;
1313  this->t_supg = 1. / sqrt( 1. / ( __t_s1 * __t_s1 ) + 1. / ( __t_s2 * __t_s2 ) + 1. / ( __t_s3 * __t_s3 ) );
1314 
1315  //printf ("%e %e\n",this->t_supg,this->t_pspg);
1316  this->t_lsic = __c_norm / __e_norm;
1317  this->t_lsic = 0.0;
1318  }
1319 
1320 #else
1321  /* UGN-Based Stabilization */
1322  double h_ugn, sum = 0.0, vnorm, t_sugn1, t_sugn2, t_sugn3, u_1, u_2, z, Re_ugn;
1323  double dscale, uscale, lscale, tscale, dt;
1324  //bool zeroFlag = false;
1325  int im1;
1326  FloatArray u;
1327 
1332 
1333  this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), u);
1334  u.times(uscale);
1335  double nu;
1336 
1337  // compute averaged viscosity based on rule of mixture
1338  GaussPoint *gp;
1339  if ( integrationRulesArray [ 0 ]->giveNumberOfIntegrationPoints() ) {
1340  gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
1341  } else {
1342  gp = integrationRulesArray [ 1 ]->getIntegrationPoint(0);
1343  }
1344 
1345  nu = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial()->giveEffectiveViscosity( gp, tStep->givePreviousStep() );
1347 
1348  dt = tStep->giveTimeIncrement() * tscale;
1349 
1350  for ( int i = 1; i <= 3; i++ ) {
1351  im1 = i - 1;
1352  sum += fabs(u.at( ( im1 ) * 2 + 1 ) * b [ im1 ] / lscale + u.at(im1 * 2 + 2) * c [ im1 ] / lscale);
1353  }
1354 
1355  /*
1356  * u_1=(u.at(1)+u.at(3)+u.at(5))/3.0;
1357  * u_2=(u.at(2)+u.at(4)+u.at(6))/3.0;
1358  * vnorm=sqrt(u_1*u_1+u_2*u_2);
1359  */
1360  vnorm = 0.;
1361  for ( int i = 1; i <= 3; i++ ) {
1362  im1 = i - 1;
1363  u_1 = u.at( ( im1 ) * 2 + 1 );
1364  u_2 = u.at( ( im1 ) * 2 + 2 );
1365  vnorm = max( vnorm, sqrt(u_1 * u_1 + u_2 * u_2) );
1366  }
1367 
1368  if ( ( vnorm == 0.0 ) || ( sum < vnorm * 1e-10 ) ) {
1369  //t_sugn1 = inf;
1370  t_sugn2 = dt / 2.0;
1371  //t_sugn3 = inf;
1372  this->t_supg = 1. / sqrt( 1. / ( t_sugn2 * t_sugn2 ) );
1373  this->t_pspg = this->t_supg;
1374  this->t_lsic = 0.0;
1375  } else {
1376  h_ugn = 2.0 * vnorm / sum;
1377  t_sugn1 = 1. / sum;
1378  t_sugn2 = dt / 2.0;
1379  t_sugn3 = h_ugn * h_ugn / 4.0 / nu;
1380 
1381  this->t_supg = 1. / sqrt( 1. / ( t_sugn1 * t_sugn1 ) + 1. / ( t_sugn2 * t_sugn2 ) + 1. / ( t_sugn3 * t_sugn3 ) );
1382  this->t_pspg = this->t_supg;
1383 
1384  Re_ugn = vnorm * h_ugn / ( 2. * nu );
1385  z = ( Re_ugn <= 3. ) ? Re_ugn / 3. : 1.0;
1386  this->t_lsic = h_ugn * vnorm * z / 2.0;
1387  }
1388 
1389  // if (this->number == 1) {
1390  // printf ("t_supg %e t_pspg %e t_lsic %e\n", t_supg, t_pspg, t_lsic);
1391  // }
1392 
1393 
1394  this->t_supg *= uscale / lscale;
1395  this->t_pspg *= 1. / ( lscale * dscale );
1396  this->t_lsic *= ( dscale * uscale ) / ( lscale * lscale );
1397 
1398  this->t_lsic = 0.0;
1399 
1400 #endif
1401 
1402  //this->t_lsic=0.0;
1403  //this->t_pspg=0.0;
1404 }
1405 
1406 /*
1407  * void
1408  * TR1_2D_SUPG :: updateStabilizationCoeffs (TimeStep* tStep)
1409  * {
1410  * double h_ugn, sum=0.0, snorm, vnorm, t_sugn1, t_sugn2, t_sugn3, u_1, u_2, z, Re_ugn;
1411  * bool zeroFlag = false;
1412  * int i,im1;
1413  * FloatArray u;
1414  * this -> computeVectorOfVelocities(VM_Total,tStep, u) ;
1415  * double nu = this->giveMaterial()->giveCharacteristicValue(MRM_Viscosity, integrationRulesArray[0]->getIntegrationPoint(0), tStep);
1416  *
1417  * // UGN-Based Stabilization
1418  *
1419  * for (i=1;i<=3;i++) {
1420  * im1=i-1;
1421  * snorm = sqrt(u.at(im1*2+1)*u.at(im1*2+1) + u.at(im1*2+2)*u.at(im1*2+2));
1422  * if (snorm == 0.0) zeroFlag = true;
1423  * sum+= fabs(u.at((im1)*2+1)*b[im1] + u.at(im1*2+2)*c[im1])/snorm;
1424  * }
1425  * u_1=(u.at(1)+u.at(3)+u.at(5))/3.0;
1426  * u_2=(u.at(2)+u.at(4)+u.at(6))/3.0;
1427  * vnorm=sqrt(u_1*u_1+u_2*u_2);
1428  *
1429  * if (zeroFlag) {
1430  *
1431  * //t_sugn1 = inf;
1432  * t_sugn2 = tStep->giveTimeIncrement()/2.0;
1433  * //t_sugn3 = inf;
1434  * this->t_supg=1./sqrt(1./(t_sugn2*t_sugn2));
1435  * this->t_pspg=this->t_supg;
1436  * this->t_lsic=0.0;
1437  *
1438  * } else {
1439  * h_ugn = 2.0*vnorm/sum;
1440  * //t_sugn1 = h_ugn/(2.*vnorm);
1441  * t_sugn1 = 1./sum;
1442  * t_sugn2 = tStep->giveTimeIncrement()/2.0;
1443  * t_sugn3 = h_ugn*h_ugn/4.0/nu;
1444  *
1445  * this->t_supg=1./sqrt(1./(t_sugn1*t_sugn1) + 1./(t_sugn2*t_sugn2) + 1./(t_sugn3*t_sugn3));
1446  * this->t_pspg=this->t_supg;
1447  *
1448  * Re_ugn = vnorm*h_ugn/(2.*nu);
1449  * z = (Re_ugn <= 3.)?Re_ugn/3. : 1.0 ;
1450  * this->t_lsic=h_ugn*vnorm*z/2.0;
1451  * this->t_lsic = 0.0;
1452  * }
1453  * //printf ("Element %d ( t_supg %e, t_pspg %e, t_lsic %e)\n", this->giveNumber(), t_supg, t_pspg, t_lsic);
1454  * }
1455  *
1456  */
1457 
1458 double
1460 {
1461  return 1.e6;
1462 }
1463 
1464 
1465 Interface *
1467 {
1468  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
1469  return static_cast< ZZNodalRecoveryModelInterface * >(this);
1470  } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
1471  return static_cast< NodalAveragingRecoveryModelInterface * >(this);
1472  } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
1473  return static_cast< SPRNodalRecoveryModelInterface * >(this);
1474  } else if ( interface == SpatialLocalizerInterfaceType ) {
1475  return static_cast< SpatialLocalizerInterface * >(this);
1476  } else if ( interface == EIPrimaryFieldInterfaceType ) {
1477  return static_cast< EIPrimaryFieldInterface * >(this);
1478  } else if ( interface == LEPlicElementInterfaceType ) {
1479  return static_cast< LEPlicElementInterface * >(this);
1480  } else if ( interface == LevelSetPCSElementInterfaceType ) {
1481  return static_cast< LevelSetPCSElementInterface * >(this);
1482  }
1483 
1484  return NULL;
1485 }
1486 
1487 
1488 void
1490 {
1491  /* one should call material driver instead */
1492  FloatArray u(6);
1493  answer.resize(3);
1494 
1495 
1496  this->computeVectorOfVelocities(VM_Total, tStep, u);
1497 
1498  answer.at(1) = ( b [ 0 ] * u.at(1) + b [ 1 ] * u.at(3) + b [ 2 ] * u.at(5) );
1499  answer.at(2) = ( c [ 0 ] * u.at(2) + c [ 1 ] * u.at(4) + c [ 2 ] * u.at(6) );
1500  answer.at(3) = ( b [ 0 ] * u.at(2) + b [ 1 ] * u.at(4) + b [ 2 ] * u.at(6) + c [ 0 ] * u.at(1) + c [ 1 ] * u.at(3) + c [ 2 ] * u.at(5) );
1501 }
1502 
1503 void
1505 {
1506  Node *node1, *node2, *node3;
1507  double x1, x2, x3, y1, y2, y3;
1508 
1509  node1 = giveNode(1);
1510  node2 = giveNode(2);
1511  node3 = giveNode(3);
1512 
1513  // init geometry data
1514  x1 = node1->giveCoordinate(1);
1515  x2 = node2->giveCoordinate(1);
1516  x3 = node3->giveCoordinate(1);
1517 
1518  y1 = node1->giveCoordinate(2);
1519  y2 = node2->giveCoordinate(2);
1520  y3 = node3->giveCoordinate(2);
1521 
1522  this->area = 0.5 * ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 );
1523 
1524  if ( area < 0.0 ) {
1525  OOFEM_ERROR("Area is negative, check element numbering orientation");
1526  }
1527 
1528  b [ 0 ] = ( y2 - y3 ) / ( 2. * area );
1529  c [ 0 ] = ( x3 - x2 ) / ( 2. * area );
1530  b [ 1 ] = ( y3 - y1 ) / ( 2. * area );
1531  c [ 1 ] = ( x1 - x3 ) / ( 2. * area );
1532  b [ 2 ] = ( y1 - y2 ) / ( 2. * area );
1533  c [ 2 ] = ( x2 - x1 ) / ( 2. * area );
1534 }
1535 
1536 
1537 int
1539 {
1541 }
1542 
1543 void
1545 {
1546  double l1, l2;
1547  answer.resize(3);
1548 
1549  answer.at(1) = l1 = gp->giveNaturalCoordinate(1);
1550  answer.at(2) = l2 = gp->giveNaturalCoordinate(2);
1551  answer.at(3) = 1.0 - l1 - l2;
1552 }
1553 
1554 /*
1555  * double
1556  * TR1_2D_SUPG :: computeCriticalTimeStep (TimeStep* tStep)
1557  * {
1558  * FloatArray u;
1559  * double dt1, dt2, dt;
1560  * double Re = static_cast<FluidModel*>(domain->giveEngngModel())->giveReynoldsNumber();
1561  *
1562  * this -> computeVectorOfVelocities(VM_Total,tStep, u) ;
1563  *
1564  * double vn1 = sqrt(u.at(1)*u.at(1)+u.at(2)*u.at(2));
1565  * double vn2 = sqrt(u.at(3)*u.at(3)+u.at(4)*u.at(4));
1566  * double vn3 = sqrt(u.at(5)*u.at(5)+u.at(6)*u.at(6));
1567  * double veln = max (vn1, max(vn2,vn3));
1568  *
1569  * double l1 = 1.0/(sqrt(b[0]*b[0]+c[0]*c[0]));
1570  * double l2 = 1.0/(sqrt(b[1]*b[1]+c[1]*c[1]));
1571  * double l3 = 1.0/(sqrt(b[2]*b[2]+c[2]*c[2]));
1572  *
1573  * double ln = min (l1, min (l2,l3));
1574  *
1575  * // viscous limit
1576  * dt2 = 0.5*ln*ln*Re;
1577  * if (veln != 0.0) {
1578  * dt1 = ln/veln;
1579  * dt = dt1*dt2/(dt1+dt2);
1580  * } else {
1581  * dt = dt2;
1582  * }
1583  * return dt;
1584  * }
1585  */
1586 
1587 
1588 /* Note this LEPLIC implementation will not work for axi elements as the true volume
1589  * is not taken into account (the effect of radius) !
1590  */
1591 
1592 
1593 double
1594 TR1_2D_SUPG :: computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag)
1595 {
1596  Polygon pg;
1597  double answer, volume = computeMyVolume(matInterface, updFlag);
1598  this->formVolumeInterfacePoly(pg, matInterface, n, p, updFlag);
1599  answer = fabs(pg.computeVolume() / volume);
1600  if ( answer > 1.0 ) {
1601  return 1.0;
1602  } else {
1603  return answer;
1604  }
1605 }
1606 
1607 void
1609  const FloatArray &normal, const double p, bool updFlag)
1610 {
1611  double x, y;
1612  Vertex v;
1613 
1614  matvolpoly.clear();
1615 
1616  if ( this->vof <= TRSUPG_ZERO_VOF ) {
1617  return;
1618  } else if ( this->vof >= ( 1 - TRSUPG_ZERO_VOF ) ) {
1619  for ( int i = 1; i <= 3; i++ ) {
1620  if ( updFlag ) {
1621  x = matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() );
1622  y = matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() );
1623  } else {
1624  x = this->giveNode(i)->giveCoordinate(1);
1625  y = this->giveNode(i)->giveCoordinate(2);
1626  }
1627 
1628  v.setCoords(x, y);
1629  matvolpoly.addVertex(v);
1630  }
1631 
1632  return;
1633  }
1634 
1635  this->formVolumeInterfacePoly(matvolpoly, matInterface, normal, p, updFlag);
1636 }
1637 
1638 
1639 void
1641  const FloatArray &normal, const double p, bool updFlag)
1642 {
1643  int next;
1644  bool nodeIn [ 3 ];
1645  double nx = normal.at(1), ny = normal.at(2), x, y;
1646  double tx, ty;
1647  Vertex v;
1648 
1649  matvolpoly.clear();
1650 
1651  for ( int i = 1; i <= 3; i++ ) {
1652  if ( updFlag ) {
1653  x = matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() );
1654  y = matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() );
1655  } else {
1656  x = this->giveNode(i)->giveCoordinate(1);
1657  y = this->giveNode(i)->giveCoordinate(2);
1658  }
1659 
1660  if ( ( nx * x + ny * y + p ) >= 0. ) {
1661  nodeIn [ i - 1 ] = true;
1662  } else {
1663  nodeIn [ i - 1 ] = false;
1664  }
1665  }
1666 
1667  if ( nodeIn [ 0 ] && nodeIn [ 1 ] && nodeIn [ 2 ] ) { // all nodes inside
1668  for ( int i = 1; i <= 3; i++ ) {
1669  if ( updFlag ) {
1670  x = matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() );
1671  y = matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() );
1672  } else {
1673  x = this->giveNode(i)->giveCoordinate(1);
1674  y = this->giveNode(i)->giveCoordinate(2);
1675  }
1676 
1677  v.setCoords(x, y);
1678  matvolpoly.addVertex(v);
1679  }
1680 
1681  return;
1682  } else if ( !( nodeIn [ 0 ] || nodeIn [ 1 ] || nodeIn [ 2 ] ) ) { // all nodes outside
1683  return;
1684  } else {
1685  for ( int i = 1; i <= 3; i++ ) {
1686  next = i < 3 ? i + 1 : 1;
1687  if ( nodeIn [ i - 1 ] ) {
1688  if ( updFlag ) {
1689  v.setCoords( matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() ),
1690  matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() ) );
1691  } else {
1692  v.setCoords( this->giveNode(i)->giveCoordinate(1),
1693  this->giveNode(i)->giveCoordinate(2) );
1694  }
1695 
1696  matvolpoly.addVertex(v);
1697  }
1698 
1699  if ( nodeIn [ next - 1 ] ^ nodeIn [ i - 1 ] ) {
1700  // compute intersection with (i,next) edge
1701  if ( updFlag ) {
1702  x = matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() );
1703  y = matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() );
1704  tx = matInterface->giveUpdatedXCoordinate( this->giveNode(next)->giveNumber() ) - x;
1705  ty = matInterface->giveUpdatedYCoordinate( this->giveNode(next)->giveNumber() ) - y;
1706  } else {
1707  x = this->giveNode(i)->giveCoordinate(1);
1708  y = this->giveNode(i)->giveCoordinate(2);
1709  tx = this->giveNode(next)->giveCoordinate(1) - x;
1710  ty = this->giveNode(next)->giveCoordinate(2) - y;
1711  }
1712 
1713  double s, sd = nx * tx + ny * ty;
1714  if ( fabs(sd) > 1.e-6 ) {
1715  s = ( -p - ( nx * x + ny * y ) ) / sd;
1716  v.setCoords(x + tx * s, y + ty * s);
1717  matvolpoly.addVertex(v);
1718  } else {
1719  // pathological case - lines are parallel
1720  if ( nodeIn [ i - 1 ] ) {
1721  if ( updFlag ) {
1722  v.setCoords( matInterface->giveUpdatedXCoordinate( this->giveNode(next)->giveNumber() ),
1723  matInterface->giveUpdatedYCoordinate( this->giveNode(next)->giveNumber() ) );
1724  } else {
1725  v.setCoords( this->giveNode(next)->giveCoordinate(1), this->giveNode(next)->giveCoordinate(2) );
1726  }
1727 
1728  matvolpoly.addVertex(v);
1729  } else {
1730  v.setCoords(x, y);
1731  matvolpoly.addVertex(v);
1732  if ( updFlag ) {
1733  v.setCoords( matInterface->giveUpdatedXCoordinate( this->giveNode(next)->giveNumber() ),
1734  matInterface->giveUpdatedYCoordinate( this->giveNode(next)->giveNumber() ) );
1735  } else {
1736  v.setCoords( this->giveNode(next)->giveCoordinate(1), this->giveNode(next)->giveCoordinate(2) );
1737  }
1738 
1739  matvolpoly.addVertex(v);
1740  }
1741  }
1742  }
1743  } // end loop over elem nodes
1744  }
1745 }
1746 
1747 
1748 double
1749 TR1_2D_SUPG :: truncateMatVolume(const Polygon &matvolpoly, double &volume)
1750 {
1751  Polygon me, clip;
1752  Graph g;
1753 
1754  this->formMyVolumePoly(me, NULL, false);
1755  g.clip(clip, me, matvolpoly);
1756 #ifdef __OOFEG
1757  EASValsSetColor( gc [ 0 ].getActiveCrackColor() );
1758  //GraphicObj *go = clip.draw(::gc[OOFEG_DEBUG_LAYER],true);
1759  clip.draw(gc [ OOFEG_DEBUG_LAYER ], true);
1760  //EVFastRedraw(myview);
1761 #endif
1762  volume = clip.computeVolume();
1763  return volume / area;
1764 }
1765 
1766 void
1767 TR1_2D_SUPG :: formMyVolumePoly(Polygon &me, LEPlic *matInterface, bool updFlag)
1768 {
1769  double x, y;
1770  Vertex v;
1771 
1772  me.clear();
1773 
1774  for ( int i = 1; i <= 3; i++ ) {
1775  if ( updFlag ) {
1776  x = matInterface->giveUpdatedXCoordinate( this->giveNode(i)->giveNumber() );
1777  y = matInterface->giveUpdatedYCoordinate( this->giveNode(i)->giveNumber() );
1778  } else {
1779  x = this->giveNode(i)->giveCoordinate(1);
1780  y = this->giveNode(i)->giveCoordinate(2);
1781  }
1782 
1783  v.setCoords(x, y);
1784  me.addVertex(v);
1785  }
1786 }
1787 
1788 
1789 double
1790 TR1_2D_SUPG :: computeMyVolume(LEPlic *matInterface, bool updFlag)
1791 {
1792  double x1, x2, x3, y1, y2, y3;
1793  if ( updFlag ) {
1794  x1 = matInterface->giveUpdatedXCoordinate( this->giveNode(1)->giveNumber() );
1795  x2 = matInterface->giveUpdatedXCoordinate( this->giveNode(2)->giveNumber() );
1796  x3 = matInterface->giveUpdatedXCoordinate( this->giveNode(3)->giveNumber() );
1797 
1798  y1 = matInterface->giveUpdatedYCoordinate( this->giveNode(1)->giveNumber() );
1799  y2 = matInterface->giveUpdatedYCoordinate( this->giveNode(2)->giveNumber() );
1800  y3 = matInterface->giveUpdatedYCoordinate( this->giveNode(3)->giveNumber() );
1801  return 0.5 * ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 );
1802  } else {
1803  return area;
1804  }
1805 }
1806 
1807 double
1809 // Returns the portion of the receiver which is attached to gp.
1810 {
1811  double determinant = fabs( 4 * area * area * ( c [ 1 ] * b [ 0 ] - c [ 0 ] * b [ 1 ] ) );
1812 
1813  return gp->giveWeight() * determinant;
1814 }
1815 
1816 
1817 double
1819 {
1820  FloatArray u;
1821  double Re = static_cast< FluidModel * >( domain->giveEngngModel() )->giveReynoldsNumber();
1822 
1823  this->computeVectorOfVelocities(VM_Total, tStep, u);
1824 
1825  double vn1 = sqrt( u.at(1) * u.at(1) + u.at(2) * u.at(2) );
1826  double vn2 = sqrt( u.at(3) * u.at(3) + u.at(4) * u.at(4) );
1827  double vn3 = sqrt( u.at(5) * u.at(5) + u.at(6) * u.at(6) );
1828  double veln = max( vn1, max(vn2, vn3) );
1829 
1830  double l1 = 1.0 / ( sqrt(b [ 0 ] * b [ 0 ] + c [ 0 ] * c [ 0 ]) );
1831  double l2 = 1.0 / ( sqrt(b [ 1 ] * b [ 1 ] + c [ 1 ] * c [ 1 ]) );
1832  double l3 = 1.0 / ( sqrt(b [ 2 ] * b [ 2 ] + c [ 2 ] * c [ 2 ]) );
1833 
1834  double ln = min( l1, min(l2, l3) );
1835 
1836  if ( veln != 0.0 ) {
1837  return ln / veln;
1838  } else {
1839  return 0.5 * ln * ln * Re;
1840  }
1841 }
1842 
1843 
1844 void
1845 TR1_2D_SUPG :: giveElementCenter(LEPlic *mat_interface, FloatArray &center, bool upd)
1846 {
1847  FloatArray coords;
1848 
1849  center.resize(2);
1850  center.zero();
1851  if ( upd ) {
1852  for ( int i = 1; i <= 3; i++ ) {
1853  mat_interface->giveUpdatedCoordinate( coords, giveNode(i)->giveNumber() );
1854  center.add(coords);
1855  }
1856  } else {
1857  for ( int i = 1; i <= 3; i++ ) {
1858  center.at(1) += this->giveNode(i)->giveCoordinate(1);
1859  center.at(2) += this->giveNode(i)->giveCoordinate(2);
1860  }
1861  }
1862 
1863  center.times(1. / 3.);
1864 }
1865 
1866 int
1868  const FloatArray &coords, IntArray &dofId, ValueModeType mode,
1869  TimeStep *tStep)
1870 {
1871  int indx, es;
1872  double sum;
1873  FloatArray elemvector, f, lc;
1874  //FloatMatrix n;
1875  IntArray elemdofs;
1876  // determine element dof ids
1877  this->giveElementDofIDMask(elemdofs);
1878  es = elemdofs.giveSize();
1879  // first evaluate element unknown vector
1880  this->computeVectorOf(pf, elemdofs, mode, tStep, elemvector);
1881  // determine corresponding local coordinates
1882  if ( this->computeLocalCoordinates(lc, coords) ) {
1883  // compute interpolation matrix
1884  // this->computeNmatrixAt(n, &lc);
1885  // compute answer
1886  answer.resize( dofId.giveSize() );
1887  for ( int i = 1; i <= dofId.giveSize(); i++ ) {
1888  if ( ( indx = elemdofs.findFirstIndexOf( dofId.at(i) ) ) ) {
1889  sum = 0.0;
1890  for ( int j = 1; j <= 3; j++ ) {
1891  sum += lc.at(j) * elemvector.at(es * ( j - 1 ) + indx);
1892  }
1893 
1894  answer.at(i) = sum;
1895  } else {
1896  // OOFEM_ERROR("unknown dof id encountered");
1897  answer.at(i) = 0.0;
1898  }
1899  }
1900 
1901  return 0; // ok
1902  } else {
1903  OOFEM_ERROR("target point not in receiver volume");
1904  return 1; // fail
1905  }
1906 }
1907 
1908 
1909 void
1911 {
1914 }
1915 
1916 int
1918 {
1919  if ( type == IST_VOFFraction ) {
1921  if ( mi ) {
1922  FloatArray val;
1923  mi->giveElementMaterialMixture( val, gp->giveElement()->giveNumber() );
1924  answer.resize(1);
1925  answer.at(1) = val.at(1);
1926  return 1;
1927  } else {
1928  answer.resize(1);
1929  answer.at(1) = 1.0;
1930  return 1;
1931  }
1932  } else {
1933  return SUPGElement :: giveIPValue(answer, gp, type, tStep);
1934  }
1935 }
1936 
1937 void
1939  InternalStateType type, TimeStep *tStep)
1940 {
1941  GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
1942  this->giveIPValue(answer, gp, type, tStep);
1943 }
1944 
1945 void
1947 {
1948  pap.resize(3);
1949  pap.at(1) = this->giveNode(1)->giveNumber();
1950  pap.at(2) = this->giveNode(2)->giveNumber();
1951  pap.at(3) = this->giveNode(3)->giveNumber();
1952 }
1953 
1954 void
1956 {
1957  answer.resize(1);
1958  if ( ( pap == this->giveNode(1)->giveNumber() ) ||
1959  ( pap == this->giveNode(2)->giveNumber() ) ||
1960  ( pap == this->giveNode(3)->giveNumber() ) ) {
1961  answer.at(1) = pap;
1962  } else {
1963  OOFEM_ERROR("node unknown");
1964  }
1965 }
1966 
1967 int
1969 
1970 
1973 {
1974  return SPRPatchType_2dxy;
1975 }
1976 
1977 
1978 
1979 void
1981 // Performs end-of-step operations.
1982 {
1983  SUPGElement :: printOutputAt(file, tStep);
1984  double rho = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveDensity( integrationRulesArray [ 0 ]->getIntegrationPoint(0) );
1985  fprintf(file, "\telement_status { VOF %e, density %e }\n\n", this->giveVolumeFraction(), rho);
1986 }
1987 
1988 
1989 
1991 //
1992 // saves full element context (saves state variables, that completely describe
1993 // current state)
1994 //
1995 {
1996  contextIOResultType iores;
1997 
1998  if ( ( iores = SUPGElement :: saveContext(stream, mode, obj) ) != CIO_OK ) {
1999  THROW_CIOERR(iores);
2000  }
2001 
2002  if ( ( iores = LEPlicElementInterface :: saveContext(stream, mode, obj) ) != CIO_OK ) {
2003  THROW_CIOERR(iores);
2004  }
2005 
2006  return CIO_OK;
2007 }
2008 
2009 
2010 
2012 //
2013 // restores full element context (saves state variables, that completely describe
2014 // current state)
2015 //
2016 {
2017  contextIOResultType iores;
2018 
2019  if ( ( iores = SUPGElement :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
2020  THROW_CIOERR(iores);
2021  }
2022 
2023  if ( ( iores = LEPlicElementInterface :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
2024  THROW_CIOERR(iores);
2025  }
2026 
2027 
2028  return CIO_OK;
2029 }
2030 
2031 
2032 double
2034 {
2035  double answer;
2036  FloatArray fi(3), un;
2037 
2038  this->computeVectorOfVelocities(VM_Total, tStep, un);
2039 
2040  for ( int i = 1; i <= 3; i++ ) {
2041  fi.at(i) = ls->giveLevelSetDofManValue( dofManArray.at(i) );
2042  }
2043 
2044  double fix = b [ 0 ] * fi.at(1) + b [ 1 ] * fi.at(2) + b [ 2 ] * fi.at(3);
2045  double fiy = c [ 0 ] * fi.at(1) + c [ 1 ] * fi.at(2) + c [ 2 ] * fi.at(3);
2046  double norm = sqrt(fix * fix + fiy * fiy);
2047 
2048  answer = ( 1. / 3. ) * ( fix * ( un.at(1) + un.at(3) + un.at(5) ) + fiy * ( un.at(2) + un.at(4) + un.at(6) ) ) / norm;
2049  return answer;
2050 }
2051 
2052 
2053 double
2055 {
2056 #if 0
2057  double fi, answer, eps = 0.0;
2058  FloatArray s(3);
2059 
2060  for ( int i = 1; i <= 3; i++ ) {
2061  fi = ls->giveLevelSetDofManValue( dofManArray.at(i) );
2062  s.at(i) = fi / sqrt(fi * fi + eps * eps);
2063  }
2064 
2065  answer = ( 1. / 3. ) * ( s.at(1) + s.at(2) + s.at(3) );
2066  return answer;
2067 
2068 #else
2069 
2070  int neg = 0, pos = 0, zero = 0, si = 0;
2071  double x1, x2, x3, y1, y2, y3;
2072  FloatArray fi(3);
2073 
2074  for ( int i = 1; i <= 3; i++ ) {
2075  fi.at(i) = ls->giveLevelSetDofManValue( dofManArray.at(i) );
2076  }
2077 
2078 
2079  for ( int i = 1; i <= 3; i++ ) {
2080  if ( fi.at(i) >= 0. ) {
2081  pos++;
2082  }
2083 
2084  if ( fi.at(i) < 0.0 ) {
2085  neg++;
2086  }
2087 
2088  if ( fi.at(i) == 0. ) {
2089  zero++;
2090  }
2091  }
2092 
2093  if ( zero == 3 ) {
2094  return 0.0;
2095  } else if ( neg == 0 ) { // all level set values positive
2096  return 1.0; //return area;
2097  } else if ( pos == 0 ) { // all level set values negative
2098  return -1.0; //return -area;
2099  } else {
2100  // zero level set inside
2101  // find the vertex vith level set sign different from other two
2102  for ( int i = 1; i <= 3; i++ ) {
2103  if ( ( pos > neg ) && ( fi.at(i) < 0.0 ) ) {
2104  si = i;
2105  break;
2106  }
2107 
2108  if ( ( pos < neg ) && ( fi.at(i) >= 0.0 ) ) {
2109  si = i;
2110  break;
2111  }
2112  }
2113 
2114  if ( si ) {
2115  x1 = this->giveNode(si)->giveCoordinate(1);
2116  y1 = this->giveNode(si)->giveCoordinate(2);
2117 
2118  // compute intersections
2119  int prev_node = ( si > 1 ) ? si - 1 : 3;
2120  int next_node = ( si < 3 ) ? si + 1 : 1;
2121 
2122  //double l = this->giveNode(si)->giveCoordinates()->distance(this->giveNode(next_node)->giveCoordinates());
2123  double t = fi.at(si) / ( fi.at(si) - fi.at(next_node) );
2124  x2 = x1 + t * ( this->giveNode(next_node)->giveCoordinate(1) - x1 );
2125  y2 = y1 + t * ( this->giveNode(next_node)->giveCoordinate(2) - y1 );
2126 
2127  //l = this->giveNode(si)->giveCoordinates()->distance(this->giveNode(prev_node)->giveCoordinates());
2128  t = fi.at(si) / ( fi.at(si) - fi.at(prev_node) );
2129  x3 = x1 + t * ( this->giveNode(prev_node)->giveCoordinate(1) - x1 );
2130  y3 = y1 + t * ( this->giveNode(prev_node)->giveCoordinate(2) - y1 );
2131 
2132  // compute area
2133  double __area = fabs( 0.5 * ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 ) );
2134 
2135  if ( pos > neg ) {
2136  // negative area computed
2137  return ( ( area - __area ) - __area ) / area;
2138  } else {
2139  // postive area computed
2140  return ( __area - ( area - __area ) ) / area;
2141  }
2142  } else {
2143  OOFEM_ERROR("internal consistency error");
2144  return 0.0;
2145  }
2146  }
2147 
2148 #endif
2149 }
2150 
2151 
2152 void
2154 {
2155  answer.resize(3, 2);
2156 
2157  for ( int i = 1; i <= 3; i++ ) {
2158  answer.at(i, 1) = b [ i - 1 ];
2159  answer.at(i, 2) = c [ i - 1 ];
2160  }
2161 }
2162 
2163 
2164 void
2166 {
2167  int neg = 0, pos = 0, zero = 0, si = 0;
2168  double x1, x2, x3, y1, y2, y3;
2169 
2170  answer.resize(2);
2171  for ( int i = 1; i <= 3; i++ ) {
2172  if ( fi.at(i) >= 0. ) {
2173  pos++;
2174  }
2175 
2176  if ( fi.at(i) < 0.0 ) {
2177  neg++;
2178  }
2179 
2180  if ( fi.at(i) == 0. ) {
2181  zero++;
2182  }
2183  }
2184 
2185  if ( neg == 0 ) { // all level set values positive
2186  answer.at(1) = 1.0;
2187  answer.at(2) = 0.0;
2188  } else if ( pos == 0 ) { // all level set values negative
2189  answer.at(1) = 0.0;
2190  answer.at(2) = 1.0;
2191  } else if ( zero == 3 ) {
2192  // ???????
2193  answer.at(1) = 1.0;
2194  answer.at(2) = 0.0;
2195  } else {
2196  // zero level set inside
2197  // find the vertex with level set sign different from other two
2198  for ( int i = 1; i <= 3; i++ ) {
2199  if ( ( pos > neg ) && ( fi.at(i) < 0.0 ) ) {
2200  si = i;
2201  break;
2202  }
2203 
2204  if ( ( pos < neg ) && ( fi.at(i) >= 0.0 ) ) {
2205  si = i;
2206  break;
2207  }
2208  }
2209 
2210  if ( si && ( ( pos + neg ) == 3 ) ) {
2211  x1 = this->giveNode(si)->giveCoordinate(1);
2212  y1 = this->giveNode(si)->giveCoordinate(2);
2213 
2214  // compute intersections
2215  int prev_node = ( si > 1 ) ? si - 1 : 3;
2216  int next_node = ( si < 3 ) ? si + 1 : 1;
2217 
2218  double t = fi.at(si) / ( fi.at(si) - fi.at(next_node) );
2219  x2 = x1 + t * ( this->giveNode(next_node)->giveCoordinate(1) - this->giveNode(si)->giveCoordinate(1) );
2220  y2 = y1 + t * ( this->giveNode(next_node)->giveCoordinate(2) - this->giveNode(si)->giveCoordinate(2) );
2221 
2222  t = fi.at(si) / ( fi.at(si) - fi.at(prev_node) );
2223  x3 = x1 + t * ( this->giveNode(prev_node)->giveCoordinate(1) - this->giveNode(si)->giveCoordinate(1) );
2224  y3 = y1 + t * ( this->giveNode(prev_node)->giveCoordinate(2) - this->giveNode(si)->giveCoordinate(2) );
2225 
2226  // compute area
2227  double __area = 0.5 * ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 );
2228  if ( fabs(__area) / area > 1.00001 ) {
2229  OOFEM_ERROR("internal consistency error");
2230  }
2231 
2232  // prevent some roundoff errors
2233  if ( fabs(__area) > area ) {
2234  __area = sgn(__area) * area;
2235  }
2236 
2237  if ( pos > neg ) {
2238  // negative area computed
2239  answer.at(2) = fabs(__area) / area;
2240  answer.at(1) = 1.0 - answer.at(2);
2241  } else {
2242  // postive area computed
2243  answer.at(1) = fabs(__area) / area;
2244  answer.at(2) = 1.0 - answer.at(1);
2245  }
2246  } else {
2247  OOFEM_ERROR("internal consistency error");
2248  }
2249  }
2250 }
2251 
2252 
2253 void
2255 {
2256  map = {1, 2, 4, 5, 7, 8};
2257 }
2258 
2259 void
2261 {
2262  map = {3, 6, 9};
2263 }
2264 
2265 
2266 #ifdef __OOFEG
2267 int
2269  int node, TimeStep *tStep)
2270 {
2271  /*
2272  * if (type == IST_VOFFraction) {
2273  * answer.resize(1);
2274  * answer.at(1) = this->giveTempVolumeFraction();
2275  * return 1;
2276  * } else if (type == IST_Density) {
2277  * answer.resize(1);
2278  * answer.at(1) = this->giveMaterial()->giveCharacteristicValue(MRM_Density, integrationRulesArray[0]-> getIntegrationPoint(0), tStep);
2279  * return 1;
2280  *
2281  * } else
2282  */
2283  return SUPGElement :: giveInternalStateAtNode(answer, type, mode, node, tStep);
2284 }
2285 
2286 void
2288 {
2289  WCRec p [ 3 ];
2290  GraphicObj *go;
2291 
2292  if ( !gc.testElementGraphicActivity(this) ) {
2293  return;
2294  }
2295 
2296  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
2297  EASValsSetColor( gc.getElementColor() );
2298  EASValsSetEdgeColor( gc.getElementEdgeColor() );
2299  EASValsSetEdgeFlag(true);
2300  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
2301  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
2302  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
2303  p [ 0 ].z = 0.;
2304  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
2305  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
2306  p [ 1 ].z = 0.;
2307  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
2308  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
2309  p [ 2 ].z = 0.;
2310 
2311  go = CreateTriangle3D(p);
2312  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
2313  EGAttachObject(go, ( EObjectP ) this);
2314  EMAddGraphicsToModel(ESIModel(), go);
2315 }
2316 
2318 {
2319  int i, indx, result = 0;
2320  WCRec p [ 3 ];
2321  GraphicObj *tr;
2322  FloatArray v1, v2, v3;
2323  double s [ 3 ];
2324 
2325  if ( !gc.testElementGraphicActivity(this) ) {
2326  return;
2327  }
2328 
2329  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
2330 
2331  // if ((gc.giveIntVarMode() == ISM_local) && (gc.giveIntVarType() == IST_VOFFraction)) {
2332  if ( ( gc.giveIntVarType() == IST_VOFFraction ) && ( gc.giveIntVarMode() == ISM_local ) ) {
2333  Polygon matvolpoly;
2334  this->formMaterialVolumePoly(matvolpoly, NULL, temp_normal, temp_p, false);
2335  EASValsSetColor( gc.getStandardSparseProfileColor() );
2336  //GraphicObj *go = matvolpoly.draw(gc,true,OOFEG_VARPLOT_PATTERN_LAYER);
2337  matvolpoly.draw(gc, true, OOFEG_VARPLOT_PATTERN_LAYER);
2338  return;
2339  }
2340 
2341  if ( gc.giveIntVarMode() == ISM_recovered ) {
2342  result += this->giveInternalStateAtNode(v1, gc.giveIntVarType(), gc.giveIntVarMode(), 1, tStep);
2343  result += this->giveInternalStateAtNode(v2, gc.giveIntVarType(), gc.giveIntVarMode(), 2, tStep);
2344  result += this->giveInternalStateAtNode(v3, gc.giveIntVarType(), gc.giveIntVarMode(), 3, tStep);
2345  } else if ( gc.giveIntVarMode() == ISM_local ) {
2346  GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
2347  result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
2348  v2 = v1;
2349  v3 = v1;
2350  result *= 3;
2351  }
2352 
2353  if ( result != 3 ) {
2354  return;
2355  }
2356 
2357  indx = gc.giveIntVarIndx();
2358 
2359  s [ 0 ] = v1.at(indx);
2360  s [ 1 ] = v2.at(indx);
2361  s [ 2 ] = v3.at(indx);
2362 
2363  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
2364 
2365  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
2366  for ( i = 0; i < 3; i++ ) {
2367  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
2368  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
2369  p [ i ].z = 0.;
2370  }
2371 
2372  //EASValsSetColor(gc.getYieldPlotColor(ratio));
2373  gc.updateFringeTableMinMax(s, 3);
2374  tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
2375  EGWithMaskChangeAttributes(LAYER_MASK, tr);
2376  EMAddGraphicsToModel(ESIModel(), tr);
2377  } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) {
2378  double landScale = gc.getLandScale();
2379 
2380  for ( i = 0; i < 3; i++ ) {
2381  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
2382  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
2383  p [ i ].z = s [ i ] * landScale;
2384  }
2385 
2386  if ( gc.getScalarAlgo() == SA_ZPROFILE ) {
2387  EASValsSetColor( gc.getDeformedElementColor() );
2388  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
2389  EASValsSetFillStyle(FILL_SOLID);
2390  tr = CreateTriangle3D(p);
2391  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | FILL_MASK | LAYER_MASK, tr);
2392  } else {
2393  gc.updateFringeTableMinMax(s, 3);
2394  EASValsSetFillStyle(FILL_SOLID);
2395  tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
2396  EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
2397  }
2398 
2399  EMAddGraphicsToModel(ESIModel(), tr);
2400  }
2401 }
2402 
2403 #endif
2404 } // end namespace oofem
CrossSection * giveCrossSection()
Definition: element.C:495
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.
The element interface required by NodalAvergagingRecoveryModel.
void setField(int item, InputFieldType id)
virtual void computeAccelerationTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes acceleration terms (generalized mass matrix with stabilization terms) for momentum balance e...
Definition: tr1_2d_supg.C:147
void computeNMtrx(FloatArray &answer, GaussPoint *gp)
Definition: tr1_2d_supg.C:1544
virtual void computeDiffusionTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes diffusion terms for momentum balance equations(s).
Definition: tr1_2d_supg.C:323
IntArray dofManArray
Array containing dofmanager numbers.
Definition: element.h:151
virtual int EIPrimaryFieldI_evaluateFieldVectorAt(FloatArray &answer, PrimaryField &pf, const FloatArray &coords, IntArray &dofId, ValueModeType mode, TimeStep *tStep)
Evaluates the value of field at given point of interest (should be located inside receiver&#39;s volume) ...
Definition: tr1_2d_supg.C:1867
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
Definition: tr1_2d_supg.C:1808
The element interface required by ZZNodalRecoveryModel.
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
virtual void computeAdvectionTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes nonlinear advection terms for momentum balance equations(s).
Definition: tr1_2d_supg.C:205
IntArray * giveBoundaryLoadArray()
Returns array containing load numbers of boundary loads acting on element.
Definition: element.C:381
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
Definition: element.C:1257
Element interface for LEPlic class representing Lagrangian-Eulerian (moving) material interface...
Definition: leplic.h:58
Class and object Domain.
Definition: domain.h:115
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
Definition: element.C:86
virtual void computeHomogenizedReinforceTerm_MC(FloatMatrix &answer, Load *load, TimeStep *tStep)
Definition: tr1_2d_supg.C:846
Fluid cross-section.
ScalarAlgorithmType getScalarAlgo()
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: tr1_2d_supg.C:135
virtual void computeAdvectionTerm_MC(FloatArray &answer, TimeStep *tStep)
Computes advection terms for mass conservation equation.
Definition: tr1_2d_supg.C:473
virtual void computeLinearAdvectionTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes the linear advection term for mass conservation equation.
Definition: tr1_2d_supg.C:456
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
double computeVolume() const
Definition: geotoolbox.C:72
The element interface required by ZZNodalRecoveryModel.
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
virtual void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep)
Computes the contribution of the given body load (volumetric).
Definition: tr1_2d_supg.C:1011
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
#define _IFT_Tr1SUPG_pvof
Definition: tr1_2d_supg.h:50
bcGeomType
Type representing the geometric character of loading.
Definition: bcgeomtype.h:40
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
int max(int i, int j)
Returns bigger value form two given decimals.
Definition: mathfem.h:71
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
double sgn(double i)
Returns the signum of given value (if value is < 0 returns -1, otherwise returns 1) ...
Definition: mathfem.h:91
Class implementing element body load, acting over whole element volume (e.g., the dead weight)...
Definition: bodyload.h:49
#define OOFEG_RAW_GEOMETRY_LAYER
Element interface for LevelSetPCS class representing level-set like material interface.
Definition: levelsetpcs.h:68
virtual int checkConsistency()
Used to check consistency and initialize some element geometry data (area,b,c).
Definition: tr1_2d_supg.C:1538
virtual double truncateMatVolume(const Polygon &matvolpoly, double &volume)
Truncates given material polygon to receiver.
Definition: tr1_2d_supg.C:1749
void setPermanentVolumeFraction(double v)
Definition: leplic.h:106
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
Base class for fluid problems.
Definition: fluidmodel.h:46
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: tr1_2d_supg.C:98
virtual void formMyVolumePoly(Polygon &myPoly, LEPlic *mat_interface, bool updFlag)
Assembles receiver volume.
Definition: tr1_2d_supg.C:1767
virtual MaterialInterface * giveMaterialInterface(int n)
Returns material interface representation for given domain.
Definition: engngm.h:351
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
double giveUpdatedYCoordinate(int num)
Definition: leplic.h:190
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: element.C:779
virtual void giveLocalPressureDofMap(IntArray &map)
Definition: tr1_2d_supg.C:2260
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: supgelement.C:80
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...
Definition: tr1_2d_supg.C:2268
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: tr1_2d_supg.C:2317
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
void negated()
Changes sign of receiver values.
Definition: floatmatrix.C:1605
int giveNumber()
Returns domain number.
Definition: domain.h:266
virtual double giveProperty(int aProperty, TimeStep *tStep, const std::map< std::string, FunctionArgument > &valDict)
Definition: boundaryload.C:137
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes boundary condition value - its components values at given time.
Definition: load.C:82
General stabilized SUPG/PSPG element for CFD analysis.
Definition: supgelement.h:58
virtual double giveCoordinate(int i)
Definition: node.C:82
Class implementing an array of integers.
Definition: intarray.h:61
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
Definition: tr1_2d_supg.C:1938
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
MatResponseMode
Describes the character of characteristic material matrix.
virtual void computeHomogenizedReinforceTerm_MB(FloatMatrix &answer, Load *load, TimeStep *tStep)
Definition: tr1_2d_supg.C:818
virtual void computePressureTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes pressure terms for mass conservation equation.
Definition: tr1_2d_supg.C:557
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
Distributed body load.
Definition: bcgeomtype.h:43
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: element.C:970
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: tr1_2d_supg.C:1466
double giveTimeIncrement()
Returns solution step associated time increment.
Definition: timestep.h:150
virtual void giveElementCenter(LEPlic *mat_interface, FloatArray &center, bool updFlag)
Computes the receiver center (in updated Lagrangian configuration).
Definition: tr1_2d_supg.C:1845
void updateYourself(TimeStep *tStep)
Definition: leplic.h:122
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:780
Element interface class.
Definition: primaryfield.h:58
virtual void computeVectorOfPressures(ValueModeType mode, TimeStep *tStep, FloatArray &pressures)
Definition: fmelement.C:55
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
Definition: tr1_2d_supg.C:1917
FloatArray * givePermeability()
Definition: reinforcement.h:90
InternalStateType giveIntVarType()
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
Definition: element.C:759
double giveNaturalCoordinate(int i) const
Returns i-th natural element coordinate of receiver.
Definition: gausspoint.h:136
virtual void giveElementMaterialMixture(FloatArray &answer, int ielem)=0
Returns volumetric (or other based measure) of relative material contents in given element...
virtual void computeBCRhsTerm_MB(FloatArray &answer, TimeStep *tStep)
Computes Rhs terms due to boundary conditions.
Definition: tr1_2d_supg.C:867
virtual double computeLEPLICVolumeFraction(const FloatArray &n, const double p, LEPlic *matInterface, bool updFlag)
Computes corresponding volume fraction to given interface position.
Definition: tr1_2d_supg.C:1594
virtual void updateStabilizationCoeffs(TimeStep *tStep)
Updates the stabilization coefficients used for CBS and SUPG algorithms.
Definition: tr1_2d_supg.C:1089
Abstract base class representing a boundary load (force, momentum, ...) that acts directly on a bound...
Definition: boundaryload.h:110
virtual void computeVectorOfVelocities(ValueModeType mode, TimeStep *tStep, FloatArray &velocities)
Definition: fmelement.C:48
virtual void computeAccelerationTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes acceleration terms for mass conservation equation.
Definition: tr1_2d_supg.C:541
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: tr1_2d_supg.C:1910
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual double LS_PCS_computeF(LevelSetPCS *ls, TimeStep *tStep)
Evaluates F in level set equation of the form where for interface position driven by flow with speed...
Definition: tr1_2d_supg.C:2033
REGISTER_Element(LSpace)
virtual double giveVariableScale(VarScaleType varId)
Returns the scale factor for given variable type.
Definition: engngm.h:1087
virtual void initGeometry()
Definition: tr1_2d_supg.C:1504
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
virtual void computeSlipWithFrictionBCTerm_MB(FloatMatrix &answer, Load *load, int side, TimeStep *tStep)
Computes Lhs term due to applied slip with friction bc.
Definition: tr1_2d_supg.C:573
void clip(Polygon &result, const Polygon &a, const Polygon &b)
Definition: geotoolbox.C:575
Abstract base class representing (moving) material interfaces.
void times(double f)
Multiplies receiver by factor f.
Definition: floatmatrix.C:1594
virtual void giveLocalVelocityDofMap(IntArray &map)
Definition: tr1_2d_supg.C:2254
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).
Definition: tr1_2d_supg.C:1608
Neumann type (prescribed flux).
Definition: bctype.h:43
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...
Definition: tr1_2d_supg.C:2165
double t_supg
Stabilization coefficients, updated for each solution step in updateStabilizationCoeffs() ...
Definition: supgelement.h:70
IntArray * giveBodyLoadArray()
Returns array containing load numbers of loads acting on element.
Definition: element.C:372
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
IntArray bodyLoadArray
Array containing indexes of loads (body loads and boundary loads are kept separately), that apply on receiver.
Definition: element.h:160
virtual double giveCharacteristicValue(CharType type, TimeStep *tStep)
Computes characteristic value of receiver of requested type in given time step.
Definition: element.C:627
Class representing the special graph constructed from two polygons that is used to perform boolean op...
Definition: geotoolbox.h:191
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
Definition: element.h:498
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
Definition: timestep.C:114
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
This class implements an influence of reinforcement into flow problems, especially concrete (binhamfl...
Definition: reinforcement.h:58
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: tr1_2d_supg.C:1990
virtual bcType giveType() const
Returns receiver load type.
Definition: boundaryload.h:166
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: tr1_2d_supg.C:2011
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: tr1_2d_supg.C:1955
virtual void computeBCRhsTerm_MC(FloatArray &answer, TimeStep *tStep)
Computes Rhs terms due to boundary conditions.
Definition: tr1_2d_supg.C:966
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
Definition: crosssection.C:54
virtual void computeAdvectionDerivativeTerm_MC(FloatMatrix &answer, TimeStep *tStep)
Computes the derivative of advection terms for mass conservation equation with respect to nodal veloc...
Definition: tr1_2d_supg.C:500
InternalStateMode giveIntVarMode()
virtual double computeCriticalTimeStep(TimeStep *tStep)
Computes the critical time increment.
Definition: tr1_2d_supg.C:1459
Abstract base class representing Lagrangian-Eulerian (moving) material interfaces.
Definition: leplic.h:153
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: tr1_2d_supg.C:2287
virtual void LS_PCS_computedN(FloatMatrix &answer)
Returns gradient of shape functions.
Definition: tr1_2d_supg.C:2153
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void computeDeviatoricStrain(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
Definition: tr1_2d_supg.C:1489
Class representing 2D polygon.
Definition: geotoolbox.h:91
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
TR1_2D_SUPG(int n, Domain *d)
Definition: tr1_2d_supg.C:73
double computeFrobeniusNorm() const
Computes the Frobenius norm of the receiver.
Definition: floatmatrix.C:1613
virtual void computeAdvectionDerivativeTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes the derivative of advection terms for momentum balance equations(s) with respect to nodal ve...
Definition: tr1_2d_supg.C:249
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual double give(CrossSectionProperty a, GaussPoint *gp)
Returns the value of cross section property at given point.
Definition: crosssection.C:151
void setCoords(double x, double y)
Definition: geotoolbox.h:77
Abstract base class representing Level Set representation of material interfaces. ...
Definition: levelsetpcs.h:114
static FEI2dTrLin interp
Definition: tr1_2d_supg.h:74
double norm(const FloatArray &x)
Definition: floatarray.C:985
CharType
Definition: chartype.h:87
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int computeNumberOfDofs()
Computes or simply returns total number of element&#39;s local DOFs.
Definition: tr1_2d_supg.C:83
double giveUpdatedXCoordinate(int num)
Definition: leplic.h:189
Class Interface.
Definition: interface.h:82
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
virtual bcGeomType giveBCGeoType() const
Returns geometry character of boundary condition.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: element.C:885
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
Class representing the a dynamic Input Record.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
virtual double LS_PCS_computeS(LevelSetPCS *ls, TimeStep *tStep)
Evaluates S in level set equation of the form where .
Definition: tr1_2d_supg.C:2054
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: tr1_2d_supg.C:1968
The spatial localizer element interface associated to spatial localizer.
virtual FEInterpolation * giveInterpolation() const
Definition: tr1_2d_supg.C:95
virtual bool computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
Computes the element local coordinates from given global coordinates.
Definition: element.C:1222
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
Definition: element.h:170
contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores context of receiver from given stream.
Definition: leplic.C:107
Class representing vertex.
Definition: geotoolbox.h:60
double vof
Volume fraction of reference fluid in element.
Definition: leplic.h:63
virtual double computeMyVolume(LEPlic *matInterface, bool updFlag)
Computes the volume of receiver.
Definition: tr1_2d_supg.C:1790
#define YieldStress
Definition: matconst.h:80
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: tr1_2d_supg.C:1972
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...
Definition: tr1_2d_supg.C:351
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
int min(int i, int j)
Returns smaller value from two given decimals.
Definition: mathfem.h:59
void updateFringeTableMinMax(double *s, int size)
virtual void computeLSICStabilizationTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes SLIC stabilization term for momentum balance equation(s).
Definition: tr1_2d_supg.C:437
#define OOFEG_DEBUG_LAYER
Load is base abstract class for all loads.
Definition: load.h:61
double p
Line constant of line segment representing interface.
Definition: leplic.h:65
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:337
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: supgelement.C:65
GraphicObj * draw(oofegGraphicContext &, bool filled, int layer=OOFEG_DEBUG_LAYER)
Definition: geotoolbox.C:152
int giveSize() const
Definition: intarray.h:203
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
void addVertex(Vertex v)
Definition: geotoolbox.h:96
virtual bcValType giveBCValType() const
Returns receiver load type.
Class implementing node in finite element mesh.
Definition: node.h:87
int giveNumber() const
Definition: femcmpnn.h:107
virtual ~TR1_2D_SUPG()
Definition: tr1_2d_supg.C:79
virtual int checkConsistency()
Performs consistency check.
Definition: supgelement.C:339
#define TRSUPG_ZERO_VOF
Definition: tr1_2d_supg.C:67
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
virtual void computePressureTerm_MB(FloatMatrix &answer, TimeStep *tStep)
Computes pressure terms for momentum balance equations(s).
Definition: tr1_2d_supg.C:385
Load * giveLoad(int n)
Service for accessing particular domain load.
Definition: domain.C:222
#define OOFEG_VARPLOT_PATTERN_LAYER
double givePorosity()
Accessor.
Definition: reinforcement.h:88
Class representing integration point in finite element program.
Definition: gausspoint.h:93
IntArray boundaryLoadArray
Definition: element.h:160
FloatArray normal
Interface segment normal.
Definition: leplic.h:67
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...
Definition: supgelement.C:366
Class representing solution step.
Definition: timestep.h:80
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.
Definition: tr1_2d_supg.C:1640
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual void computePenetrationWithResistanceBCTerm_MB(FloatMatrix &answer, Load *load, int side, TimeStep *tStep)
Computes Lhs contribution due to applied Penetration bc.
Definition: tr1_2d_supg.C:667
InternalStateMode
Determines the mode of internal variable.
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void computeOutFlowBCTerm_MB(FloatMatrix &answer, int side, TimeStep *tStep)
Computes Lhs contribution due to outflow BC.
Definition: tr1_2d_supg.C:759
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: tr1_2d_supg.C:1946
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.
Definition: intarray.C:331
#define _IFT_Tr1SUPG_vof
Definition: tr1_2d_supg.h:51
virtual double computeCriticalLEPlicTimeStep(TimeStep *tStep)
Computes critical time step.
Definition: tr1_2d_supg.C:1818
Class representing Gaussian-quadrature integration rule.
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to stream, for given time step.
Definition: tr1_2d_supg.C:1980
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
Definition: tr1_2d_supg.C:89
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: tr1_2d_supg.C:123

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