OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
hydratingisoheatmat.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 "hydratingisoheatmat.h"
36 #include "gausspoint.h"
37 #include "timestep.h"
38 #include "contextioerr.h"
39 #include "classfactory.h"
40 
41 namespace oofem {
42 REGISTER_Material(HydratingIsoHeatMaterial);
43 
46 {
47  IRResultType result; // Required by IR_GIVE_FIELD macro
48  int value;
49  double dvalue;
50 
51  // set k, c - necessary; rc beton Hellmich 2428 kJ/m3
53  if ( result != IRRT_OK ) return result;
54 
55  // setup hydration model
57  if ( result != IRRT_OK ) return result;
58 
59  dvalue = -2.;
61  if ( dvalue >= 0. ) {
62  hydration = 1;
63  } else {
64  hydration = 0;
65  }
66 
67  if ( hydration ) {
68  // mixture type: 1 - mtLafarge, 2 - mtHuber, 3 - mtC60
69  value = 0;
71  if ( !value ) {
72  value = mtLafarge;
73  }
74 
75  setMixture( ( MixtureType ) value );
76  printf("\nHydratingHeatMat %d: using mixture %d.\n", giveNumber(), value);
77 
79  hydrationHeat = 0;
80  printf( "HydratingHeatMat %d: hydration heat neglected.\n", giveNumber() );
81  } else {
82  hydrationHeat = 1;
83  }
84 
85  if ( hydrationHeat ) {
86  // include hydration internal source in LHS?
88  hydrationLHS = 0;
89  printf( "HydratingHeatMat %d: hydration heat not included in LHS.\n", giveNumber() );
90  } else {
91  hydrationLHS = 1;
92  }
93  }
94  }
95 
96  return IRRT_OK;
97 }
98 
99 void
101 // creates the hydration model instance if necessary, sets the mixture type
102 {
103  if ( hydrationModel ) {
104  hydrationModel->setMixture(mix);
105  } else if ( hydration ) {
106  OOFEM_ERROR("Can't setup undefined hydrationModel.");
107  }
108 }
109 
110 int
112 // return true if hydration heat source is present
113 {
114  if ( hydrationHeat ) {
115  return 1;
116  } else {
117  return 0;
118  }
119 }
120 
121 void
123 // returns in val the hydration heat computed by the hydration model for given hydration degree increment
124 // current hydration model returns heat in (k)J/m3.
125 // maybe??? element expects J/kg -> would have to divide by density here
126 // rate of internal source must be returned, it is multiplied by time increment in element integration.
127 {
128  if ( hydrationHeat ) {
129  if ( hydrationModel ) {
130  hydrationModel->computeInternalSourceVector(val, gp, tStep, VM_Incremental);
131  val.times( 1. / tStep->giveTimeIncrement() ); // /give('d');
132  } else {
133  val.zero();
134  }
135 
136  /*
137  * printf("HIsoHeatMat: Ksi %.4f, dksi %.4f, heat %g\n",
138  * giveHydrationDegree(gp, tStep, VM_Total), giveHydrationDegree(gp, tStep, VM_Incremental), (val.giveSize())?val.at(1):0);
139  */
140  } else {
141  val.clear();
142  }
143 }
144 
145 void
147 {
148  TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
149  FloatArray aux;
150  if ( ms ) {
151  ms->letTempStateVectorBe(vec);
152  if ( hydration ) {
153  /* OBSOLETE
154  * FloatArray s = ms->giveStateVector ();
155  * if (vec.isEmpty()) OOFEM_ERROR("empty new state vector");
156  * aux.resize(2);
157  * aux.at(1) = vec.at(1);
158  * if (s.isEmpty()||(tStep->giveTime()<=0)) aux.at(2) = initialHydrationDegree; // apply initial conditions
159  * else {
160  * aux.at(2) = s.at(2);
161  * if (!castAt || (tStep->giveTime()>=castAt)) aux.at(2) += hydrationModel->dksi (s.at(2), vec.at(1), tStep->giveTimeIncrement()); // compute hydration degree increment
162  * }
163  */
165 
166  // additional file output !!!
167  if ( ( gp->giveNumber() == 1 ) && giveStatus(gp) ) {
168  FILE *vyst = fopen("teplota.out", "a");
169  computeInternalSourceVector(aux, gp, tStep, VM_Incremental);
170  if ( aux.isEmpty() ) {
171  aux.resize(1);
172  aux.zero();
173  }
174 
175  aux.times( 1. / give('d', gp, tStep) );
176  fprintf( vyst, "Elem %.3d krok %.2d: t= %.0f, dt=%.0f, %ld. it, ksi= %.12f, T= %.8f, heat=%.8f\n", gp->giveElement()->giveNumber(), tStep->giveNumber(),
177  tStep->giveTargetTime(), tStep->giveTimeIncrement(), tStep->giveSolutionStateCounter(),
178  giveHydrationDegree(gp, tStep, VM_Total), vec.at(1), aux.at(1) * tStep->giveTimeIncrement() );
179  fclose(vyst);
180  }
181  }
182  }
183 }
184 
185 double
187 {
188  double answer = 0;
189  FloatArray vec;
190 
191  if ( rmode == Capacity ) {
192  if ( castAt && ( tStep->giveTargetTime() < castAt ) ) {
193  answer = this->give('c', gp, tStep) * this->give('d', gp, tStep) / 1000; // Zero capacity before cast
194  } else {
195  answer = this->give('c', gp, tStep) * this->give('d', gp, tStep);
196  }
197  } else if ( !hydrationLHS ) {
198  answer = 0;
199  } else if ( hydrationModel ) {
200  vec = static_cast< TransportMaterialStatus * >( giveStatus(gp) )->giveTempField();
201  if ( vec.giveSize() < 2 ) {
202  vec.resize(2);
203  vec.at(2) = 1.; // saturated if undefined
204  }
205 
206  answer = hydrationModel->giveCharacteristicValue(vec, rmode, gp, tStep)
207  / tStep->giveTimeIncrement();
208  } else {
209  OOFEM_ERROR("unknown MatResponseMode (%s)", __MatResponseModeToString(rmode) );
210  }
211 
212  return answer;
213 }
214 
217 // saves full status for this material, also invokes saving
218 // for sub-objects of this.
219 {
220  contextIOResultType iores;
221 
222  // write parent data
223  if ( ( iores = TransportMaterial :: saveIPContext(stream, mode, gp) ) != CIO_OK ) {
224  THROW_CIOERR(iores);
225  }
226 
227  // save hydration model data - maybe should check hydration option?
228  if ( ( iores = HydrationModelInterface :: saveContext(stream, mode, gp) ) != CIO_OK ) {
229  THROW_CIOERR(iores);
230  }
231 
232  return CIO_OK;
233 }
234 
237 // restores full status for this material, also invokes restoring for sub-objects of this.
238 {
239  contextIOResultType iores;
240 
241  // read parent data
242  if ( ( iores = TransportMaterial :: restoreIPContext(stream, mode, gp) ) != CIO_OK ) {
243  THROW_CIOERR(iores);
244  }
245 
246  // read hydration model data - maybe should check hydration option?
247  if ( ( iores = HydrationModelInterface :: restoreContext(stream, mode, gp) ) != CIO_OK ) {
248  THROW_CIOERR(iores);
249  }
250 
251  return CIO_OK;
252 }
253 
254 int
256 {
257  // printf ("IP %d::giveIPValue, IST %d", giveNumber(), type);
258  if ( type == IST_HydrationDegree ) {
259  //TransportMaterialStatus* status = (TransportMaterialStatus*) this -> giveStatus (gp);
260  answer.resize(1);
261  //if (hydration)
262  answer.at(1) = giveHydrationDegree(gp, tStep, VM_Total);
263  //else answer.at(1) = 0;
264  return 1;
265  } else {
266  return TransportMaterial :: giveIPValue(answer, gp, type, tStep);
267  }
268 }
269 
272 {
273  return new HydratingTransportMaterialStatus(1, domain, gp);
274 }
275 
276 
277 void
279 {
280  fprintf(file, " status ");
283 }
284 
285 // necessary for proper cast to interface, can't be done from outside
286 Interface *
288 {
289  if ( type == HydrationModelStatusInterfaceType ) {
290  return static_cast< HydrationModelStatusInterface * >(this);
291  } else {
292  return NULL;
293  }
294 }
295 } // 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 IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
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
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
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
#define _IFT_HydratingIsoHeatMaterial_mix
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.
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
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.
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
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
#define _IFT_HydratingIsoHeatMaterial_noLHS
int giveNumber()
Returns receiver&#39;s number.
Definition: timestep.h:129
StateCounterType giveSolutionStateCounter()
Returns current solution state counter.
Definition: timestep.h:188
#define OOFEM_ERROR(...)
Definition: error.h:61
int giveNumber()
Returns number of receiver.
Definition: gausspoint.h:184
Isotropic material for heat with hydration.
virtual void computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode)
Computes the internal source vector of receiver.
bool isEmpty() const
Returns true if receiver is empty.
Definition: floatarray.h:222
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
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
virtual contextIOResultType saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Stores integration point state to output stream.
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: isoheatmat.C:56
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
#define _IFT_HydratingIsoHeatMaterial_noHeat
void printOutputAt(FILE *file, TimeStep *tStep)
Outputs the status variables.
Definition: hydram.C:589
virtual double give(int aProperty, GaussPoint *gp, TimeStep *tStep)
Definition: isoheatmat.C:69
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
#define _IFT_HydratingIsoHeatMaterial_hydration
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
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
int giveNumber() const
Definition: femcmpnn.h:107
void letTempStateVectorBe(FloatArray v)
virtual void updateInternalState(const FloatArray &state, GaussPoint *gp, TimeStep *tStep)
Calls hydrationModel->updateInternalState, if the material is already cast.
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the characteristic value of receiver in given integration point, respecting its history...
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
Class representing solution step.
Definition: timestep.h:80
IRResultType initializeFrom(InputRecord *ir)
Creates and initializes the hydration model according to object description stored in input record...
Definition: hydram.C:599
virtual contextIOResultType restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Reads integration point state to output stream.
virtual int hasInternalSource()
Return true if hydration heat source is present.
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