OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
hydratinghemomat.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 "hydratinghemomat.h"
36 #include "hydratingisoheatmat.h"
37 #include "gausspoint.h"
38 #include "timestep.h"
39 #include "contextioerr.h"
40 #include "classfactory.h"
41 
42 namespace oofem {
43 #define PRECAST_CAPACITY_COEFF 1e-2 // coefficient for obtaining capacity before cast of the material : 1e-4, tried 1e-2 for jete (no convergency with 1e-4)
44 
45 REGISTER_Material(HydratingHeMoMaterial);
46 
49 {
50  IRResultType result; // Required by IR_GIVE_FIELD macro
51  int value;
52  double dvalue;
53 
54  // set k, c - necessary; rc beton Hellmich 2428 kJ/m3
56  if ( result != IRRT_OK ) return result;
57 
58  // setup hydration model
60  if ( result != IRRT_OK ) return result;
61 
62  dvalue = -2.;
64  if ( dvalue >= 0. ) {
65  hydration = 1;
66  } else {
67  hydration = 0;
68  }
69 
70  /* if (ir->hasField("tout")) {
71  * teplotaOut = 1;
72  * printf("HydratingHeMoMat %d: additional teplota.out output selected.\n", giveNumber());
73  * } else */
74  teplotaOut = 0;
75 
76  if ( hydration ) {
77  // mixture type: 1 - mtLafarge, 2 - mtHuber, 3 - mtC60
78  value = 0;
80  if ( !value ) {
81  value = mtLafarge;
82  }
83 
84  setMixture( ( MixtureType ) value );
85  printf("\nHydratingHeMoMat %d: using mixture %d.\n", giveNumber(), value);
86 
88  hydrationHeat = 0;
89  printf( "HydratingHeMoMat %d: hydration heat neglected.\n", giveNumber() );
90  } else {
91  hydrationHeat = 1;
92  }
93 
94  if ( hydrationHeat ) {
95  // include hydration internal source in LHS?
97  hydrationLHS = 0;
98  printf( "HydratingHeMoMat %d: hydration heat not included in LHS.\n", giveNumber() );
99  } else {
100  hydrationLHS = 1;
101  }
102  }
103  } else {
104  hydrationHeat = false;
105  hydrationLHS = false;
106  }
107 
108  return IRRT_OK;
109 }
110 
111 void
113 // creates the hydration model instance if necessary, sets the mixture type
114 {
115  if ( hydrationModel ) {
116  hydrationModel->setMixture(mix);
117  } else if ( hydration ) {
118  OOFEM_ERROR("Can't setup undefined hydrationModel.");
119  }
120 }
121 
122 int
124 // return true if hydration heat source is present
125 {
126  if ( hydrationHeat ) {
127  return 1;
128  } else {
129  return 0;
130  }
131 }
132 
133 void
135 // returns in val the hydration heat computed by the hydration model for given hydration degree increment
136 // current hydration model returns heat in (k)J/m3.
137 // maybe??? element expects J/kg -> would have to divide by density here
138 // rate of internal source must be returned, it is multiplied by time increment in element integration.
139 {
140  if ( hydrationHeat ) {
141  if ( hydrationModel ) {
142  hydrationModel->computeInternalSourceVector(val, gp, tStep, VM_Incremental);
143  val.times( 1. / tStep->giveTimeIncrement() ); // /give('d');
144  } else {
145  val.zero();
146  }
147 
148  /*
149  * printf("HIsoHeatMat: Ksi %.4f, dksi %.4f, heat %g\n",
150  * giveHydrationDegree(gp, tStep, VM_Total), giveHydrationDegree(gp, tStep, VM_Incremental), (val.giveSize())?val.at(1):0);
151  */
152  } else {
153  val.clear();
154  }
155 }
156 
157 void
159 {
160  TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
161  FloatArray aux;
162  if ( ms ) {
163  ms->letTempStateVectorBe(vec);
164  if ( hydration ) {
165  /* OBSOLETE
166  * FloatArray s = ms->giveStateVector ();
167  * if (vec.isEmpty()) OOFEM_ERROR("empty new state vector");
168  * aux.resize(2);
169  * aux.at(1) = vec.at(1);
170  * if (s.isEmpty()||(tStep->giveTime()<=0)) aux.at(2) = initialHydrationDegree; // apply initial conditions
171  * else {
172  * aux.at(2) = s.at(2);
173  * if (!castAt || (tStep->giveTime()>=castAt)) aux.at(2) += hydrationModel->dksi (s.at(2), vec.at(1), tStep->giveTimeIncrement()); // compute hydration degree increment
174  * }
175  */
176  // it is necessary to convert the passed state vector to relative humidity expected by the hydration model
179  FloatArray vech = vec;
180  if ( vech.giveSize() >= 2 ) {
181  vech.at(2) = inverse_sorption_isotherm( vec.at(2) ); // compute relative humidity
182  } else {
183  vech.resize(2);
184  vech.at(2) = 1.; // saturated if undefined
185  }
186 
188 
189  // additional file output !!!
190  if ( teplotaOut && ( gp->giveNumber() == 1 ) && giveStatus(gp) ) {
191  FILE *vyst = fopen("teplota.out", "a");
192  computeInternalSourceVector(aux, gp, tStep, VM_Incremental);
193  if ( aux.isEmpty() ) {
194  aux.resize(1);
195  aux.zero();
196  }
197 
198  aux.times( 1. / give('d', gp) );
199  fprintf( vyst, "Elem %.3d krok %.2d: t= %.0f, dt=%.0f, %ld. it, ksi= %.12f, T= %.8f, heat=%.8f\n", gp->giveElement()->giveNumber(), tStep->giveNumber(),
200  tStep->giveTargetTime(), tStep->giveTimeIncrement(), tStep->giveSolutionStateCounter(),
201  giveHydrationDegree(gp, tStep, VM_Total), vec.at(1), aux.at(1) * tStep->giveTimeIncrement() );
202  fclose(vyst);
203  }
204  }
205  }
206 }
207 
208 double
210 {
211  double answer = 0;
212 
213  if ( ( rmode >= Capacity_ww ) && ( rmode <= Capacity_wh ) ) { // standard HeMoTK values
214  answer = HeMoTKMaterial :: giveCharacteristicValue(rmode, gp, tStep);
215  if ( castAt && ( tStep->giveTargetTime() < castAt ) ) {
216  answer *= PRECAST_CAPACITY_COEFF; // ~Zero capacity before cast
217  }
218  } else if ( ( rmode >= IntSource_ww ) && ( rmode <= IntSource_wh ) ) { // Internal source values
219  if ( !hydrationLHS ) {
220  answer = 0;
221  } else if ( hydrationModel ) {
222  FloatArray vec = static_cast< TransportMaterialStatus * >( giveStatus(gp) )->giveTempField();
223 
224  if ( vec.giveSize() < 2 ) {
225  vec.resize(2);
226  vec.at(2) = 1.0; // saturated if undefined
227  } else {
228  vec.at(2) = inverse_sorption_isotherm( vec.at(2) ); // compute relative humidity
229  }
230 
231  answer = hydrationModel->giveCharacteristicValue(vec, rmode, gp, tStep)
232  / tStep->giveTimeIncrement();
233  if ( ( rmode == IntSource_ww ) || ( rmode == IntSource_hw ) ) {
234  answer *= give_dphi_dw( vec.at(2) );
235  }
236  }
237  } else {
238  OOFEM_ERROR("unknown MatResponseMode (%s)", __MatResponseModeToString(rmode) );
239  }
240 
241  return answer;
242 }
243 
246 // saves full status for this material, also invokes saving
247 // for sub-objects of this.
248 {
249  contextIOResultType iores;
250 
251  // write parent data
252  if ( ( iores = TransportMaterial :: saveIPContext(stream, mode, gp) ) != CIO_OK ) {
253  THROW_CIOERR(iores);
254  }
255 
256  // save hydration model data - maybe should check hydration option?
257  if ( ( iores = HydrationModelInterface :: saveContext(stream, mode, gp) ) != CIO_OK ) {
258  THROW_CIOERR(iores);
259  }
260 
261  return CIO_OK;
262 }
263 
266 // restores full status for this material, also invokes restoring for sub-objects of this.
267 {
268  contextIOResultType iores;
269 
270  // read parent data
271  if ( ( iores = TransportMaterial :: restoreIPContext(stream, mode, gp) ) != CIO_OK ) {
272  THROW_CIOERR(iores);
273  }
274 
275  // read hydration model data - maybe should check hydration option?
276  if ( ( iores = HydrationModelInterface :: restoreContext(stream, mode, gp) ) != CIO_OK ) {
277  THROW_CIOERR(iores);
278  }
279 
280  return CIO_OK;
281 }
282 
283 int
285 {
286  // printf ("IP %d::giveIPValue, IST %d", giveNumber(), type);
287  if ( type == IST_HydrationDegree ) {
288  //TransportMaterialStatus* status = (TransportMaterialStatus*) this -> giveStatus (gp);
289  answer.resize(1);
290  // zh 24/08/2004 hydration should be selected in HydrationModelInterface->giveHydrationDegree()
291  //if (hydration)
292  answer.at(1) = giveHydrationDegree(gp, tStep, VM_Total);
293  //else answer.at(1) = 0;
294  return 1;
295  } else {
296  return HeMoTKMaterial :: giveIPValue(answer, gp, type, tStep);
297  }
298 }
299 
302 {
303  return new HydratingTransportMaterialStatus(1, domain, gp);
304 }
305 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Definition: hydram.h:331
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
#define _IFT_HydratingHeMoMaterial_noHeat
#define _IFT_HydratingHeMoMaterial_mix
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
double give_dphi_dw(double w)
Definition: hemotkmat.C:471
virtual int hasInternalSource()
Returns nonzero if receiver generates internal source of state variable(s), zero otherwise.
virtual contextIOResultType saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Stores integration point state to output stream.
Definition: material.C:173
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the characteristic value of receiver in given integration point, respecting its history...
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
const char * __MatResponseModeToString(MatResponseMode _value)
Definition: cltypes.C:326
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
double giveTargetTime()
Returns target time.
Definition: timestep.h:146
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
virtual contextIOResultType restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Reads integration point state to output stream.
Definition: material.C:204
This class implements a transport material status information.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
MatResponseMode
Describes the character of characteristic material matrix.
contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Definition: hydram.h:323
MixtureType
Definition: hydram.h:150
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
virtual void updateInternalState(const FloatArray &state, GaussPoint *gp, TimeStep *tStep)
Calls hydrationModel->updateInternalState, if the material is already cast.
double giveTimeIncrement()
Returns solution step associated time increment.
Definition: timestep.h:150
std::unique_ptr< HydrationModel > hydrationModel
Reference to the associated hydrationModel instance.
Definition: hydram.h:306
int giveNumber()
Returns receiver&#39;s number.
Definition: timestep.h:129
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: hemotkmat.C:604
StateCounterType giveSolutionStateCounter()
Returns current solution state counter.
Definition: timestep.h:188
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Definition: hemotkmat.C:82
#define OOFEM_ERROR(...)
Definition: error.h:61
int giveNumber()
Returns number of receiver.
Definition: gausspoint.h:184
virtual void computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode)
Computes the internal source vector of receiver.
Isotropic material for heat with hydration.
bool isEmpty() const
Returns true if receiver is empty.
Definition: floatarray.h:222
double giveHydrationDegree(GaussPoint *gp, TimeStep *tStep, ValueModeType mode)
Returns the hydration degree at end of TimeStep tStep in given integration point. ...
Definition: hydram.C:660
Abstract base class representing a material status information.
Definition: matstatus.h:84
#define PRECAST_CAPACITY_COEFF
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the characteristic value of receiver in given integration point, respecting its history...
Definition: hemotkmat.C:143
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: hemotkmat.C:56
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
Class representing the general Input Record.
Definition: inputrecord.h:101
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual contextIOResultType restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Reads integration point state to output stream.
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.
double castAt
Material cast time - start of hydration.
Definition: hydram.h:308
#define _IFT_HydratingHeMoMaterial_hydration
int giveNumber() const
Definition: femcmpnn.h:107
virtual contextIOResultType saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Stores integration point state to output stream.
void letTempStateVectorBe(FloatArray v)
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual void updateInternalState(const FloatArray &vec, GaussPoint *gp, TimeStep *tStep)
Calls hydrationModel->updateInternalState, if the material is already cast.
Definition: hydram.C:640
#define _IFT_HydratingHeMoMaterial_noLHS
Class representing solution step.
Definition: timestep.h:80
void setMixture(MixtureType mix)
IRResultType initializeFrom(InputRecord *ir)
Creates and initializes the hydration model according to object description stored in input record...
Definition: hydram.C:599
double inverse_sorption_isotherm(double w)
Definition: hemotkmat.C:447
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