GRINS-0.6.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-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_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"
33 
34 // libMesh forward declarations
35 class GetPot;
36 
37 namespace GRINS
38 {
40  {
41  public:
42 
43  HeatTransferStabilizationHelper( const std::string & helper_name,
44  const GetPot& input );
45 
47 
48  void init( libMesh::FEMSystem& system );
49 
50  libMesh::Real compute_res_energy_steady( AssemblyContext& context,
51  unsigned int qp,
52  const libMesh::Real rho,
53  const libMesh::Real Cp,
54  const libMesh::Real k ) const;
55 
56 
58  unsigned int qp,
59  const libMesh::Real rho,
60  const libMesh::Real Cp,
61  const libMesh::Real k,
62  libMesh::Real &res,
63  libMesh::Real &d_res_dT,
64  libMesh::Gradient &d_res_dgradT,
65  libMesh::Tensor &d_res_dhessT,
66  libMesh::Gradient &d_res_dU
67  ) const;
68 
69  libMesh::Real compute_res_energy_transient( AssemblyContext& context,
70  unsigned int qp,
71  const libMesh::Real rho,
72  const libMesh::Real Cp
73  ) const;
74 
75 
77  unsigned int qp,
78  const libMesh::Real rho,
79  const libMesh::Real Cp,
80  libMesh::Real &res,
81  libMesh::Real &d_res_dTdot
82  ) const;
83 
84  libMesh::Real compute_tau_energy( AssemblyContext& c,
85  libMesh::RealTensor& G,
86  libMesh::Real rho,
87  libMesh::Real cp,
88  libMesh::Real k,
89  libMesh::Gradient U,
90  bool is_steady ) const;
91 
93  libMesh::RealTensor& G,
94  libMesh::Real rho,
95  libMesh::Real cp,
96  libMesh::Real k,
97  libMesh::Gradient U,
98  libMesh::Real &tau_E,
99  libMesh::Real &d_tau_E_d_rho,
100  libMesh::Gradient &d_tau_E_d_U,
101  bool is_steady ) const;
102 
103  protected:
104 
105  libMesh::Real _C, _tau_factor;
106 
108 
110 
111  }; // class HeatTransferStabilizationHelper
112 
113  /* ------------- Inline Functions ---------------*/
114  inline
116  libMesh::RealTensor& G,
117  libMesh::Real rho,
118  libMesh::Real cp,
119  libMesh::Real k,
120  libMesh::Gradient U,
121  bool is_steady ) const
122  {
123  libMesh::Real tau = (rho*cp*U)*(G*(rho*cp*U)) + this->_C*k*k*G.contract(G);
124 
125  if(!is_steady)
126  tau += (2.0*rho*cp/c.get_deltat_value())*(2.0*rho*cp/c.get_deltat_value());
127 
128  return this->_tau_factor/std::sqrt(tau);
129  }
130 
131 
132  inline
135  libMesh::RealTensor& G,
136  libMesh::Real rho,
137  libMesh::Real cp,
138  libMesh::Real k,
139  libMesh::Gradient U,
140  libMesh::Real &tau_E,
141  libMesh::Real &d_tau_E_d_rho,
142  libMesh::Gradient &d_tau_E_d_U,
143  bool is_steady ) const
144  {
145  libMesh::Gradient rhocpU = rho*cp*U;
146  libMesh::Gradient GrhocpU = G*rhocpU;
147  libMesh::Real rhocpUGrhocpU = rhocpU * GrhocpU;
148  libMesh::Real GG = G.contract(G);
149  tau_E = (rhocpU)*(GrhocpU) + this->_C*k*k*GG;
150  d_tau_E_d_rho = rhocpUGrhocpU*2/rho/cp;
151  d_tau_E_d_U = 2*rho*cp*GrhocpU;
152 
153  if(!is_steady)
154  {
155  libMesh::Real two_rhocp_over_dt = 2*rho*cp/c.get_deltat_value();
156  tau_E += two_rhocp_over_dt * two_rhocp_over_dt;
157  d_tau_E_d_rho += 4*two_rhocp_over_dt/c.get_deltat_value();
158  }
159 
160  // But what we've computed so far isn't tau; we need
161  // tau = _tau_factor/ sqrt(our_tau)
162 
163  libMesh::Real root_oldtau = std::sqrt(tau_E);
164  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau_E*root_oldtau) / 2;
165 
166  d_tau_E_d_rho = d_tau_d_oldtau * d_tau_E_d_rho;
167  d_tau_E_d_U = d_tau_d_oldtau * d_tau_E_d_U;
168 
169  tau_E = this->_tau_factor / root_oldtau;
170  }
171 
172 }
173 #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
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 Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1