programmer's documentation
cs_cdo_bc.h
Go to the documentation of this file.
1 #ifndef __CS_CDO_BC_H__
2 #define __CS_CDO_BC_H__
3 
4 /*============================================================================
5  * Manage boundary conditions. Produce ready-to-use BC structure from the
6  * user definition.
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2018 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------
30  * Local headers
31  *----------------------------------------------------------------------------*/
32 
33 #include "cs_base.h"
34 #include "cs_time_step.h"
35 
36 #include "cs_param.h"
37 #include "cs_cdo_quantities.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
55 #define CS_CDO_BC_DIRICHLET (1 << 0)
56 
57 #define CS_CDO_BC_HMG_DIRICHLET (1 << 1)
58 
59 #define CS_CDO_BC_NEUMANN (1 << 2)
60 
61 #define CS_CDO_BC_HMG_NEUMANN (1 << 3)
62 
63 #define CS_CDO_BC_ROBIN (1 << 4)
64 
67 /*============================================================================
68  * Type definitions
69  *============================================================================*/
70 
71 /* List of entities attached to a type of BC (for instance Dirichlet or Neumann)
72  Two categories are considered
73  First, the entities attached to a non-homogeneous BC, then those attached
74  to a homogeneous BC.
75 */
76 
77 typedef struct {
78 
80  cs_lnum_t n_nhmg_elts; /* number of non-homogeneous elements */
81 
82  cs_lnum_t *elt_ids; /* size = n_elts (first elements are those associated
83  to non-homogeneous BC then the homogeneous one */
84  short int *def_ids; /* id related to the associated BC definition
85  Only for non homogeneous BCs (i.e. size is equal
86  to the number elements associated to a
87  non-homogeneous BC */
88 
90 
91 /* Translation of the user-defined BCs setup into a computable-oriented
92  structure */
93 
94 typedef struct {
95 
96  cs_lnum_t n_elts; // Number of elements
97  cs_flag_t *flag; /* Type of boundary conditions associated to
98  an element. For a face, one (and only one)
99  type is set. For an edge and a vertex,
100  several BCs can be set.
101  size = n_elts */
102 
103  // List of faces by type of boundary conditions
107 
108 } cs_cdo_bc_t;
109 
110 /*============================================================================
111  * Public function prototypes
112  *============================================================================*/
113 
114 /*============================================================================
115  * Public function prototypes
116  *============================================================================*/
117 
118 /*----------------------------------------------------------------------------*/
127 /*----------------------------------------------------------------------------*/
128 
131  cs_lnum_t n_nhmg_elts);
132 
133 /*----------------------------------------------------------------------------*/
141 /*----------------------------------------------------------------------------*/
142 
145 
146 /*----------------------------------------------------------------------------*/
158 /*----------------------------------------------------------------------------*/
159 
160 cs_cdo_bc_t *
161 cs_cdo_bc_define(const cs_param_bc_t *param_bc,
162  cs_lnum_t n_b_faces);
163 
164 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 cs_cdo_bc_t *
175 cs_cdo_bc_free(cs_cdo_bc_t *face_bc);
176 
177 /*----------------------------------------------------------------------------*/
178 
180 
181 #endif /* __CS_CDO_BC_H__ */
Definition: cs_cdo_bc.h:77
cs_cdo_bc_list_t * rob
Definition: cs_cdo_bc.h:106
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
cs_cdo_bc_list_t * dir
Definition: cs_cdo_bc.h:104
Definition: cs_cdo_bc.h:94
cs_flag_t * flag
Definition: cs_cdo_bc.h:97
cs_cdo_bc_list_t * neu
Definition: cs_cdo_bc.h:105
cs_cdo_bc_t * cs_cdo_bc_free(cs_cdo_bc_t *face_bc)
Free a cs_cdo_bc_t structure.
Definition: cs_cdo_bc.c:424
cs_cdo_bc_t * cs_cdo_bc_define(const cs_param_bc_t *param_bc, cs_lnum_t n_b_faces)
Define the structure which translates the BC definition from the user viewpoint into a ready-to-use s...
Definition: cs_cdo_bc.c:266
cs_cdo_bc_list_t * cs_cdo_bc_list_create(cs_lnum_t n_elts, cs_lnum_t n_nhmg_elts)
Create a cs_cdo_bc_list_t structure.
Definition: cs_cdo_bc.c:194
cs_lnum_t n_nhmg_elts
Definition: cs_cdo_bc.h:80
short int * def_ids
Definition: cs_cdo_bc.h:84
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
cs_cdo_bc_list_t * cs_cdo_bc_list_free(cs_cdo_bc_list_t *bcl)
Free a cs_cdo_bc_list_t structure.
Definition: cs_cdo_bc.c:236
cs_lnum_t n_elts
Definition: cs_cdo_bc.h:96
#define END_C_DECLS
Definition: cs_defs.h:452
unsigned short int cs_flag_t
Definition: cs_defs.h:299
cs_lnum_t * elt_ids
Definition: cs_cdo_bc.h:82
Definition: cs_param.h:298
cs_lnum_t n_elts
Definition: cs_cdo_bc.h:79