OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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
48namespace oofem {
50
51void
52NeumannMomentLoad :: initializeFrom(InputRecord &ir)
53{
54 BoundaryLoad :: initializeFrom(ir);
55
57 p = 0.;
60
61 xbar.resize(0);
62}
63
64void
65NeumannMomentLoad :: computeXbar()
66{
67
68 xbar.resize(this->giveDomain()->giveNumberOfSpatialDimensions());
69 xbar.zero();
70
71 celements = this->giveDomain()->giveSet(cset)->giveElementList();
72
73 double V = 0.0;
74
75 for ( auto elementID : celements ) {
76
77 Element *thisElement = this->giveDomain()->giveElement(elementID);
78 FEInterpolation *i = thisElement->giveInterpolation();
79
80 auto iRule = i->giveIntegrationRule(3, thisElement->giveGeometryType() );
81
82 FloatArray coord;
83 for ( auto &gp: *iRule ) {
84 FloatArray lcoords = gp->giveNaturalCoordinates();
85 double detJ = i->giveTransformationJacobian(lcoords, FEIElementGeometryWrapper(thisElement));
86
87 i->local2global(coord, lcoords, FEIElementGeometryWrapper(thisElement));
88 coord.times(gp->giveWeight()*fabs(detJ));
89
90 V += gp->giveWeight()*fabs(detJ);
91
92 xbar.add(coord);
93 }
94 }
95 xbar.times(1.0/V);
96}
97
98void
99NeumannMomentLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
100{
101 // we overload general implementation on the boundary load level due
102 // to implementation efficiency
103
104 computeXbar();
105
106 //double factor;
107
108 if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
109 OOFEM_ERROR("mode not supported");
110 }
111
112 OOFEM_ERROR("Should not happen!");
113/*
114 factor = this->giveTimeFunction()->evaluate(tStep, mode);
115 answer = componentArray;
116 answer.times(factor);
117*/
118}
119
120void
121NeumannMomentLoad :: computeNormal(FloatArray &answer, Element *e, int side)
122{
123
124 FloatArray xi;
125
126 if ( this->domain->giveNumberOfSpatialDimensions() == 3 ) {
127 xi.resize(2);
128 xi(0) = 0.25;
129 xi(1) = 0.25;
130 } else {
131 xi.resize(1);
132 xi(0) = 0.5;
133 }
134
135 FEInterpolation *interpolation = e->giveInterpolation();
136
137 interpolation->boundaryEvalNormal( answer, side, xi, FEIElementGeometryWrapper(e) );
138}
139
140void
141NeumannMomentLoad :: computeValueAtBoundary(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode, Element *e, int boundary)
142{
143 computeXbar();
144
145 FEInterpolation *interpolation = e->giveInterpolation();
146
147 // Compute normal
148 FloatArray Normal, lcoords;
149 interpolation->global2local(lcoords, coords, FEIElementGeometryWrapper(e));
150 interpolation->boundaryEvalNormal( Normal, boundary, lcoords, FEIElementGeometryWrapper(e) );
151
152 // Compute x in current configuration
153 FloatArray u;
154 IntArray bNodes;
155
156 FloatArray xdiff = coords-xbar;;
157
158 double l = p+g.dotProduct(xdiff);
159
160 answer = l*Normal;
161
162 // Finally, compute value of loadtimefunction
163 double factor;
164 factor = this->giveTimeFunction()->evaluate(tStep, mode);
165 answer=answer*factor;
166
167}
168
169}
#define REGISTER_BoundaryCondition(class)
virtual FEInterpolation * giveInterpolation() const
Definition element.h:648
virtual Element_Geometry_Type giveGeometryType() const =0
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const =0
virtual double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
Definition feinterpol.C:81
virtual std::unique_ptr< IntegrationRule > giveIntegrationRule(int order, const Element_Geometry_Type) const
Definition feinterpol.C:90
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
Domain * giveDomain() const
Definition femcmpnn.h:97
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
void resize(Index s)
Definition floatarray.C:94
void times(double s)
Definition floatarray.C:834
void computeXbar()
Compute centre of mass for set cset.
int cset
Set containing elements used to calculate xbar.
FloatArray xbar
Center of structure.
IntArray celements
Array containing elements elements in set cset.
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_NeumannMomentLoad_Gradient
#define _IFT_NeumannMomentLoad_Constant
#define _IFT_NeumannMomentLoad_CenterSet

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011