27#ifndef _GEMA_PLUGIN_HYDRAULIC_MATERIAL_PIPEFLOW_H_
28#define _GEMA_PLUGIN_HYDRAULIC_MATERIAL_PIPEFLOW_H_
30#include <gmpFemPhysicsCommonMaterial.h>
69 : GmpFemPhysicsCommonMaterial(typeIndex, typeName, logger) {}
79 virtual const QVariantMap* materialMetaDataMap()
88 m[
"properties"] = GmpFemPhysicsCommon::ValueList()
89 << GmpFemPhysicsCommon::ScalarValue(Dc_ID,
"Dp",
QObject::tr(
"Pipe diameter"),
"m",
true)
90 << GmpFemPhysicsCommon::ScalarValue(Uf_ID,
"uf",
QObject::tr(
"Dynamic fluid viscosity"),
"kPa*s",
true)
91 << GmpFemPhysicsCommon::ScalarValue(MFw_ID,
"Mfw",
QObject::tr(
"Interface biot modulus"),
"kPa/m",
false)
92 << GmpFemPhysicsCommon::ScalarValue(GW_ID,
"gw",
QObject::tr(
"Fluid specific weight"),
"kN/m3",
true)
93 << GmpFemPhysicsCommon::ScalarValue(W_ID,
"wr",
QObject::tr(
"Wall roughness"),
"m",
true)
94 << GmpFemPhysicsCommon::ScalarValue(rhof_ID,
"rhow",
QObject::tr(
"Water density"),
"kg/m3",
true);
98 m[
"gaussAttributes"] = GmpFemPhysicsCommon::ValueList()
99 << GmpFemPhysicsCommon::ScalarValue(FR_GA_ID,
"FR",
QObject::tr(
"flow regime"),
" ",
true,
false, 2)
100 << GmpFemPhysicsCommon::HistoryValue(FROLD_GA_ID, FR_GA_ID, 1,
true)
101 << GmpFemPhysicsCommon::ScalarValue(QFLOW_GA_ID,
"Qf",
QObject::tr(
"Flow in the pipe element"),
"m3/s",
true,
false, 1)
102 << GmpFemPhysicsCommon::ScalarValue(RE_GA_ID,
"Re",
QObject::tr(
"Reynolds number of the flow in the pipe"),
" ",
true,
false, 1);
113 return propertyAc(Dc_ID)->scalarValueAt(e, coord, ip);
121 return propertyAc(Uf_ID)->scalarValueAt(e, coord, ip);
129 return propertyAc(GW_ID)->scalarValueAt(e, coord, ip);
137 return propertyAc(W_ID)->scalarValueAt(e, coord, ip);
146 return propertyAc(rhof_ID)->scalarValueAt(e, coord, ip);
156 double w = pipeWallRoughness(e, coord, ip);
157 double NRe = ReAcc->scalarValueAt(e, ip, coord);
158 double fs, ft, fr, fmax, R, dR, deltaft;
159 int it = 1, iterMAX = 30;
163 fs = 0.3164*pow(NRe, -0.25);
168 R = pow(ft, -0.50) - 1.14 + 2.0*log10(w / dp + 9.35 / NRe * pow(ft, -0.50));
171 while (abs(R) >= 1e-10)
174 dR = -0.50 / pow(ft, 1.50) - 9.350 / (NRe*pow(ft, 1.50)*(w / dp + 9.35 / NRe * pow(ft, -0.50))*log(10.0));
183 R = pow(ft, -0.50) - 1.14 + 2.0*log10(w / dp + 9.35 / NRe * pow(ft, -0.50));
187 gmErrorMsg(logger(),
"Error to compute the friction factor. No convergence");
195 fr = pow(1 / (1.14 - 2.0*log10(w / dp)),2.0);
198 fmax = (fs > ft) ? fs : ft;
199 fmax = (fmax > fr) ? fmax : fr;
209 if (propertyAc(MFw_ID) == NULL)
213 return propertyAc(MFw_ID)->scalarValueAt(e, coord, ip);
222 double isTurbulent = oldFrAcc->scalarValueAt(e, ip, coord);
224 double dp = DpAcc->scalarValueAt(e, ip, coord);
225 double uf = fluidViscosity(e, coord, ip);
226 double gw = fluidSpecificWeight(e, coord, ip);
227 double rhoW = fluidDensity(e, coord, ip);
228 double w = pipeWallRoughness(e, coord, ip);
229 double dH = abs(Pe(0) - Pe(1))/gw;
232 double gAc = 1000.0 * gw / rhoW;
243 kl = arma::datum::pi*pow(dp, 4.0) / (128.0 * uf);
253 double nu = 1000.0*uf / rhoW;
254 double A = w / (3.7*dp);
255 double B = 2.51*nu / dp;
256 double alpha = 2.0*gAc*dp*abs(dH) / L;
257 double f1 = -arma::datum::pi * pow(dp, 2.0)*sqrt(2.0*gAc*dp*L / abs(dH)) / (2.0*gw);
258 double f2 = log10(A + B / sqrt(alpha));
291 assert(uf != 0 &&
"Ufw Dynamic viscosity must be different to zero");
303 double isTurbulent = oldFrAcc->scalarValueAt(e, ip, coord);
305 double dp = DpAcc->scalarValueAt(e, ip, coord);
306 double uf = fluidViscosity(e, coord, ip);
307 double gw = fluidSpecificWeight(e, coord, ip);
308 double rhoW = fluidDensity(e, coord, ip);
309 double w = pipeWallRoughness(e, coord, ip);
310 double dH = (Pe(0) - Pe(1))/ gw;
324 double gAc = 1000.0*gw / rhoW;
332 if (isTurbulent == 0)
335 kt = arma::datum::pi * pow(dp, 4.0) / (128.0 * uf);
344 double nu = 1000.0*uf / rhoW;
345 double A = w / (3.7*dp);
346 double B = 2.51*nu / dp;
347 double alpha = 2.0*gAc*dp*abs(dH) / L;
348 double f1 = -arma::datum::pi * pow(dp, 2.0)*sqrt(2.0*gAc*dp*L / abs(dH)) / (2.0*gw);
349 double f2 = log10(A + B / sqrt(alpha));
350 double df1h1 = signaldH * arma::datum::pi*pow(dp, 3.0)*gAc*L / (4.0*gw*pow(dH, 2.0))*sqrt(2.0*abs(dH) / (gAc*dp*L));
351 double df2h1 = -1.0*signaldH*B / (2.0*abs(dH)*(A*sqrt(alpha) + B)*log(10));
353 kt = dH * (df1h1*f2 + f1 * df2h1) + f1 * f2;
360 assert(uf != 0 &&
"Ufw Dynamic viscosity must be different to zero");
372 double Qflow = abs(Fi(0));
373 double dp = DpAcc->scalarValueAt(e, ip, coord);
374 double uf = fluidViscosity(e, coord, ip);
375 double rhoW = fluidDensity(e, coord, ip);
376 double nu = 1000.0*uf / rhoW;
377 double Re = 4.0*Qflow / (arma::datum::pi*nu*dp);
383 FrAcc->setScalarValue(e, ip, 1);
387 FrAcc->setScalarValue(e, ip, 0);
392 QfAcc->setScalarValue(e, ip, Qflow);
396 ReAcc->setScalarValue(e, ip, Re);
Definition gmpMaterialPipeFlow.h:40
virtual double fluidViscosity(const GmElement *e, const GmVector *coord, int ip) const
Returns the dynamic fluid viscosity.
Definition gmpMaterialPipeFlow.h:117
virtual double pipeDiameter(const GmElement *e, const GmVector *coord, int ip) const
Returns the initial fracture opening.
Definition gmpMaterialPipeFlow.h:109
virtual double pipeTangentConductivity(const GmElement *e, const GmVector *coord, int ip, GmGaussAccessor *DpAcc, GmVector &Pe, double L) const
Returns the hydraulic conductivity of Pipe [m^4/(kPa*s)].
Definition gmpMaterialPipeFlow.h:298
virtual double frictionFactor(const GmElement *e, const GmVector *coord, int ip, double dp) const
Returns friction factor as presented by Kaufmann.
Definition gmpMaterialPipeFlow.h:150
virtual double pipeWallRoughness(const GmElement *e, const GmVector *coord, int ip) const
Returns the wall roughness of the pipe.
Definition gmpMaterialPipeFlow.h:133
PipePropertyIds
IDs for saturated material element properties.
Definition gmpMaterialPipeFlow.h:44
@ MFw_ID
Id for retrieving the discontinuity Biot's Modulus.
Definition gmpMaterialPipeFlow.h:47
@ rhof_ID
Id for retrieving the water density.
Definition gmpMaterialPipeFlow.h:50
@ Uf_ID
Id for retrieving the dynamic fluid viscosity.
Definition gmpMaterialPipeFlow.h:46
@ Dc_ID
Id for retrieving the pipe diameter.
Definition gmpMaterialPipeFlow.h:45
@ W_ID
Id for retrieving the wall roughness of the pipe.
Definition gmpMaterialPipeFlow.h:49
@ GW_ID
Id for retrieving the specific weight of the fluid.
Definition gmpMaterialPipeFlow.h:48
GmpMaterialPipeFlow(int typeIndex, QString typeName, const GmLogCategory &logger)
Constructor. Gets as parameters the material index and its name.
Definition gmpMaterialPipeFlow.h:68
virtual void ckeckFlowRegime(const GmElement *e, const GmVector *coord, int ip, GmGaussAccessor *DpAcc, GmVector &Fi) const
Definition gmpMaterialPipeFlow.h:368
virtual double fluidSpecificWeight(const GmElement *e, const GmVector *coord, int ip) const
Returns the specific weight of the fluid.
Definition gmpMaterialPipeFlow.h:125
virtual double fluidDensity(const GmElement *e, const GmVector *coord, int ip) const
Returns gravitational accelaration.
Definition gmpMaterialPipeFlow.h:141
static GmpFemPhysicsCommonMaterial * instance(GmSimulationData *simulation, int typeIndex, QString typeName, const GmLogCategory &logger)
A "factory" function used to register the material with the physics material factory.
Definition gmpMaterialPipeFlow.h:72
virtual double pipeConductivity(const GmElement *e, const GmVector *coord, int ip, GmGaussAccessor *DpAcc, GmVector &Pe, double L) const
Returns the hydraulic conductivity of Pipe [m^4/(kPa*s)].
Definition gmpMaterialPipeFlow.h:217
pipeGaussAttrIds
IDs for Gauss attributes of pipe material.
Definition gmpMaterialPipeFlow.h:55
@ FR_GA_ID
Base Id for Gauss attribute(s) used to store the calculated Flow regime.
Definition gmpMaterialPipeFlow.h:56
@ RE_GA_ID
Base Id for Gauss attribute(s) used to store the Reynolds number.
Definition gmpMaterialPipeFlow.h:59
@ NUM_GA_IDS
The number of gauss attributes.
Definition gmpMaterialPipeFlow.h:62
@ FROLD_GA_ID
Id for retrieving the plastic strain accessor at the previous state (old Flow regime)
Definition gmpMaterialPipeFlow.h:57
virtual double interfaceBiotModulus(const GmElement *e, const GmVector *coord, int ip) const
Returns the discontinuity Biot's Modulus.
Definition gmpMaterialPipeFlow.h:205
Declaration of useful configuration definitions for the plugin library.
Declaration of the GmpHydraulicPipe classes.
QString tr(const char *sourceText, const char *disambiguation, int n)