OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "load.h"
37#include "floatarray.h"
38#include "floatmatrix.h"
39#include "classfactory.h"
40
41namespace oofem {
43
44void
45GravityPressure :: initializeFrom(InputRecord &ir)
46{
47 Load :: initializeFrom(ir);
48
49 normalVector.resize(3);
50 normalVector.zero();
51 normalVector.at(3) = -1.;
53
54 zeroLevel = 0;
56}
57
58void
59GravityPressure :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
60{
61 //Need to include the information on the fluid
62 //This assumes that the z-direction represents gravity.
63
64 //Use normal input normal vector to set up the local coordinate system
65 FloatArray s(3), t;
66
67 if ( this->normalVector.at(1) == 0 ) {
68 s.at(1) = 0.;
69 s.at(2) = this->normalVector.at(3);
70 s.at(3) = -this->normalVector.at(2);
71 } else if ( this->normalVector.at(2) == 0 ) {
72 s.at(1) = this->normalVector.at(3);
73 s.at(2) = 0.;
74 s.at(3) = -this->normalVector.at(1);
75 } else {
76 s.at(1) = this->normalVector.at(2);
77 s.at(2) = -this->normalVector.at(1);
78 s.at(3) = 0.;
79 }
80
81 s.normalize();
82
84 t.normalize();
85
86 //Locate coordinate matrix
87 FloatMatrix lcs(3, 3);
88 for ( int i = 1; i <= 3; i++ ) {
89 lcs.at(1, i) = normalVector.at(i);
90 lcs.at(2, i) = s.at(i);
91 lcs.at(3, i) = t.at(i);
92 }
93
94 //Express integration point in local coordinate system
95 FloatArray coordsLocal;
96 coordsLocal.beProductOf(lcs, coords);
97
98 //Subtract zero level. Assume that pressure is positive.
99 double pressureHead = coordsLocal.at(1);
100 computeComponentArrayAt(answer, tStep, mode);
101 answer.times(pressureHead);
102}
103} // end namespace oofem
#define REGISTER_BoundaryCondition(class)
double & at(Index i)
Definition floatarray.h:202
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void times(double s)
Definition floatarray.C:834
double at(std::size_t i, std::size_t j) const
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Definition load.C:84
#define _IFT_GravityPressure_normal
#define _IFT_GravityPressure_zerolevel
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75

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