OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 "latticetransmat.h"
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 
46 namespace oofem {
47 REGISTER_Material(LatticeTransportMaterial);
48 
51 {
52  IRResultType result; // Required by IR_GIVE_FIELD macro
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  }
70  else if ( conType == 1 ) {
72 
74 
75  //Assume that original van Genuchten is used.
76  this->thetaM = this->thetaS;
78 
79  this->suctionAirEntry = 0;
81 
82  if ( thetaM < thetaS ) {
83  OOFEM_WARNING("thetaM cannot be smaller than thetaS. Choose thetaM=thetaS.");
84  thetaM = thetaS;
85  }
86 
87  //Define value of either air entry pressure or thetaM for later use. Only based on input parameters.
88  if ( suctionAirEntry == 0. ) {
89  suctionAirEntry = paramA * pow( ( pow( ( thetaS - thetaR ) / ( thetaM - thetaR ), -1. / paramM ) - 1. ), ( 1 - paramM ) );
90  } else {
91  thetaM = ( thetaS - thetaR ) * pow(1. + pow( suctionAirEntry / paramA, 1. / ( 1. - paramM ) ), paramM) + thetaR;
92  }
93  } //end of contype condition
94  else if ( conType != 0 && conType != 1 ) {
95  OOFEM_ERROR("unknown conType mode");
96  }
97 
98  crackTortuosity = 1.;
100 
101  crackLimit = -1.;
103 
104  return Material :: initializeFrom(ir);
105 }
106 
107 
108 void
110 {
111  LatticeTransportMaterialStatus *status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
112  status->setTempField(field);
113  double suction = field.at(1);
114  double c = this->computeConductivity(suction, gp, tStep);
115  answer.beScaled(-c, grad);
116 }
117 
118 
119 double
121 {
122  if ( aProperty == 'k' ) {
123  return permeability;
124  } else if ( ( aProperty == HeatCapaCoeff ) || ( aProperty == 'c' ) ) {
125  return ( this->give('d', gp) );
126  }
127 
128  return this->Material :: give(aProperty, gp);
129 }
130 
131 
132 double
134  GaussPoint *gp,
135  TimeStep *tStep)
136 {
137  LatticeTransportMaterialStatus *status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
138  double suction = status->giveTempField().at(1);
139 
140  if ( mode == Capacity ) {
141  return computeCapacity(suction, gp);
142  } else if ( mode == Conductivity ) {
143  return computeConductivity(suction, gp, tStep);
144  } else {
145  OOFEM_ERROR("unknown mode");
146  }
147 
148  return 0; // to make compiler happy
149 }
150 
151 
152 double
154  GaussPoint *gp,
155  TimeStep *tStep)
156 {
157  LatticeTransportMaterialStatus *status = static_cast< LatticeTransportMaterialStatus * >( this->giveStatus(gp) );
158 
159  matMode = gp->giveMaterialMode();
160 
161  this->density = this->give('d', gp);
162 
163  double relativePermeability = 0.;
164  double conductivity = 0.;
165 
166  double saturation, partOne, partTwo, numerator, denominator;
167  if ( suction < this->suctionAirEntry || conType == 0 ) {
168  saturation = 1.;
169  relativePermeability = 1.;
170  } else {
171  partOne = pow( suction / this->paramA, 1. / ( 1. - this->paramM ) );
172 
173  saturation = ( this->thetaM - this->thetaR ) / ( this->thetaS - this->thetaR ) * pow(1. + partOne, -this->paramM);
174 
175  partTwo = ( this->thetaS - this->thetaR ) / ( this->thetaM - this->thetaR );
176 
177  numerator = ( 1. - pow(1. - pow(partTwo * saturation, 1 / this->paramM), this->paramM) );
178  denominator = ( 1. - pow(1. - pow(partTwo, 1 / this->paramM), this->paramM) );
179 
180  relativePermeability = sqrt(saturation) * pow( ( numerator ) / ( denominator ), 2.0 );
181  }
182 
183  //Calculate mass for postprocessing
184  double mass = ( saturation * ( this->thetaS - this->thetaR ) + this->thetaR ) * this->density;
185 
186  status->setMass(mass);
187 
188  conductivity = this->permeability / this->viscosity * relativePermeability;
189 
190 
191 
192  //add crack contribution;
193 
194  //Read in crack lengths
195 
196  FloatArray crackLengths;
197 
198  static_cast< LatticeTransportElement * >( gp->giveElement())->giveCrackLengths(crackLengths);
199 
200  FloatArray crackWidths;
201  crackWidths.resize(crackLengths.giveSize());
202 
203 #ifdef __SM_MODULE
204  IntArray coupledModels;
206  (static_cast< StaggeredProblem *>(domain->giveEngngModel()->giveMasterEngngModel()))->giveCoupledModels(coupledModels);
207  int couplingFlag = ( static_cast< LatticeTransportElement * >( gp->giveElement() ) )->giveCouplingFlag();
208 
209  if ( couplingFlag == 1 && coupledModels.at(1) != 0 && !tStep->isTheFirstStep() ) {
210  IntArray couplingNumbers;
211 
212  static_cast< LatticeTransportElement * >( gp->giveElement())->giveCouplingNumbers(couplingNumbers);
213  for (int i = 1; i <= crackLengths.giveSize(); i++) {
214  if ( couplingNumbers.at(i) != 0 ) {
215  crackWidths.at(i) = static_cast< LatticeStructuralElement* >( domain->giveEngngModel()->giveMasterEngngModel()->giveSlaveProblem( coupledModels.at(1) )->giveDomain(1)->giveElement(couplingNumbers.at(i)))->giveCrackWidth();
216  } else {
217  crackWidths.at(i) = 0.;
218  }
219  }
220  }
221  }
222 #endif
223 
224  //Read in crack widths from transport element
226  static_cast< LatticeTransportElement * >( gp->giveElement() )->giveCrackWidths(crackWidths);
227  }
228 
229  //Use crack width and apply cubic law
230  double crackContribution = 0.;
231 
232  for (int i = 1; i <= crackLengths.giveSize(); i++) {
233  if ( crackWidths.at(i) < this->crackLimit || this->crackLimit < 0. ) {
234  crackContribution += pow(crackWidths.at(i), 3.) / crackLengths.at(i);
235  } else {
236  printf("Limit is activated\n");
237  crackContribution += pow(crackLimit, 3.) / crackLengths.at(i);
238  }
239  }
240 
241  crackContribution *= this->crackTortuosity * relativePermeability/ (12. * this->viscosity );
242 
243  conductivity += crackContribution;
244 
245  return this->density * conductivity;
246 }
247 
248 
249 
250 double
252 {
253  double cap = 0.;
254 
255  this->density = this->give('d', gp);
256 
257  if ( conType == 0 ) {
258  cap = this->capacity;
259  } else {
260  if ( suction < this->suctionAirEntry) {
261  cap = 0.;
262  } else {
263  double partOne = this->paramM / ( this->paramA * ( 1. - this->paramM ) );
264  double partTwo = pow( suction / this->paramA, this->paramM / ( 1. - this->paramM ) );
265  double partThree = pow(1. + pow( suction / this->paramA, 1. / ( 1. - this->paramM ) ), -this->paramM - 1.);
266  cap = ( this->thetaM - this->thetaR ) * partOne * partTwo * partThree;
267  }
268  }
269 
270  return this->density * cap;
271 }
272 
273 
276 {
278 }
279 
280 
281 void
283 {
284  MaterialStatus :: printOutputAt(File, tStep);
285 
286  fprintf(File, " state");
287 
288  for ( auto &val : field ) {
289  fprintf( File, " %.4e", val );
290  }
291 
292  fprintf(File, " mass %.8e", mass);
293  fprintf(File, "\n");
294 }
295 
296 void
298 {
300 }
301 
302 
303 void
305 {
307  oldPressure = field.at(1);
308 }
309 
310 
312  TransportMaterialStatus(n, d, g)
313 {
314  mass = 0.;
315 }
316 } // end namespace oofem
virtual EngngModel * giveSlaveProblem(int i)
Returns i-th slave problem.
Definition: engngm.h:1082
int conType
Type of conductivity and capcity laws.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
const FloatArray & giveTempField()
Return last field.
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
Class and object Domain.
Definition: domain.h:115
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
double crackTortuosity
crack tortuosity
double thetaS
Relative saturated water content.
This class implements associated Material Status to LatticeTransportMaterial.
LatticeTransportMaterialStatus(int n, Domain *d, GaussPoint *g)
Constructor.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define _IFT_LatticeTransportMaterial_thetar
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
#define _IFT_LatticeTransportMaterial_paev
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
This class implements a transport material status information.
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
MatResponseMode
Describes the character of characteristic material matrix.
#define _IFT_LatticeTransportMaterial_c
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
double paramA
Parameter of van Genuchten law.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
double computeConductivity(double suction, GaussPoint *gp, TimeStep *tStep)
Computes the conductivity.
double viscosity
Viscosity of fluid.
bool isTheFirstStep()
Check if receiver is first step.
Definition: timestep.C:134
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
Definition: floatarray.C:146
virtual double give(int aProperty, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Definition: material.C:52
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the characteristic value of receiver in given integration point, respecting its history...
virtual void giveFluxVector(FloatArray &answer, GaussPoint *gp, const FloatArray &grad, const FloatArray &field, TimeStep *tStep)
Returns the flux for the field and its gradient.
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
#define OOFEM_ERROR(...)
Definition: error.h:61
#define _IFT_LatticeTransportMaterial_contype
double suctionAirEntry
suction air entry value
#define _IFT_LatticeTransportMaterial_thetam
#define _IFT_LatticeTransportMaterial_ctor
int capacity
Type of conductivity and capcity laws.
void setTempField(FloatArray newField)
Set field.
Implementation of general sequence (staggered) problem.
EngngModel * giveMasterEngngModel()
Returns the master engnmodel.
Definition: engngm.h:516
double thetaR
Residual water content.
virtual double give(int, GaussPoint *gp)
Returns the value of material property &#39;aProperty&#39;.
Abstract base class representing a material status information.
Definition: matstatus.h:84
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
#define _IFT_LatticeTransportMaterial_k
double mass
Liquid mass in element.
Class representing the general Input Record.
Definition: inputrecord.h:101
void printOutputAt(FILE *, TimeStep *)
Print receiver&#39;s output to given stream.
#define _IFT_LatticeTransportMaterial_a
MaterialMode matMode
Material mode for convenient access.
Domain * giveDomain() const
Definition: femcmpnn.h:100
double thetaM
modified water content
double permeability
Intrinsic permeability of porous material.
REGISTER_Material(DummyMaterial)
This class implements the base of a special lattice element following the concepts orginally develope...
#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.
#define _IFT_LatticeTransportMaterial_vis
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: matstatus.h:97
#define HeatCapaCoeff
Definition: matconst.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
#define _IFT_LatticeTransportMaterial_thetas
double paramM
Parameter of van Genuchten law.
double computeCapacity(double suction, GaussPoint *gp)
Computes the capacity.
#define _IFT_LatticeTransportMaterial_m
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: material.C:89
void setMass(double input)
Sets the mass.
#define _IFT_LatticeTransportMaterial_clim
Class representing integration point in finite element program.
Definition: gausspoint.h:93
#define OOFEM_WARNING(...)
Definition: error.h:62
double density
Density of fluid.
Class representing solution step.
Definition: timestep.h:80
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
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