OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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
37#include "gausspoint.h"
38#include "timestep.h"
39#include "contextioerr.h"
40#include "classfactory.h"
41
42namespace 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
46
47void
48HydratingHeMoMaterial :: initializeFrom(InputRecord &ir)
49{
50 int value;
51 double dvalue;
52
53 // set k, c - necessary; rc beton Hellmich 2428 kJ/m3
54 HeMoTKMaterial :: initializeFrom(ir);
55
56 // setup hydration model
57 HydrationModelInterface :: initializeFrom(ir);
58
59 dvalue = -2.;
61 hydration = dvalue >= 0.;
62
63 /* if (ir->hasField("tout")) {
64 * teplotaOut = true;
65 * printf("HydratingHeMoMat %d: additional teplota.out output selected.\n", giveNumber());
66 * } else */
67 teplotaOut = false;
68
69 if ( hydration ) {
70 // mixture type: 1 - mtLafarge, 2 - mtHuber, 3 - mtC60
71 value = 0;
73 if ( !value ) {
74 value = mtLafarge;
75 }
76
77 setMixture( ( MixtureType ) value );
78 printf("\nHydratingHeMoMat %d: using mixture %d.\n", giveNumber(), value);
79
81 hydrationHeat = false;
82 printf( "HydratingHeMoMat %d: hydration heat neglected.\n", giveNumber() );
83 } else {
84 hydrationHeat = true;
85 }
86
87 if ( hydrationHeat ) {
88 // include hydration internal source in LHS?
90 hydrationLHS = false;
91 printf( "HydratingHeMoMat %d: hydration heat not included in LHS.\n", giveNumber() );
92 } else {
93 hydrationLHS = true;
94 }
95 }
96 } else {
97 hydrationHeat = false;
98 hydrationLHS = false;
99 }
100}
101
102void
103HydratingHeMoMaterial :: setMixture(MixtureType mix)
104// creates the hydration model instance if necessary, sets the mixture type
105{
106 if ( hydrationModel ) {
107 hydrationModel->setMixture(mix);
108 } else if ( hydration ) {
109 OOFEM_ERROR("Can't setup undefined hydrationModel.");
110 }
111}
112
113bool
114HydratingHeMoMaterial :: hasInternalSource() const
115{
116 return hydrationHeat;
117}
118
119void
120HydratingHeMoMaterial :: computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
121// returns in val the hydration heat computed by the hydration model for given hydration degree increment
122// current hydration model returns heat in (k)J/m3.
123// maybe??? element expects J/kg -> would have to divide by density here
124// rate of internal source must be returned, it is multiplied by time increment in element integration.
125{
126 if ( hydrationHeat ) {
127 if ( hydrationModel ) {
128 hydrationModel->computeInternalSourceVector(val, gp, tStep, VM_Incremental);
129 val.times( 1. / tStep->giveTimeIncrement() ); // /give('d');
130 } else {
131 val.zero();
132 }
133
134 /*
135 * printf("HIsoHeatMat: Ksi %.4f, dksi %.4f, heat %g\n",
136 * giveHydrationDegree(gp, tStep, VM_Total), giveHydrationDegree(gp, tStep, VM_Incremental), (val.giveSize())?val.at(1):0);
137 */
138 } else {
139 val.clear();
140 }
141}
142
143void
144HydratingHeMoMaterial :: updateInternalState(const FloatArray &vec, GaussPoint *gp, TimeStep *tStep)
145{
146 auto ms = static_cast< HeMoTransportMaterialStatus * >( this->giveStatus(gp) );
147 if ( ms ) {
148 ms->setTempTemperature(vec[0]);
149 ms->setTempHumidity(vec[1]);
150 if ( hydration ) {
151 /* OBSOLETE
152 * FloatArray s = ms->giveStateVector ();
153 * if (vec.isEmpty()) OOFEM_ERROR("empty new state vector");
154 * aux.resize(2);
155 * aux.at(1) = vec.at(1);
156 * if (s.isEmpty()||(tStep->giveTime()<=0)) aux.at(2) = initialHydrationDegree; // apply initial conditions
157 * else {
158 * aux.at(2) = s.at(2);
159 * if (!castAt || (tStep->giveTime()>=castAt)) aux.at(2) += hydrationModel->dksi (s.at(2), vec.at(1), tStep->giveTimeIncrement()); // compute hydration degree increment
160 * }
161 */
162 // it is necessary to convert the passed state vector to relative humidity expected by the hydration model
165 FloatArray vech = vec;
166 if ( vech.giveSize() >= 2 ) {
167 vech.at(2) = inverse_sorption_isotherm( vec.at(2) ); // compute relative humidity
168 } else {
169 vech.resize(2);
170 vech.at(2) = 1.; // saturated if undefined
171 }
172
173 HydrationModelInterface :: updateInternalState(vech, gp, tStep);
174
175 // additional file output !!!
176 if ( teplotaOut && ( gp->giveNumber() == 1 ) && giveStatus(gp) ) {
177 FILE *vyst = fopen("teplota.out", "a");
178 FloatArray aux;
179 computeInternalSourceVector(aux, gp, tStep, VM_Incremental);
180 if ( aux.isEmpty() ) {
181 aux.resize(1);
182 aux.zero();
183 }
184
185 aux.times( 1. / give('d', gp) );
186 fprintf( vyst, "Elem %.3d krok %.2d: t= %.0f, dt=%.0f, %ld. it, ksi= %.12f, T= %.8f, heat=%.8f\n", gp->giveElement()->giveNumber(), tStep->giveNumber(),
187 tStep->giveTargetTime(), tStep->giveTimeIncrement(), tStep->giveSolutionStateCounter(),
188 giveHydrationDegree(gp, tStep, VM_Total), vec.at(1), aux.at(1) * tStep->giveTimeIncrement() );
189 fclose(vyst);
190 }
191 }
192 }
193}
194
195double
196HydratingHeMoMaterial :: giveCharacteristicValue(MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const
197{
198 double answer = 0;
199
200 if ( rmode >= Capacity_ww && rmode <= Capacity_wh ) { // standard HeMoTK values
201 answer = HeMoTKMaterial :: giveCharacteristicValue(rmode, gp, tStep);
202 if ( castAt && ( tStep->giveTargetTime() < castAt ) ) {
203 answer *= PRECAST_CAPACITY_COEFF; // ~Zero capacity before cast
204 }
205 } else if ( rmode >= IntSource_ww && rmode <= IntSource_wh ) { // Internal source values
206 if ( !hydrationLHS ) {
207 answer = 0;
208 } else if ( hydrationModel ) {
209 auto status = static_cast< HeMoTransportMaterialStatus * >( giveStatus(gp) );
210
211 double t = status->giveTempTemperature();
212 double h = status->giveTempHumidity();
213 h = inverse_sorption_isotherm( h ); // compute relative humidity
214 answer = hydrationModel->_giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement();
215 if ( rmode == IntSource_ww || rmode == IntSource_hw ) {
216 answer *= give_dphi_dw( h );
217 }
218 }
219 } else {
220 OOFEM_ERROR("unknown MatResponseMode (%s)", __MatResponseModeToString(rmode) );
221 }
222
223 return answer;
224}
225
226void
227HydratingHeMoMaterial :: saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
228{
229 TransportMaterial :: saveIPContext(stream, mode, gp);
230
231 // save hydration model data - maybe should check hydration option?
232 HydrationModelInterface :: saveContext(stream, mode);
233}
234
235void
236HydratingHeMoMaterial :: restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
237{
238 TransportMaterial :: restoreIPContext(stream, mode, gp);
239
240 // read hydration model data - maybe should check hydration option?
241 HydrationModelInterface :: restoreContext(stream, mode);
242}
243
244int
245HydratingHeMoMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
246{
247 // printf ("IP %d::giveIPValue, IST %d", giveNumber(), type);
248 if ( type == IST_HydrationDegree ) {
249 //TransportMaterialStatus* status = (TransportMaterialStatus*) this -> giveStatus (gp);
250 answer.resize(1);
251 // zh 24/08/2004 hydration should be selected in HydrationModelInterface->giveHydrationDegree()
252 //if (hydration)
253 answer.at(1) = giveHydrationDegree(gp, tStep, VM_Total);
254 //else answer.at(1) = 0;
255 return 1;
256 } else {
257 return HeMoTKMaterial :: giveIPValue(answer, gp, type, tStep);
258 }
259}
260
261std::unique_ptr<MaterialStatus>
262HydratingHeMoMaterial :: CreateStatus(GaussPoint *gp) const
263{
264 return std::make_unique<HydratingTransportMaterialStatus>(gp);
265}
266} // 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
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
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 give_dphi_dw(double w) const
Definition hemotkmat.C:268
double inverse_sorption_isotherm(double w) const
Definition hemotkmat.C:247
double give(int aProperty, GaussPoint *gp) const override
Definition hemotkmat.C:76
double giveTempTemperature() const
Return last field.
void setMixture(MixtureType mix)
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
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
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
#define OOFEM_ERROR(...)
Definition error.h:79
#define PRECAST_CAPACITY_COEFF
#define _IFT_HydratingHeMoMaterial_noHeat
#define _IFT_HydratingHeMoMaterial_mix
#define _IFT_HydratingHeMoMaterial_noLHS
#define _IFT_HydratingHeMoMaterial_hydration
#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

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