OOFEM 3.0
Loading...
Searching...
No Matches
latticetransmat.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 "domain.h"
37#include "gausspoint.h"
39#include "mathfem.h"
40#include "staggeredproblem.h"
41#include "classfactory.h"
42#ifdef __SM_MODULE
44#endif
45
46namespace oofem {
48
49void
50LatticeTransportMaterial :: initializeFrom(InputRecord &ir)
51{
52 Material :: initializeFrom(ir);
53
55
57
59
60 this->thetaR = 0.;
62
63 //Options are 0 = constant conductivity and capacity and 1 = van Genuchten conductivity and capactity
64 conType = 0;
66 this->capacity = 0;
67 if ( conType == 0 ) {
69 } else if ( conType == 1 ) {
71
73
74 //Assume that original van Genuchten is used.
75 this->thetaM = this->thetaS;
77
78 this->suctionAirEntry = 0;
80
81 if ( thetaM < thetaS ) {
82 OOFEM_WARNING("thetaM cannot be smaller than thetaS. Choose thetaM=thetaS.");
83 thetaM = thetaS;
84 }
85
86 //Define value of either air entry pressure or thetaM for later use. Only based on input parameters.
87 if ( suctionAirEntry == 0. ) {
88 suctionAirEntry = paramA * pow( ( pow( ( thetaS - thetaR ) / ( thetaM - thetaR ), -1. / paramM ) - 1. ), ( 1 - paramM ) );
89 } else {
90 thetaM = ( thetaS - thetaR ) * pow(1. + pow(suctionAirEntry / paramA, 1. / ( 1. - paramM ) ), paramM) + thetaR;
91 }
92 } else if ( conType != 0 && conType != 1 ) {
93 OOFEM_ERROR("unknown conType mode");
94 }
95
96 crackTortuosity = 1.;
98
99 crackLimit = -1.;
101}
102
103
105LatticeTransportMaterial :: computeFlux3D(const FloatArrayF< 3 > &grad, double field, GaussPoint *gp, TimeStep *tStep) const
106{
107 auto status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
108 status->setTempGradient(grad);
109 status->setTempField(field);
110
111 double c = this->computeConductivity(field, gp, tStep);
112 auto flux = -c * grad;
113 status->setTempFlux(flux);
114 return flux;
115}
116
117
118double
119LatticeTransportMaterial :: give(int aProperty, GaussPoint *gp) const
120{
121 if ( aProperty == 'k' ) {
122 return permeability;
123 } else if ( ( aProperty == HeatCapaCoeff ) || ( aProperty == 'c' ) ) {
124 return ( this->give('d', gp) );
125 }
126
127 return this->Material :: give(aProperty, gp);
128}
129
130
131double
132LatticeTransportMaterial :: giveCharacteristicValue(MatResponseMode mode,
133 GaussPoint *gp,
134 TimeStep *tStep) const
135{
136 auto status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
137 double suction = status->giveTempField();
138
139 if ( mode == Capacity ) {
140 return computeCapacity(suction, gp);
141 } else if ( mode == Conductivity ) {
142 return computeConductivity(suction, gp, tStep);
143 } else {
144 OOFEM_ERROR("unknown mode");
145 }
146
147 //return 0; // to make compiler happy
148}
149
150
151double
152LatticeTransportMaterial :: computeConductivity(double suction,
153 GaussPoint *gp,
154 TimeStep *tStep) const
155{
156 auto status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
157
158 double density = this->give('d', gp);
159
160 double relativePermeability = 0.;
161 double conductivity = 0.;
162
163 double saturation, partOne, partTwo, numerator, denominator;
164 if ( suction < this->suctionAirEntry || conType == 0 ) {
165 saturation = 1.;
166 relativePermeability = 1.;
167 } else {
168 partOne = pow(suction / this->paramA, 1. / ( 1. - this->paramM ) );
169
170 saturation = ( this->thetaM - this->thetaR ) / ( this->thetaS - this->thetaR ) * pow(1. + partOne, -this->paramM);
171
172 partTwo = ( this->thetaS - this->thetaR ) / ( this->thetaM - this->thetaR );
173
174 numerator = ( 1. - pow(1. - pow(partTwo * saturation, 1 / this->paramM), this->paramM) );
175 denominator = ( 1. - pow(1. - pow(partTwo, 1 / this->paramM), this->paramM) );
176
177 relativePermeability = sqrt(saturation) * pow( ( numerator ) / ( denominator ), 2.0 );
178 }
179
180 //Calculate mass for postprocessing
181 double mass = ( saturation * ( this->thetaS - this->thetaR ) + this->thetaR ) * density;
182
183 status->setMass(mass);
184
185 conductivity = this->permeability / this->viscosity * relativePermeability;
186
187
188
189 //add crack contribution;
190 //Read in crack lengths
191 FloatArray crackLengths;
192 static_cast< LatticeTransportElement * >( gp->giveElement() )->giveCrackLengths(crackLengths);
193 FloatArray crackWidths;
194 crackWidths.resize(crackLengths.giveSize() );
195
196#ifdef __SM_MODULE
197 IntArray coupledModels;
198 if ( domain->giveEngngModel()->giveMasterEngngModel() ) {
199 ( static_cast< StaggeredProblem * >( domain->giveEngngModel()->giveMasterEngngModel() ) )->giveCoupledModels(coupledModels);
200 int couplingFlag = ( static_cast< LatticeTransportElement * >( gp->giveElement() ) )->giveCouplingFlag();
201
202 if ( couplingFlag == 1 && coupledModels.at(1) != 0 && !tStep->isTheFirstStep() ) {
203 IntArray couplingNumbers;
204 static_cast< LatticeTransportElement * >( gp->giveElement() )->giveCouplingNumbers(couplingNumbers);
205 for ( int i = 1; i <= crackLengths.giveSize(); i++ ) {
206 if ( couplingNumbers.at(i) != 0 ) {
207 crackWidths.at(i) = static_cast< LatticeStructuralElement * >( domain->giveEngngModel()->giveMasterEngngModel()->giveSlaveProblem(coupledModels.at(1) )->giveDomain(1)->giveElement(couplingNumbers.at(i) ) )->giveCrackWidth();
208 } else {
209 crackWidths.at(i) = 0.;
210 }
211 }
212 }
213 }
214#endif
215 //Read in crack widths from transport element
216 if ( !domain->giveEngngModel()->giveMasterEngngModel() ) {
217 static_cast< LatticeTransportElement * >( gp->giveElement() )->giveCrackWidths(crackWidths);
218 }
219 //Use crack width and apply cubic law
220 double crackContribution = 0.;
221
222 for ( int i = 1; i <= crackLengths.giveSize(); i++ ) {
223 if ( crackWidths.at(i) < this->crackLimit || this->crackLimit < 0. ) {
224 crackContribution += pow(crackWidths.at(i), 3.) / crackLengths.at(i);
225 } else {
226 printf("Limit is activated\n");
227 crackContribution += pow(crackLimit, 3.) / crackLengths.at(i);
228 }
229 }
230
231 crackContribution *= this->crackTortuosity * relativePermeability / ( 12. * this->viscosity );
232 conductivity += crackContribution;
233 return density * conductivity;
234}
235
236
237double
238LatticeTransportMaterial :: computeCapacity(double suction, GaussPoint *gp) const
239{
240 double cap = 0.;
241
242 double density = this->give('d', gp);
243
244 if ( conType == 0 ) {
245 cap = this->capacity;
246 } else {
247 if ( suction < this->suctionAirEntry ) {
248 cap = 0.;
249 } else {
250 double partOne = this->paramM / ( this->paramA * ( 1. - this->paramM ) );
251 double partTwo = pow(suction / this->paramA, this->paramM / ( 1. - this->paramM ) );
252 double partThree = pow(1. + pow(suction / this->paramA, 1. / ( 1. - this->paramM ) ), -this->paramM - 1.);
253 cap = ( this->thetaM - this->thetaR ) * partOne * partTwo * partThree;
254 }
255 }
256
257 return density * cap;
258}
259
260
261std::unique_ptr<MaterialStatus>
262LatticeTransportMaterial :: CreateStatus(GaussPoint *gp) const
263{
264 return std::make_unique<LatticeTransportMaterialStatus>(gp);
265}
266
267
268void
269LatticeTransportMaterialStatus :: printOutputAt(FILE *File, TimeStep *tStep) const
270{
271 MaterialStatus :: printOutputAt(File, tStep);
272
273 fprintf(File, " state %.4e", field);
274 fprintf(File, " mass %.8e", mass);
275 fprintf(File, "\n");
276}
277
278void
279LatticeTransportMaterialStatus :: updateYourself(TimeStep *tStep)
280{
281 TransportMaterialStatus :: updateYourself(tStep);
282}
283
284
285void
286LatticeTransportMaterialStatus :: initTempStatus()
287{
288 TransportMaterialStatus :: initTempStatus();
290}
291
292
293LatticeTransportMaterialStatus :: LatticeTransportMaterialStatus(GaussPoint *g) :
295{
296 mass = 0.;
297}
298} // end namespace oofem
#define REGISTER_Material(class)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
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
Element * giveElement()
Returns corresponding element to receiver.
Definition gausspoint.h:187
int & at(std::size_t i)
Definition intarray.h:104
virtual void giveCrackWidths(FloatArray &widths)
virtual void giveCrackLengths(FloatArray &lengths)
virtual void giveCouplingNumbers(IntArray &numbers)
double mass
Liquid mass in element.
double computeCapacity(double suction, GaussPoint *gp) const
double permeability
Intrinsic permeability of porous material.
double thetaR
Residual water content.
int conType
Type of conductivity and capcity laws.
double thetaS
Relative saturated water content.
double thetaM
Modified water content.
double suctionAirEntry
Suction air entry value.
double give(int, GaussPoint *gp) const override
double density
Density of fluid.
int capacity
Type of conductivity and capcity laws.
double paramM
Parameter of van Genuchten law.
double viscosity
Viscosity of fluid.
double paramA
Parameter of van Genuchten law.
double computeConductivity(double suction, GaussPoint *gp, TimeStep *tStep) const
double crackTortuosity
Crack tortuosity.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
bool isTheFirstStep()
Definition timestep.C:148
double giveTempField() const
Return last field.
void setTempGradient(const FloatArrayF< 3 > &newGradient)
Set gradient.
double field
General field (temperature, concentration, etc.).
#define OOFEM_WARNING(...)
Definition error.h:80
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_LatticeTransportMaterial_thetam
#define _IFT_LatticeTransportMaterial_thetar
#define _IFT_LatticeTransportMaterial_ctor
#define _IFT_LatticeTransportMaterial_contype
#define _IFT_LatticeTransportMaterial_paev
#define _IFT_LatticeTransportMaterial_thetas
#define _IFT_LatticeTransportMaterial_clim
#define _IFT_LatticeTransportMaterial_vis
#define _IFT_LatticeTransportMaterial_a
#define _IFT_LatticeTransportMaterial_c
#define _IFT_LatticeTransportMaterial_m
#define _IFT_LatticeTransportMaterial_k
#define HeatCapaCoeff
Definition matconst.h:75

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