programmer's documentation
cs_cdofb_vecteq.h
Go to the documentation of this file.
1 #ifndef __CS_CDOFB_VECTEQ_H__
2 #define __CS_CDOFB_VECTEQ_H__
3 
4 /*============================================================================
5  * Build an algebraic CDO face-based system for unsteady convection/diffusion
6  * reaction of vector-valued equations with source terms
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 
31 #include "cs_defs.h"
32 
33 /*----------------------------------------------------------------------------
34  * Standard C library headers
35  *----------------------------------------------------------------------------*/
36 
37 /*----------------------------------------------------------------------------
38  * Local headers
39  *----------------------------------------------------------------------------*/
40 
41 #include "cs_base.h"
42 #include "cs_cdo_connect.h"
43 #include "cs_cdo_quantities.h"
44 #include "cs_equation_common.h"
45 #include "cs_equation_param.h"
46 #include "cs_field.h"
47 #include "cs_matrix.h"
48 #include "cs_mesh.h"
49 #include "cs_restart.h"
50 #include "cs_source_term.h"
51 #include "cs_time_step.h"
52 
53 /*----------------------------------------------------------------------------*/
54 
56 
57 /*============================================================================
58  * Macro definitions
59  *============================================================================*/
60 
61 /*============================================================================
62  * Type definitions
63  *============================================================================*/
64 
65 /* Algebraic system for CDO face-based discretization */
66 typedef struct _cs_cdofb_t cs_cdofb_vecteq_t;
67 
68 /*============================================================================
69  * Public function prototypes
70  *============================================================================*/
71 
72 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 
90 void
92  const cs_cell_mesh_t *cm,
93  const cs_equation_param_t *eqp,
94  const cs_equation_builder_t *eqb,
95  const cs_cdofb_vecteq_t *eqc,
96  const cs_real_t dir_values[],
97  const short int neu_tags[],
98  const cs_real_t field_tn[],
99  cs_real_t t_eval,
100  cs_cell_sys_t *csys,
101  cs_cell_builder_t *cb);
102 
103 /*----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------*/
111 
112 bool
114 
115 /*----------------------------------------------------------------------------*/
126 /*----------------------------------------------------------------------------*/
127 
128 void
130  const cs_cdo_connect_t *connect,
131  const cs_time_step_t *time_step,
132  const cs_matrix_structure_t *ms);
133 
134 /*----------------------------------------------------------------------------*/
140 /*----------------------------------------------------------------------------*/
141 
142 const cs_matrix_structure_t *
144 
145 /*----------------------------------------------------------------------------*/
152 /*----------------------------------------------------------------------------*/
153 
154 void
156  cs_cell_builder_t **cb);
157 
158 /*----------------------------------------------------------------------------*/
163 /*----------------------------------------------------------------------------*/
164 
165 void
167 
168 /*----------------------------------------------------------------------------*/
180 /*----------------------------------------------------------------------------*/
181 
182 void *
184  int var_id,
185  int bflux_id,
186  cs_equation_builder_t *eqb);
187 
188 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 void *
199 cs_cdofb_vecteq_free_context(void *data);
200 
201 /*----------------------------------------------------------------------------*/
213 /*----------------------------------------------------------------------------*/
214 
215 void
218  void *data,
219  cs_matrix_t **system_matrix,
220  cs_real_t **system_rhs);
221 
222 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 
235 void
237  const cs_equation_param_t *eqp,
239  cs_real_t t_eval,
240  cs_real_t field_val[]);
241 
242 /*----------------------------------------------------------------------------*/
257 /*----------------------------------------------------------------------------*/
258 
259 void
261  const cs_real_t *field_val,
262  double dt_cur,
263  const cs_equation_param_t *eqp,
265  void *data,
266  cs_real_t *rhs,
268 
269 /*----------------------------------------------------------------------------*/
281 /*----------------------------------------------------------------------------*/
282 
283 void
285  const cs_real_t *rhs,
286  const cs_equation_param_t *eqp,
288  void *data,
289  cs_real_t *field_val);
290 
291 /*----------------------------------------------------------------------------*/
301 /*----------------------------------------------------------------------------*/
302 
303 void
304 cs_cdofb_vecteq_extra_op(const char *eqname,
305  const cs_field_t *field,
306  const cs_equation_param_t *eqp,
308  void *data);
309 
310 /*----------------------------------------------------------------------------*/
322 /*----------------------------------------------------------------------------*/
323 
324 cs_real_t *
325 cs_cdofb_vecteq_get_cell_values(void *context);
326 
327 /*----------------------------------------------------------------------------*/
337 /*----------------------------------------------------------------------------*/
338 
339 cs_real_t *
340 cs_cdofb_vecteq_get_face_values(void *context);
341 
342 /*----------------------------------------------------------------------------*/
351 /*----------------------------------------------------------------------------*/
352 
353 void
355  const char *eqname,
356  void *scheme_context);
357 
358 /*----------------------------------------------------------------------------*/
367 /*----------------------------------------------------------------------------*/
368 
369 void
371  const char *eqname,
372  void *scheme_context);
373 
374 /*----------------------------------------------------------------------------*/
375 
377 
378 #endif /* __CS_CDOFB_VECTEQ_H__ */
void * cs_cdofb_vecteq_init_context(const cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
Initialize a cs_cdofb_vecteq_t structure storing data useful for building and managing such a scheme...
Definition: cs_cdofb_vecteq.c:432
void cs_cdofb_vecteq_init_cell_system(const cs_flag_t cell_flag, const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const cs_cdofb_vecteq_t *eqc, const cs_real_t dir_values[], const short int neu_tags[], const cs_real_t field_tn[], cs_real_t t_eval, cs_cell_sys_t *csys, cs_cell_builder_t *cb)
Initialize the local structure for the current cell.
Definition: cs_cdofb_vecteq.c:171
Store common elements used when building an algebraic system related to an equation.
Definition: cs_equation_common.h:63
time step descriptor
Definition: cs_time_step.h:51
Field descriptor.
Definition: cs_field.h:124
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:159
void cs_cdofb_vecteq_write_restart(cs_restart_t *restart, const char *eqname, void *scheme_context)
Write additional arrays (not defined as fields) but useful for the checkpoint/restart process...
Definition: cs_cdofb_vecteq.c:1177
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
void cs_cdofb_vecteq_build_system(const cs_mesh_t *mesh, const cs_real_t *field_val, double dt_cur, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data, cs_real_t *rhs, cs_matrix_t *matrix)
Build the linear system arising from a vector convection/diffusion equation with a CDO face-based sch...
Definition: cs_cdofb_vecteq.c:686
void * cs_cdofb_vecteq_free_context(void *data)
Destroy a cs_cdofb_vecteq_t structure.
Definition: cs_cdofb_vecteq.c:568
Set of local quantities and connectivities related to a mesh cell This is a key structure for all cel...
Definition: cs_cdo_local.h:163
const cs_matrix_structure_t * cs_cdofb_vecteq_matrix_structure(void)
Get the pointer to the related cs_matrix_structure_t.
Definition: cs_cdofb_vecteq.c:359
Definition: cs_cdo_connect.h:74
Definition: field.f90:27
bool cs_cdofb_vecteq_is_initialized(void)
Check if the generic structures for building a CDO-Fb scheme are allocated.
Definition: cs_cdofb_vecteq.c:272
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:94
void cs_cdofb_vecteq_finalize_common(void)
Free work buffer and general structure related to CDO face-based schemes.
Definition: cs_cdofb_vecteq.c:396
void matrix(const int *iconvp, const int *idiffp, const int *ndircp, const int *isym, const cs_real_t *thetap, const int *imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:111
Set of arrays and local (small) dense matrices related to a mesh cell This is a key structure for bui...
Definition: cs_cdo_local.h:112
void cs_cdofb_vecteq_read_restart(cs_restart_t *restart, const char *eqname, void *scheme_context)
Read additional arrays (not defined as fields) but useful for the checkpoint/restart process...
Definition: cs_cdofb_vecteq.c:1096
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:90
Definition: cs_mesh.h:63
struct _cs_restart_t cs_restart_t
Definition: cs_restart.h:86
void cs_cdofb_vecteq_init_common(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step, const cs_matrix_structure_t *ms)
Allocate work buffer and general structures related to CDO vector-valued face-based schemes...
Definition: cs_cdofb_vecteq.c:294
Set of local and temporary buffers useful for building the algebraic system with a cellwise process...
Definition: cs_cdo_local.h:75
void cs_cdofb_vecteq_extra_op(const char *eqname, const cs_field_t *field, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data)
Predefined extra-operations related to this equation.
Definition: cs_cdofb_vecteq.c:998
void cs_cdofb_vecteq_initialize_system(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data, cs_matrix_t **system_matrix, cs_real_t **system_rhs)
Create the matrix of the current algebraic system. Allocate and initialize the right-hand side associ...
Definition: cs_cdofb_vecteq.c:601
#define END_C_DECLS
Definition: cs_defs.h:463
unsigned short int cs_flag_t
Definition: cs_defs.h:299
void cs_cdofb_vecteq_get(cs_cell_sys_t **csys, cs_cell_builder_t **cb)
Retrieve work buffers used for building a CDO system cellwise.
Definition: cs_cdofb_vecteq.c:374
Definition: cs_cdofb_priv.h:51
cs_real_t * cs_cdofb_vecteq_get_face_values(void *context)
Retrieve an array of values at mesh faces for the current context. The lifecycle of this array is man...
Definition: cs_cdofb_vecteq.c:1074
void cs_cdofb_vecteq_set_dir_bc(const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, cs_real_t t_eval, cs_real_t field_val[])
Set the boundary conditions known from the settings when the fields stem from a vector CDO face-based...
Definition: cs_cdofb_vecteq.c:643
Structure and routines handling the specific settings related to a cs_equation_t structure.
struct _cs_matrix_structure_t cs_matrix_structure_t
Definition: cs_matrix.h:86
void cs_cdofb_vecteq_update_field(const cs_real_t *solu, const cs_real_t *rhs, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data, cs_real_t *field_val)
Store solution(s) of the linear system into a field structure Update extra-field values if required (...
Definition: cs_cdofb_vecteq.c:958
Definition: mesh.f90:26
cs_real_t * cs_cdofb_vecteq_get_cell_values(void *context)
Get the computed values at mesh cells from the inverse operation w.r.t. the static condensation (DoF ...
Definition: cs_cdofb_vecteq.c:1053