OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
hemobaznajmat.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 "hemobaznajmat.h"
36 #include "floatmatrix.h"
37 #include "gausspoint.h"
38 #include "mathfem.h"
39 #include "classfactory.h"
40 
41 namespace oofem {
42 
43 REGISTER_Material( HeMoBazNajMaterial );
44 
45 int
47 {
48  if ( ( mode == _2dHeMo ) || ( mode == _3dHeMo ) ) {
49  return 1;
50  }
51 
52  return 0;
53 }
54 
55 
58 {
59  IRResultType result; // Required by IR_GIVE_FIELD macro
60 
65 
66  this->moistureCapacity = 1.;
68 
71 
72  return Material :: initializeFrom(ir);
73 }
74 
75 
76 double
78 //
79 // Returns the value of the property aProperty (e.g. the Young's modulus
80 // 'E') of the receiver.
81 //
82 {
83  return this->Material :: give(aProperty, gp);
84 }
85 
86 
87 void
89 {
90  TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
91 
92  FloatArray s;
93  s = ms->giveTempField();
94  if ( s.isEmpty() ) {
95  OOFEM_ERROR("undefined state vector");
96  }
97  double h = s.at(2);
98  double t = s.at(1);
99 
100  FloatArray ans_w, ans_t;
101  int size = grad.giveSize() / 2;
102  FloatArray grad_w(size), grad_t(size);
103  for (int i = 1; i <= size; ++i) {
104  grad_w.at(i) = grad.at(i);
105  }
106  for (int i = 1; i <= size; ++i) {
107  grad_t.at(i) = grad.at(i+size);
108  }
109 
110  ans_w.beScaled(perm_mm(h, t), grad_w);
111  ans_w.beScaled(perm_mh(h, t), grad_t);
112  ans_t.beScaled(perm_hm(h, t), grad_w);
113  ans_t.beScaled(perm_hh(h, t), grad_t);
114 
115  answer.resize(size * 2);
116  answer.zero();
117  answer.addSubVector(ans_w, 1);
118  answer.addSubVector(ans_t, size+1);
119 
120  ms->setTempField(field);
121  ms->setTempGradient(grad);
122  ms->setTempFlux(answer);
123 }
124 
125 
126 void
128  MatResponseMode mode,
129  GaussPoint *gp,
130  TimeStep *atTime)
131 {
132  /*
133  * returns constitutive matrix of receiver
134  */
135  if ( ( mode == Conductivity_ww ) || ( mode == Conductivity_hh ) || ( mode == Conductivity_hw ) || ( mode == Conductivity_wh ) ) {
136  this->computeConductivityMtrx(answer, mode, gp, atTime);
137  } else {
138  OOFEM_ERROR( "giveCharacteristicMatrix : unknown mode (%s)", __MatResponseModeToString(mode) );
139  }
140 }
141 
142 
143 double
145  GaussPoint *gp,
146  TimeStep *atTime)
147 {
148  return this->computeCapacityCoeff(mode, gp, atTime);
149 }
150 
151 
153 {
154  MaterialMode mmode = gp->giveMaterialMode();
155  switch ( mmode ) {
156  case _2dHeMo:
157  this->matcond2d(answer, gp, mode, atTime);
158  return;
159 
160  case _3dHeMo:
161  this->matcond3d(answer, gp, mode, atTime);
162  return;
163 
164  default:
165  OOFEM_ERROR("Unsupported MaterialMode");
166  }
167 }
168 
169 
170 void
172 {
173  double k = 0.0, h = 0.0, t = 0.0;
174  TransportMaterialStatus *status = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
175 
176  FloatArray s;
177  s = status->giveTempField();
178  if ( s.isEmpty() ) {
179  OOFEM_ERROR("undefined state vector");
180  }
181  h = s.at(2);
182  t = s.at(1);
183 
184 
185  if ( mode == Conductivity_ww ) {
186  k = perm_mm(h, t);
187  } else if ( mode == Conductivity_wh ) {
188  k = perm_mh(h, t);
189  } else if ( mode == Conductivity_hw ) {
190  k = perm_hm(h, t);
191  } else if ( mode == Conductivity_hh ) {
192  k = perm_hh(h, t);
193  } else {
194  OOFEM_ERROR("Unknown MatResponseMode");
195  }
196 
197  d.resize(1, 1);
198  d.at(1, 1) = k;
199 }
200 
201 void
203 {
204  double k = 0.0, h = 0.0, t = 0.0;
205  TransportMaterialStatus *status = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
206 
207  FloatArray s;
208  s = status->giveTempField();
209  if ( s.isEmpty() ) {
210  OOFEM_ERROR("undefined state vector");
211  }
212  h = s.at(2);
213  t = s.at(1);
214 
215  if ( mode == Conductivity_ww ) {
216  k = perm_mm(h, t);
217  } else if ( mode == Conductivity_wh ) {
218  k = perm_mh(h, t);
219  } else if ( mode == Conductivity_hw ) {
220  k = perm_hm(h, t);
221  } else if ( mode == Conductivity_hh ) {
222  k = perm_hh(h, t);
223  } else {
224  OOFEM_ERROR("Unknown MatResponseMode");
225  }
226 
227  d.resize(2, 2);
228  d.at(1, 1) = k;
229  d.at(1, 2) = 0.0;
230  d.at(2, 1) = 0.0;
231  d.at(2, 2) = k;
232 }
233 
234 void
236 {
237  double k = 0.0, h = 0.0, t = 0.0;
238  TransportMaterialStatus *status = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
239 
240  FloatArray s;
241  s = status->giveTempField();
242  if ( s.isEmpty() ) {
243  OOFEM_ERROR("undefined state vector");
244  }
245  h = s.at(2);
246  t = s.at(1);
247 
248  if ( mode == Conductivity_ww ) {
249  k = perm_mm(h, t);
250  } else if ( mode == Conductivity_wh ) {
251  k = perm_mh(h, t);
252  } else if ( mode == Conductivity_hw ) {
253  k = perm_hm(h, t);
254  } else if ( mode == Conductivity_hh ) {
255  k = perm_hh(h, t);
256  } else {
257  OOFEM_ERROR("Unknown MatResponseMode");
258  }
259 
260  d.resize(3, 3);
261  d.at(1, 1) = k;
262  d.at(1, 2) = 0.0;
263  d.at(1, 3) = 0.0;
264  d.at(2, 1) = 0.0;
265  d.at(2, 2) = k;
266  d.at(2, 3) = 0.0;
267  d.at(3, 1) = 0.0;
268  d.at(3, 2) = 0.0;
269  d.at(3, 3) = k;
270 }
271 
272 
274 {
275  if ( mode == Capacity_ww ) {
276  return this->moistureCapacity;
277 
278  } else if ( mode == Capacity_wh ) {
279  return 0.0;
280 
281  } else if ( mode == Capacity_hw ) {
282  return 0.0;
283 
284  } else if ( mode == Capacity_hh ) {
285  return this->heatCapacity;
286 
287  } else {
288  OOFEM_ERROR("Unknown MatResponseMode");
289  }
290 
291  return 0.0; // to make compiler happy
292 }
293 
294 
295 double
296 HeMoBazNajMaterial :: perm_mm(double h, double T)
297 {
298  return ( C1 * ( alpha0 + ( 1. - alpha0 ) / ( 1. + pow( ( 1. - h ) / ( 1. - hC ), n ) ) ) );
299 }
300 
301 double
302 HeMoBazNajMaterial :: perm_mh(double h, double T)
303 {
304  return (0.);
305 }
306 
307 double
308 HeMoBazNajMaterial :: perm_hm(double h, double T)
309 {
310  return (0.);
311 }
312 
313 double
314 HeMoBazNajMaterial :: perm_hh(double h, double T)
315 {
316  return this->heatConductivity;
317 }
318 
319 bool
321 {
322  if ( ( mode == Conductivity_ww ) || ( mode == Conductivity_hh ) || ( mode == Conductivity_hw ) || ( mode == Conductivity_wh ) ) {
323  return true;
324  } else {
325  OOFEM_ERROR( "isCharacteristicMtrxSymmetric : unknown mode (%s)", __MatResponseModeToString(mode) );
326  }
327 
328  return false; // to make compiler happy
329 }
330 
331 int
333 // IST_Humidity overriden to use inverse_sorption_isotherm
334 {
335  if ( type == IST_Humidity ) {
336  answer.resize(1);
337  answer.at(1) = giveHumidity(gp, VM_Velocity); // VM_Previous = equilibrated value of humidity
338  return 1;
339  } else {
340  return TransportMaterial :: giveIPValue(answer, gp, type, atTime);
341  }
342 }
343 } // end namespace oofem
virtual bool isCharacteristicMtrxSymmetric(MatResponseMode rMode)
Returns true if stiffness matrix of receiver is symmetric Default implementation returns true...
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
const FloatArray & giveTempField()
Return last field.
double heatConductivity
Conductivity (k in input file).
Definition: hemobaznajmat.h:71
double hC
nonlinear threshold [-]
Definition: hemobaznajmat.h:69
#define _IFT_HeMoBazNajMaterial_hc
Definition: hemobaznajmat.h:46
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
double perm_mh(double h, double T)
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define _IFT_HeMoBazNajMaterial_alpha0
Definition: hemobaznajmat.h:45
virtual double giveHumidity(GaussPoint *gp, ValueModeType mode)
Returns positive value of humidity if implemented and enabled in derived material, -1 otherwise.
void matcond3d(FloatMatrix &d, GaussPoint *gp, MatResponseMode mode, TimeStep *atTime)
const char * __MatResponseModeToString(MatResponseMode _value)
Definition: cltypes.C:326
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
#define _IFT_HeMoBazNajMaterial_c
Specific heat.
Definition: hemobaznajmat.h:49
double computeCapacityCoeff(MatResponseMode mode, GaussPoint *gp, TimeStep *atTime)
double C1
maximal permeability [kg/ m s]
Definition: hemobaznajmat.h:63
This class implements a transport material status information.
void matcond2d(FloatMatrix &d, GaussPoint *gp, MatResponseMode mode, TimeStep *atTime)
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
MatResponseMode
Describes the character of characteristic material matrix.
double heatCapacity
Capacity (c in input file).
Definition: hemobaznajmat.h:72
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
Definition: floatarray.C:146
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Definition: material.C:52
double n
exponent in nonlinear permeability function [-]
Definition: hemobaznajmat.h:65
#define OOFEM_ERROR(...)
Definition: error.h:61
double perm_mm(double h, double T)
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *atTime)
Computes the characteristic value of receiver in given integration point, respecting its history...
void computeConductivityMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *atTime)
void addSubVector(const FloatArray &src, int si)
Adds the given vector as sub-vector to receiver.
Definition: floatarray.C:399
#define _IFT_HeMoBazNajMaterial_c1
Definition: hemobaznajmat.h:43
void setTempField(FloatArray newField)
Set field.
#define _IFT_HeMoBazNajMaterial_k
Conductivity.
Definition: hemobaznajmat.h:48
bool isEmpty() const
Returns true if receiver is empty.
Definition: floatarray.h:222
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
double perm_hm(double h, double T)
double alpha0
fraction minimal/maximal permeability [-]
Definition: hemobaznajmat.h:67
void setTempGradient(FloatArray grad)
Set gradient.
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Definition: hemobaznajmat.C:77
void matcond1d(FloatMatrix &d, GaussPoint *gp, MatResponseMode mode, TimeStep *atTime)
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
double perm_hh(double h, double T)
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void setTempFlux(FloatArray w)
Set flux.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *atTime)
Returns the integration point corresponding value in Reduced form.
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int hasMaterialModeCapability(MaterialMode mode)
Tests if material supports material mode.
Definition: hemobaznajmat.C:46
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
#define _IFT_HeMoBazNajMaterial_n
Definition: hemobaznajmat.h:44
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: hemobaznajmat.C:57
double moistureCapacity
sorption isotherm derivative [kg/m^3]
Definition: hemobaznajmat.h:60
#define _IFT_HeMoBazNajMaterial_capa
Definition: hemobaznajmat.h:47
REGISTER_Material(DummyMaterial)
#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 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
virtual void giveFluxVector(FloatArray &answer, GaussPoint *gp, const FloatArray &grad, const FloatArray &field, TimeStep *tStep)
Returns the flux for the field and its gradient.
Definition: hemobaznajmat.C:88
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
virtual void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *atTime)
Computes characteristic matrix of receiver in given integration point.

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