OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
fluiddynamicmaterial.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 "fluiddynamicmaterial.h"
36 #include "gausspoint.h"
37 #include "floatarray.h"
38 #include "contextioerr.h"
39 
40 namespace oofem {
41 void
43 { }
44 
45 
46 void
47 FluidDynamicMaterial :: computeDeviatoricStressVector(FloatArray &stress_dev, double &epsp_vol, GaussPoint *gp, const FloatArray &eps, double pressure, TimeStep *tStep)
48 {
49  if ( gp->giveMaterialMode() == _2dFlow ) {
50  epsp_vol = -( eps.at(1) + eps.at(2) );
51  } else {
52  epsp_vol = -( eps.at(1) + eps.at(2) + eps.at(3) );
53  }
54 
55  this->computeDeviatoricStressVector(stress_dev, gp, eps, tStep);
56 }
57 
58 void
60  MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
61 {
62  this->giveDeviatoricStiffnessMatrix(dsdd, mode, gp, tStep);
63  int size = dsdd.giveNumberOfRows();
64  dsdp.resize(size);
65  dsdp.zero();
66  dedd.resize(size);
67  dedd.zero();
68  dedp = 0;
69 }
70 
71 
73  MaterialStatus(n, d, g), deviatoricStressVector(), deviatoricStrainRateVector()
74 { }
75 
76 void
78 // Prints the strains and stresses on the data file.
79 {
80  fprintf(File, "\n deviatoric stresses");
81  for ( double e: deviatoricStressVector ) {
82  fprintf( File, " %.4e", e );
83  }
84 
85  fprintf(File, "\n");
86 }
87 
88 void
90 {
92 }
93 
94 
95 int
97 {
98  FluidDynamicMaterialStatus *status = static_cast< FluidDynamicMaterialStatus * >( this->giveStatus(gp) );
99  if ( type == IST_DeviatoricStress ) {
100  MaterialMode mmode = gp->giveMaterialMode();
101  const FloatArray &vec = status->giveDeviatoricStressVector();
102  if ( mmode == _2dFlow ) {
103  answer.resize(6);
104  answer.at(1) = vec.at(1);
105  answer.at(2) = vec.at(2);
106  answer.at(3) = -( vec.at(1) + vec.at(2) );
107  answer.at(4) = 0.;
108  answer.at(5) = 0.;
109  answer.at(6) = vec.at(3);
110  return 1;
111  } else if ( mmode == _2dAxiFlow ) {
112  answer.resize(6);
113  answer.at(1) = vec.at(1);
114  answer.at(2) = vec.at(2);
115  answer.at(3) = vec.at(3);
116  answer.at(4) = 0;
117  answer.at(5) = 0;
118  answer.at(6) = vec.at(6);
119  return 1;
120  } else if ( mmode == _3dFlow ) {
121  answer = vec;
122  return 1;
123  } else {
124  OOFEM_ERROR("material mode not supported");
125  return 0;
126  }
127 
128  } else if ( type == IST_DeviatoricStrain ) {
129  MaterialMode mmode = gp->giveMaterialMode();
130  const FloatArray &vec = status->giveDeviatoricStrainRateVector();
131  if ( mmode == _2dFlow ) {
132  answer.resize(6);
133  answer.at(1) = vec.at(1);
134  answer.at(2) = vec.at(2);
135  answer.at(3) = 0.;
136  answer.at(4) = vec.at(3);
137  answer.at(5) = 0.;
138  answer.at(6) = 0.;
139  answer.copySubVector(vec, 1);
140  return 1;
141  } else if ( mmode == _2dAxiFlow ) {
142  answer.resize(6);
143  answer.at(1) = vec.at(1);
144  answer.at(2) = vec.at(2);
145  answer.at(3) = vec.at(3);
146  answer.at(4) = 0;
147  answer.at(5) = 0;
148  answer.at(6) = vec.at(6);
149  return 1;
150  } else if ( mmode == _3dFlow ) {
151  answer = vec;
152  return 1;
153  } else {
154  OOFEM_ERROR("material mode not supported");
155  return 0;
156  }
157 
158  } else if ( type == IST_Viscosity ) {
159  answer.resize(1);
160  answer.at(1) = this->giveEffectiveViscosity(gp, tStep);
161  return 1;
162  } else if ( type == IST_Density ) {
163  answer.resize(1);
164  answer.at(1) = this->give('d', gp);
165  return 1;
166  } else {
167  return Material :: giveIPValue(answer, gp, type, tStep);
168  }
169 }
170 
171 
174 {
175  contextIOResultType iores;
176  if ( ( iores = MaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
177  THROW_CIOERR(iores);
178  }
179 
180  if ( ( iores = deviatoricStressVector.storeYourself(stream) ) != CIO_OK ) {
181  THROW_CIOERR(iores);
182  }
183 
184  if ( ( iores = deviatoricStrainRateVector.storeYourself(stream) ) != CIO_OK ) {
185  THROW_CIOERR(iores);
186  }
187 
188  return CIO_OK;
189 }
190 
191 
194 {
195  contextIOResultType iores;
196  if ( ( iores = MaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
197  THROW_CIOERR(iores);
198  }
199 
200  if ( ( iores = deviatoricStressVector.restoreYourself(stream) ) != CIO_OK ) {
201  THROW_CIOERR(iores);
202  }
203 
204  if ( ( iores = deviatoricStrainRateVector.restoreYourself(stream) ) != CIO_OK ) {
205  THROW_CIOERR(iores);
206  }
207 
208  return CIO_OK;
209 }
210 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
FloatArray deviatoricStressVector
Stress vector in reduced form.
void copySubVector(const FloatArray &src, int si)
Copy the given vector as sub-vector to receiver.
Definition: floatarray.C:864
GaussPoint * gp
Associated integration point.
Class and object Domain.
Definition: domain.h:115
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
contextIOResultType storeYourself(DataStream &stream) const
Definition: floatarray.C:872
const FloatArray & giveDeviatoricStrainRateVector()
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual void updateInternalState(const FloatArray &vec, GaussPoint *gp, TimeStep *tStep)
Updates internal state of material according to new state vector.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: femcmpnn.C:51
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
virtual void giveStiffnessMatrices(FloatMatrix &dsdd, FloatArray &dsdp, FloatArray &dedd, double &dedp, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the 4 tangents of the compressible material response in 3D.
MatResponseMode
Describes the character of characteristic material matrix.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
FluidDynamicMaterialStatus(int n, Domain *d, GaussPoint *g)
Constructor - creates new TransportMaterialStatus with number n, belonging to domain d and integratio...
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: matstatus.h:103
FloatArray deviatoricStrainRateVector
Strain vector in reduced form.
This class implements a transport material status information.
virtual void computeDeviatoricStressVector(FloatArray &stress_dev, double &epsp_vol, GaussPoint *gp, const FloatArray &eps, double pressure, TimeStep *tStep)
Computes the deviatoric stress vector and volumetric strain rate from given deviatoric strain and pre...
#define OOFEM_ERROR(...)
Definition: error.h:61
const FloatArray & giveDeviatoricStressVector()
Gives the deviatoric stress.
contextIOResultType restoreYourself(DataStream &stream)
Definition: floatarray.C:895
Abstract base class representing a material status information.
Definition: matstatus.h:84
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: femcmpnn.C:64
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumberOfRows() const
Returns number of rows of receiver.
Definition: floatmatrix.h:156
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: material.C:142
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
virtual void giveDeviatoricStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)=0
Computes the deviatoric stiffness; .

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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011