GRINS-0.6.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-2015 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"
32 
33 // libMesh foward declarations
34 class GetPot;
35 
36 namespace GRINS
37 {
39  {
40  public:
41 
43  ( const std::string & helper_name,
44  const GetPot& input );
45 
47 
48  void init( libMesh::FEMSystem& system );
49 
50  libMesh::Real compute_tau_continuity( libMesh::Real tau_C,
51  libMesh::RealGradient& g ) const;
52 
53  void compute_tau_continuity_and_derivs( libMesh::Real tau_M,
54  libMesh::Real d_tau_M_d_rho,
55  libMesh::Gradient d_tau_M_d_U,
56  libMesh::RealGradient& g,
57  libMesh::Real &tau_C,
58  libMesh::Real &d_tau_C_d_rho,
59  libMesh::Gradient &d_tau_C_d_U
60  ) const;
61 
62  libMesh::Real compute_tau_momentum( AssemblyContext& c,
63  unsigned int qp,
64  libMesh::RealGradient& g,
65  libMesh::RealTensor& G,
66  libMesh::Real rho,
67  libMesh::Gradient U,
68  libMesh::Real mu,
69  bool is_steady ) const;
70 
72  unsigned int qp,
73  libMesh::RealGradient& g,
74  libMesh::RealTensor& G,
75  libMesh::Real rho,
76  libMesh::Gradient U,
77  libMesh::Real T,
78  libMesh::Real &tau_M,
79  libMesh::Real &d_tau_M_d_rho,
80  libMesh::Gradient &d_tau_M_d_U,
81  bool is_steady ) const;
82 
83  libMesh::Real compute_tau( AssemblyContext& c,
84  unsigned int qp,
85  libMesh::Real mat_prop_sq,
86  libMesh::RealGradient& g,
87  libMesh::RealTensor& G,
88  libMesh::Real rho,
89  libMesh::Gradient U,
90  bool is_steady ) const;
91 
93  unsigned int qp,
94  libMesh::Real mat_prop_sq,
95  libMesh::RealGradient& g,
96  libMesh::RealTensor& G,
97  libMesh::Real rho,
98  libMesh::Gradient U,
99  libMesh::Real& tau,
100  libMesh::Real& d_tau_d_rho,
101  libMesh::Gradient& d_tau_d_U,
102  bool is_steady ) const;
103 
104 
105 
106  libMesh::Real compute_res_continuity( AssemblyContext& context,
107  unsigned int qp ) const;
108 
110  unsigned int qp,
111  libMesh::Real &res_C,
112  libMesh::Tensor &d_res_C_dgradU ) const;
113 
114  libMesh::RealGradient compute_res_momentum_steady( AssemblyContext& context,
115  unsigned int qp,
116  const libMesh::Real rho,
117  const libMesh::Real mu ) const;
118 
120  unsigned int qp,
121  const libMesh::Real rho,
122  const libMesh::Real mu,
123  libMesh::Gradient &res_M,
124  libMesh::Tensor &d_res_M_dgradp,
125  libMesh::Tensor &d_res_M_dU,
126  libMesh::Gradient &d_res_Muvw_dgraduvw,
127  libMesh::Tensor &d_res_Muvw_dhessuvw
128  ) const;
129 
130  libMesh::RealGradient compute_res_momentum_transient( AssemblyContext& context,
131  unsigned int qp,
132  const libMesh::Real rho ) const;
133 
135  unsigned int qp,
136  const libMesh::Real rho,
137  libMesh::RealGradient &res_M,
138  libMesh::Real &d_res_Muvw_duvw
139  ) const;
140 
142  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
143  libMesh::Gradient& grad_v ) const;
144 
146  libMesh::RealGradient UdotGradU( libMesh::Gradient& U, libMesh::Gradient& grad_u,
147  libMesh::Gradient& grad_v, libMesh::Gradient& grad_w ) const;
148 
150  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
151 
153  libMesh::RealGradient div_GradU( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
154  libMesh::RealTensor& hess_w ) const;
155 
157  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
158 
160  libMesh::RealGradient div_GradU_T( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
161  libMesh::RealTensor& hess_w ) const;
162 
164  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v ) const;
165 
167  libMesh::RealGradient div_divU_I( libMesh::RealTensor& hess_u, libMesh::RealTensor& hess_v,
168  libMesh::RealTensor& hess_w ) const;
169 
170  protected:
171 
172  libMesh::Real _C, _tau_factor;
173 
175 
176  }; // class IncompressibleNavierStokesStabilizationHelper
177 
178  /* ------------- Inline Functions ---------------*/
179 
180  inline
182  libMesh::RealGradient& g ) const
183  {
184  return this->_tau_factor/(tau_M*(g*g));
185  }
186 
187  inline
189  ( libMesh::Real tau_M,
190  libMesh::Real d_tau_M_d_rho,
191  libMesh::Gradient d_tau_M_d_U,
192  libMesh::RealGradient& g,
193  libMesh::Real &tau_C,
194  libMesh::Real &d_tau_C_d_rho,
195  libMesh::Gradient &d_tau_C_d_U
196  ) const
197  {
198  tau_C = this->_tau_factor/(tau_M*(g*g));
199  libMesh::Real d_tau_C_d_tau_M = -tau_C/tau_M;
200  d_tau_C_d_rho = d_tau_C_d_tau_M * d_tau_M_d_rho;
201  d_tau_C_d_U = d_tau_C_d_tau_M * d_tau_M_d_U;
202  }
203 
204  inline
206  unsigned int qp,
207  libMesh::RealGradient& g,
208  libMesh::RealTensor& G,
209  libMesh::Real rho,
210  libMesh::Gradient U,
211  libMesh::Real mu,
212  bool is_steady ) const
213  {
214  return this->compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
215  }
216 
217  inline void
220  unsigned int qp,
221  libMesh::RealGradient& g,
222  libMesh::RealTensor& G,
223  libMesh::Real rho,
224  libMesh::Gradient U,
225  libMesh::Real mu,
226  libMesh::Real& tau_M,
227  libMesh::Real &d_tau_M_d_rho,
228  libMesh::Gradient &d_tau_M_d_U,
229  bool is_steady ) const
230  {
231  this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
232  d_tau_M_d_rho, d_tau_M_d_U,
233  is_steady );
234  }
235 
236 
237  inline
239  unsigned int /*qp*/,
240  libMesh::Real mat_prop_sq,
241  libMesh::RealGradient& /*g*/,
242  libMesh::RealTensor& G,
243  libMesh::Real rho,
244  libMesh::Gradient U,
245  bool is_steady ) const
246  {
247  libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->_C*mat_prop_sq*G.contract(G);
248 
249  if(!is_steady)
250  tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
251 
252  return this->_tau_factor/std::sqrt(tau);
253  }
254 
255  inline
256  void
259  unsigned int /*qp*/,
260  libMesh::Real mat_prop_sq,
261  libMesh::RealGradient& /*g*/, // constant
262  libMesh::RealTensor& G, // constant
263  libMesh::Real rho,
264  libMesh::Gradient U,
265  libMesh::Real& tau,
266  libMesh::Real& d_tau_d_rho,
267  libMesh::Gradient& d_tau_d_U,
268  bool is_steady ) const
269  {
270  libMesh::Gradient rhoU = rho*U;
271  libMesh::Gradient GrhoU = G*rhoU;
272  libMesh::Real rhoUGrhoU = rhoU * GrhoU;
273  libMesh::Real GG = G.contract(G);
274  tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
275  d_tau_d_rho = rhoUGrhoU*2/rho;
276  d_tau_d_U = 2*rho*GrhoU;
277 
278  if(!is_steady)
279  {
280  libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
281  tau += two_rho_over_dt * two_rho_over_dt;
282  d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
283  }
284 
285  // But what we've computed so far isn't tau; we need
286  // tau = _tau_factor/ sqrt(our_tau)
287 
288  libMesh::Real root_oldtau = std::sqrt(tau);
289  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
290 
291  d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
292  d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
293 
294  tau = this->_tau_factor / root_oldtau;
295  }
296 
297 }
298 #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::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
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
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 Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1