8.3
general documentation
cs_reco.h
Go to the documentation of this file.
1#ifndef __CS_RECO_H__
2#define __CS_RECO_H__
3
4/*============================================================================
5 * Functions 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-2024 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 "assert.h"
35
36#include "cs_cdo_connect.h"
37#include "cs_cdo_local.h"
38#include "cs_cdo_quantities.h"
39#include "cs_flag.h"
40
41/*----------------------------------------------------------------------------*/
42
44
45/*============================================================================
46 * Macro definitions
47 *============================================================================*/
48
49/*============================================================================
50 * Type definitions
51 *============================================================================*/
52
53/*============================================================================
54 * Public function prototypes
55 *============================================================================*/
56
57/*----------------------------------------------------------------------------*/
70/*----------------------------------------------------------------------------*/
71
72void
74 const cs_cdo_quantities_t *quant,
75 int stride,
76 bool interlace,
77 cs_real_t *array);
78
79/*----------------------------------------------------------------------------*/
91/*----------------------------------------------------------------------------*/
92
93void
95 const cs_cdo_quantities_t *cdoq,
96 const cs_real_t i_face_vals[],
97 const cs_real_t b_face_vals[],
98 cs_real_t *cell_reco);
99
100/*----------------------------------------------------------------------------*/
115/*----------------------------------------------------------------------------*/
116
117void
119 const cs_adjacency_t *c2f,
120 const cs_cdo_quantities_t *cdoq,
121 const cs_real_t face_dofs[],
122 bool local_input,
123 cs_real_t *cell_reco);
124
125/*----------------------------------------------------------------------------*/
138/*----------------------------------------------------------------------------*/
139
140void
142 const cs_cdo_quantities_t *cdoq,
143 const cs_real_t face_dofs[],
144 cs_real_t *cell_reco);
145
146/*----------------------------------------------------------------------------*/
160/*----------------------------------------------------------------------------*/
161
162void
164 const cs_lnum_t *cell_ids,
165 const cs_adjacency_t *c2v,
166 const cs_cdo_quantities_t *cdoq,
167 const double *array,
168 bool dense_ouput,
169 cs_real_t *reco);
170
171/*----------------------------------------------------------------------------*/
186/*----------------------------------------------------------------------------*/
187
188void
190 const cs_lnum_t *cell_ids,
191 const cs_adjacency_t *c2v,
192 const cs_cdo_quantities_t *cdoq,
193 const double *array,
194 bool dense_ouput,
195 cs_real_t *reco);
196
197/*----------------------------------------------------------------------------*/
212/*----------------------------------------------------------------------------*/
213
214void
216 const cs_lnum_t *cell_ids,
217 const cs_adjacency_t *c2e,
218 const cs_cdo_quantities_t *cdoq,
219 const double *array,
220 bool dense_ouput,
221 cs_real_t *reco);
222
223/*----------------------------------------------------------------------------*/
237/*----------------------------------------------------------------------------*/
238
239void
241 const cs_lnum_t *cell_ids,
242 const cs_adjacency_t *c2v,
243 const cs_cdo_quantities_t *cdoq,
244 const double *array,
245 bool dense_ouput,
246 cs_real_t *reco);
247
248/*----------------------------------------------------------------------------*/
262/*----------------------------------------------------------------------------*/
263
264void
266 const cs_lnum_t *face_ids,
267 const cs_cdo_connect_t *connect,
268 const cs_cdo_quantities_t *cdoq,
269 const double *array,
270 bool dense_ouput,
271 cs_real_t *reco);
272
273/*----------------------------------------------------------------------------*/
283/*----------------------------------------------------------------------------*/
284
285void
287 const cs_cdo_quantities_t *cdoq,
288 const double *p_c,
289 double *p_reco_f);
290
291/*----------------------------------------------------------------------------*/
304/*----------------------------------------------------------------------------*/
305
306void
308 const cs_cdo_quantities_t *cdoq,
309 const double *dof,
310 double *p_reco_c[],
311 double *p_reco_f[]);
312
313/*----------------------------------------------------------------------------*/
323/*----------------------------------------------------------------------------*/
324
325void
327 const cs_cdo_quantities_t *quant,
328 const cs_real_t *cell_val,
329 cs_real_t *vtx_val);
330
331/*----------------------------------------------------------------------------*/
341/*----------------------------------------------------------------------------*/
342
343void
345 const cs_cdo_quantities_t *quant,
346 const cs_real_t *cell_val,
347 cs_real_t *vtx_val);
348
349/*----------------------------------------------------------------------------*/
361/*----------------------------------------------------------------------------*/
362
363void
365 const cs_adjacency_t *c2e,
366 const cs_cdo_quantities_t *quant,
367 const double *array,
368 cs_real_3_t val_xc);
369
370/*----------------------------------------------------------------------------*/
382/*----------------------------------------------------------------------------*/
383
384void
386 const cs_real_t *array,
387 cs_real_3_t val_c);
388
389/*----------------------------------------------------------------------------*/
403/*----------------------------------------------------------------------------*/
404
405void
407 short int e,
408 const cs_real_t *array,
409 cs_real_3_t val_pec);
410
411/*----------------------------------------------------------------------------*/
421/*----------------------------------------------------------------------------*/
422
423void
425 const cs_adjacency_t *c2e,
426 const cs_cdo_quantities_t *quant,
427 const double *dof,
428 double reco[]);
429
430/*----------------------------------------------------------------------------*/
439/*----------------------------------------------------------------------------*/
440
441void
443 const cs_cdo_quantities_t *quant,
444 const double *dof,
445 double *p_ccrec[]);
446
447/*----------------------------------------------------------------------------*/
458/*----------------------------------------------------------------------------*/
459
460void
462 const cs_cdo_quantities_t *quant,
463 const cs_real_t *circ,
464 cs_real_t **p_curl);
465
466/*----------------------------------------------------------------------------*/
480/*----------------------------------------------------------------------------*/
481
482void
484 const cs_cdo_connect_t *connect,
485 const cs_cdo_quantities_t *quant,
486 const cs_real_t *p_c,
487 const cs_real_t *p_f,
488 cs_real_t grd_c[]);
489
490/*----------------------------------------------------------------------------*/
504/*----------------------------------------------------------------------------*/
505
506void
508 const cs_cdo_connect_t *connect,
509 const cs_cdo_quantities_t *quant,
510 const cs_real_t *u_c,
511 const cs_real_t *u_f,
512 cs_real_t grd_c[]);
513
514/*----------------------------------------------------------------------------*/
525/*----------------------------------------------------------------------------*/
526
527void
529 const cs_cdo_connect_t *connect,
530 const cs_cdo_quantities_t *quant,
531 const cs_real_t *pdi,
532 cs_real_t grdc[]);
533
534/*----------------------------------------------------------------------------*/
547/*----------------------------------------------------------------------------*/
548
549void
551 const cs_cdo_connect_t *connect,
552 const cs_cdo_quantities_t *quant,
553 const cs_real_t *p1di,
554 const cs_real_t *p2di,
555 cs_real_t grd1c[],
556 cs_real_t grd2c[]);
557
558/*----------------------------------------------------------------------------*/
569/*----------------------------------------------------------------------------*/
570
571void
573 const cs_real_t *fluxes,
574 cs_real_t *cell_reco);
575
576/*----------------------------------------------------------------------------*/
587/*----------------------------------------------------------------------------*/
588
589void
591 const cs_real_t i_face_vals[],
592 const cs_real_t b_face_vals[],
593 cs_real_t *cell_reco);
594
595/*----------------------------------------------------------------------------*/
604/*----------------------------------------------------------------------------*/
605
606void
608 const cs_real_t pdi[],
609 cs_real_t *cell_gradient);
610
611/*----------------------------------------------------------------------------*/
624/*----------------------------------------------------------------------------*/
625
628 const cs_real_t pdi[],
629 const cs_real_t length_xcxp,
630 const cs_real_t unitv_xcxp[],
631 cs_real_t wbuf[]);
632
633/*----------------------------------------------------------------------------*/
646/*----------------------------------------------------------------------------*/
647
648void
650 const cs_real_t *pot,
652 cs_real_t *vgrd);
653
654/*----------------------------------------------------------------------------*/
666/*----------------------------------------------------------------------------*/
667
668void
670 const cs_real_t *pot,
672 cs_real_t *cgrd);
673
674/*============================================================================
675 * Inline public function prototypes
676 *============================================================================*/
677
678/*----------------------------------------------------------------------------*/
689/*----------------------------------------------------------------------------*/
690
691static inline void
693 const cs_cdo_quantities_t *cdoq,
694 const double *array,
695 cs_real_t *reco)
696{
697 cs_reco_scalar_v2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
698}
699
700/*----------------------------------------------------------------------------*/
711/*----------------------------------------------------------------------------*/
712
713static inline void
715 const cs_cdo_quantities_t *cdoq,
716 const double *array,
717 cs_real_t *reco)
718{
719 cs_reco_vector_v2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
720}
721
722/*----------------------------------------------------------------------------*/
734/*----------------------------------------------------------------------------*/
735
736static inline void
738 const cs_cdo_quantities_t *cdoq,
739 const double *array,
740 cs_real_t *reco)
741{
742 cs_reco_scalar_vbyc2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
743}
744
745/*----------------------------------------------------------------------------*/
757/*----------------------------------------------------------------------------*/
758
759static inline void
761 const cs_cdo_quantities_t *cdoq,
762 const double *array,
763 cs_real_t *reco)
764{
765 cs_reco_scalar_ebyc2c(cdoq->n_cells, NULL, c2e, cdoq, array, false, reco);
766}
767
768/*----------------------------------------------------------------------------*/
769
771
772#endif /* __CS_RECO_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
void cs_reco_scalar_ebyc2c(cs_lnum_t n_cells, const cs_lnum_t *cell_ids, const cs_adjacency_t *c2e, const cs_cdo_quantities_t *cdoq, const double *array, bool dense_ouput, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined for each couple (e,...
Definition: cs_reco.cpp:634
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.cpp:1090
void cs_reco_cw_cell_vect_from_flux(const cs_cell_mesh_t *cm, const cs_real_t *fluxes, cs_real_t *cell_reco)
Reconstruct the vector-valued quantity inside each cell from the given flux array....
Definition: cs_reco.cpp:1495
void cs_reco_dual_vol_weight_reduction(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, int stride, bool interlace, cs_real_t *array)
Apply 1/|dual_vol| to a synchronized array of DoF vertices Parallel synchronization is done inside th...
Definition: cs_reco.cpp:252
void cs_reco_vector_v2c(cs_lnum_t n_cells, const cs_lnum_t *cell_ids, const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, bool dense_ouput, cs_real_t *reco)
Reconstruct the value at all cell centers from an array of values defined on primal vertices....
Definition: cs_reco.cpp:695
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.cpp:1044
void cs_reco_cw_vgrd_wbs_from_pvc(const cs_cell_mesh_t *cm, const cs_real_t *pot, cs_cell_builder_t *cb, cs_real_t *vgrd)
Compute the weighted (by volume) gradient inside a given primal cell for the related vertices....
Definition: cs_reco.cpp:1687
void cs_reco_cell_vectors_by_ib_face_dofs(const cs_adjacency_t *c2f, const cs_cdo_quantities_t *cdoq, const cs_real_t i_face_vals[], const cs_real_t b_face_vals[], cs_real_t *cell_reco)
Reconstruct the vector-valued quantity inside each cell from the face DoFs (interior and boundary)....
Definition: cs_reco.cpp:339
void cs_reco_grad_cell_from_fb_dofs(cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *p_c, const cs_real_t *p_f, cs_real_t grd_c[])
Reconstruct the mean-value of the gradient field with DoFs arising from a face-based scheme (values a...
Definition: cs_reco.cpp:1277
void cs_reco_cw_cell_vect_from_face_dofs(const cs_cell_mesh_t *cm, const cs_real_t i_face_vals[], const cs_real_t b_face_vals[], cs_real_t *cell_reco)
Reconstruct the vector-valued quantity inside each cell from the face DoFs (interior and boundary)....
Definition: cs_reco.cpp:1542
void cs_reco_scalar_v2f(cs_lnum_t n_faces, const cs_lnum_t *face_ids, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const double *array, bool dense_ouput, cs_real_t *reco)
Reconstruct the value at the face center from an array of values defined on primal vertices....
Definition: cs_reco.cpp:758
void cs_reco_cw_cgrd_wbs_from_pvc(const cs_cell_mesh_t *cm, const cs_real_t *pot, cs_cell_builder_t *cb, cs_real_t *cgrd)
Compute the mean value of a gradient inside a given primal cell. Use the WBS algo....
Definition: cs_reco.cpp:1792
void cs_reco_grad_33_cell_from_fb_dofs(cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *u_c, const cs_real_t *u_f, cs_real_t grd_c[])
Reconstruct the mean-value of the tensor gradient field with DoFs arising from a face-based scheme (v...
Definition: cs_reco.cpp:1328
void cs_reco_cell_vectors_by_face_dofs(const cs_adjacency_t *c2f, const cs_cdo_quantities_t *cdoq, const cs_real_t face_dofs[], cs_real_t *cell_reco)
Reconstruct the vector-valued quantity inside each cell from the face DoFs (interior and boundary)....
Definition: cs_reco.cpp:463
static void cs_reco_scalar_vbyc2c_full(const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined for each couple (v,...
Definition: cs_reco.h:737
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.cpp:1193
void cs_reco_dfbyc_at_cell_center(cs_lnum_t c_id, const cs_adjacency_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.cpp:1003
void cs_reco_2grad_cell_from_pv(cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *p1di, const cs_real_t *p2di, cs_real_t grd1c[], cs_real_t grd2c[])
Reconstruct the constant gradient vector in a cell (the mean value) from the value at mesh vertices....
Definition: cs_reco.cpp:1436
void cs_reco_cell_curl_by_edge_dofs(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *circ, cs_real_t **p_curl)
Reconstruct a cell-wise constant curl from the knowledge of the circulation at primal edges.
Definition: cs_reco.cpp:1233
void cs_reco_cell_vector_by_face_dofs(cs_lnum_t c_id, const cs_adjacency_t *c2f, const cs_cdo_quantities_t *cdoq, const cs_real_t face_dofs[], bool local_input, cs_real_t *cell_reco)
Reconstruct the vector-valued quantity inside a cell from the face DoFs (interior and boundary)....
Definition: cs_reco.cpp:400
void cs_reco_scalar_c2f(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const double *p_c, double *p_reco_f)
Reconstruct at face centers by a cell-based field weighted average.
Definition: cs_reco.cpp:868
void cs_reco_scalar_vbyc2c(cs_lnum_t n_cells, const cs_lnum_t *cell_ids, const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, bool dense_ouput, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined for each couple (v,...
Definition: cs_reco.cpp:571
cs_real_t cs_reco_cw_scalar_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.cpp:1629
void cs_reco_scalar_v2c_v2f(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const double *dof, double *p_reco_c[], double *p_reco_f[])
Reconstruct at cell centers and face centers a vertex-based field Linear interpolation....
Definition: cs_reco.cpp:817
void cs_reco_scalar_v2c(cs_lnum_t n_cells, const cs_lnum_t *cell_ids, const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, bool dense_ouput, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined at primal vertices....
Definition: cs_reco.cpp:510
void cs_reco_ccen_edge_dof(cs_lnum_t c_id, const cs_adjacency_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.cpp:1148
static void cs_reco_vector_v2c_full(const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined at primal vertices....
Definition: cs_reco.h:714
static void cs_reco_scalar_ebyc2c_full(const cs_adjacency_t *c2e, const cs_cdo_quantities_t *cdoq, const double *array, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined for each couple (e,...
Definition: cs_reco.h:760
void cs_reco_vect_pv_from_pc(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *cell_val, cs_real_t *vtx_val)
Reconstruct a vector-valued array at vertices from a vector-valued array at cells.
Definition: cs_reco.cpp:957
void cs_reco_cw_cell_grad_from_scalar_pv(const cs_cell_mesh_t *cm, const cs_real_t pdi[], cs_real_t *cell_gradient)
Reconstruct the value of a scalar potential at a point inside a cell The scalar potential has DoFs lo...
Definition: cs_reco.cpp:1588
void cs_reco_grad_cell_from_pv(cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *pdi, cs_real_t grdc[])
Reconstruct the constant gradient vector in a cell (the mean value) from the value at mesh vertices.
Definition: cs_reco.cpp:1383
void cs_reco_scal_pv_from_pc(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *cell_val, cs_real_t *vtx_val)
Reconstruct a scalar-valued array at vertices from a scalar-valued array at cells.
Definition: cs_reco.cpp:920
static void cs_reco_scalar_v2c_full(const cs_adjacency_t *c2v, const cs_cdo_quantities_t *cdoq, const double *array, cs_real_t *reco)
Reconstruct the value at cell center from an array of values defined at primal vertices....
Definition: cs_reco.h:692
Definition: cs_mesh_adjacencies.h:68
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:139
cs_lnum_t n_cells
Definition: cs_cdo_quantities.h:153
Set of local and temporary buffers.
Definition: cs_cdo_local.h:60
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:203