OOFEM 3.0
Loading...
Searching...
No Matches
freeconstantsurfaceload.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
36#include "dynamicinputrecord.h"
37#include "function.h"
38#include "floatarray.h"
39#include "intarray.h"
40#include "timestep.h"
41#include "classfactory.h"
42#include "feinterpol3d.h"
43
44#include "connectivitytable.h"
45#include <iostream>
46#include <map>
47
48#include <algorithm>
49
50namespace oofem {
52
53FreeConstantSurfaceLoad :: FreeConstantSurfaceLoad(int i, Domain *d) : SurfaceLoad(i, d)
54{
55 this->loadOffset = 0.0;
56}
57
58void
85
86void
87FreeConstantSurfaceLoad :: giveInputRecord(DynamicInputRecord &input)
88{
89 SurfaceLoad :: giveInputRecord(input);
91}
92
93void
94FreeConstantSurfaceLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
95{
96 if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
97 OOFEM_ERROR("mode not supported");
98 }
99
100 double factor = this->giveTimeFunction()->evaluate(tStep, mode);
101 answer.beScaled(factor, componentArray);
102}
103
104bool FreeConstantSurfaceLoad :: isImposed(TimeStep *tStep)
105{
106 if(this->alreadyDisabled) return false;
107
108 //std::cout << "start\n";
109 IntArray boundaries = domain->giveSet(set)->giveBoundaryList();
110
111 // !!! only elementboundaries with single element and single surface accepted at the moment !!!
112 Element *el = domain->giveElement(boundaries.at(1));
113 IntArray surfNodes = el->giveBoundarySurfaceNodes(boundaries.at(2));
114 int nSurfNodes = surfNodes.giveSize();
115
116 //int nElements = domain->giveNumberOfElements();
117
118 // map of node occurance
119 std::map<int, int> connmap;
120 // iterate over BC's surface nodes
121 for(int k = 1; k <= nSurfNodes; k++) {
122 auto nodeId = el->giveDofManagerNumber(surfNodes.at(k));
123
124 // connected element ids
125 auto conns = domain->giveConnectivityTable()->giveDofManConnectivityArray(nodeId);
126 int connSize = conns->giveSize();
127 //std::cout << "\nel=" << el->giveNumber() << ", ";
128 //std::cout << connSize << ", ";
129 //std::cout << conns->at(1) << "\n";
130
131 // TODO: ITS WRONG WITH INDEPENDENT ELEMENTS?
132 if(connSize > 8 || connSize == 0) return true;
133
134 for(int c = 1; c <= connSize; c++) {
135 if(el->giveNumber() != conns->at(c)) {
136 if (connmap.find(conns->at(c)) == connmap.end()) {
137 connmap[conns->at(c)] = 1;
138 } else {
139 connmap[conns->at(c)] = connmap[conns->at(c)]+1;
140 }
141 }
142 //std::cout << conns->at(c) << ", ";
143 }
144 //giveDofManager(nodeId)->;
145 }
146
147 //std::cout << "end\n";
148
149 // if some element is connected to 4 nodes, its connected to the whole face!
150 for(auto &el : connmap) {
151 if(el.second == 4) {
152 this->alreadyDisabled = true;
153 return false;
154 }
155 }
156
157 return true;
158}
159} // end namespace oofem
#define _IFT_BoundaryLoad_propertyTimeFunctions
#define _IFT_BoundaryLoad_properties
#define _IFT_BoundaryLoad_propertyMultExpr
#define _IFT_BoundaryLoad_temperOffset
#define _IFT_BoundaryLoad_loadtype
#define _IFT_BoundaryLoad_cstype
#define REGISTER_BoundaryCondition(class)
bcType lType
Load type (its physical meaning).
Dictionary propertyTimeFunctDictionary
Optional time-functions for properties.
Dictionary propertyDictionary
Additional b.c properties.
CoordSystType coordSystemType
Load coordinate system.
ScalarFunction propertyMultExpr
Expression to multiply all properties.
double temperOffset
Temperature offset with regards to Kelvin. Default is 273.15.
void setField(int item, InputFieldType id)
virtual IntArray giveBoundarySurfaceNodes(int boundary, bool includeHierarchical=false) const
Definition element.C:898
int giveDofManagerNumber(int i) const
Definition element.h:609
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int giveNumber() const
Definition femcmpnn.h:104
void beScaled(double s, const FloatArray &b)
Definition floatarray.C:208
int set
Set number for boundary condition to be applied to.
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
FloatArray componentArray
Components of boundary condition.
Definition load.h:86
CoordSystType
Definition load.h:70
SurfaceLoad(int i, Domain *d)
#define OOFEM_ERROR(...)
Definition error.h:79
#define _IFT_FreeConstantSurfaceLoad_LoadOffset
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
bcType
Type representing the type of bc.
Definition bctype.h:40

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