9.2
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-2026 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 "cdo/cs_cdo_connect.h"
37#include "cdo/cs_cdo_local.h"
39#include "cdo/cs_flag.h"
40
41/*============================================================================
42 * Macro definitions
43 *============================================================================*/
44
45/*============================================================================
46 * Type definitions
47 *============================================================================*/
48
49/*============================================================================
50 * Public function prototypes
51 *============================================================================*/
52
53/*----------------------------------------------------------------------------*/
66/*----------------------------------------------------------------------------*/
67
68void
70 const cs_cdo_quantities_t *quant,
71 int stride,
72 bool interlace,
73 cs_real_t *array);
74
75/*----------------------------------------------------------------------------*/
87/*----------------------------------------------------------------------------*/
88
89void
91 const cs_cdo_quantities_t *cdoq,
92 const cs_real_t i_face_vals[],
93 const cs_real_t b_face_vals[],
94 cs_real_t *cell_reco);
95
96/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112
113void
115 const cs_adjacency_t *c2f,
116 const cs_cdo_quantities_t *cdoq,
117 const cs_real_t face_dofs[],
118 bool local_input,
119 cs_real_t *cell_reco);
120
121/*----------------------------------------------------------------------------*/
134/*----------------------------------------------------------------------------*/
135
136void
138 const cs_cdo_quantities_t *cdoq,
139 const cs_real_t face_dofs[],
140 cs_real_t *cell_reco);
141
142/*----------------------------------------------------------------------------*/
156/*----------------------------------------------------------------------------*/
157
158void
160 const cs_lnum_t *cell_ids,
161 const cs_adjacency_t *c2v,
162 const cs_cdo_quantities_t *cdoq,
163 const double *array,
164 bool dense_ouput,
165 cs_real_t *reco);
166
167/*----------------------------------------------------------------------------*/
182/*----------------------------------------------------------------------------*/
183
184void
186 const cs_lnum_t *cell_ids,
187 const cs_adjacency_t *c2v,
188 const cs_cdo_quantities_t *cdoq,
189 const double *array,
190 bool dense_ouput,
191 cs_real_t *reco);
192
193/*----------------------------------------------------------------------------*/
208/*----------------------------------------------------------------------------*/
209
210void
212 const cs_lnum_t *cell_ids,
213 const cs_adjacency_t *c2e,
214 const cs_cdo_quantities_t *cdoq,
215 const double *array,
216 bool dense_ouput,
217 cs_real_t *reco);
218
219/*----------------------------------------------------------------------------*/
233/*----------------------------------------------------------------------------*/
234
235void
237 const cs_lnum_t *cell_ids,
238 const cs_adjacency_t *c2v,
239 const cs_cdo_quantities_t *cdoq,
240 const double *array,
241 bool dense_ouput,
242 cs_real_t *reco);
243
244/*----------------------------------------------------------------------------*/
258/*----------------------------------------------------------------------------*/
259
260void
262 const cs_lnum_t *face_ids,
263 const cs_cdo_connect_t *connect,
264 const cs_cdo_quantities_t *cdoq,
265 const double *array,
266 bool dense_ouput,
267 cs_real_t *reco);
268
269/*----------------------------------------------------------------------------*/
279/*----------------------------------------------------------------------------*/
280
281void
283 const cs_cdo_quantities_t *cdoq,
284 const double *p_c,
285 double *p_reco_f);
286
287/*----------------------------------------------------------------------------*/
300/*----------------------------------------------------------------------------*/
301
302void
304 const cs_cdo_quantities_t *cdoq,
305 const double *dof,
306 double *p_reco_c[],
307 double *p_reco_f[]);
308
309/*----------------------------------------------------------------------------*/
319/*----------------------------------------------------------------------------*/
320
321void
323 const cs_cdo_quantities_t *quant,
324 const cs_real_t *cell_val,
325 cs_real_t *vtx_val);
326
327/*----------------------------------------------------------------------------*/
337/*----------------------------------------------------------------------------*/
338
339void
341 const cs_cdo_quantities_t *quant,
342 const cs_real_t *cell_val,
343 cs_real_t *vtx_val);
344
345/*----------------------------------------------------------------------------*/
357/*----------------------------------------------------------------------------*/
358
359void
361 const cs_adjacency_t *c2e,
362 const cs_cdo_quantities_t *quant,
363 const double *array,
364 cs_real_3_t val_xc);
365
366/*----------------------------------------------------------------------------*/
378/*----------------------------------------------------------------------------*/
379
380void
382 const cs_real_t *array,
383 cs_real_3_t val_c);
384
385/*----------------------------------------------------------------------------*/
399/*----------------------------------------------------------------------------*/
400
401void
403 short int e,
404 const cs_real_t *array,
405 cs_real_3_t val_pec);
406
407/*----------------------------------------------------------------------------*/
417/*----------------------------------------------------------------------------*/
418
419void
421 const cs_adjacency_t *c2e,
422 const cs_cdo_quantities_t *quant,
423 const double *dof,
424 double reco[]);
425
426/*----------------------------------------------------------------------------*/
435/*----------------------------------------------------------------------------*/
436
437void
439 const cs_cdo_quantities_t *quant,
440 const double *dof,
441 double *p_ccrec[]);
442
443/*----------------------------------------------------------------------------*/
454/*----------------------------------------------------------------------------*/
455
456void
458 const cs_cdo_quantities_t *quant,
459 const cs_real_t *circ,
460 cs_real_t **p_curl);
461
462/*----------------------------------------------------------------------------*/
476/*----------------------------------------------------------------------------*/
477
478void
480 const cs_cdo_connect_t *connect,
481 const cs_cdo_quantities_t *quant,
482 const cs_real_t *p_c,
483 const cs_real_t *p_f,
484 cs_real_t grd_c[]);
485
486/*----------------------------------------------------------------------------*/
500/*----------------------------------------------------------------------------*/
501
502void
504 const cs_cdo_connect_t *connect,
505 const cs_cdo_quantities_t *quant,
506 const cs_real_t *u_c,
507 const cs_real_t *u_f,
508 cs_real_t grd_c[]);
509
510/*----------------------------------------------------------------------------*/
521/*----------------------------------------------------------------------------*/
522
523void
525 const cs_cdo_connect_t *connect,
526 const cs_cdo_quantities_t *quant,
527 const cs_real_t *pdi,
528 cs_real_t grdc[]);
529
530/*----------------------------------------------------------------------------*/
543/*----------------------------------------------------------------------------*/
544
545void
547 const cs_cdo_connect_t *connect,
548 const cs_cdo_quantities_t *quant,
549 const cs_real_t *p1di,
550 const cs_real_t *p2di,
551 cs_real_t grd1c[],
552 cs_real_t grd2c[]);
553
554/*----------------------------------------------------------------------------*/
565/*----------------------------------------------------------------------------*/
566
567void
569 const cs_real_t *fluxes,
570 cs_real_t *cell_reco);
571
572/*----------------------------------------------------------------------------*/
583/*----------------------------------------------------------------------------*/
584
585void
587 const cs_real_t i_face_vals[],
588 const cs_real_t b_face_vals[],
589 cs_real_t *cell_reco);
590
591/*----------------------------------------------------------------------------*/
600/*----------------------------------------------------------------------------*/
601
602void
604 const cs_real_t pdi[],
605 cs_real_t *cell_gradient);
606
607/*----------------------------------------------------------------------------*/
620/*----------------------------------------------------------------------------*/
621
624 const cs_real_t pdi[],
625 const cs_real_t length_xcxp,
626 const cs_real_t unitv_xcxp[],
627 cs_real_t wbuf[]);
628
629/*----------------------------------------------------------------------------*/
642/*----------------------------------------------------------------------------*/
643
644void
646 const cs_real_t *pot,
648 cs_real_t *vgrd);
649
650/*----------------------------------------------------------------------------*/
662/*----------------------------------------------------------------------------*/
663
664void
666 const cs_real_t *pot,
668 cs_real_t *cgrd);
669
670/*============================================================================
671 * Inline public function prototypes
672 *============================================================================*/
673
674/*----------------------------------------------------------------------------*/
685/*----------------------------------------------------------------------------*/
686
687static inline void
689 const cs_cdo_quantities_t *cdoq,
690 const double *array,
691 cs_real_t *reco)
692{
693 cs_reco_scalar_v2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
694}
695
696/*----------------------------------------------------------------------------*/
707/*----------------------------------------------------------------------------*/
708
709static inline void
711 const cs_cdo_quantities_t *cdoq,
712 const double *array,
713 cs_real_t *reco)
714{
715 cs_reco_vector_v2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
716}
717
718/*----------------------------------------------------------------------------*/
730/*----------------------------------------------------------------------------*/
731
732static inline void
734 const cs_cdo_quantities_t *cdoq,
735 const double *array,
736 cs_real_t *reco)
737{
738 cs_reco_scalar_vbyc2c(cdoq->n_cells, NULL, c2v, cdoq, array, false, reco);
739}
740
741/*----------------------------------------------------------------------------*/
753/*----------------------------------------------------------------------------*/
754
755static inline void
757 const cs_cdo_quantities_t *cdoq,
758 const double *array,
759 cs_real_t *reco)
760{
761 cs_reco_scalar_ebyc2c(cdoq->n_cells, NULL, c2e, cdoq, array, false, reco);
762}
763
764#endif /* CS_RECO_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
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:632
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:1088
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:1493
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:247
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:693
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:1042
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:1685
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:337
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:1275
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:1540
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:756
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:1790
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:1326
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:461
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:733
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:1191
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:1001
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:1434
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:1231
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:398
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:866
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:569
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:1627
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:815
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:508
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:1146
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:710
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:756
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:955
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:1586
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:1381
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:918
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:688
Definition: cs_mesh_adjacencies.h:68
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
cs_lnum_t n_cells
Definition: cs_cdo_quantities.h:156
Set of local and temporary buffers.
Definition: cs_cdo_local.h:56
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:242