GRINS-0.8.0
spalart_allmaras_parameters.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 // This class
28 
29 // GRINS
30 #include "grins/physics_naming.h"
31 
32 // libMesh
33 #include "libmesh/getpot.h"
34 
35 namespace GRINS
36 {
38  : ParameterUser("SpalartAllmarasParameters"),
39  _kappa(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/kappa",0.41)),
40  _cv1(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv1",7.1)),
41  _cv2(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv2",0.7)),
42  _cv3(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv3",0.9)),
43  _cb1(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cb1",0.1355)),
44  _sigma(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/sigma",2./3.)),
45  _cb2(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cb2",0.622)),
46  //_cw1( _cb1/(_kappa*_kappa) + (1.0+_cb2)/_sigma ),
47  _r_lin(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/r_lin",10.0)),
48  _c_w2(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_w2",0.3)),
49  _c_w3(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_w3",2.0)),
50  _c_t3(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_t3",1.2)),
51  _c_t4(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_t4",0.5)),
52  _c_n1(input("Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_n1",16.0))
53  {
54  this->set_parameter(this->_kappa ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/kappa" , this->_kappa );
55  this->set_parameter(this->_cv1 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv1", this->_cv1 );
56  this->set_parameter(this->_cv2 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv2", this->_cv2 );
57  this->set_parameter(this->_cv3 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cv3", this->_cv3 );
58  this->set_parameter(this->_cb1 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cb1", this->_cb1 );
59  this->set_parameter(this->_sigma ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/sigma", this->_sigma );
60  this->set_parameter(this->_cb2 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/cb2" , this->_cb2 );
61  this->set_parameter(this->_r_lin ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/r_lin", this->_r_lin );
62  this->set_parameter(this->_c_w2 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_w2", this->_c_w2 );
63  this->set_parameter(this->_c_w3 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_w3", this->_c_w3 );
64  this->set_parameter(this->_c_t3 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_t3", this->_c_t3 );
65  this->set_parameter(this->_c_t4 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_t4", this->_c_t4 );
66  this->set_parameter(this->_c_n1 ,input, "Physics/"+PhysicsNaming::spalart_allmaras()+"/Parameters/c_n1", this->_c_n1 );
67  }
68 
69  libMesh::Real SpalartAllmarasParameters::source_fn(libMesh::Number nu, libMesh::Real mu,
70  libMesh::Real wall_distance, libMesh::Real vorticity_value, bool infinite_distance) const
71  {
72  // Step 1
73  libMesh::Real chi = nu/mu;
74 
75  // Step 2
76  libMesh::Real fv1 = this->fv1(chi);
77 
78  // Step 3
79  libMesh::Real fv2 = 1 - (chi/(1 + chi*fv1));
80 
81  libMesh::Real S_bar = 0.0;
82  // Step 4
83  if(infinite_distance)
84  {
85  S_bar = 0.0;
86  }
87  else
88  {
89  S_bar = nu/(pow(_kappa, 2.0) * pow(wall_distance, 2.0))*(fv2) ;
90  }
91 
92  // Step 5, the absolute value of the vorticity
93  libMesh::Real S = vorticity_value;
94 
95  // Step 6
96  libMesh::Real S_tilde = 0.0;
97  if(S_bar >= -this->_cv2*S)
98  {
99  S_tilde = S + S_bar;
100  }
101  else
102  {
103  S_tilde = S + (S*(pow(this->_cv2,2.0)*S + this->_cv3*S_bar))/((this->_cv3 - (2*this->_cv2))*S - S_bar);
104  }
105 
106  return S_tilde;
107  }
108 
109  libMesh::Real SpalartAllmarasParameters::destruction_fn(libMesh::Number nu, libMesh::Real wall_distance,
110  libMesh::Real S_tilde, bool infinite_distance) const
111  {
112  // Step 1
113  libMesh::Real r = 0.0;
114  if(infinite_distance)
115  {
116  r = 0.0;
117  }
118  else
119  {
120  r = std::min(nu/(S_tilde*pow(this->_kappa,2.0)*pow(wall_distance,2.0)), this->_r_lin);
121  }
122 
123  // Step 2
124  libMesh::Real g = r + this->_c_w2*(pow(r,6.0) - r);
125 
126  // Step 3
127  libMesh::Real fw = g*pow(((1 + pow(this->_c_w3,6.0))/(pow(g,6.0) + pow(this->_c_w3,6.0))), 1.0/6.0);
128 
129  return fw;
130  }
131 
132 } // end namespace GRINS
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
libMesh::Real _r_lin
Constants specific to the calculation of the destruction function.
libMesh::Real _kappa
Constants specific to the calculation of the source function.
static PhysicsName spalart_allmaras()
libMesh::Real _cb1
Spalart Allmaras model constants, the constant _cw1 are calculated, not cached.
libMesh::Real source_fn(libMesh::Number nu, libMesh::Real mu, libMesh::Real wall_distance, libMesh::Real vorticity_value, bool infinite_distance) const
GRINS namespace.
libMesh::Real _c_n1
Constants specific to the calculation of the negative S-A model.
ParameterUser base class. Utility methods for subclasses.
libMesh::Real destruction_fn(libMesh::Number nu, libMesh::Real wall_distance, libMesh::Real S_tilde, bool infinite_distance) const
libMesh::Real fv1(libMesh::Real chi) const
Helper function.
libMesh::Real _c_t3
Constants specific to the calculation of the trip function (but used in.

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1