OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
quad1_ht.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 "quad1_ht.h"
36 #include "fei2dquadlin.h"
37 #include "crosssection.h"
38 #include "gausspoint.h"
39 #include "gaussintegrationrule.h"
40 #include "floatmatrix.h"
41 #include "floatarray.h"
42 #include "intarray.h"
43 #include "mathfem.h"
44 #include "classfactory.h"
45 
46 #ifdef __OOFEG
47  #include "oofeggraphiccontext.h"
48  #include "oofegutils.h"
49 #endif
50 
51 namespace oofem {
52 REGISTER_Element(Quad1_ht);
53 REGISTER_Element(Quad1_hmt);
54 REGISTER_Element(Quad1_mt);
55 
56 FEI2dQuadLin Quad1_ht :: interpolation(1, 2);
57 
58 Quad1_ht :: Quad1_ht(int n, Domain *aDomain) : TransportElement(n, aDomain, HeatTransferEM), SpatialLocalizerInterface(this), ZZNodalRecoveryModelInterface(this)
59 {
60  numberOfDofMans = 4;
62 }
63 
64 Quad1_hmt :: Quad1_hmt(int n, Domain *aDomain) : Quad1_ht(n, aDomain)
65 {
67 }
68 
69 Quad1_mt :: Quad1_mt(int n, Domain *aDomain) : Quad1_ht(n, aDomain)
70 {
72 }
73 
75 { }
76 
79 
80 void
82 {
83  if ( integrationRulesArray.size() == 0 ) {
84  integrationRulesArray.resize( 1 );
85  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 3) );
87  }
88 }
89 
90 
93 {
96 }
97 
98 
99 double
101 // Returns the portion of the receiver which is attached to gp.
102 {
103  double determinant, weight, thickness, volume;
104  determinant = fabs( this->interpolation.giveTransformationJacobian( gp->giveNaturalCoordinates(),
105  FEIElementGeometryWrapper(this) ) );
106  weight = gp->giveWeight();
107  thickness = this->giveCrossSection()->give(CS_Thickness, gp); // 't'
108  volume = determinant * weight * thickness;
109 
110  return volume;
111 }
112 
113 
114 double
116 {
117  return this->giveCrossSection()->give(CS_Thickness, gcoords, this, false);
118 }
119 
120 
121 double
123 {
124  double result = this->interpolation.edgeGiveTransformationJacobian( iEdge, gp->giveNaturalCoordinates(),
126  FloatArray gc;
127  this->interpolation.edgeLocal2global( gc, iEdge, gp->giveNaturalCoordinates(),
129  // temporary gauss point on element (not edge) to evaluate thickness
130  GaussPoint _gp( NULL, 1, gc, 1.0, gp->giveMaterialMode() );
131  double thick = this->giveCrossSection()->give(CS_Thickness, & _gp); // 't'
132  return result *thick *gp->giveWeight();
133 }
134 
135 Interface *
137 {
138  if ( interface == SpatialLocalizerInterfaceType ) {
139  return static_cast< SpatialLocalizerInterface * >(this);
140  } else if ( interface == EIPrimaryFieldInterfaceType ) {
141  return static_cast< EIPrimaryFieldInterface * >(this);
142  } else if ( interface == ZZNodalRecoveryModelInterfaceType ) {
143  return static_cast< ZZNodalRecoveryModelInterface * >(this);
144  }
145 
146  return NULL;
147 }
148 
149 
150 #ifdef __OOFEG
152 {
153  WCRec p [ 4 ];
154  GraphicObj *go;
155 
156  if ( !gc.testElementGraphicActivity(this) ) {
157  return;
158  }
159 
160  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
161  EASValsSetColor( gc.getElementColor() );
162  EASValsSetEdgeColor( gc.getElementEdgeColor() );
163  EASValsSetEdgeFlag(true);
164  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
165  EASValsSetFillStyle(FILL_HOLLOW);
166  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
167  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
168  p [ 0 ].z = 0.;
169  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
170  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
171  p [ 1 ].z = 0.;
172  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
173  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
174  p [ 2 ].z = 0.;
175  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
176  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
177  p [ 3 ].z = 0.;
178 
179  go = CreateQuad3D(p);
180  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
181  EGAttachObject(go, ( EObjectP ) this);
182  EMAddGraphicsToModel(ESIModel(), go);
183 }
184 
186 {
187  int i, result = 0;
188  WCRec p [ 4 ];
189  double s [ 4 ];
190  InternalStateType itype = gc.giveIntVarType();
191 
192  if ( !gc.testElementGraphicActivity(this) ) {
193  return;
194  }
195 
196  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
197 
198  if ( itype == IST_HydrationDegree ) {
199  FloatArray v [ 4 ];
200  for ( i = 1; i <= 4; i++ ) {
201  result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
202  }
203 
204  if ( result != 4 ) {
205  return;
206  }
207 
208  int indx = gc.giveIntVarIndx();
209 
210  for ( i = 1; i <= 4; i++ ) {
211  s [ i - 1 ] = v [ i - 1 ].at(indx);
212  }
213 
214  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
215  for ( i = 0; i < 4; i++ ) {
216  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
217  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
218  p [ i ].z = 0.;
219  }
220 
221  gc.updateFringeTableMinMax(s, 4);
222  GraphicObj *tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
223  EGWithMaskChangeAttributes(LAYER_MASK, tr);
224  EMAddGraphicsToModel(ESIModel(), tr);
225  }
226  } else if ( ( ( ( emode == HeatTransferEM ) || ( emode == HeatMass1TransferEM ) ) && ( itype == IST_Temperature ) ) ||
227  ( ( emode == HeatMass1TransferEM ) && ( itype == IST_MassConcentration_1 ) ) ) {
228  IntArray dofMask(1);
229  if ( itype == IST_Temperature ) {
230  dofMask.at(1) = T_f;
231  } else {
232  dofMask.at(1) = C_1;
233  }
234 
235  FloatArray r;
236  for ( i = 0; i < 4; i++ ) {
237  this->giveNode(i + 1)->giveUnknownVector(r, dofMask, VM_Total, tStep);
238  s [ i ] = r.at(1);
239 
240  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
241  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
242  p [ i ].z = 0.;
243  }
244 
245  gc.updateFringeTableMinMax(s, 4);
246  GraphicObj *tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
247  EGWithMaskChangeAttributes(LAYER_MASK, tr);
248  EMAddGraphicsToModel(ESIModel(), tr);
249  }
250 }
251 
252 #endif
253 } // end namespace oofem
CrossSection * giveCrossSection()
Definition: element.C:495
Quad1_hmt(int n, Domain *d)
Definition: quad1_ht.C:64
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.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
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...
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
Definition: quad1_ht.C:136
Class and object Domain.
Definition: domain.h:115
ScalarAlgorithmType getScalarAlgo()
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Definition: feinterpol.C:43
The element interface required by ZZNodalRecoveryModel.
Quad1_mt(int n, Domain *d)
Definition: quad1_ht.C:69
virtual double computeEdgeVolumeAround(GaussPoint *gp, int iEdge)
Computes the length around a integration point on a edge.
Definition: quad1_ht.C:122
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define OOFEG_RAW_GEOMETRY_LAYER
virtual double giveThicknessAt(const FloatArray &gcoords)
Gives the thickness at some global coordinate.
Definition: quad1_ht.C:115
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge Jacobian of transformation between local and global coordinates.
Definition: feinterpol2d.C:175
static FEI2dQuadLin interpolation
Definition: quad1_ht.h:55
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: quad1_ht.C:185
virtual double giveCoordinate(int i)
Definition: node.C:82
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual FEInterpolation * giveInterpolation() const
Definition: quad1_ht.C:78
Quad1_ht(int n, Domain *d)
Definition: quad1_ht.C:58
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
Element interface class.
Definition: primaryfield.h:58
InternalStateType giveIntVarType()
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
Definition: quad1_ht.C:100
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
Assembles the vector of unknowns in global c.s for given dofs of receiver.
Definition: dofmanager.C:685
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: element.C:638
REGISTER_Element(LSpace)
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
This abstract class represent a general base element class for transport problems.
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: quad1_ht.C:81
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
Quadratic (2d) element with linear approximation for heat transfer.
Definition: quad1_ht.h:52
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
Definition: crosssection.C:54
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
virtual ~Quad1_ht()
Definition: quad1_ht.C:74
Class representing vector of real numbers.
Definition: floatarray.h:82
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
virtual void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: fei2dquadlin.C:279
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
The spatial localizer element interface associated to spatial localizer.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: quad1_ht.C:92
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
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: quad1_ht.C:151
the oofem namespace is to define a context or scope in which all oofem names are defined.
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
Class representing Gaussian-quadrature integration rule.

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