programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_gradient_perio.h
Go to the documentation of this file.
1 #ifndef __CS_GRADIENT_PERIO_H__
2 #define __CS_GRADIENT_PERIO_H__
3 
4 /*============================================================================
5  * Gradient reconstruction.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 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_field.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*=============================================================================
42  * Local Macro definitions
43  *============================================================================*/
44 
45 /*============================================================================
46  * Type definition
47  *============================================================================*/
48 
49 /*============================================================================
50  * Global variables
51  *============================================================================*/
52 
53 /*============================================================================
54  * Public function prototypes for Fortran API
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Periodicity management for INIMAS
59  *
60  * If INIMAS is called by NAVSTO :
61  * We assume that gradient on ghost cells given by a rotation is known
62  * and is equal to the velocity one for the previous time step.
63  * If INIMAS is called by DIVRIJ
64  * We assume that (more justifiable than in previous case) gradient on
65  * ghost cells given by rotation is equal to Rij gradient for the previous
66  * time step.
67  *
68  * Fortran Interface:
69  *
70  * subroutine permas
71  * *****************
72  *
73  * integer iappel : -> : indicateur d'appel dans inimas
74  * = 1 si appel au debut
75  * = 2 si appel a la fin
76  * double precision rom(ncelet) : -> : masse volumique aux cellules
77  *
78  * Size of DRDXYZ and WDRDXY = n_ghost_cells*6*3
79  *----------------------------------------------------------------------------*/
80 
81 void
82 CS_PROCF (permas, PERMAS)(const cs_int_t *iappel,
83  cs_real_t rom[]);
84 
85 /*----------------------------------------------------------------------------
86  * Preparation rotation periodicity for Reynolds stresses.
87  *
88  * Compute an estimation of the velocity gradient.
89  * The gradient is not reconstructed (as we would need a gradient,
90  * thus periodicity). I seems possible to use a least-squares gradient.
91  *
92  * The gradient is then saved in an array representing the ghost cells, then
93  * rotated where necessary to be ready for use (cf. pering).
94  *
95  * Compute cell gradient of vector field.
96  *----------------------------------------------------------------------------*/
97 
98 void CS_PROCF (perinr, PERINR)
99 (
100  const cs_int_t *const imrgra, /* <-- gradient computation mode */
101  const cs_int_t *const iwarnp, /* <-- verbosity level */
102  const cs_real_t *const epsrgp, /* <-- precision for iterative gradient
103  calculation */
104  const cs_real_t *const extrap /* <-- extrapolate gradient at boundary */
105 );
106 
107 /*----------------------------------------------------------------------------
108  * Process dpdx, dpdy, dpdz buffers in case of rotation on
109  * Reynolds stress tensor.
110  *
111  * We retrieve the gradient given by perinr (phyvar) for the Reynolds
112  * stress tensor in a buffer on ghost cells. then we define
113  * dpdx, dpdy and dpdz gradient (1 -> n_cells_with_ghosts).
114  *
115  * We can't implicitly take into account rotation of a gradient of a tensor
116  * variable because we have to know the all three components.
117  *
118  * We set idimtr to 2 for the Reynolds stress tensor.
119  *
120  * We assume that is correct to treat periodicities implicitly for the other
121  * variables when reconstructing gradients.
122  *
123  * Fortran Interface:
124  *
125  * subroutine pering
126  * *****************
127  *
128  * integer f_id : <-- : field_id
129  * integer tr_dim : --> : 2 for tensor (Rij) in case of
130  * rotation, 0 otherwise
131  * double precision dpdx(ncelet) : <-> : gradient of ivar
132  * double precision dpdy(ncelet) : <-> : " "
133  * double precision dpdz(ncelet) : <-> : " "
134  *
135  * size of _drdxyz and _wdrdxy = n_ghost_cells*6*3
136  *----------------------------------------------------------------------------*/
137 
138 void
139 CS_PROCF (pering, PERING)(const cs_int_t *f_id,
140  cs_int_t *tr_dim,
141  cs_real_t dpdx[],
142  cs_real_t dpdy[],
143  cs_real_t dpdz[]);
144 
145 /*=============================================================================
146  * Public function prototypes
147  *============================================================================*/
148 
149 /*----------------------------------------------------------------------------
150  * Initialize gradient computation API.
151  *----------------------------------------------------------------------------*/
152 
153 void
155 
156 /*----------------------------------------------------------------------------
157  * Finalize gradient computation API.
158  *----------------------------------------------------------------------------*/
159 
160 void
162 
163 /*----------------------------------------------------------------------------
164  * Update gradient rotational periodicity computation API in case of
165  * mesh modification.
166  *----------------------------------------------------------------------------*/
167 
168 void
170 
171 /*----------------------------------------------------------------------------
172  * Initialize ghost cell values for Reynolds stress tensor gradient.
173  *
174  * We retrieve the gradient given by perinr (phyvar) for the Reynolds
175  * stress tensor in a buffer on ghost cells. then we define
176  * dpdx, dpdy and dpdz gradient (1 -> n_cells_with_ghosts).
177  *
178  * We can't implicitly take into account rotation of a gradient of a tensor
179  * variable because we have to know all components.
180  *
181  * We set idimtr to 2 for the Reynolds stress tensor.
182  *
183  * We assume that is correct to treat periodicities implicitly for the other
184  * variables when reconstructing gradients.
185  *
186  * parameters:
187  * f <-- pointer to field
188  * tr_dim --> 2 for tensor (Rij) in case of rotation, 0 otherwise
189  * grad <-> gradient of field
190  *----------------------------------------------------------------------------*/
191 
192 void
194  int *tr_dim,
195  cs_real_3_t grad[]);
196 
197 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 void
221  cs_real_3_t grad[]);
222 
223 /*----------------------------------------------------------------------------*/
224 
226 
227 #endif /* __CS_GRADIENT_PERIO__ */
Field descriptor.
Definition: cs_field.h:98
void cs_gradient_perio_finalize(void)
Finalize gradient rotational periodicity computation API.
Definition: cs_gradient_perio.c:554
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void permas(const cs_int_t *iappel, cs_real_t rom[])
Definition: cs_gradient_perio.c:246
void cs_gradient_perio_update_mesh(void)
Update gradient rotational periodicity computation API in case of mesh modification.
Definition: cs_gradient_perio.c:568
void cs_gradient_perio_init_rij(const cs_field_t *f, int *tr_dim, cs_real_3_t grad[])
Initialize ghost cell values for Reynolds stress tensor gradient.
Definition: cs_gradient_perio.c:597
void cs_gradient_perio_process_rij(const cs_int_t *f_id, cs_real_3_t grad[])
Process grad buffers in case of rotation on Reynolds stress tensor.
Definition: cs_gradient_perio.c:712
void pering(const cs_int_t *f_id, cs_int_t *tr_dim, cs_real_t dpdx[], cs_real_t dpdy[], cs_real_t dpdz[])
Definition: cs_gradient_perio.c:434
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:307
#define END_C_DECLS
Definition: cs_defs.h:406
double cs_real_t
Definition: cs_defs.h:296
void cs_gradient_perio_initialize(void)
Initialize gradient rotational periodicity computation API.
Definition: cs_gradient_perio.c:541
void perinr(const cs_int_t *const imrgra, const cs_int_t *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const extrap)
Definition: cs_gradient_perio.c:320
#define CS_PROCF(x, y)
Definition: cs_defs.h:419