OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "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#include "paramkey.h"
44
45#ifdef __OOFEG
46 #include "oofeggraphiccontext.h"
47#endif
48
49namespace oofem {
50
53
54
55CBSElement :: CBSElement(int n, Domain *aDomain) :
56 FMElement(n, aDomain)
57{ }
58
59
60void
61CBSElement :: initializeFrom(InputRecord &ir, int priority)
62{
63 FMElement :: initializeFrom(ir, priority);
64 ParameterManager &ppm = this->giveDomain()->elementPPM;
67}
68
69void
70CBSElement :: initializeFinish()
71{
72 ParameterManager &ppm = this->giveDomain()->elementPPM;
73 FMElement :: initializeFinish();
74 if (!boundarySides.isEmpty() ) {
76 }
77}
78
79
80void
81CBSElement :: giveInputRecord(DynamicInputRecord &input)
82{
83 FMElement :: giveInputRecord(input);
84 if ( boundarySides.giveSize() > 0 ) {
85 input.setField(this->boundarySides, IPK_CBSElement_bsides.getNameCStr());
86 input.setField(this->boundaryCodes, IPK_CBSElement_bcodes.getNameCStr());
87 }
88}
89
90
91void
92CBSElement :: giveCharacteristicMatrix(FloatMatrix &answer,
93 CharType mtrx, TimeStep *tStep)
94//
95// returns characteristics matrix of receiver according to mtrx
96//
97{
98 if ( mtrx == MassMatrix ) {
99 this->computeConsistentMassMtrx(answer, tStep);
100 } else {
101 OOFEM_ERROR("Unknown Type of characteristic mtrx.");
102 }
103}
104
105
106void
107CBSElement :: giveCharacteristicVector(FloatArray &answer, CharType mtrx, ValueModeType mode,
108 TimeStep *tStep)
109//
110// returns characteristics vector of receiver according to requested type
111//
112{
113 if ( mtrx == LumpedMassMatrix ) {
114 this->computeDiagonalMassMtrx(answer, tStep);
115 }
116 //else if (mtrx == PrescribedDensityRhsVector)
117 // this->computePrescribedTermsII (answer, mode, tStep);
118 else {
119 OOFEM_ERROR("Unknown Type of characteristic mtrx.");
120 }
121}
122
123
124void
125CBSElement :: computePrescribedTermsI(FloatArray &answer, TimeStep *tStep)
126{
127 FloatMatrix mass;
128 FloatArray usp;
129 this->computeConsistentMassMtrx(mass, tStep);
130 this->computeVectorOfVelocities(VM_Incremental, tStep, usp);
131 answer.beProductOf(mass, usp);
132 answer.negated();
133}
134
135#if 0
136void
137CBSElement :: computePrescribedTermsII(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
138{
139 FloatMatrix lhs;
140 FloatArray usp;
141 this->computePressureLhs(lhs, tStep);
142 this->computeVectorOfPressures(mode, tStep, usp);
143 answer.beProductOf(lhs, usp);
144 answer.negated();
145}
146#endif
147
148int
149CBSElement :: checkConsistency()
150//
151// check internal consistency
152// mainly tests, whether material and crossSection data
153// are safe for conversion to "Structural" versions
154//
155{
156 int result = 1;
157 return result;
158}
159
160
161void
162CBSElement :: updateInternalState(TimeStep *tStep)
163{
164 FloatArray stress;
165
166 // force updating strains & stresses
167 for ( auto &iRule: integrationRulesArray ) {
168 for ( auto &gp: *iRule ) {
169 computeDeviatoricStress(stress, gp, tStep);
170 }
171 }
172}
173
174
175#ifdef __OOFEG
176int
177CBSElement :: giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode,
178 int node, TimeStep *tStep)
179{
180 int indx = 1;
181 Node *n = this->giveNode(node);
182
183 if ( type == IST_Velocity ) {
184 answer.resize( this->giveSpatialDimension() );
185 std::vector< Dof* >::const_iterator dofindx;
186 if ( ( dofindx = n->findDofWithDofId(V_u) ) != n->end() ) {
187 answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
188 } else if ( ( dofindx = n->findDofWithDofId(V_v) ) != n->end() ) {
189 answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
190 } else if ( ( dofindx = n->findDofWithDofId(V_w) ) != n->end() ) {
191 answer.at(indx++) = (*dofindx)->giveUnknown(VM_Total, tStep);
192 }
193
194 return 1;
195 } else if ( type == IST_Pressure ) {
196 auto dofindx = n->findDofWithDofId(P_f);
197 if ( dofindx != n->end() ) {
198 answer.resize(1);
199 answer.at(1) = (*dofindx)->giveUnknown(VM_Total, tStep);
200 return 1;
201 } else {
202 return 0;
203 }
204 } else {
205 return Element :: giveInternalStateAtNode(answer, type, mode, node, tStep);
206 }
207}
208
209#endif
210} // end namespace oofem
IntArray boundaryCodes
Boundary sides codes.
Definition cbselement.h:57
virtual void computeDiagonalMassMtrx(FloatArray &answer, TimeStep *tStep)=0
IntArray boundarySides
Array of boundary sides.
Definition cbselement.h:55
static ParamKey IPK_CBSElement_bcodes
Definition cbselement.h:60
virtual void computeConsistentMassMtrx(FloatMatrix &answer, TimeStep *tStep)=0
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...
static ParamKey IPK_CBSElement_bsides
Definition cbselement.h:59
std::vector< Dof * >::const_iterator findDofWithDofId(DofIDItem dofID) const
Definition dofmanager.C:274
std::vector< Dof * >::iterator end()
Definition dofmanager.h:162
void setField(int item, InputFieldType id)
Node * giveNode(int i) const
Definition element.h:629
virtual int giveSpatialDimension()
Definition element.C:1391
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
Domain * giveDomain() const
Definition femcmpnn.h:97
int number
Component number.
Definition femcmpnn.h:77
void computeVectorOfVelocities(ValueModeType mode, TimeStep *tStep, FloatArray &velocities)
Definition fmelement.C:44
FMElement(int n, Domain *aDomain)
Definition fmelement.C:38
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
#define OOFEM_ERROR(...)
Definition error.h:79
InternalStateMode
Determines the mode of internal variable.
#define PM_ELEMENT_ERROR_IFNOTSET(_pm, _componentnum, _paramkey)
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)

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