Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
CarreauYasuda_def.hpp
1#ifndef CARREAUYASUDA_DEF_hpp
2#define CARREAUYASUDA_DEF_hpp
3
4namespace FEDD
5{
6
7 template <class SC, class LO, class GO, class NO>
8 CarreauYasuda<SC, LO, GO, NO>::CarreauYasuda(ParameterListPtr_Type params) : DifferentiableFuncClass<SC, LO, GO, NO>(params)
9 {
10 this->params_ = params;
11 // Reading through parameterlist
12 shearThinningModel_ = this->params_->sublist("Material").get("ShearThinningModel", "");
13 characteristicTime = this->params_->sublist("Material").get("CharacteristicTime_Lambda", 0.); // corresponds to \lambda in the formulas in the literature
14 fluid_index_n = this->params_->sublist("Material").get("FluidIndex_n", 1.); // corresponds to n in the formulas being the power-law index
15 nu_0 = this->params_->sublist("Material").get("ZeroShearRateViscosity_eta0", 0.); // is the zero shear-rate viscosity
16 nu_infty = this->params_->sublist("Material").get("InftyShearRateViscosity_etaInfty", 0.); // is the infnite shear-rate viscosity
17 inflectionPoint = this->params_->sublist("Material").get("InflectionPoint_a", 1.); // corresponds to a in the formulas in the literature
18 shear_rate_limitZero = this->params_->sublist("Material").get("Numerical_ZeroValue_ShearRate", 1e-8);
19
20 viscosity_ = 0.; // Initialize Viscsoity value to zero
21 }
22
23 template <class SC, class LO, class GO, class NO>
24 void CarreauYasuda<SC, LO, GO, NO>::evaluateMapping(ParameterListPtr_Type params, double shearRate, double &viscosity)
25 {
26
27 viscosity = this->nu_infty + (this->nu_0 - this->nu_infty) * (std::pow(1.0 + std::pow(this->characteristicTime * shearRate, this->inflectionPoint), (this->fluid_index_n - 1.0) / this->inflectionPoint));
28 this->viscosity_ = viscosity;
29 }
30
31 /*
32 The function is composed of d(eta)/d(GammaDot) * d(GammaDot)/d(Tau) through chain rule
33 while d(GammaDot) * d(GammaDot)/d(Tau)= - 2/GammaDot
34 So a problematic case is if this->inflectionPoint-2.0 < 0 than the shear rate is in the denominator and because it can
35 be zero we may get nan/inf values. Therefore we have to check these cases and catch them
36 */
37 template <class SC, class LO, class GO, class NO>
38 void CarreauYasuda<SC, LO, GO, NO>::evaluateDerivative(ParameterListPtr_Type params, double shearRate, double &res)
39 {
40
41 if (std::abs(this->inflectionPoint - 2.0) < std::numeric_limits<double>::epsilon()) // for a=2.0 we get gammaDot^{-0} which is 1
42 {
43 // So for a Carreau-like Fluid we should jump here because a=2.0
44 res = (-2.0) * (this->nu_0 - this->nu_infty) * (this->fluid_index_n - 1.0) * std::pow(this->characteristicTime, this->inflectionPoint) * std::pow(1.0 + std::pow(this->characteristicTime * shearRate, this->inflectionPoint), ((this->fluid_index_n - 1.0 - this->inflectionPoint) / this->inflectionPoint));
45 }
46 else // in the other case we have to check that gammaDot is not zero because otherwise we get 1/0
47 {
48 if (std::abs(shearRate) <= shear_rate_limitZero) // How to choose epsilon?
49 {
50 shearRate = shear_rate_limitZero;
51 }
52 res = (-2.0) * (this->nu_0 - this->nu_infty) * (this->fluid_index_n - 1.0) * std::pow(this->characteristicTime, this->inflectionPoint) * std::pow(shearRate, this->inflectionPoint - 2.0) * std::pow(1.0 + std::pow(this->characteristicTime * shearRate, this->inflectionPoint), ((this->fluid_index_n - 1.0 - this->inflectionPoint) / this->inflectionPoint));
53 }
54 }
55
56 template <class SC, class LO, class GO, class NO>
57 void CarreauYasuda<SC, LO, GO, NO>::setParams(ParameterListPtr_Type params)
58 {
59 this->params_ = params;
60 // Reading through parameterlist
61 shearThinningModel_ = this->params_->sublist("Material").get("ShearThinningModel", "");
62 characteristicTime = this->params_->sublist("Material").get("CharacteristicTime_Lambda", 0.); // corresponds to \lambda in the formulas in the literature
63 fluid_index_n = this->params_->sublist("Material").get("FluidIndex_n", 1.); // corresponds to n in the formulas being the power-law index
64 nu_0 = this->params_->sublist("Material").get("ZeroShearRateViscosity_eta0", 0.); // is the zero shear-rate viscosity
65 nu_infty = this->params_->sublist("Material").get("InftyShearRateViscosity_etaInfty", 0.); // is the infnite shear-rate viscosity
66 inflectionPoint = this->params_->sublist("Material").get("InflectionPoint_a", 1.);
67 shear_rate_limitZero = this->params_->sublist("Material").get("Numerical_ZeroValue_ShearRate", 1e-8);
68 }
69
70 template <class SC, class LO, class GO, class NO>
72 {
73 std::cout << "************************************************************ " << std::endl;
74 std::cout << "-- Chosen material model ..." << this->shearThinningModel_ << " --- " << std::endl;
75 std::cout << "-- Specified material parameters:" << std::endl;
76 std::cout << "-- eta_0:" << this->nu_0 << std::endl;
77 std::cout << "-- eta_Infty:" << this->nu_infty << std::endl;
78 std::cout << "-- Fluid index n:" << this->fluid_index_n << std::endl;
79 std::cout << "-- Inflection point a:" << this->inflectionPoint << std::endl;
80 std::cout << "-- Characteristic time lambda:" << this->characteristicTime << std::endl;
81 std::cout << "************************************************************ " << std::endl;
82 }
83
84}
85#endif
CarreauYasuda(ParameterListPtr_Type parameters)
Constructor for CarreauYasuda.
Definition CarreauYasuda_def.hpp:8
void evaluateMapping(ParameterListPtr_Type params, double shearRate, double &viscosity) override
Update the viscosity according to a chosen shear thinning generalized newtonian constitutive equation...
Definition CarreauYasuda_def.hpp:24
void setParams(ParameterListPtr_Type params) override
Each constitutive model includes different material parameters which will be specified in parametersP...
Definition CarreauYasuda_def.hpp:57
void evaluateDerivative(ParameterListPtr_Type params, double shearRate, double &res) override
For Newton method and NOX we need additional term in Jacobian considering directional derivative of o...
Definition CarreauYasuda_def.hpp:38
void echoInformationMapping() override
Print parameter values used in model at runtime.
Definition CarreauYasuda_def.hpp:71
DifferentiableFuncClass(ParameterListPtr_Type parameters)
Definition DifferentiableFuncClass_def.hpp:8
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36