GRINS-0.8.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-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 #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 VelocityVariable;
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 ) const;
144 
146  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
147  libMesh::Gradient& grad_v ) const;
148 
150  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
151  libMesh::Gradient& grad_v, libMesh::Gradient& grad_w ) const;
152 
154  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u ) const;
155 
156  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
157 
158  libMesh::RealGradient div_GradU_axi( libMesh::Real r, const libMesh::Gradient& U,
159  const libMesh::Gradient& grad_u, const libMesh::Gradient& grad_v,
160  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
161 
163  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
164  libMesh::RealTensor& hess_w ) const;
165 
167  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u ) const;
168 
169  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
170 
171  libMesh::RealGradient div_GradU_T_axi( libMesh::Real r, const libMesh::Gradient& U, const libMesh::Gradient& grad_u,
172  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
173 
175  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
176  libMesh::RealTensor& hess_w ) const;
177 
179  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u ) const;
180 
181  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
182 
183  libMesh::RealGradient div_divU_I_axi( libMesh::Real r, const libMesh::Gradient& U, const libMesh::Gradient& grad_u,
184  const libMesh::RealTensor& hess_u, const libMesh::RealTensor& hess_v ) const;
185 
187  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
188  libMesh::RealTensor& hess_w ) const;
189 
190  protected:
191 
192  libMesh::Real _C, _tau_factor;
193 
196 
197  }; // class IncompressibleNavierStokesStabilizationHelper
198 
199  /* ------------- Inline Functions ---------------*/
200 
201  inline
203  libMesh::RealGradient& g ) const
204  {
205  return this->_tau_factor/(tau_M*(g*g));
206  }
207 
208  inline
210  ( libMesh::Real tau_M,
211  libMesh::Real d_tau_M_d_rho,
212  libMesh::Gradient d_tau_M_d_U,
213  libMesh::RealGradient& g,
214  libMesh::Real &tau_C,
215  libMesh::Real &d_tau_C_d_rho,
216  libMesh::Gradient &d_tau_C_d_U
217  ) const
218  {
219  tau_C = this->_tau_factor/(tau_M*(g*g));
220  libMesh::Real d_tau_C_d_tau_M = -tau_C/tau_M;
221  d_tau_C_d_rho = d_tau_C_d_tau_M * d_tau_M_d_rho;
222  d_tau_C_d_U = d_tau_C_d_tau_M * d_tau_M_d_U;
223  }
224 
225  inline
227  unsigned int qp,
228  libMesh::RealGradient& g,
229  libMesh::RealTensor& G,
230  libMesh::Real rho,
231  libMesh::Gradient U,
232  libMesh::Real mu,
233  bool is_steady ) const
234  {
235  return this->compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
236  }
237 
238  inline void
241  unsigned int qp,
242  libMesh::RealGradient& g,
243  libMesh::RealTensor& G,
244  libMesh::Real rho,
245  libMesh::Gradient U,
246  libMesh::Real mu,
247  libMesh::Real& tau_M,
248  libMesh::Real &d_tau_M_d_rho,
249  libMesh::Gradient &d_tau_M_d_U,
250  bool is_steady ) const
251  {
252  this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
253  d_tau_M_d_rho, d_tau_M_d_U,
254  is_steady );
255  }
256 
257 
258  inline
260  unsigned int /*qp*/,
261  libMesh::Real mat_prop_sq,
262  libMesh::RealGradient& /*g*/,
263  libMesh::RealTensor& G,
264  libMesh::Real rho,
265  libMesh::Gradient U,
266  bool is_steady ) const
267  {
268  libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->_C*mat_prop_sq*G.contract(G);
269 
270  if(!is_steady)
271  tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
272 
273  return this->_tau_factor/std::sqrt(tau);
274  }
275 
276  inline
277  void
280  unsigned int /*qp*/,
281  libMesh::Real mat_prop_sq,
282  libMesh::RealGradient& /*g*/, // constant
283  libMesh::RealTensor& G, // constant
284  libMesh::Real rho,
285  libMesh::Gradient U,
286  libMesh::Real& tau,
287  libMesh::Real& d_tau_d_rho,
288  libMesh::Gradient& d_tau_d_U,
289  bool is_steady ) const
290  {
291  libMesh::Gradient rhoU = rho*U;
292  libMesh::Gradient GrhoU = G*rhoU;
293  libMesh::Real rhoUGrhoU = rhoU * GrhoU;
294  libMesh::Real GG = G.contract(G);
295  tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
296  d_tau_d_rho = rhoUGrhoU*2/rho;
297  d_tau_d_U = 2*rho*GrhoU;
298 
299  if(!is_steady)
300  {
301  libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
302  tau += two_rho_over_dt * two_rho_over_dt;
303  d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
304  }
305 
306  // But what we've computed so far isn't tau; we need
307  // tau = _tau_factor/ sqrt(our_tau)
308 
309  libMesh::Real root_oldtau = std::sqrt(tau);
310  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
311 
312  d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
313  d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
314 
315  tau = this->_tau_factor / root_oldtau;
316  }
317 
318 }
319 #endif // GRINS_INC_NAVIER_STOKES_STAB_HELPER_H
libMesh::RealGradient div_GradU_T(libMesh::RealTensor &hess_u) 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 UdotGradU(libMesh::Gradient &U, libMesh::Gradient &grad_u) 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_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 div_GradU(libMesh::RealTensor &hess_u) 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_divU_I(libMesh::RealTensor &hess_u) 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 Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1