My Project
programmer's documentation
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-2019 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,
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. cs_gradient_perio_init_rij).
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  * Public function prototypes
109  *============================================================================*/
110 
111 /*----------------------------------------------------------------------------
112  * Initialize gradient computation API.
113  *----------------------------------------------------------------------------*/
114 
115 void
117 
118 /*----------------------------------------------------------------------------
119  * Finalize gradient computation API.
120  *----------------------------------------------------------------------------*/
121 
122 void
124 
125 /*----------------------------------------------------------------------------
126  * Update gradient rotational periodicity computation API in case of
127  * mesh modification.
128  *----------------------------------------------------------------------------*/
129 
130 void
132 
133 /*----------------------------------------------------------------------------
134  * Initialize ghost cell values for Reynolds stress tensor gradient.
135  *
136  * We retrieve the gradient given by perinr (phyvar) for the Reynolds
137  * stress tensor in a buffer on ghost cells. then we define
138  * dpdx, dpdy and dpdz gradient (1 -> n_cells_with_ghosts).
139  *
140  * We can't implicitly take into account rotation of a gradient of a tensor
141  * variable because we have to know all components.
142  *
143  * We set idimtr to 2 for the Reynolds stress tensor.
144  *
145  * We assume that is correct to treat periodicities implicitly for the other
146  * variables when reconstructing gradients.
147  *
148  * parameters:
149  * f <-- pointer to field
150  * tr_dim --> 2 for tensor (Rij) in case of rotation, 0 otherwise
151  * grad <-> gradient of field
152  *----------------------------------------------------------------------------*/
153 
154 void
156  int *tr_dim,
157  cs_real_3_t grad[]);
158 
159 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
180 void
182  cs_real_63_t grad[]);
183 
184 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
208  cs_real_3_t grad[]);
209 
210 /*----------------------------------------------------------------------------*/
211 
213 
214 #endif /* __CS_GRADIENT_PERIO__ */
f_id
void const int * f_id
Definition: cs_gui.h:292
rom
void cs_real_t rom[]
Definition: cs_gradient_perio.h:83
cs_real_3_t
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:315
cs_gradient_perio_finalize
void cs_gradient_perio_finalize(void)
Finalize gradient rotational periodicity computation API.
Definition: cs_gradient_perio.c:434
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
grad
void const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_real_t *const const cs_real_t *const const cs_real_t *const cs_real_3_t const cs_real_t const cs_real_t cs_real_t cs_real_t cs_real_3_t grad[]
Definition: cs_gradient.h:93
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_gradient_perio_init_rij
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:477
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_gradient_perio_init_rij_tensor
void cs_gradient_perio_init_rij_tensor(int *tr_dim, cs_real_63_t grad[])
Initialize ghost cell values for Reynolds stress tensor gradient.
Definition: cs_gradient_perio.c:592
cs_gradient_perio_update_mesh
void cs_gradient_perio_update_mesh(void)
Update gradient rotational periodicity computation API in case of mesh modification.
Definition: cs_gradient_perio.c:448
epsrgp
void const cs_int_t *const const cs_real_t *const epsrgp
Definition: cs_gradient_perio.h:101
imrgra
void const cs_int_t *const const cs_int_t *const const cs_int_t *const imrgra
Definition: cs_convection_diffusion.h:5386
cs_gradient_perio_process_rij
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:689
cs_field.h
cs_gradient_perio_initialize
void cs_gradient_perio_initialize(void)
Initialize gradient rotational periodicity computation API.
Definition: cs_gradient_perio.c:421
cs_int_t
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:301
extrap
void const cs_int_t *const const cs_real_t *const const cs_real_t *const extrap
Definition: cs_gradient_perio.h:101
iwarnp
void const cs_int_t *const iwarnp
Definition: cs_gradient_perio.h:101
cs_field_t
Field descriptor.
Definition: cs_field.h:124
cs_real_63_t
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:327
cs_base.h
CS_PROCF
void CS_PROCF(permas, PERMAS)(const cs_int_t *iappel