OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
neumannmomentload.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 "neumannmomentload.h"
36 #include "classfactory.h"
37 #include "function.h"
38 #include "inputrecord.h"
39 #include "domain.h"
40 #include "set.h"
41 #include "element.h"
42 #include "feinterpol.h"
43 #include "gausspoint.h"
44 #include "timestep.h"
45 #include "mathfem.h"
46 
47 
48 namespace oofem {
49 REGISTER_BoundaryCondition(NeumannMomentLoad);
50 
53 {
55 
56  IRResultType result;
57 
59  p = 0.;
62 
63  xbar.resize(0);
64 
65  return result;
66 }
67 
68 void
70 {
71 
72  xbar.resize(this->giveDomain()->giveNumberOfSpatialDimensions());
73  xbar.zero();
74 
76 
77  double V=0.0;
78 
79  for ( auto elementID : celements ) {
80 
81  Element *thisElement = this->giveDomain()->giveElement(elementID);
82  FEInterpolation *i = thisElement->giveInterpolation();
83 
84  IntegrationRule *iRule = i->giveIntegrationRule(3);
85 
86  for ( GaussPoint * gp: * iRule ) {
87  FloatArray coord;
88  FloatArray lcoords = gp->giveNaturalCoordinates();
89  double detJ = i->giveTransformationJacobian(lcoords, FEIElementGeometryWrapper(thisElement));
90 
91  i->local2global(coord, lcoords, FEIElementGeometryWrapper(thisElement));
92  coord.times(gp->giveWeight()*fabs(detJ));
93 
94  V=V+gp->giveWeight()*fabs(detJ);
95 
96  xbar.add(coord);
97  }
98 
99  delete iRule;
100 
101  }
102 
103  xbar.times(1.0/V);
104 
105 }
106 
107 void
109 {
110  // we overload general implementation on the boundary load level due
111  // to implementation efficiency
112 
113  computeXbar();
114 
115  double factor;
116 
117  if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
118  OOFEM_ERROR("mode not supported");
119  }
120 
121  OOFEM_ERROR("Should not happen!");
122 
123  factor = this->giveTimeFunction()->evaluate(tStep, mode);
124  answer = componentArray;
125  answer.times(factor);
126 }
127 
128 void
130 {
131 
132  FloatArray xi;
133 
134  if ( this->domain->giveNumberOfSpatialDimensions() == 3 ) {
135  xi.resize(2);
136  xi(0) = 0.25;
137  xi(1) = 0.25;
138  } else {
139  xi.resize(1);
140  xi(0) = 0.5;
141  }
142 
143  FEInterpolation *interpolation = e->giveInterpolation();
144 
145  interpolation->boundaryEvalNormal( answer, side, xi, FEIElementGeometryWrapper(e) );
146 }
147 
148 void
150 {
151  computeXbar();
152 
153  FEInterpolation *interpolation = e->giveInterpolation();
154 
155  // Compute normal
156  FloatArray Normal, lcoords;
157  interpolation->global2local(lcoords, coords, FEIElementGeometryWrapper(e));
158  interpolation->boundaryEvalNormal( Normal, boundary, lcoords, FEIElementGeometryWrapper(e) );
159 
160  // Compute x in current configuration
161  FloatArray u;
162  IntArray bNodes;
163 
164  FloatArray xdiff = coords-xbar;;
165 
166  double l = p+g.dotProduct(xdiff);
167 
168  answer = l*Normal;
169 
170  // Finally, compute value of loadtimefunction
171  double factor;
172  factor = this->giveTimeFunction()->evaluate(tStep, mode);
173  answer=answer*factor;
174 
175 }
176 
177 }
REGISTER_BoundaryCondition(BoundaryCondition)
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation.
Definition: feinterpol.C:43
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
FloatArray componentArray
Components of boundary condition.
Definition: load.h:85
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the normal on the requested boundary.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
IntArray celements
Array containing elements elements in set cset.
Abstract base class for all finite elements.
Definition: element.h:145
double evaluate(TimeStep *tStep, ValueModeType mode)
Returns the value of load time function at given time.
Definition: function.C:55
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition: domain.C:1067
Class implementing an array of integers.
Definition: intarray.h:61
virtual FEInterpolation * giveInterpolation() const
Definition: element.h:629
Abstract base class representing integration rule.
void computeXbar()
Compute centre of mass for set cset.
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
virtual void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
Computes components values of load at given point - global coordinates (coordinates given)...
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
#define OOFEM_ERROR(...)
Definition: error.h:61
int cset
Set containing elements used to calculate xbar.
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
virtual void computeValueAtBoundary(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode, Element *e, int boundary)
Set * giveSet(int n)
Service for accessing particular domain set.
Definition: domain.C:363
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo)=0
Evaluates local coordinates from given global ones.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: boundaryload.C:92
Class representing the general Input Record.
Definition: inputrecord.h:101
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
void computeNormal(FloatArray &answer, Element *e, int side)
Compute normal at center of element.
#define _IFT_NeumannMomentLoad_Constant
Domain * giveDomain() const
Definition: femcmpnn.h:100
#define _IFT_NeumannMomentLoad_Gradient
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual IntegrationRule * giveIntegrationRule(int order)
Sets up a suitable integration rule for numerical integrating over volume.
Definition: feinterpol.C:52
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
#define _IFT_NeumannMomentLoad_CenterSet
FloatArray xbar
Center of structure.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
const IntArray & giveElementList()
Returns list of elements within set.
Definition: set.C:138
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates global coordinates from given local ones.
FloatArray g
Gradient.
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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