1 #ifndef __CS_FACE_VISCOSITY_H__ 2 #define __CS_FACE_VISCOSITY_H__ 3 4 /*============================================================================ 5 * Face viscosity 6 *============================================================================*/ 7 8 /* 9 This file is part of Code_Saturne, a general-purpose CFD tool. 10 11 Copyright (C) 1998-2021 EDF S.A. 12 13 This program is free software; you can redistribute it and/or modify it under 14 the terms of the GNU General Public License as published by the Free Software 15 Foundation; either version 2 of the License, or (at your option) any later 16 version. 17 18 This program is distributed in the hope that it will be useful, but WITHOUT 19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 21 details. 22 23 You should have received a copy of the GNU General Public License along with 24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 25 Street, Fifth Floor, Boston, MA 02110-1301, USA. 26 */ 27 28 /*----------------------------------------------------------------------------*/ 29 30 /*---------------------------------------------------------------------------- 31 * Local headers 32 *----------------------------------------------------------------------------*/ 33 34 #include "cs_base.h" 35 #include "cs_halo.h" 36 #include "cs_mesh.h" 37 #include "cs_mesh_quantities.h" 38 39 /*----------------------------------------------------------------------------*/ 40 41 BEGIN_C_DECLS 42 43 /*============================================================================= 44 * Local Macro definitions 45 *============================================================================*/ 46 47 /*============================================================================ 48 * Type definition 49 *============================================================================*/ 50 51 /*============================================================================ 52 * Global variables 53 *============================================================================*/ 54 55 /*============================================================================ 56 * Public function prototypes for Fortran API 57 *============================================================================*/ 58 59 /*---------------------------------------------------------------------------- 60 * Wrapper to cs_face_viscosity 61 *----------------------------------------------------------------------------*/ 62 63 void CS_PROCF (viscfa, VISCFA) 64 ( 65 const int *const visc_mean_type, 66 cs_real_t c_visc[], 67 cs_real_t i_visc[], 68 cs_real_t b_visc[] 69 ); 70 71 /*---------------------------------------------------------------------------- 72 * Wrapper to cs_face_anisotropic_viscosity_vector 73 *----------------------------------------------------------------------------*/ 74 75 void CS_PROCF (vistnv, VISTNV) 76 ( 77 const int *const visc_mean_type, 78 cs_real_6_t c_visc[], 79 cs_real_33_t i_visc[], 80 cs_real_t b_visc[] 81 ); 82 83 /*---------------------------------------------------------------------------- 84 * Wrapper to cs_face_anisotropic_viscosity_scalar 85 *----------------------------------------------------------------------------*/ 86 87 void CS_PROCF (vitens, VITENS) 88 ( 89 cs_real_6_t c_visc[], 90 const int *const iwarnp, 91 cs_real_2_t weighf[], 92 cs_real_t weighb[], 93 cs_real_t i_visc[], 94 cs_real_t b_visc[] 95 ); 96 97 /*============================================================================ 98 * Public function prototypes 99 *============================================================================*/ 100 101 /*----------------------------------------------------------------------------*/ 102 /*! 103 * \brief Compute the diffusion velocity at faces. 104 * i_visc,b_visc = viscosity*surface/distance, homogeneous to a rate of flow 105 * in kg/s. 106 * 107 * Remark: a priori, no need of reconstruction techniques 108 * (to improve if necessary). 109 * 110 * \param[in] m pointer to mesh 111 * \param[in] fvq pointer to finite volume quantities 112 * \param[in] visc_mean_type method to compute the viscosity at faces: 113 * - 0 arithmetical 114 * - 1 harmonic 115 * \param[in] c_visc cell viscosity (scalar) 116 * \param[out] i_visc inner face viscosity 117 * (times surface divided by distance) 118 * \param[out] b_visc boundary face viscosity 119 * (surface, must be consistent with flux BCs) 120 */ 121 /*----------------------------------------------------------------------------*/ 122 123 void 124 cs_face_viscosity(const cs_mesh_t *m, 125 const cs_mesh_quantities_t *fvq, 126 const int visc_mean_type, 127 cs_real_t *restrict c_visc, 128 cs_real_t *restrict i_visc, 129 cs_real_t *restrict b_visc); 130 131 /*----------------------------------------------------------------------------*/ 132 /*! 133 * \brief Compute the equivalent tensor viscosity at faces for a 3x3 symetric 134 * tensor. 135 * 136 * \param[in] m pointer to mesh 137 * \param[in] fvq pointer to finite volume quantities 138 * \param[in] visc_mean_type method to compute the viscosity at faces: 139 * - 0: arithmetic 140 * - 1: harmonic 141 * \param[in] c_visc cell viscosity symmetric tensor 142 * \param[out] i_visc inner face tensor viscosity 143 * (times surface divided by distance) 144 * \param[out] b_visc boundary face viscosity 145 * (surface, must be consistent with flux BCs) 146 */ 147 /*----------------------------------------------------------------------------*/ 148 149 void 150 cs_face_anisotropic_viscosity_vector(const cs_mesh_t *m, 151 const cs_mesh_quantities_t *fvq, 152 const int visc_mean_type, 153 cs_real_6_t *restrict c_visc, 154 cs_real_33_t *restrict i_visc, 155 cs_real_t *restrict b_visc); 156 157 /*----------------------------------------------------------------------------*/ 158 /*! 159 * \brief Compute the equivalent viscosity at faces for a 3x3 symetric tensor, 160 * always using a harmonic mean. 161 * 162 * \param[in] m pointer to mesh 163 * \param[in] fvq pointer to finite volume quantities 164 * \param[in] c_visc cell viscosity symmetric tensor 165 * \param[in] iwarnp verbosity 166 * \param[out] weighf inner face weight between cells i and j 167 * \f$ \frac{\vect{IF} \cdot \tens{K}_\celli} 168 * {\norm{\tens{K}_\celli \cdot \vect{S}}^2} \f$ 169 * and 170 * \f$ \frac{\vect{FJ} \cdot \tens{K}_\cellj} 171 * {\norm{\tens{K}_\cellj \cdot \vect{S}}^2} \f$ 172 * \param[out] weighb boundary face weight 173 * \f$ \frac{\vect{IF} \cdot \tens{K}_\celli} 174 * {\norm{\tens{K}_\celli \cdot \vect{S}}^2} \f$ 175 * \param[out] i_visc inner face viscosity 176 * (times surface divided by distance) 177 * \param[out] b_visc boundary face viscosity 178 * (surface, must be consistent with flux BCs) 179 */ 180 /*----------------------------------------------------------------------------*/ 181 182 void 183 cs_face_anisotropic_viscosity_scalar(const cs_mesh_t *m, 184 const cs_mesh_quantities_t *fvq, 185 cs_real_6_t *restrict c_visc, 186 const int iwarnp, 187 cs_real_2_t *restrict weighf, 188 cs_real_t *restrict weighb, 189 cs_real_t *restrict i_visc, 190 cs_real_t *restrict b_visc); 191 192 /*----------------------------------------------------------------------------*/ 193 194 END_C_DECLS 195 196 #endif /* __CS_FACE_VISCOSITY_H__ */ 197