programmer's documentation
cs_reco.h
Go to the documentation of this file.
1 #ifndef __CS_RECO_H__
2 #define __CS_RECO_H__
3 
4 /*============================================================================
5  * Routines to handle the reconstruction of fields
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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_cdo_connect.h"
35 #include "cs_cdo_local.h"
36 #include "cs_cdo_quantities.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /*============================================================================
47  * Type definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Public function prototypes
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------*/
67 
68 void
70  const cs_cdo_quantities_t *quant,
71  const double *dof,
72  double *p_crec[],
73  double *p_frec[]);
74 
75 /*----------------------------------------------------------------------------*/
85 /*----------------------------------------------------------------------------*/
86 
87 void
89  const cs_cdo_quantities_t *quant,
90  const double *array,
91  cs_real_t *val_xc);
92 
93 /*----------------------------------------------------------------------------*/
104 /*----------------------------------------------------------------------------*/
105 
106 void
108  const cs_connect_index_t *c2v,
109  const cs_cdo_quantities_t *quant,
110  const double *array,
111  cs_real_t *val_xc);
112 
113 /*----------------------------------------------------------------------------*/
122 /*----------------------------------------------------------------------------*/
123 
124 static inline void
126  const double *p_v,
127  double *p_f)
128 {
129  *p_f = 0.;
130 
131  if (p_v == NULL)
132  return;
133 
134  const cs_quant_t pfq = fm->face;
135 
136  for (short int e = 0; e < fm->n_ef; e++)
137  *p_f += (p_v[fm->e2v_ids[2*e]] + p_v[fm->e2v_ids[2*e+1]]) * fm->tef[e];
138  *p_f *= 0.5 / pfq.meas;
139 }
140 
141 /*----------------------------------------------------------------------------*/
152 /*----------------------------------------------------------------------------*/
153 
154 void
156  const cs_cdo_connect_t *connect,
157  const cs_cdo_quantities_t *quant,
158  const double *pdi,
159  cs_real_t *pdi_f);
160 
161 /*----------------------------------------------------------------------------*/
173 /*----------------------------------------------------------------------------*/
174 
175 void
177  const cs_connect_index_t *c2e,
178  const cs_cdo_quantities_t *quant,
179  const double *array,
180  cs_real_3_t val_xc);
181 
182 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 void
198  const cs_real_t *array,
199  cs_real_3_t val_c);
200 
201 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
219  short int e,
220  const cs_real_t *array,
221  cs_real_3_t val_pec);
222 
223 /*----------------------------------------------------------------------------*/
236 /*----------------------------------------------------------------------------*/
237 
238 cs_real_t
240  const cs_real_t pdi[],
241  const cs_real_t length_xcxp,
242  const cs_real_t unitv_xcxp[],
243  cs_real_t wbuf[]);
244 
245 /*----------------------------------------------------------------------------*/
257 /*----------------------------------------------------------------------------*/
258 
259 void
261  cs_lnum_t e1_id,
262  const cs_connect_index_t *c2e,
263  const cs_cdo_quantities_t *quant,
264  const double *dof,
265  double reco[]);
266 
267 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
280 void
282  const cs_cdo_connect_t *connect,
283  const cs_cdo_quantities_t *quant,
284  const double *pdi,
285  cs_real_t val_xc[]);
286 
287 /*----------------------------------------------------------------------------*/
297 /*----------------------------------------------------------------------------*/
298 
299 void
301  const cs_connect_index_t *c2e,
302  const cs_cdo_quantities_t *quant,
303  const double *dof,
304  double reco[]);
305 
306 /*----------------------------------------------------------------------------*/
315 /*----------------------------------------------------------------------------*/
316 
317 void
319  const cs_cdo_quantities_t *quant,
320  const double *dof,
321  double *p_ccrec[]);
322 
323 /*----------------------------------------------------------------------------*/
324 
326 
327 #endif /* __CS_RECO_H__ */
void cs_reco_cost_edge_dof(cs_lnum_t cid, cs_lnum_t e1_id, const cs_connect_index_t *c2e, const cs_cdo_quantities_t *quant, const double *dof, double reco[])
Reconstruct by a constant vector a field of edge-based DoFs in a volume surrounding an edge...
Definition: cs_reco.c:164
Definition: cs_cdo_toolbox.h:52
void cs_reco_conf_vtx_dofs(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const double *dof, double *p_crec[], double *p_frec[])
Reconstruct at cell centers and face centers a vertex-based field Linear interpolation. If p_crec and/or p_frec are not allocated, this done in this subroutine.
Definition: cs_reco.c:81
cs_real_t cs_reco_pv_inside_cell(const cs_cell_mesh_t *cm, const cs_real_t pdi[], const cs_real_t length_xcxp, const cs_real_t unitv_xcxp[], cs_real_t wbuf[])
Reconstruct the value of a scalar potential at a point inside a cell The scalar potential has DoFs lo...
Definition: cs_reco.c:515
double * tef
Definition: cs_cdo_local.h:211
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
double meas
Definition: cs_cdo_quantities.h:83
Definition: cs_cdo_local.h:132
Definition: cs_cdo_connect.h:56
void cs_reco_ccen_edge_dof(cs_lnum_t cid, const cs_connect_index_t *c2e, const cs_cdo_quantities_t *quant, const double *dof, double reco[])
Reconstruct at the cell center a field of edge-based DoFs.
Definition: cs_reco.c:618
short int n_ef
Definition: cs_cdo_local.h:208
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:102
Definition: cs_field_pointer.h:121
void cs_reco_dfbyc_at_cell_center(cs_lnum_t c_id, const cs_connect_index_t *c2e, const cs_cdo_quantities_t *quant, const double *array, cs_real_3_t val_xc)
Reconstruct a constant vector at the cell center from an array of values defined on dual faces lying ...
Definition: cs_reco.c:368
void cs_reco_ccen_edge_dofs(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const double *dof, double *p_ccrec[])
Reconstruct at each cell center a field of edge-based DoFs.
Definition: cs_reco.c:659
void cs_reco_grd_cell_from_pv(cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const double *pdi, cs_real_t val_xc[])
Reconstruct the value at the cell center of the gradient of a field defined on primal vertices...
Definition: cs_reco.c:569
short int * e2v_ids
Definition: cs_cdo_local.h:214
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:309
void cs_reco_pv_at_cell_centers(const cs_connect_index_t *c2v, const cs_cdo_quantities_t *quant, const double *array, cs_real_t *val_xc)
Reconstruct the value at all cell centers from an array of values defined on primal vertices...
Definition: cs_reco.c:230
void cs_reco_dfbyc_in_cell(const cs_cell_mesh_t *cm, const cs_real_t *array, cs_real_3_t val_c)
Reconstruct a constant vector inside the cell c. array is scanned thanks to the c2e connectivity...
Definition: cs_reco.c:413
cs_quant_t face
Definition: cs_cdo_local.h:198
Definition: cs_cdo_quantities.h:81
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
#define END_C_DECLS
Definition: cs_defs.h:452
void cs_reco_pf_from_pv(cs_lnum_t f_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const double *pdi, cs_real_t *pdi_f)
Reconstruct the value at the face center from an array of values defined on primal vertices...
Definition: cs_reco.c:320
Definition: cs_cdo_local.h:188
void cs_reco_pv_at_cell_center(cs_lnum_t c_id, const cs_connect_index_t *c2v, const cs_cdo_quantities_t *quant, const double *array, cs_real_t *val_xc)
Reconstruct the value at the cell center from an array of values defined on primal vertices...
Definition: cs_reco.c:276
static void cs_reco_pv_at_face_center(const cs_face_mesh_t *fm, const double *p_v, double *p_f)
Reconstruct the value at the face center from an array of values defined on primal vertices...
Definition: cs_reco.h:125
void cs_reco_dfbyc_in_pec(const cs_cell_mesh_t *cm, short int e, const cs_real_t *array, cs_real_3_t val_pec)
Reconstruct a constant vector inside pec which is a volume surrounding the edge e inside the cell c...
Definition: cs_reco.c:459