programmer's documentation
cs_cdo_quantities.h
Go to the documentation of this file.
1 #ifndef __CS_CDO_QUANTITIES_H__
2 #define __CS_CDO_QUANTITIES_H__
3 
4 /*============================================================================
5  * Manage geometrical quantities needed in CDO schemes
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2015 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_mesh.h"
36 #include "cs_mesh_quantities.h"
37 #include "cs_cdo.h"
38 #include "cs_cdo_connect.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /* Type of algorithm to compute geometrical quantities */
53 typedef enum {
54 
55  CS_CDO_CC_NONE, /* Default */
56  CS_CDO_CC_MEANV, /* Cell center is computed as the mean of cell vertices */
57  CS_CDO_CC_BARYC, /* Cell center is computed as the real cell barycenter */
58  CS_CDO_CC_SATUR, /* Cell center is given by Code_Saturne */
59  CS_CDO_CC_ORTHO, /* Cell center is optimized to enforce orthogonality
60  between cell-face edge and face plane */
62 
64 
65 typedef struct {
66 
67  double meas;
68  double unitv[3];
69 
70 } cs_qvect_t;
71 
72 /* For primal vector quantities (edge or face) */
73 typedef struct {
74 
75  double meas; /* length or area */
76  double unitv[3]; /* unitary vector: tangent or normal to the element */
77  double center[3];
78 
79 } cs_quant_t;
80 
81 /* For dual face quantities. Add also a link to entity id related to this dual
82  quantities */
83 
84 typedef struct { /* TODO: remove what is the less necessary in order to
85  save memory comsumption */
86 
87  cs_lnum_t parent_id[2]; /* parent entity id of (primal) faces */
88  double meas[2]; /* length or area related to each parent */
89  double unitv[6]; /* unitary vector related to each parent */
90  double vect[3]; /* dual face vector (TO REMOVE) */
91 
92 } cs_dface_t;
93 
94 typedef struct { /* Specific mesh quantities */
95 
96  /* Global mesh quantities */
97  double vol_tot;
98 
99  /* Vertex-based quantities */
101  double *dcell_vol; /* dual volume related to each vertex.
102  Scan with the c2v connectivity */
103 
104  /* Cell-based quantities */
108 
109  /* Face-based quantities */
112  cs_lnum_t n_faces; /* n_i_faces + n_b_faces */
113  cs_quant_t *face; /* face quantities */
114  double *dedge; /* dual edge quantities. 4 values by entry
115  length and unitv[3].
116  Scan with the c2f connectivity */
117 
118  /* Edge-based quantities */
120  cs_quant_t *edge; /* edge quantities */
121  cs_dface_t *dface; /* for each edge belonging to a cell, two
122  contributions coming from 2 triangles
123  s(x_cell, x_face, x_edge) for face\in\Face_edge
124  are considered.
125  Scan with the c2e connectivity */
126 
128 
129 /*============================================================================
130  * Global variables
131  *============================================================================*/
132 
133 /*============================================================================
134  * Public function prototypes
135  *============================================================================*/
136 
137 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
151  const cs_mesh_quantities_t *mq,
152  const cs_cdo_connect_t *topo);
153 
154 /*----------------------------------------------------------------------------*/
162 /*----------------------------------------------------------------------------*/
163 
166 
167 /*----------------------------------------------------------------------------*/
174 /*----------------------------------------------------------------------------*/
175 
176 void
178 
179 /*----------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------*/
188 
189 void
190 cs_quant_dump(FILE *f,
191  cs_lnum_t num,
192  const cs_quant_t q);
193 
194 /*----------------------------------------------------------------------------*/
205 /*----------------------------------------------------------------------------*/
206 
207 void
209  const cs_cdo_quantities_t *quant,
210  double *p_pvol[]);
211 
212 /*----------------------------------------------------------------------------*/
221 /*----------------------------------------------------------------------------*/
222 
223 void
225  const cs_cdo_quantities_t *quant,
226  double *p_pvol[]);
227 
228 /*----------------------------------------------------------------------------*/
237 /*----------------------------------------------------------------------------*/
238 
239 void
241  const cs_cdo_quantities_t *quant,
242  double *p_pvol[]);
243 
244 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
258 void
260  const cs_cdo_connect_t *connect,
261  const cs_cdo_quantities_t *quant,
262  const short int loc_ids[],
263  double wf[]);
264 
265 /*----------------------------------------------------------------------------*/
266 
268 
269 #endif /* __CS_CDO_QUANTITIES_H__ */
double meas
Definition: cs_cdo_quantities.h:67
void cs_compute_face_weights(cs_lnum_t f_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const short int loc_ids[], double wf[])
Compute for each face a weight related to each vertex w_{v,f} This weight is equal to |dc(v) cap f|/|...
Definition: cs_cdo_quantities.c:1263
Definition: cs_cdo_quantities.h:56
cs_cdo_quantities_t * cs_cdo_quantities_build(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, const cs_cdo_connect_t *topo)
Build a cs_cdo_quantities_t structure.
Definition: cs_cdo_quantities.c:871
cs_real_t * cell_centers
Definition: cs_cdo_quantities.h:106
cs_cdo_quantities_t * cs_cdo_quantities_free(cs_cdo_quantities_t *q)
Destroy a cs_cdo_quantities_t structure.
Definition: cs_cdo_quantities.c:1010
void cs_cdo_quantities_dump(const cs_cdo_quantities_t *iq)
Dump a cs_cdo_quantities_t structure.
Definition: cs_cdo_quantities.c:1041
Definition: cs_cdo_quantities.h:59
void cs_quant_dump(FILE *f, cs_lnum_t num, const cs_quant_t q)
Dump a cs_quant_t structure.
Definition: cs_cdo_quantities.c:1096
void cs_compute_pvol_vtx(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double *p_pvol[])
Compute for each vertex the dual cell volume which is also.
Definition: cs_cdo_quantities.c:1124
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
cs_cdo_cc_algo_t
Definition: cs_cdo_quantities.h:53
cs_lnum_t n_edges
Definition: cs_cdo_quantities.h:119
double meas
Definition: cs_cdo_quantities.h:75
cs_dface_t * dface
Definition: cs_cdo_quantities.h:121
Definition: cs_cdo_connect.h:86
double vol_tot
Definition: cs_cdo_quantities.h:97
Definition: cs_cdo_quantities.h:57
Definition: cs_cdo_quantities.h:94
Definition: cs_mesh.h:62
Definition: cs_cdo_quantities.h:58
Definition: cs_cdo_quantities.h:55
Definition: cs_cdo_quantities.h:65
cs_lnum_t n_faces
Definition: cs_cdo_quantities.h:112
Definition: cs_cdo_quantities.h:61
Definition: cs_mesh_quantities.h:51
cs_quant_t * face
Definition: cs_cdo_quantities.h:113
cs_lnum_t n_b_faces
Definition: cs_cdo_quantities.h:111
double * dcell_vol
Definition: cs_cdo_quantities.h:101
Definition: cs_cdo_quantities.h:84
cs_lnum_t n_vertices
Definition: cs_cdo_quantities.h:100
Definition: cs_cdo_quantities.h:73
cs_real_t * cell_vol
Definition: cs_cdo_quantities.h:107
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
void cs_compute_pvol_face(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double *p_pvol[])
Compute for each face a related volume pvol_f which constitutes a partition of unity.
Definition: cs_cdo_quantities.c:1205
cs_lnum_t n_i_faces
Definition: cs_cdo_quantities.h:110
#define END_C_DECLS
Definition: cs_defs.h:420
double cs_real_t
Definition: cs_defs.h:296
cs_lnum_t n_cells
Definition: cs_cdo_quantities.h:105
void cs_compute_pvol_edge(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double *p_pvol[])
Compute for each edge a related volume pvol_e which constitutes a partition of unity.
Definition: cs_cdo_quantities.c:1160
double * dedge
Definition: cs_cdo_quantities.h:114
cs_quant_t * edge
Definition: cs_cdo_quantities.h:120