OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
coupledfieldselement.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  *
14  * Copyright (C) 1993 - 2013 Borek Patzak
15  *
16  *
17  *
18  * Czech Technical University, Faculty of Civil Engineering,
19  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
20  *
21  * This library is free software; you can redistribute it and/or
22  * modify it under the terms of the GNU Lesser General Public
23  * License as published by the Free Software Foundation; either
24  * version 2.1 of the License, or (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29  * Lesser General Public License for more details.
30  *
31  * You should have received a copy of the GNU Lesser General Public
32  * License along with this library; if not, write to the Free Software
33  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34  */
35 
36 #if 1
37 #include "../sm/Elements/coupledfieldselement.h"
38 #include "../sm/Materials/structuralms.h"
39 #include "../sm/CrossSections/structuralcrosssection.h"
40 #include "../sm/Elements/nlstructuralelement.h"
41 #include "node.h"
42 #include "material.h"
43 #include "gausspoint.h"
44 #include "gaussintegrationrule.h"
45 #include "floatmatrix.h"
46 #include "floatarray.h"
47 #include "intarray.h"
48 #include "domain.h"
49 #include "cltypes.h"
50 #include "mathfem.h"
51 #include "unknownnumberingscheme.h"
52 #include <cstdio>
53 
54 namespace oofem {
56 // Constructor.
57 {
58  nlGeo = 0;
59 
60 }
61 
62 
63 void
65 {
66  // Routine to extract compute the location array an element given an dofid array.
67  answer.resize(0);
68 
69  int k = 0;
70  for ( int i = 1; i <= numberOfDofMans; i++ ) {
71  DofManager *dMan = this->giveDofManager(i);
72  for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {
73 
74  if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
75  Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
76  answer.followedBy( k + d->giveNumber() );
77  //answer.followedBy( k + j );
78  }
79  }
80  k += dMan->giveNumberOfDofs( );
81  }
82 }
83 
84 
85 void
87 {
88  // Routine to extract the solution vector for an element given an dofid array.
89  // Size will be numberOfDofs and if a certain dofId does not exist a zero is used as value.
90 
91  answer.resize( numberOfDofMans * dofIdArray.giveSize() ); // equal number of nodes for all fields
92  answer.zero();
93  int k = 1;
94  for ( int i = 1; i <= numberOfDofMans; i++ ) {
95  DofManager *dMan = this->giveDofManager(i);
96  for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {
97 
98  if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
99  Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
100  answer.at(k) = d->giveUnknown(valueMode, stepN);
101  }
102  k++;
103  }
104  }
105 }
106 
107 
108 
109 void
111  void (*Nfunc)(GaussPoint*, FloatMatrix), void (*Bfunc)(GaussPoint*, FloatMatrix, int, int), //(GaussPoint*, FloatMatrix)
112  void (*NStressFunc)(GaussPoint*, FloatArray), void (*BStressFunc)(GaussPoint*, FloatArray),
113  double (*dVFunc)(GaussPoint*))
114 {
115  // General implementation of internal forces that computes
116  // f = sum_gp( N^T*GenStress_N + B^T*GenStress_B ) * dV
117 
118  FloatArray NStress, BStress, vGenStress, NS, BS;
119  FloatMatrix N, B;
120 
121  for ( int j = 0; j < this->giveNumberOfIntegrationRules(); j++ ) {
122  for ( auto &gp: this->giveIntegrationRule(j) ) {
123  double dV = this->computeVolumeAround(gp);
124 
125  // compute generalized stress measures
126  if ( NStressFunc && Nfunc ) {
127  Nfunc(gp, N);
128  NStressFunc(gp, NStress);
129  NS.beTProductOf(N, NStress);
130  answer.add(dV, NS);
131  }
132 
133  if ( BStressFunc && Bfunc ) {
134  Bfunc(gp, B, 1, 3);
135  BStressFunc(gp, BStress);
136  BS.beTProductOf(B, BStress);
137  answer.add(dV, BS);
138  }
139 
140 
141  }
142  }
143 }
144 
145 
146 
147 
148 void
150  void (*Nfunc)(GaussPoint*, FloatMatrix),
151  void (*Bfunc)(GaussPoint*, FloatMatrix),
152  void (*NStiffness)(FloatMatrix, MatResponseMode, GaussPoint*, TimeStep*),
153  void (*BStiffness)(FloatMatrix, MatResponseMode, GaussPoint*, TimeStep*),
154  double (*volumeAround)(GaussPoint*) )
155 {
156  FloatMatrix B, DB, N, DN, D_B, D_N;
157 
158  bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode);
159  answer.resize(0,0);
160 
161  for ( auto &gp: this->giveIntegrationRule(0) ) {
162  double dV = this->computeVolumeAround(gp);
163 
164 
165  // compute int_V ( N^t * D_N * N )dV
166  if ( NStiffness && Nfunc ) {
167  Nfunc(gp, N);
168  NStiffness(D_N, rMode, gp, tStep);
169  DN.beProductOf(D_N, N);
170  if ( matStiffSymmFlag ) {
171  answer.plusProductSymmUpper(N, DN, dV);
172  } else {
173  answer.plusProductUnsym(N, DN, dV);
174  }
175  }
176 
177 
178  // compute int_V ( B^t * D_B * B )dV
179  if ( BStiffness && Bfunc ) {
180  Bfunc(gp, B);
181  BStiffness(D_B, rMode, gp, tStep);
182  DB.beProductOf(D_B, B);
183  if ( matStiffSymmFlag ) {
184  answer.plusProductSymmUpper(B, DB, dV);
185  } else {
186  answer.plusProductUnsym(B, DB, dV);
187  }
188  }
189 
190  }
191 
192 
193  if ( matStiffSymmFlag ) {
194  answer.symmetrized();
195  }
196 }
197 
198 
199 
202 {
203  //IRResultType result; // Required by IR_GIVE_FIELD macro
204  //nlGeo = 0;
205 
206  return IRRT_OK;
207 }
208 
209 
210 } // end namespace oofem
211 
212 #endif
CrossSection * giveCrossSection()
Definition: element.C:495
Class and object Domain.
Definition: domain.h:115
virtual IntegrationRule * giveIntegrationRule(int i)
Definition: element.h:835
Abstract base class for "structural" finite elements with geometrical nonlinearities.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
CoupledFieldsElement(int i, Domain *aDomain)
void computeVectorOfDofIDs(const IntArray &dofIdArray, ValueModeType valueMode, TimeStep *stepN, FloatArray &answer)
Base class for dof managers.
Definition: dofmanager.h:113
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
MatResponseMode
Describes the character of characteristic material matrix.
int giveNumberOfIntegrationRules()
Definition: element.h:830
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:780
int giveNumberOfDofs() const
Definition: dofmanager.C:279
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
virtual bool isCharacteristicMtrxSymmetric(MatResponseMode rMode)
Check for symmetry of stiffness matrix.
Definition: crosssection.h:172
#define N(p, q)
Definition: mdm.C:367
void plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:698
virtual double computeVolumeAround(GaussPoint *)=0
Returns volume related to given integration point.
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
Definition: floatarray.C:708
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
Class representing vector of real numbers.
Definition: floatarray.h:82
bool hasDofID(DofIDItem id) const
Checks if receiver contains dof with given ID.
Definition: dofmanager.C:166
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void giveInternalForcesVectorGen(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord, void(*Nfunc)(GaussPoint *, FloatMatrix), void(*Bfunc)(GaussPoint *, FloatMatrix, int, int), void(*NStress)(GaussPoint *, FloatArray), void(*BStress)(GaussPoint *, FloatArray), double(*volumeAround)(GaussPoint *))
void computeLocationArrayOfDofIDs(const IntArray &dofIdArray, IntArray &answer)
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
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
Definition: dofmanager.C:119
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
Definition: intarray.C:145
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
void computeStiffnessMatrixGen(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep, void(*Nfunc)(GaussPoint *, FloatMatrix), void(*Bfunc)(GaussPoint *, FloatMatrix), void(*NStiffness)(FloatMatrix, MatResponseMode, GaussPoint *, TimeStep *), void(*BStiffness)(FloatMatrix, MatResponseMode, GaussPoint *, TimeStep *), double(*volumeAround)(GaussPoint *))
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:337
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
Definition: element.C:514
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
void symmetrized()
Initializes the lower half of the receiver according to the upper half.
Definition: floatmatrix.C:1576
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
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011