programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-2017 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 #include "cs_xdef.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
56 #define CS_CDO_BC_DIRICHLET (1 << 0)
57 
58 #define CS_CDO_BC_HMG_DIRICHLET (1 << 1)
59 
60 #define CS_CDO_BC_NEUMANN (1 << 2)
61 
62 #define CS_CDO_BC_HMG_NEUMANN (1 << 3)
63 
64 #define CS_CDO_BC_ROBIN (1 << 4)
65 
68 /*============================================================================
69  * Type definitions
70  *============================================================================*/
71 
72 /* List of entities attached to a type of BC (for instance Dirichlet or Neumann)
73  Two categories are considered
74  First, the entities attached to a non-homogeneous BC, then those attached
75  to a homogeneous BC.
76 */
77 
78 typedef struct {
79 
81  cs_lnum_t n_nhmg_elts; /* number of non-homogeneous elements */
82 
83  cs_lnum_t *elt_ids; /* size = n_elts (first elements are those associated
84  to non-homogeneous BC then the homogeneous one */
85  short int *def_ids; /* id related to the associated BC definition
86  Only for non homogeneous BCs (i.e. size is equal
87  to the number elements associated to a
88  non-homogeneous BC */
89 
91 
92 /* Translation of the user-defined BCs setup into a computable-oriented
93  structure */
94 
95 typedef struct {
96 
97  cs_lnum_t n_elts; // Number of elements
98  cs_flag_t *flag; /* Type of boundary conditions associated to
99  an element. For a face, one (and only one)
100  type is set. For an edge and a vertex,
101  several BCs can be set.
102  size = n_elts */
103 
104  // List of faces by type of boundary conditions
108 
109 } cs_cdo_bc_t;
110 
111 /*============================================================================
112  * Public function prototypes
113  *============================================================================*/
114 
115 /*============================================================================
116  * Public function prototypes
117  *============================================================================*/
118 
119 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 static inline cs_flag_t
132 {
133  cs_flag_t ret_flag;
134  switch (bc_type) {
136  ret_flag = CS_CDO_BC_HMG_DIRICHLET;
137  break;
139  ret_flag = CS_CDO_BC_DIRICHLET;
140  break;
142  ret_flag = CS_CDO_BC_HMG_NEUMANN;
143  break;
144  case CS_PARAM_BC_NEUMANN:
145  ret_flag = CS_CDO_BC_NEUMANN;
146  break;
147  default:
148  ret_flag = 0;
149  break;
150  }
151  return ret_flag;
152 }
153 
154 /*----------------------------------------------------------------------------*/
163 /*----------------------------------------------------------------------------*/
164 
167  cs_lnum_t n_nhmg_elts);
168 
169 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
181 
182 /*----------------------------------------------------------------------------*/
195 /*----------------------------------------------------------------------------*/
196 
197 cs_cdo_bc_t *
199  int n_desc,
200  cs_xdef_t **desc,
201  cs_lnum_t n_b_faces);
202 
203 /*----------------------------------------------------------------------------*/
211 /*----------------------------------------------------------------------------*/
212 
213 cs_cdo_bc_t *
214 cs_cdo_bc_free(cs_cdo_bc_t *face_bc);
215 
216 /*----------------------------------------------------------------------------*/
217 
219 
220 #endif /* __CS_CDO_BC_H__ */
#define CS_CDO_BC_HMG_DIRICHLET
Definition: cs_cdo_bc.h:58
Definition: cs_cdo_bc.h:78
cs_cdo_bc_t * cs_cdo_bc_define(cs_param_bc_type_t default_bc, int n_desc, cs_xdef_t **desc, 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:233
cs_cdo_bc_list_t * rob
Definition: cs_cdo_bc.h:107
static cs_flag_t cs_cdo_bc_get_flag(cs_param_bc_type_t bc_type)
Convert a cs_param_bc_type_t into a flag (enable multiple type for a same entity as required for vert...
Definition: cs_cdo_bc.h:131
Definition: cs_param.h:166
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
cs_cdo_bc_list_t * dir
Definition: cs_cdo_bc.h:105
Definition: cs_cdo_bc.h:95
cs_flag_t * flag
Definition: cs_cdo_bc.h:98
cs_cdo_bc_list_t * neu
Definition: cs_cdo_bc.h:106
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:378
Definition: cs_param.h:163
#define CS_CDO_BC_DIRICHLET
Definition: cs_cdo_bc.h:56
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:160
#define CS_CDO_BC_NEUMANN
Definition: cs_cdo_bc.h:60
cs_lnum_t n_nhmg_elts
Definition: cs_cdo_bc.h:81
short int * def_ids
Definition: cs_cdo_bc.h:85
#define CS_CDO_BC_HMG_NEUMANN
Definition: cs_cdo_bc.h:62
Definition: cs_xdef.h:72
cs_param_bc_type_t
Definition: cs_param.h:161
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:202
cs_lnum_t n_elts
Definition: cs_cdo_bc.h:97
#define END_C_DECLS
Definition: cs_defs.h:454
unsigned short int cs_flag_t
Definition: cs_defs.h:299
Definition: cs_param.h:165
cs_lnum_t * elt_ids
Definition: cs_cdo_bc.h:83
Definition: cs_param.h:164
cs_lnum_t n_elts
Definition: cs_cdo_bc.h:80