OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 "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 
43 namespace oofem {
44 
45 BoundaryLoad :: BoundaryLoad(int i, Domain * d) : Load(i, d), coordSystemType(CST_Global){
46 
47 }
48 
49 void
51 {
52  // returns component array for elements which use direct formulae
53  Load :: computeComponentArrayAt(answer, tStep, mode);
54 }
55 
56 
57 void
59 {
60  // Evaluates the value at specific integration point
61  int nSize, nDofs;
62  double factor;
63  FloatArray N;
64 
65  if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
66  OOFEM_ERROR("unknown mode");
67  }
68 
69  this->computeNArray(N, coords);
70  nSize = N.giveSize();
71 
72  nDofs = this->componentArray.giveSize() / nSize;
73 
74  answer.resize(nDofs);
75 
76  for ( int i = 1; i <= nDofs; i++ ) {
77  double value = 0.;
78  for ( int j = 1; j <= nSize; j++ ) {
79  value += N.at(j) * this->componentArray.at(i + ( j - 1 ) * nDofs);
80  }
81 
82  answer.at(i) = value;
83  }
84 
85  // time distribution
86  factor = this->giveTimeFunction()->evaluate(tStep, mode);
87  answer.times(factor);
88 }
89 
90 
93 {
94  IRResultType result; // Required by IR_GIVE_FIELD macro
95 
96  result = Load :: initializeFrom(ir);
97  if ( result != IRRT_OK ) {
98  return result;
99  }
100 
101  int dummy;
102  IR_GIVE_OPTIONAL_FIELD(ir, dummy, "ndofs");
103 
104  int value = 0;
106  lType = ( bcType ) value;
107 
108  value = 0;
110  coordSystemType = ( CoordSystType ) value;
111 
114 
116 
117  temperOffset = 273.15;
119 
120  return IRRT_OK;
121 }
122 
123 
124 void
126 {
133 }
134 
135 
136 double
137 BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict)
138 {
139  double answer;
140  if ( propertyDictionary.includes(aProperty) ) {
141  // check if time fuction registered under the same key
142  if ( propertyTimeFunctDictionary.includes(aProperty) ) {
143  answer = propertyDictionary.at(aProperty) * domain->giveFunction( (int)propertyTimeFunctDictionary.at(aProperty) )->evaluate(tStep, VM_Total);
144  } else {
145  answer = propertyDictionary.at(aProperty);
146  }
147  } else {
148  OOFEM_ERROR("Property '%c' not defined", (char)aProperty);
149  }
150 
151  if ( propertyMultExpr.isDefined() ) {
152  answer *= propertyMultExpr.eval( valDict, this->giveDomain() );
153  }
154  return answer;
155 }
156 
157 double
159 {
160  return this->giveProperty(aProperty, tStep, {});
161 }
162 
163 double
165 {
166  return this->temperOffset;
167 }
168 
169 
170 } // end namespace oofem
void setField(int item, InputFieldType id)
#define _IFT_BoundaryLoad_propertyMultExpr
Definition: boundaryload.h:50
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: boundaryload.C:125
double eval(const std::map< std::string, FunctionArgument >valDict, Domain *d, GaussPoint *gp=NULL, double param=0.) const
Evaluates the receiver.
Class and object Domain.
Definition: domain.h:115
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
FloatArray componentArray
Components of boundary condition.
Definition: load.h:85
Dictionary propertyTimeFunctDictionary
Optional time-functions for properties.
Definition: boundaryload.h:133
double & at(int aKey)
Returns the value of the pair which key is aKey.
Definition: dictionary.C:106
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
bool includes(int aKey)
Checks if dictionary includes given key.
Definition: dictionary.C:126
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: load.C:98
#define _IFT_BoundaryLoad_properties
Definition: boundaryload.h:48
bool isDefined() const
True if receiver is defined.
virtual double giveProperty(int aProperty, TimeStep *tStep, const std::map< std::string, FunctionArgument > &valDict)
Definition: boundaryload.C:137
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes boundary condition value - its components values at given time.
Definition: load.C:82
double evaluate(TimeStep *tStep, ValueModeType mode)
Returns the value of load time function at given time.
Definition: function.C:55
#define _IFT_BoundaryLoad_loadtype
Definition: boundaryload.h:46
bcType
Type representing the type of bc.
Definition: bctype.h:40
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Returns array of load "vertex" values evaluated at given time.
Definition: boundaryload.C:50
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual void computeNArray(FloatArray &answer, const FloatArray &coords) const =0
Abstract function, for computing approximation matrix of receiver at given point. ...
CoordSystType
Load coordinate system type.
Definition: load.h:69
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: load.C:129
#define N(p, q)
Definition: mdm.C:367
ScalarFunction propertyMultExpr
Expression to multiply all properties.
Definition: boundaryload.h:172
Function * giveFunction(int n)
Service for accessing particular domain load time function.
Definition: domain.C:268
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Dictionary propertyDictionary
Additional b.c properties.
Definition: boundaryload.h:131
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: boundaryload.C:92
#define _IFT_BoundaryLoad_cstype
Definition: boundaryload.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
double temperOffset
Temperature offset with regards to Kelvin. Default is 273.15.
Definition: boundaryload.h:135
#define _IFT_BoundaryLoad_propertyTimeFunctions
Definition: boundaryload.h:49
Class representing the a dynamic Input Record.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
bcType lType
Load type (its physical meaning).
Definition: boundaryload.h:127
Domain * giveDomain() const
Definition: femcmpnn.h:100
Load is base abstract class for all loads.
Definition: load.h:61
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define _IFT_BoundaryLoad_temperOffset
Definition: boundaryload.h:51
virtual void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
Computes components values of load at given point - global coordinates (coordinates given)...
Definition: boundaryload.C:58
virtual double giveTemperOffset(void)
Return temperature offset.
Definition: boundaryload.C:164
Class representing solution step.
Definition: timestep.h:80
CoordSystType coordSystemType
Load coordinate system.
Definition: boundaryload.h:129
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
BoundaryLoad(int i, Domain *d)
Constructor.
Definition: boundaryload.C:45

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