OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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
36#include "gausspoint.h"
37#include "timestep.h"
38#include "contextioerr.h"
39#include "classfactory.h"
40
41namespace oofem {
43
44void
45HydratingIsoHeatMaterial :: initializeFrom(InputRecord &ir)
46{
47 int value;
48 double dvalue;
49
50 // set k, c - necessary; rc beton Hellmich 2428 kJ/m3
51 IsotropicHeatTransferMaterial :: initializeFrom(ir);
52
53 // setup hydration model
54 HydrationModelInterface :: initializeFrom(ir);
55
56 dvalue = -2.;
58 hydration = dvalue >= 0.;
59
60 if ( hydration ) {
61 // mixture type: 1 - mtLafarge, 2 - mtHuber, 3 - mtC60
62 value = 0;
64 if ( !value ) {
65 value = mtLafarge;
66 }
67
68 setMixture( ( MixtureType ) value );
69 printf("\nHydratingHeatMat %d: using mixture %d.\n", giveNumber(), value);
70
72 hydrationHeat = false;
73 printf( "HydratingHeatMat %d: hydration heat neglected.\n", giveNumber() );
74 } else {
75 hydrationHeat = true;
76 }
77
78 if ( hydrationHeat ) {
79 // include hydration internal source in LHS?
81 hydrationLHS = false;
82 printf( "HydratingHeatMat %d: hydration heat not included in LHS.\n", giveNumber() );
83 } else {
84 hydrationLHS = true;
85 }
86 }
87 }
88}
89
90void
91HydratingIsoHeatMaterial :: setMixture(MixtureType mix)
92// creates the hydration model instance if necessary, sets the mixture type
93{
94 if ( hydrationModel ) {
95 hydrationModel->setMixture(mix);
96 } else if ( hydration ) {
97 OOFEM_ERROR("Can't setup undefined hydrationModel.");
98 }
99}
100
101bool
102HydratingIsoHeatMaterial :: hasInternalSource() const
103{
104 return hydrationHeat;
105}
106
107void
108HydratingIsoHeatMaterial :: computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
109// returns in val the hydration heat computed by the hydration model for given hydration degree increment
110// current hydration model returns heat in (k)J/m3.
111// maybe??? element expects J/kg -> would have to divide by density here
112// rate of internal source must be returned, it is multiplied by time increment in element integration.
113{
114 if ( hydrationHeat ) {
115 if ( hydrationModel ) {
116 hydrationModel->computeInternalSourceVector(val, gp, tStep, VM_Incremental);
117 val.times( 1. / tStep->giveTimeIncrement() ); // /give('d');
118 } else {
119 val.zero();
120 }
121
122 /*
123 * printf("HIsoHeatMat: Ksi %.4f, dksi %.4f, heat %g\n",
124 * giveHydrationDegree(gp, tStep, VM_Total), giveHydrationDegree(gp, tStep, VM_Incremental), (val.giveSize())?val.at(1):0);
125 */
126 } else {
127 val.clear();
128 }
129}
130
131void
132HydratingIsoHeatMaterial :: updateInternalState(const FloatArray &vec, GaussPoint *gp, TimeStep *tStep)
133{
134 TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
135 if ( ms ) {
136 ms->setTempField(vec[0]);
137
138 if ( hydration ) {
139 /* OBSOLETE
140 * FloatArray s = ms->giveStateVector ();
141 * if (vec.isEmpty()) OOFEM_ERROR("empty new state vector");
142 * aux.resize(2);
143 * aux.at(1) = vec.at(1);
144 * if (s.isEmpty()||(tStep->giveTime()<=0)) aux.at(2) = initialHydrationDegree; // apply initial conditions
145 * else {
146 * aux.at(2) = s.at(2);
147 * if (!castAt || (tStep->giveTime()>=castAt)) aux.at(2) += hydrationModel->dksi (s.at(2), vec.at(1), tStep->giveTimeIncrement()); // compute hydration degree increment
148 * }
149 */
150 HydrationModelInterface :: updateInternalState(vec, gp, tStep);
151
152 // additional file output !!!
153 if ( gp->giveNumber() == 1 && giveStatus(gp) ) {
154 FILE *vyst = fopen("teplota.out", "a");
155 FloatArray aux;
156 computeInternalSourceVector(aux, gp, tStep, VM_Incremental);
157 if ( aux.isEmpty() ) {
158 aux.resize(1);
159 aux.zero();
160 }
161
162 aux.times( 1. / giveProperty('d', gp, tStep) );
163 fprintf( vyst, "Elem %.3d krok %.2d: t= %.0f, dt=%.0f, %ld. it, ksi= %.12f, T= %.8f, heat=%.8f\n", gp->giveElement()->giveNumber(), tStep->giveNumber(),
164 tStep->giveTargetTime(), tStep->giveTimeIncrement(), tStep->giveSolutionStateCounter(),
165 giveHydrationDegree(gp, tStep, VM_Total), vec.at(1), aux.at(1) * tStep->giveTimeIncrement() );
166 fclose(vyst);
167 }
168 }
169 }
170}
171
172double
173HydratingIsoHeatMaterial :: giveCharacteristicValue(MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const
174{
175 if ( rmode == Capacity ) {
176 if ( castAt && ( tStep->giveTargetTime() < castAt ) ) {
177 return this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep) / 1000; // Zero capacity before cast
178 } else {
179 return this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep);
180 }
181 } else if ( !hydrationLHS ) {
182 return 0;
183 } else if ( hydrationModel ) {
184 auto status = static_cast< HeMoTransportMaterialStatus * >( giveStatus(gp) );
185 double t = status->giveTempTemperature();
186 double h = status->giveTempHumidity(); // TODO CHECK
187
188 return hydrationModel->_giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement();
189 } else {
190 OOFEM_ERROR("unknown MatResponseMode (%s)", __MatResponseModeToString(rmode) );
191 }
192}
193
194void
195HydratingIsoHeatMaterial :: saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
196{
197 TransportMaterial :: saveIPContext(stream, mode, gp);
198
199 // save hydration model data - maybe should check hydration option?
200 HydrationModelInterface :: saveContext(stream, mode);
201}
202
203void
204HydratingIsoHeatMaterial :: restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
205{
206 TransportMaterial :: restoreIPContext(stream, mode, gp);
207
208 // read hydration model data - maybe should check hydration option?
209 HydrationModelInterface :: restoreContext(stream, mode);
210}
211
212int
213HydratingIsoHeatMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
214{
215 // printf ("IP %d::giveIPValue, IST %d", giveNumber(), type);
216 if ( type == IST_HydrationDegree ) {
217 //TransportMaterialStatus* status = (TransportMaterialStatus*) this -> giveStatus (gp);
218 answer.resize(1);
219 //if (hydration)
220 answer.at(1) = giveHydrationDegree(gp, tStep, VM_Total);
221 //else answer.at(1) = 0;
222 return 1;
223 } else {
224 return TransportMaterial :: giveIPValue(answer, gp, type, tStep);
225 }
226}
227
228std::unique_ptr<MaterialStatus>
229HydratingIsoHeatMaterial :: CreateStatus(GaussPoint *gp) const
230{
231 return std::make_unique<HydratingTransportMaterialStatus>(gp);
232}
233
234
235void
236HydratingTransportMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
237{
238 fprintf(file, " status ");
239 HydrationModelStatusInterface :: printOutputAt(file, tStep);
240 TransportMaterialStatus :: printOutputAt(file, tStep);
241}
242
243// necessary for proper cast to interface, can't be done from outside
244Interface *
245HydratingTransportMaterialStatus :: giveInterface(InterfaceType type)
246{
247 if ( type == HydrationModelStatusInterfaceType ) {
248 return static_cast< HydrationModelStatusInterface * >(this);
249 } else {
250 return nullptr;
251 }
252}
253} // end namespace oofem
#define REGISTER_Material(class)
int giveNumber() const
Definition femcmpnn.h:104
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
bool isEmpty() const
Returns true if receiver is empty.
Definition floatarray.h:265
void times(double s)
Definition floatarray.C:834
int giveNumber()
Returns number of receiver.
Definition gausspoint.h:183
Element * giveElement()
Returns corresponding element to receiver.
Definition gausspoint.h:187
double giveTempTemperature() const
Return last field.
void computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const override
std ::unique_ptr< HydrationModel > hydrationModel
Reference to the associated hydrationModel instance.
Definition hydram.h:299
double giveHydrationDegree(GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
Definition hydram.C:626
double castAt
Material cast time - start of hydration.
Definition hydram.h:301
HydrationModelStatusInterface()
Constructor. Nulls the hydrationModelStatus pointer.
Definition hydram.h:281
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
double giveProperty(int aProperty, GaussPoint *gp, TimeStep *tStep) const
Definition isoheatmat.C:60
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
double giveTimeIncrement()
Returns solution step associated time increment.
Definition timestep.h:168
double giveTargetTime()
Returns target time.
Definition timestep.h:164
int giveNumber()
Returns receiver's number.
Definition timestep.h:144
StateCounterType giveSolutionStateCounter()
Definition timestep.h:211
void setTempField(double newField)
Set field.
#define OOFEM_ERROR(...)
Definition error.h:79
#define _IFT_HydratingIsoHeatMaterial_noLHS
#define _IFT_HydratingIsoHeatMaterial_hydration
#define _IFT_HydratingIsoHeatMaterial_mix
#define _IFT_HydratingIsoHeatMaterial_noHeat
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
long ContextMode
Definition contextmode.h:43
MixtureType
Definition hydram.h:148
@ mtLafarge
Definition hydram.h:148
@ HydrationModelStatusInterfaceType

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011