GRINS-0.8.0
heat_transfer_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_HEAT_TRANSFER_STAB_HELPER_H
26 #define GRINS_HEAT_TRANSFER_STAB_HELPER_H
27 
28 //GRINS
29 #include "grins/stab_helper.h"
30 #include "grins/assembly_context.h"
31 
32 // libMesh forward declarations
33 class GetPot;
34 
35 namespace GRINS
36 {
37  // Forward declarations
38  class PrimitiveTempFEVariables;
39  class VelocityVariable;
40  class PressureFEVariable;
41 
43  {
44  public:
45 
46  HeatTransferStabilizationHelper( const std::string & helper_name,
47  const GetPot& input );
48 
50 
51  libMesh::Real compute_res_energy_steady( AssemblyContext& context,
52  unsigned int qp,
53  const libMesh::Real rho,
54  const libMesh::Real Cp,
55  const libMesh::Real k ) const;
56 
57 
59  unsigned int qp,
60  const libMesh::Real rho,
61  const libMesh::Real Cp,
62  const libMesh::Real k,
63  libMesh::Real &res,
64  libMesh::Real &d_res_dT,
65  libMesh::Gradient &d_res_dgradT,
66  libMesh::Tensor &d_res_dhessT,
67  libMesh::Gradient &d_res_dU
68  ) const;
69 
70  libMesh::Real compute_res_energy_transient( AssemblyContext& context,
71  unsigned int qp,
72  const libMesh::Real rho,
73  const libMesh::Real Cp
74  ) const;
75 
76 
78  unsigned int qp,
79  const libMesh::Real rho,
80  const libMesh::Real Cp,
81  libMesh::Real &res,
82  libMesh::Real &d_res_dTdot
83  ) const;
84 
85  libMesh::Real compute_tau_energy( AssemblyContext& c,
86  libMesh::RealTensor& G,
87  libMesh::Real rho,
88  libMesh::Real cp,
89  libMesh::Real k,
90  libMesh::Gradient U,
91  bool is_steady ) const;
92 
94  libMesh::RealTensor& G,
95  libMesh::Real rho,
96  libMesh::Real cp,
97  libMesh::Real k,
98  libMesh::Gradient U,
99  libMesh::Real &tau_E,
100  libMesh::Real &d_tau_E_d_rho,
101  libMesh::Gradient &d_tau_E_d_U,
102  bool is_steady ) const;
103 
104  protected:
105 
106  libMesh::Real _C, _tau_factor;
107 
109 
112 
113  }; // class HeatTransferStabilizationHelper
114 
115  /* ------------- Inline Functions ---------------*/
116  inline
118  libMesh::RealTensor& G,
119  libMesh::Real rho,
120  libMesh::Real cp,
121  libMesh::Real k,
122  libMesh::Gradient U,
123  bool is_steady ) const
124  {
125  libMesh::Real tau = (rho*cp*U)*(G*(rho*cp*U)) + this->_C*k*k*G.contract(G);
126 
127  if(!is_steady)
128  tau += (2.0*rho*cp/c.get_deltat_value())*(2.0*rho*cp/c.get_deltat_value());
129 
130  return this->_tau_factor/std::sqrt(tau);
131  }
132 
133 
134  inline
137  libMesh::RealTensor& G,
138  libMesh::Real rho,
139  libMesh::Real cp,
140  libMesh::Real k,
141  libMesh::Gradient U,
142  libMesh::Real &tau_E,
143  libMesh::Real &d_tau_E_d_rho,
144  libMesh::Gradient &d_tau_E_d_U,
145  bool is_steady ) const
146  {
147  libMesh::Gradient rhocpU = rho*cp*U;
148  libMesh::Gradient GrhocpU = G*rhocpU;
149  libMesh::Real rhocpUGrhocpU = rhocpU * GrhocpU;
150  libMesh::Real GG = G.contract(G);
151  tau_E = (rhocpU)*(GrhocpU) + this->_C*k*k*GG;
152  d_tau_E_d_rho = rhocpUGrhocpU*2/rho/cp;
153  d_tau_E_d_U = 2*rho*cp*GrhocpU;
154 
155  if(!is_steady)
156  {
157  libMesh::Real two_rhocp_over_dt = 2*rho*cp/c.get_deltat_value();
158  tau_E += two_rhocp_over_dt * two_rhocp_over_dt;
159  d_tau_E_d_rho += 4*two_rhocp_over_dt/c.get_deltat_value();
160  }
161 
162  // But what we've computed so far isn't tau; we need
163  // tau = _tau_factor/ sqrt(our_tau)
164 
165  libMesh::Real root_oldtau = std::sqrt(tau_E);
166  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau_E*root_oldtau) / 2;
167 
168  d_tau_E_d_rho = d_tau_d_oldtau * d_tau_E_d_rho;
169  d_tau_E_d_U = d_tau_d_oldtau * d_tau_E_d_U;
170 
171  tau_E = this->_tau_factor / root_oldtau;
172  }
173 
174 }
175 #endif // GRINS_HEAT_TRANSFER_STAB_HELPER_H
libMesh::Real compute_res_energy_transient(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp) const
void compute_res_energy_transient_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, libMesh::Real &res, libMesh::Real &d_res_dTdot) const
void compute_res_energy_steady_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, const libMesh::Real k, libMesh::Real &res, libMesh::Real &d_res_dT, libMesh::Gradient &d_res_dgradT, libMesh::Tensor &d_res_dhessT, libMesh::Gradient &d_res_dU) const
void compute_tau_energy_and_derivs(AssemblyContext &c, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Real cp, libMesh::Real k, libMesh::Gradient U, libMesh::Real &tau_E, libMesh::Real &d_tau_E_d_rho, libMesh::Gradient &d_tau_E_d_U, bool is_steady) const
const PrimitiveTempFEVariables & _temp_vars
GRINS namespace.
libMesh::Real compute_tau_energy(AssemblyContext &c, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Real cp, libMesh::Real k, libMesh::Gradient U, bool is_steady) const
libMesh::Real compute_res_energy_steady(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, const libMesh::Real k) const
HeatTransferStabilizationHelper(const std::string &helper_name, const GetPot &input)

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