programmer's documentation
cs_cdovb_vecteq.h
Go to the documentation of this file.
1 #ifndef __CS_CDOVB_VECTEQ_H__
2 #define __CS_CDOVB_VECTEQ_H__
3 
4 /*============================================================================
5  * Build an algebraic CDO vertex-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  * Local headers
31  *----------------------------------------------------------------------------*/
32 
33 #include "cs_base.h"
34 #include "cs_cdo_connect.h"
35 #include "cs_cdo_local.h"
36 #include "cs_cdo_quantities.h"
37 #include "cs_cdovb_priv.h"
38 #include "cs_equation_common.h"
39 #include "cs_equation_param.h"
40 #include "cs_field.h"
41 #include "cs_matrix.h"
42 #include "cs_mesh.h"
43 #include "cs_source_term.h"
44 #include "cs_time_step.h"
45 
46 /*----------------------------------------------------------------------------*/
47 
49 
50 /*============================================================================
51  * Macro definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Type definitions
56  *============================================================================*/
57 
58 /* Algebraic system for CDO vertex-based discretization */
59 typedef struct _cs_cdovb_t cs_cdovb_vecteq_t;
60 
61 /*============================================================================
62  * Public function prototypes
63  *============================================================================*/
64 
65 /*----------------------------------------------------------------------------*/
72 /*----------------------------------------------------------------------------*/
73 
74 bool
76 
77 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 
90 void
92  const cs_cdo_connect_t *connect,
93  const cs_time_step_t *time_step,
94  const cs_matrix_structure_t *ms);
95 
96 /*----------------------------------------------------------------------------*/
103 /*----------------------------------------------------------------------------*/
104 
105 void
107  cs_cell_builder_t **cb);
108 
109 /*----------------------------------------------------------------------------*/
114 /*----------------------------------------------------------------------------*/
115 
116 void
118 
119 /*----------------------------------------------------------------------------*/
131 /*----------------------------------------------------------------------------*/
132 
133 void *
135  int var_id,
136  int bflux_id,
137  cs_equation_builder_t *eqb);
138 
139 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 void *
150 cs_cdovb_vecteq_free_context(void *builder);
151 
152 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 void
169  void *data,
170  cs_matrix_t **system_matrix,
171  cs_real_t **system_rhs);
172 
173 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
186 void
188  const cs_equation_param_t *eqp,
190  cs_real_t t_eval,
191  cs_real_t field_val[]);
192 
193 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 void
212  const cs_real_t *field_val,
213  double dt_cur,
214  const cs_equation_param_t *eqp,
216  void *data,
217  cs_real_t *rhs,
219 
220 /*----------------------------------------------------------------------------*/
232 /*----------------------------------------------------------------------------*/
233 
234 void
236  const cs_real_t *rhs,
237  const cs_equation_param_t *eqp,
239  void *data,
240  cs_real_t *field_val);
241 
242 /*----------------------------------------------------------------------------*/
253 /*----------------------------------------------------------------------------*/
254 
255 cs_real_t *
256 cs_cdovb_vecteq_get_vertex_values(void *context);
257 
258 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 
272 cs_real_t *
273 cs_cdovb_vecteq_get_cell_values(void *context);
274 
275 /*----------------------------------------------------------------------------*/
288 /*----------------------------------------------------------------------------*/
289 
290 void
292  const cs_real_t *pdi,
293  int ml_id,
294  const cs_equation_param_t *eqp,
296  void *data,
297  double *d_flux,
298  double *c_flux);
299 
300 /*----------------------------------------------------------------------------*/
312 /*----------------------------------------------------------------------------*/
313 
314 void
316  const cs_equation_param_t *eqp,
317  cs_real_t t_eval,
319  void *data,
320  cs_flag_t location,
321  cs_real_t *diff_flux);
322 
323 /*----------------------------------------------------------------------------*/
333 /*----------------------------------------------------------------------------*/
334 
335 void
336 cs_cdovb_vecteq_extra_op(const char *eqname,
337  const cs_field_t *field,
338  const cs_equation_param_t *eqp,
340  void *data);
341 
342 /*----------------------------------------------------------------------------*/
343 
345 
346 #endif /* __CS_CDOVB_VECTEQ_H__ */
Store common elements used when building an algebraic system related to an equation.
Definition: cs_equation_common.h:63
Structures for building an algebraic CDO vertex-based system for unsteady convection-diffusion-reacti...
time step descriptor
Definition: cs_time_step.h:51
void cs_cdovb_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_cdovb_vecteq.c:1121
cs_real_t * cs_cdovb_vecteq_get_vertex_values(void *context)
Retrieve an array of values at mesh vertices for the variable field associated to the given context T...
Definition: cs_cdovb_vecteq.c:946
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_cdovb_vecteq_init_context(const cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
Initialize a cs_cdovb_vecteq_t structure storing data useful for building and managing such a scheme...
Definition: cs_cdovb_vecteq.c:409
bool cs_cdovb_vecteq_is_initialized(void)
Check if the generic structures for building a CDO-Vb scheme are allocated.
Definition: cs_cdovb_vecteq.c:261
void cs_cdovb_vecteq_compute_flux_across_plane(const cs_real_t normal[], const cs_real_t *pdi, int ml_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data, double *d_flux, double *c_flux)
Compute the diffusive and convective flux across a list of faces.
Definition: cs_cdovb_vecteq.c:1006
void cs_cdovb_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_cdovb_vecteq.c:616
Definition: cs_cdovb_priv.h:63
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
void cs_cdovb_vecteq_finalize_common(void)
Free work buffer and general structure related to CDO vertex-based schemes.
Definition: cs_cdovb_vecteq.c:373
Definition: cs_cdo_connect.h:74
Definition: field.f90:27
void cs_cdovb_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 vertex-based s...
Definition: cs_cdovb_vecteq.c:700
void cs_cdovb_vecteq_cellwise_diff_flux(const cs_real_t *values, const cs_equation_param_t *eqp, cs_real_t t_eval, cs_equation_builder_t *eqb, void *data, cs_flag_t location, cs_real_t *diff_flux)
Cellwise computation of the diffusive flux.
Definition: cs_cdovb_vecteq.c:1073
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:94
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
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:90
Definition: cs_mesh.h:63
cs_real_t * cs_cdovb_vecteq_get_cell_values(void *context)
Compute an array of values at mesh cells by interpolating the variable field associated to the given ...
Definition: cs_cdovb_vecteq.c:969
void cs_cdovb_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_cdovb_vecteq.c:910
void cs_cdovb_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 vertex-based schemes Set shared pointers...
Definition: cs_cdovb_vecteq.c:283
Set of local and temporary buffers useful for building the algebraic system with a cellwise process...
Definition: cs_cdo_local.h:75
#define END_C_DECLS
Definition: cs_defs.h:463
unsigned short int cs_flag_t
Definition: cs_defs.h:299
void * cs_cdovb_vecteq_free_context(void *builder)
Destroy a cs_cdovb_vecteq_t structure.
Definition: cs_cdovb_vecteq.c:585
void cs_cdovb_vecteq_get(cs_cell_sys_t **csys, cs_cell_builder_t **cb)
Retrieve work buffers used for building a CDO system cellwise.
Definition: cs_cdovb_vecteq.c:351
void cs_cdovb_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 vertex-bas...
Definition: cs_cdovb_vecteq.c:657
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
Definition: mesh.f90:26