OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
gravitypressure.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 "gravitypressure.h"
36 #include "load.h"
37 #include "floatarray.h"
38 #include "floatmatrix.h"
39 #include "classfactory.h"
40 
41 namespace oofem {
42 REGISTER_BoundaryCondition(GravityPressure);
43 
46 {
47  IRResultType result; // Required by IR_GIVE_FIELD macro
48 
51  normalVector.at(3) = -1.;
53 
54  zeroLevel = 0;
56 
57  return Load :: initializeFrom(ir);
58 }
59 
60 void
62 {
63  //Need to include the information on the fluid
64  //This assumes that the z-direction represents gravity.
65 
66  //Use normal input normal vector to set up the local coordinate system
67  FloatArray s(3), t;
68 
69  if ( this->normalVector.at(1) == 0 ) {
70  s.at(1) = 0.;
71  s.at(2) = this->normalVector.at(3);
72  s.at(3) = -this->normalVector.at(2);
73  } else if ( this->normalVector.at(2) == 0 ) {
74  s.at(1) = this->normalVector.at(3);
75  s.at(2) = 0.;
76  s.at(3) = -this->normalVector.at(1);
77  } else {
78  s.at(1) = this->normalVector.at(2);
79  s.at(2) = -this->normalVector.at(1);
80  s.at(3) = 0.;
81  }
82 
83  s.normalize();
84 
86  t.normalize();
87 
88  //Locate coordinate matrix
89  FloatMatrix lcs(3, 3);
90  for ( int i = 1; i <= 3; i++ ) {
91  lcs.at(1, i) = normalVector.at(i);
92  lcs.at(2, i) = s.at(i);
93  lcs.at(3, i) = t.at(i);
94  }
95 
96  //Express integration point in local coordinate system
97  FloatArray coordsLocal;
98  coordsLocal.beProductOf(lcs, coords);
99 
100  //Subtract zero level. Assume that pressure is positive.
101  double pressureHead = coordsLocal.at(1);
102  computeComponentArrayAt(answer, tStep, mode);
103  answer.times(pressureHead);
104 }
105 } // end namespace oofem
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
REGISTER_BoundaryCondition(BoundaryCondition)
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Computes vector product (or cross product) of vectors given as parameters, , and stores the result in...
Definition: floatarray.C:415
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
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: load.C:98
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes boundary condition value - its components values at given time.
Definition: load.C:82
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
Class representing vector of real numbers.
Definition: floatarray.h:82
#define _IFT_GravityPressure_zerolevel
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
Class representing the general Input Record.
Definition: inputrecord.h:101
#define _IFT_GravityPressure_normal
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
Computes components values of load at given point - global coordinates (coordinates given)...
double normalize()
Normalizes receiver.
Definition: floatarray.C:828
Class representing solution step.
Definition: timestep.h:80
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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011