GRINS-0.7.0
inc_navier_stokes_stab_helper.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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 #ifndef GRINS_INC_NAVIER_STOKES_STAB_HELPER_H
26 #define GRINS_INC_NAVIER_STOKES_STAB_HELPER_H
27 
28 // GRINS
29 #include "grins/stab_helper.h"
30 #include "grins/assembly_context.h"
31 
32 // libMesh foward declarations
33 class GetPot;
34 
35 namespace GRINS
36 {
37  // Forward declarations
38  class VelocityFEVariables;
39  class PressureFEVariable;
40 
42  {
43  public:
44 
46  ( const std::string & helper_name,
47  const GetPot& input );
48 
50 
51  libMesh::Real compute_tau_continuity( libMesh::Real tau_C,
52  libMesh::RealGradient& g ) const;
53 
54  void compute_tau_continuity_and_derivs( libMesh::Real tau_M,
55  libMesh::Real d_tau_M_d_rho,
56  libMesh::Gradient d_tau_M_d_U,
57  libMesh::RealGradient& g,
58  libMesh::Real &tau_C,
59  libMesh::Real &d_tau_C_d_rho,
60  libMesh::Gradient &d_tau_C_d_U
61  ) const;
62 
63  libMesh::Real compute_tau_momentum( AssemblyContext& c,
64  unsigned int qp,
65  libMesh::RealGradient& g,
66  libMesh::RealTensor& G,
67  libMesh::Real rho,
68  libMesh::Gradient U,
69  libMesh::Real mu,
70  bool is_steady ) const;
71 
73  unsigned int qp,
74  libMesh::RealGradient& g,
75  libMesh::RealTensor& G,
76  libMesh::Real rho,
77  libMesh::Gradient U,
78  libMesh::Real T,
79  libMesh::Real &tau_M,
80  libMesh::Real &d_tau_M_d_rho,
81  libMesh::Gradient &d_tau_M_d_U,
82  bool is_steady ) const;
83 
84  libMesh::Real compute_tau( AssemblyContext& c,
85  unsigned int qp,
86  libMesh::Real mat_prop_sq,
87  libMesh::RealGradient& g,
88  libMesh::RealTensor& G,
89  libMesh::Real rho,
90  libMesh::Gradient U,
91  bool is_steady ) const;
92 
94  unsigned int qp,
95  libMesh::Real mat_prop_sq,
96  libMesh::RealGradient& g,
97  libMesh::RealTensor& G,
98  libMesh::Real rho,
99  libMesh::Gradient U,
100  libMesh::Real& tau,
101  libMesh::Real& d_tau_d_rho,
102  libMesh::Gradient& d_tau_d_U,
103  bool is_steady ) const;
104 
105 
106 
107  libMesh::Real compute_res_continuity( AssemblyContext& context,
108  unsigned int qp ) const;
109 
111  unsigned int qp,
112  libMesh::Real &res_C,
113  libMesh::Tensor &d_res_C_dgradU ) const;
114 
115  libMesh::RealGradient compute_res_momentum_steady( AssemblyContext& context,
116  unsigned int qp,
117  const libMesh::Real rho,
118  const libMesh::Real mu ) const;
119 
121  unsigned int qp,
122  const libMesh::Real rho,
123  const libMesh::Real mu,
124  libMesh::Gradient &res_M,
125  libMesh::Tensor &d_res_M_dgradp,
126  libMesh::Tensor &d_res_M_dU,
127  libMesh::Gradient &d_res_Muvw_dgraduvw,
128  libMesh::Tensor &d_res_Muvw_dhessuvw
129  ) const;
130 
131  libMesh::RealGradient compute_res_momentum_transient( AssemblyContext& context,
132  unsigned int qp,
133  const libMesh::Real rho ) const;
134 
136  unsigned int qp,
137  const libMesh::Real rho,
138  libMesh::RealGradient &res_M,
139  libMesh::Real &d_res_Muvw_duvw
140  ) const;
141 
143  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
144  libMesh::Gradient& grad_v ) const;
145 
147  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
148  libMesh::Gradient& grad_v, libMesh::Gradient& grad_w ) const;
149 
151  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
152 
153  libMesh::RealGradient div_GradU_axi( libMesh::Real r, const libMesh::Gradient& U,
154  const libMesh::Gradient& grad_u, const libMesh::Gradient& grad_v,
155  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
156 
158  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
159  libMesh::RealTensor& hess_w ) const;
160 
162  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
163 
164  libMesh::RealGradient div_GradU_T_axi( libMesh::Real r, const libMesh::Gradient& U, const libMesh::Gradient& grad_u,
165  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
166 
168  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
169  libMesh::RealTensor& hess_w ) const;
170 
172  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
173 
174  libMesh::RealGradient div_divU_I_axi( libMesh::Real r, const libMesh::Gradient& U, const libMesh::Gradient& grad_u,
175  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
176 
178  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
179  libMesh::RealTensor& hess_w ) const;
180 
181  protected:
182 
183  libMesh::Real _C, _tau_factor;
184 
187 
188  }; // class IncompressibleNavierStokesStabilizationHelper
189 
190  /* ------------- Inline Functions ---------------*/
191 
192  inline
194  libMesh::RealGradient& g ) const
195  {
196  return this->_tau_factor/(tau_M*(g*g));
197  }
198 
199  inline
201  ( libMesh::Real tau_M,
202  libMesh::Real d_tau_M_d_rho,
203  libMesh::Gradient d_tau_M_d_U,
204  libMesh::RealGradient& g,
205  libMesh::Real &tau_C,
206  libMesh::Real &d_tau_C_d_rho,
207  libMesh::Gradient &d_tau_C_d_U
208  ) const
209  {
210  tau_C = this->_tau_factor/(tau_M*(g*g));
211  libMesh::Real d_tau_C_d_tau_M = -tau_C/tau_M;
212  d_tau_C_d_rho = d_tau_C_d_tau_M * d_tau_M_d_rho;
213  d_tau_C_d_U = d_tau_C_d_tau_M * d_tau_M_d_U;
214  }
215 
216  inline
218  unsigned int qp,
219  libMesh::RealGradient& g,
220  libMesh::RealTensor& G,
221  libMesh::Real rho,
222  libMesh::Gradient U,
223  libMesh::Real mu,
224  bool is_steady ) const
225  {
226  return this->compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
227  }
228 
229  inline void
232  unsigned int qp,
233  libMesh::RealGradient& g,
234  libMesh::RealTensor& G,
235  libMesh::Real rho,
236  libMesh::Gradient U,
237  libMesh::Real mu,
238  libMesh::Real& tau_M,
239  libMesh::Real &d_tau_M_d_rho,
240  libMesh::Gradient &d_tau_M_d_U,
241  bool is_steady ) const
242  {
243  this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
244  d_tau_M_d_rho, d_tau_M_d_U,
245  is_steady );
246  }
247 
248 
249  inline
251  unsigned int /*qp*/,
252  libMesh::Real mat_prop_sq,
253  libMesh::RealGradient& /*g*/,
254  libMesh::RealTensor& G,
255  libMesh::Real rho,
256  libMesh::Gradient U,
257  bool is_steady ) const
258  {
259  libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->_C*mat_prop_sq*G.contract(G);
260 
261  if(!is_steady)
262  tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
263 
264  return this->_tau_factor/std::sqrt(tau);
265  }
266 
267  inline
268  void
271  unsigned int /*qp*/,
272  libMesh::Real mat_prop_sq,
273  libMesh::RealGradient& /*g*/, // constant
274  libMesh::RealTensor& G, // constant
275  libMesh::Real rho,
276  libMesh::Gradient U,
277  libMesh::Real& tau,
278  libMesh::Real& d_tau_d_rho,
279  libMesh::Gradient& d_tau_d_U,
280  bool is_steady ) const
281  {
282  libMesh::Gradient rhoU = rho*U;
283  libMesh::Gradient GrhoU = G*rhoU;
284  libMesh::Real rhoUGrhoU = rhoU * GrhoU;
285  libMesh::Real GG = G.contract(G);
286  tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
287  d_tau_d_rho = rhoUGrhoU*2/rho;
288  d_tau_d_U = 2*rho*GrhoU;
289 
290  if(!is_steady)
291  {
292  libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
293  tau += two_rho_over_dt * two_rho_over_dt;
294  d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
295  }
296 
297  // But what we've computed so far isn't tau; we need
298  // tau = _tau_factor/ sqrt(our_tau)
299 
300  libMesh::Real root_oldtau = std::sqrt(tau);
301  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
302 
303  d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
304  d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
305 
306  tau = this->_tau_factor / root_oldtau;
307  }
308 
309 }
310 #endif // GRINS_INC_NAVIER_STOKES_STAB_HELPER_H
libMesh::RealGradient div_divU_I(libMesh::RealTensor &hess_u, libMesh::RealTensor &hess_v) const
void compute_tau_momentum_and_derivs(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real T, libMesh::Real &tau_M, libMesh::Real &d_tau_M_d_rho, libMesh::Gradient &d_tau_M_d_U, bool is_steady) const
libMesh::RealGradient div_divU_I_axi(libMesh::Real r, const libMesh::Gradient &U, const libMesh::Gradient &grad_u, const libMesh::RealTensor &hess_u, const libMesh::RealTensor &hess_v) const
libMesh::Real compute_tau_continuity(libMesh::Real tau_C, libMesh::RealGradient &g) const
libMesh::RealGradient compute_res_momentum_steady(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real mu) const
libMesh::RealGradient compute_res_momentum_transient(AssemblyContext &context, unsigned int qp, const libMesh::Real rho) const
void compute_tau_and_derivs(AssemblyContext &c, unsigned int qp, libMesh::Real mat_prop_sq, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real &tau, libMesh::Real &d_tau_d_rho, libMesh::Gradient &d_tau_d_U, bool is_steady) const
libMesh::RealGradient div_GradU(libMesh::RealTensor &hess_u, libMesh::RealTensor &hess_v) const
libMesh::RealGradient div_GradU_axi(libMesh::Real r, const libMesh::Gradient &U, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::RealTensor &hess_u, const libMesh::RealTensor &hess_v) const
GRINS namespace.
void compute_tau_continuity_and_derivs(libMesh::Real tau_M, libMesh::Real d_tau_M_d_rho, libMesh::Gradient d_tau_M_d_U, libMesh::RealGradient &g, libMesh::Real &tau_C, libMesh::Real &d_tau_C_d_rho, libMesh::Gradient &d_tau_C_d_U) const
libMesh::RealGradient UdotGradU(libMesh::Gradient &U, libMesh::Gradient &grad_u, libMesh::Gradient &grad_v) const
libMesh::RealGradient div_GradU_T(libMesh::RealTensor &hess_u, libMesh::RealTensor &hess_v) const
void compute_res_momentum_steady_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real mu, libMesh::Gradient &res_M, libMesh::Tensor &d_res_M_dgradp, libMesh::Tensor &d_res_M_dU, libMesh::Gradient &d_res_Muvw_dgraduvw, libMesh::Tensor &d_res_Muvw_dhessuvw) const
void compute_res_momentum_transient_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, libMesh::RealGradient &res_M, libMesh::Real &d_res_Muvw_duvw) const
libMesh::Real compute_tau_momentum(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real mu, bool is_steady) const
void compute_res_continuity_and_derivs(AssemblyContext &context, unsigned int qp, libMesh::Real &res_C, libMesh::Tensor &d_res_C_dgradU) const
libMesh::RealGradient div_GradU_T_axi(libMesh::Real r, const libMesh::Gradient &U, const libMesh::Gradient &grad_u, const libMesh::RealTensor &hess_u, const libMesh::RealTensor &hess_v) const
IncompressibleNavierStokesStabilizationHelper(const std::string &helper_name, const GetPot &input)
libMesh::Real compute_tau(AssemblyContext &c, unsigned int qp, libMesh::Real mat_prop_sq, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, bool is_steady) const
libMesh::Real compute_res_continuity(AssemblyContext &context, unsigned int qp) const

Generated on Thu Jun 2 2016 21:52:27 for GRINS-0.7.0 by  doxygen 1.8.10