OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
cbselement.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 "cbselement.h"
36 #include "dof.h"
37 #include "node.h"
38 #include "integrationrule.h"
39 #include "intarray.h"
40 #include "floatarray.h"
41 #include "floatmatrix.h"
42 #include "dynamicinputrecord.h"
43 
44 #ifdef __OOFEG
45  #include "oofeggraphiccontext.h"
46 #endif
47 
48 namespace oofem {
49 CBSElement :: CBSElement(int n, Domain *aDomain) :
50  FMElement(n, aDomain)
51 { }
52 
53 
55 { }
56 
59 {
60  IRResultType result; // Required by IR_GIVE_FIELD macro
61 
63  if ( !boundarySides.isEmpty() ) {
65  }
66 
67  return FMElement :: initializeFrom(ir);
68 }
69 
70 
71 void
73 {
75  if ( boundarySides.giveSize() > 0 ) {
78  }
79 }
80 
81 
82 void
84  CharType mtrx, TimeStep *tStep)
85 //
86 // returns characteristics matrix of receiver according to mtrx
87 //
88 {
89  if ( mtrx == MassMatrix ) {
90  this->computeConsistentMassMtrx(answer, tStep);
91  } else {
92  OOFEM_ERROR("Unknown Type of characteristic mtrx.");
93  }
94 }
95 
96 
97 void
99  TimeStep *tStep)
100 //
101 // returns characteristics vector of receiver according to requested type
102 //
103 {
104  if ( mtrx == LumpedMassMatrix ) {
105  this->computeDiagonalMassMtrx(answer, tStep);
106  }
107  //else if (mtrx == PrescribedDensityRhsVector)
108  // this->computePrescribedTermsII (answer, mode, tStep);
109  else {
110  OOFEM_ERROR("Unknown Type of characteristic mtrx.");
111  }
112 }
113 
114 
115 void
117 {
118  FloatMatrix mass;
119  FloatArray usp;
120  this->computeConsistentMassMtrx(mass, tStep);
121  this->computeVectorOfVelocities(VM_Incremental, tStep, usp);
122  answer.beProductOf(mass, usp);
123  answer.negated();
124 }
125 
126 #if 0
127 void
128 CBSElement :: computePrescribedTermsII(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
129 {
130  FloatMatrix lhs;
131  FloatArray usp;
132  this->computePressureLhs(lhs, tStep);
133  this->computeVectorOfPressures(mode, tStep, usp);
134  answer.beProductOf(lhs, usp);
135  answer.negated();
136 }
137 #endif
138 
139 int
141 //
142 // check internal consistency
143 // mainly tests, whether material and crossSection data
144 // are safe for conversion to "Structural" versions
145 //
146 {
147  int result = 1;
148  return result;
149 }
150 
151 
152 void
154 {
155  FloatArray stress;
156 
157  // force updating strains & stresses
158  for ( auto &iRule: integrationRulesArray ) {
159  for ( GaussPoint *gp: *iRule ) {
160  computeDeviatoricStress(stress, gp, tStep);
161  }
162  }
163 }
164 
165 
166 #ifdef __OOFEG
167 int
169  int node, TimeStep *tStep)
170 {
171  int indx = 1;
172  Node *n = this->giveNode(node);
173 
174  if ( type == IST_Velocity ) {
175  answer.resize( this->giveSpatialDimension() );
176  std::vector< Dof* >::const_iterator dofindx;
177  if ( ( dofindx = n->findDofWithDofId(V_u) ) != n->end() ) {
178  answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
179  } else if ( ( dofindx = n->findDofWithDofId(V_v) ) != n->end() ) {
180  answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
181  } else if ( ( dofindx = n->findDofWithDofId(V_w) ) != n->end() ) {
182  answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
183  }
184 
185  return 1;
186  } else if ( type == IST_Pressure ) {
187  auto dofindx = n->findDofWithDofId(P_f);
188  if ( dofindx != n->end() ) {
189  answer.resize(1);
190  answer.at(1) = (*dofindx)->giveUnknown(VM_Total, tStep);
191  return 1;
192  } else {
193  return 0;
194  }
195  } else {
196  return Element :: giveInternalStateAtNode(answer, type, mode, node, tStep);
197  }
198 }
199 
200 #endif
201 } // end namespace oofem
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: cbselement.C:168
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
void setField(int item, InputFieldType id)
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: cbselement.C:72
Class and object Domain.
Definition: domain.h:115
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: cbselement.C:58
IntArray boundarySides
Array of boundary sides.
Definition: cbselement.h:60
bool isEmpty() const
Checks if receiver is empty (i.e., zero sized).
Definition: intarray.h:208
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
IntArray boundaryCodes
Boundary sides codes.
Definition: cbselement.h:62
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: element.C:706
virtual void computeDiagonalMassMtrx(FloatArray &answer, TimeStep *tStep)=0
Calculates diagonal mass matrix.
virtual void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep)
Computes characteristic matrix of receiver of requested type in given time step.
Definition: cbselement.C:83
CBSElement(int n, Domain *aDomain)
Definition: cbselement.C:49
virtual void computeVectorOfPressures(ValueModeType mode, TimeStep *tStep, FloatArray &pressures)
Definition: fmelement.C:55
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: element.C:638
virtual void computeVectorOfVelocities(ValueModeType mode, TimeStep *tStep, FloatArray &velocities)
Definition: fmelement.C:48
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual void computeDeviatoricStress(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)=0
Computes deviatoric stress vector in given integration point and solution step from given total strai...
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
virtual 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: element.C:1661
virtual void computeConsistentMassMtrx(FloatMatrix &answer, TimeStep *tStep)=0
Calculates consistent mass matrix.
Class representing vector of real numbers.
Definition: floatarray.h:82
This abstract class represent a general base element class for fluid dynamic problems.
Definition: fmelement.h:54
virtual int giveSpatialDimension()
Returns the element spatial dimension (1, 2, or 3).
Definition: element.C:1347
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
virtual void updateInternalState(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: cbselement.C:153
CharType
Definition: chartype.h:87
#define _IFT_CBSElement_bsides
Definition: cbselement.h:42
Class representing the general Input Record.
Definition: inputrecord.h:101
std::vector< Dof * >::const_iterator findDofWithDofId(DofIDItem dofID) const
Finds index of DOF with required physical meaning of receiver.
Definition: dofmanager.C:266
virtual void giveCharacteristicVector(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep)
Computes characteristic vector of receiver of requested type in given time step.
Definition: cbselement.C:98
Class representing the a dynamic Input Record.
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
virtual void computePrescribedTermsI(FloatArray &answer, TimeStep *tStep)
Calculates rhs due to prescribed (*) velocities for (*) velocities.
Definition: cbselement.C:116
virtual int checkConsistency()
Performs consistency check.
Definition: cbselement.C:140
virtual ~CBSElement()
Definition: cbselement.C:54
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
int giveSize() const
Definition: intarray.h:203
virtual void computePressureLhs(FloatMatrix &answer, TimeStep *tStep)=0
Calculates the pressure LHS.
the oofem namespace is to define a context or scope in which all oofem names are defined.
std::vector< Dof * >::iterator end()
Definition: dofmanager.h:158
Class implementing node in finite element mesh.
Definition: node.h:87
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
void negated()
Switches the sign of every coefficient of receiver.
Definition: floatarray.C:739
#define _IFT_CBSElement_bcodes
Definition: cbselement.h:43
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
InternalStateMode
Determines the mode of internal variable.
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:27 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011