OOFEM 3.0
Loading...
Searching...
No Matches
boundaryload.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 "boundaryload.h"
36#include "function.h"
37#include "floatarray.h"
38#include "timestep.h"
39#include "dynamicinputrecord.h"
40#include "valuemodetype.h"
41#include "domain.h"
42#include "datastream.h"
43#include "contextioerr.h"
44
45namespace oofem {
46
47BoundaryLoad :: BoundaryLoad(int i, Domain * d) : Load(i, d), coordSystemType(CST_Global){
48
49}
50
51void
52BoundaryLoad :: computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
53{
54 // returns component array for elements which use direct formulae
55 Load :: computeComponentArrayAt(answer, tStep, mode);
56}
57
58
59void
60BoundaryLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
61{
62 // Evaluates the value at specific integration point
63 int nSize, nDofs;
64 double factor;
66
67 if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) && (mode != VM_TotalIntrinsic) ) {
68 OOFEM_ERROR("unknown mode");
69 }
70
71 this->computeNArray(N, coords);
72 nSize = N.giveSize();
73
74 nDofs = this->componentArray.giveSize() / nSize;
75
76 answer.resize(nDofs);
77
78 for ( int i = 1; i <= nDofs; i++ ) {
79 double value = 0.;
80 for ( int j = 1; j <= nSize; j++ ) {
81 value += N.at(j) * this->componentArray.at(i + ( j - 1 ) * nDofs);
82 }
83
84 answer.at(i) = value;
85 }
86
87 // time distribution
88 factor = this->giveTimeFunction()->evaluate(tStep, mode);
89 answer.times(factor);
90}
91
92
93void
94BoundaryLoad :: initializeFrom(InputRecord &ir)
95{
96 Load :: initializeFrom(ir);
97
98 int dummy;
99 IR_GIVE_OPTIONAL_FIELD(ir, dummy, "ndofs");
100
101 int value = 0;
103 lType = ( bcType ) value;
104
105 value = 0;
107 coordSystemType = ( CoordSystType ) value;
108
111
113
114 temperOffset = 273.15;
116}
117
118
119void
120BoundaryLoad :: giveInputRecord(DynamicInputRecord &input)
121{
122 Load :: giveInputRecord(input);
128}
129
130
131double
132BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict) const
133{
134 double answer;
135 if ( propertyDictionary.includes(aProperty) ) {
136 // check if time fuction registered under the same key
137 if ( propertyTimeFunctDictionary.includes(aProperty) ) {
138 answer = propertyDictionary.at(aProperty) * domain->giveFunction( (int)propertyTimeFunctDictionary.at(aProperty) )->evaluate(tStep, VM_Total);
139 } else {
140 answer = propertyDictionary.at(aProperty);
141 }
142 } else {
143 OOFEM_ERROR("Property '%c' not defined", (char)aProperty);
144 }
145
146 if ( propertyMultExpr.isDefined() ) {
147 answer *= propertyMultExpr.eval( valDict, this->giveDomain() );
148 }
149 return answer;
150}
151
152double
153BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep) const
154{
155 return this->giveProperty(aProperty, tStep, {});
156}
157
158double
159BoundaryLoad :: giveTemperOffset(void)
160{
161 return this->temperOffset;
162}
163
164void
165BoundaryLoad :: saveContext(DataStream &stream, ContextMode mode)
166{
167 Load :: saveContext(stream, mode);
168
169 if ( mode & CM_Definition ) {
170 if ( !stream.write(lType) ) {
172 }
173 if ( !stream.write(coordSystemType) ) {
175 }
176 propertyDictionary.saveContext(stream);
177 propertyTimeFunctDictionary.saveContext(stream);
178
179 if ( !stream.write(temperOffset) ) {
181 }
182 }
183}
184
185
186void
187BoundaryLoad :: restoreContext(DataStream &stream, ContextMode mode)
188{
189 Load :: restoreContext(stream, mode);
190
191 if ( mode & CM_Definition ) {
192 int _val;
193 if ( !stream.read(_val) ) {
195 }
196 lType = (bcType) _val;
197
198 if ( !stream.read(_val) ) {
200 }
202
203 propertyDictionary.restoreContext(stream);
204 propertyTimeFunctDictionary.restoreContext(stream);
205
206 if ( !stream.read(temperOffset) ) {
208 }
209 }
210}
211
212} // 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 N(a, b)
virtual void computeNArray(FloatArray &answer, const FloatArray &coords) const =0
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.
virtual double giveProperty(int aProperty, TimeStep *tStep, const std ::map< std ::string, FunctionArgument > &valDict) const
ScalarFunction propertyMultExpr
Expression to multiply all properties.
double temperOffset
Temperature offset with regards to Kelvin. Default is 273.15.
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
void setField(int item, InputFieldType id)
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
double & at(Index i)
Definition floatarray.h:202
void times(double s)
Definition floatarray.C:834
FloatArray componentArray
Components of boundary condition.
Definition load.h:86
Load(int n, Domain *d)
Definition load.C:44
CoordSystType
Definition load.h:70
@ CST_Global
Load is specified in global c.s.
Definition load.h:71
#define THROW_CIOERR(e)
#define CM_Definition
Definition contextmode.h:47
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
long ContextMode
Definition contextmode.h:43
bcType
Type representing the type of bc.
Definition bctype.h:40
@ CIO_IOERR
General IO error.

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