OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
newtonianfluid.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 "newtonianfluid.h"
36 #include "domain.h"
37 #include "floatmatrix.h"
38 #include "gausspoint.h"
39 #include "engngm.h"
40 #include "dynamicinputrecord.h"
41 #include "classfactory.h"
42 
43 namespace oofem {
44 REGISTER_Material(NewtonianFluidMaterial);
45 
48 {
49  IRResultType result; // Required by IR_GIVE_FIELD macro
50 
52 
54 }
55 
56 
57 void
59 {
62 }
63 
64 
65 double
67 {
68  return this->viscosity;
69 }
70 
71 
72 double
74 {
75  if ( aProperty == Viscosity ) {
76  return viscosity;
77  } else if ( aProperty == YieldStress ) {
78  return 0.0;
79  } else {
80  return FluidDynamicMaterial :: give(aProperty, gp);
81  }
82 }
83 
84 
87 {
88  return new FluidDynamicMaterialStatus(1, this->giveDomain(), gp);
89 }
90 
91 
92 void
94 {
95  int size = eps.giveSize();
96  answer.resize(size);
97 
98  if ( gp->giveMaterialMode() == _2dFlow ) {
99  double ekk = eps.at(1) + eps.at(2);
100 
101  answer = {
102  2.0 * viscosity * ( eps.at(1) - ekk / 3.0 ),
103  2.0 * viscosity * ( eps.at(2) - ekk / 3.0 ),
104  eps.at(3) * viscosity
105  };
106  } else if ( gp->giveMaterialMode() == _2dAxiFlow ) {
107 #if 1
108  double ekk = eps.at(1) + eps.at(2) + eps.at(3);
109 
110  answer = {
111  2.0 * viscosity * ( eps.at(1) - ekk / 3.0 ),
112  2.0 * viscosity * ( eps.at(2) - ekk / 3.0 ),
113  2.0 * viscosity * ( eps.at(3) - ekk / 3.0 ),
114  eps.at(4) * viscosity
115  };
116 #else
117  answer = {
118  2.0 * viscosity * ( eps.at(1) ),
119  2.0 * viscosity * ( eps.at(2) ),
120  2.0 * viscosity * ( eps.at(3) ),
121  eps.at(4) * viscosity
122  };
123 #endif
124  } else if ( gp->giveMaterialMode() == _3dFlow ) {
125  double ekk = eps.at(1) + eps.at(2) + eps.at(3);
126 
127  answer = {
128  2.0 * viscosity * ( eps.at(1) - ekk / 3.0 ),
129  2.0 * viscosity * ( eps.at(2) - ekk / 3.0 ),
130  2.0 * viscosity * ( eps.at(3) - ekk / 3.0 ),
131  eps.at(4) * viscosity,
132  eps.at(5) * viscosity,
133  eps.at(6) * viscosity
134  };
135  } else {
136  OOFEM_ERROR("unsupported material mode");
137  }
138 
139 
140  static_cast< FluidDynamicMaterialStatus * >( this->giveStatus(gp) )->letDeviatoricStressVectorBe(answer);
141  static_cast< FluidDynamicMaterialStatus * >( this->giveStatus(gp) )->letDeviatoricStrainRateVectorBe(eps);
142 }
143 
144 void
146  TimeStep *tStep)
147 {
148  if ( ( gp->giveMaterialMode() == _2dFlow ) ) {
149  answer.resize(3, 3);
150  answer.zero();
151 
152  answer.at(1, 1) = answer.at(2, 2) = 2.0 * viscosity * ( 2. / 3. );
153  answer.at(1, 2) = answer.at(2, 1) = -2.0 * viscosity * ( 1. / 3. );
154  answer.at(3, 3) = viscosity;
155  } else if ( gp->giveMaterialMode() == _2dAxiFlow ) {
156 #if 1
157  answer.resize(4, 4);
158  answer.zero();
159 
160  answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = 2.0 * viscosity * ( 2. / 3. );
161  answer.at(1, 2) = answer.at(1, 3) = -2.0 * viscosity * ( 1. / 3. );
162  answer.at(2, 1) = answer.at(2, 3) = -2.0 * viscosity * ( 1. / 3. );
163  answer.at(3, 1) = answer.at(3, 2) = -2.0 * viscosity * ( 1. / 3. );
164 
165  answer.at(4, 4) = viscosity;
166 #else
167  answer.resize(4, 4);
168  answer.zero();
169 
170  answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = 2.0 * viscosity;
171  answer.at(4, 4) = viscosity;
172 #endif
173  } else if ( gp->giveMaterialMode() == _3dFlow ) {
174  answer.resize(6, 6);
175  answer.zero();
176 
177  answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = 2.0 * viscosity * ( 2. / 3. );
178  answer.at(1, 2) = answer.at(1, 3) = -2.0 * viscosity * ( 1. / 3. );
179  answer.at(2, 1) = answer.at(2, 3) = -2.0 * viscosity * ( 1. / 3. );
180  answer.at(3, 1) = answer.at(3, 2) = -2.0 * viscosity * ( 1. / 3. );
181 
182  answer.at(4, 4) = answer.at(5, 5) = answer.at(6, 6) = viscosity;
183  } else {
184  OOFEM_ERROR("unsupportted material mode");
185  }
186 }
187 
188 
189 int
191 {
194  double scale;
196  propertyDictionary.at('d') /= scale;
197 
199  this->viscosity /= scale;
200  }
201 
202  return 1;
203 }
204 } // end namespace oofem
void setField(int item, InputFieldType id)
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
#define Viscosity
Definition: matconst.h:79
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
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
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
Dictionary propertyDictionary
Property dictionary.
Definition: material.h:105
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: material.C:110
MatResponseMode
Describes the character of characteristic material matrix.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Definition: material.C:52
This class implements a transport material status information.
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual double giveVariableScale(VarScaleType varId)
Returns the scale factor for given variable type.
Definition: engngm.h:1087
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
virtual int checkConsistency()
Allows programmer to test some internal data, before computation begins.
Abstract base class representing a material status information.
Definition: matstatus.h:84
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
#define _IFT_NewtonianFluidMaterial_mu
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual void computeDeviatoricStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &eps, TimeStep *tStep)
Computes the deviatoric stress vector from given strain.
virtual void giveDeviatoricStiffnessMatrix(FloatMatrix &answer, MatResponseMode, GaussPoint *gp, TimeStep *tStep)
Computes the deviatoric stiffness; .
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual bool giveEquationScalingFlag()
Returns the Equation scaling flag, which is used to indicate that governing equation(s) are scaled...
Definition: engngm.h:1085
virtual double giveEffectiveViscosity(GaussPoint *gp, TimeStep *tStep)
Gives the effective viscosity for the given integration point.
Class representing the a dynamic Input Record.
#define YieldStress
Definition: matconst.h:80
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
Domain * giveDomain() const
Definition: femcmpnn.h:100
REGISTER_Material(DummyMaterial)
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 IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: material.C:89
Class representing integration point in finite element program.
Definition: gausspoint.h:93
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011