programmer's documentation
cs_cdovcb_scaleq.h
Go to the documentation of this file.
1 #ifndef __CS_CDOVCB_SCALEQ_H__
2 #define __CS_CDOVCB_SCALEQ_H__
3 
4 /*============================================================================
5  * Build an algebraic CDO vertex+cell-based system for scalar conv./diff. eq.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_base.h"
33 #include "cs_time_step.h"
34 #include "cs_mesh.h"
35 #include "cs_field.h"
36 #include "cs_cdo_connect.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_equation_param.h"
39 #include "cs_source_term.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Algebraic system for CDO vertex-based discretization */
54 typedef struct _cs_cdovcb_scaleq_t cs_cdovcb_scaleq_t;
55 
56 /*============================================================================
57  * Public function prototypes
58  *============================================================================*/
59 
60 /*----------------------------------------------------------------------------*/
68 /*----------------------------------------------------------------------------*/
69 
70 void
72  const cs_cdo_connect_t *connect,
73  const cs_time_step_t *time_step);
74 
75 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 
82 void
84 
85 /*----------------------------------------------------------------------------*/
90 /*----------------------------------------------------------------------------*/
91 
92 void
94 
95 /*----------------------------------------------------------------------------*/
104 /*----------------------------------------------------------------------------*/
105 
106 void *
108  const cs_mesh_t *mesh);
109 
110 /*----------------------------------------------------------------------------*/
118 /*----------------------------------------------------------------------------*/
119 
120 void *
121 cs_cdovcb_scaleq_free(void *builder);
122 
123 /*----------------------------------------------------------------------------*/
130 /*----------------------------------------------------------------------------*/
131 
132 void
133 cs_cdovcb_scaleq_monitor(const char *eqname,
134  const void *builder);
135 
136 /*----------------------------------------------------------------------------*/
142 /*----------------------------------------------------------------------------*/
143 
144 void
145 cs_cdovcb_scaleq_compute_source(void *builder);
146 
147 /*----------------------------------------------------------------------------*/
157 /*----------------------------------------------------------------------------*/
158 
159 void
161  cs_matrix_t **system_matrix,
162  cs_real_t **system_rhs);
163 
164 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 void
181  const cs_real_t *field_val,
182  double dt_cur,
183  void *builder,
184  cs_real_t *rhs,
186 
187 /*----------------------------------------------------------------------------*/
197 /*----------------------------------------------------------------------------*/
198 
199 void
201  const cs_real_t *rhs,
202  void *builder,
203  cs_real_t *field_val);
204 
205 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 double *
218 cs_cdovcb_scaleq_get_cell_values(const void *builder);
219 
220 /*----------------------------------------------------------------------------*/
231 /*----------------------------------------------------------------------------*/
232 
233 void
235  const cs_real_t *pdi,
236  int ml_id,
237  void *builder,
238  double *diff_flux,
239  double *conv_flux);
240 
241 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
252 void
254  void *builder,
255  cs_flag_t location,
256  cs_real_t *diff_flux);
257 
258 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 void
269 cs_cdovcb_scaleq_extra_op(const char *eqname,
270  const cs_field_t *field,
271  void *builder);
272 
273 /*----------------------------------------------------------------------------*/
274 
276 
277 #endif /* __CS_CDOVCB_SCALEQ_H__ */
time step descriptor
Definition: cs_time_step.h:51
void cs_cdovcb_scaleq_set_shared_pointers(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Set shared pointers from the main domain members.
Definition: cs_cdovcb_scaleq.c:480
void cs_cdovcb_scaleq_compute_source(void *builder)
Compute the contributions of source terms (store inside builder)
Definition: cs_cdovcb_scaleq.c:880
Field descriptor.
Definition: cs_field.h:124
void * cs_cdovcb_scaleq_init(const cs_equation_param_t *eqp, const cs_mesh_t *mesh)
Initialize a cs_cdovcb_scaleq_t structure.
Definition: cs_cdovcb_scaleq.c:577
Definition: cs_equation_param.h:100
void cs_cdovcb_scaleq_initialize_system(void *builder, 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_cdovcb_scaleq.c:976
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
void cs_cdovcb_scaleq_update_field(const cs_real_t *solu, const cs_real_t *rhs, void *builder, cs_real_t *field_val)
Store solution(s) of the linear system into a field structure Update extra-field values if required (...
Definition: cs_cdovcb_scaleq.c:1387
Definition: cs_cdo_connect.h:56
void * cs_cdovcb_scaleq_free(void *builder)
Destroy a cs_cdovcb_scaleq_t structure.
Definition: cs_cdovcb_scaleq.c:818
Definition: field.f90:27
void cs_cdovcb_scaleq_initialize(void)
Allocate work buffer and general structures related to CDO vertex+cell-based schemes.
Definition: cs_cdovcb_scaleq.c:498
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:102
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
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:90
Definition: cs_mesh.h:63
void cs_cdovcb_scaleq_extra_op(const char *eqname, const cs_field_t *field, void *builder)
Predefined extra-operations related to this equation.
Definition: cs_cdovcb_scaleq.c:1767
void cs_cdovcb_scaleq_monitor(const char *eqname, const void *builder)
Display information related to the monitoring of the current system.
Definition: cs_cdovcb_scaleq.c:860
void cs_cdovcb_scaleq_compute_flux_across_plane(const cs_real_t direction[], const cs_real_t *pdi, int ml_id, void *builder, double *diff_flux, double *conv_flux)
Compute the diffusive and convective flux across a list of faces.
Definition: cs_cdovcb_scaleq.c:1460
#define END_C_DECLS
Definition: cs_defs.h:452
unsigned short int cs_flag_t
Definition: cs_defs.h:299
void cs_cdovcb_scaleq_cellwise_diff_flux(const cs_real_t *values, void *builder, cs_flag_t location, cs_real_t *diff_flux)
Cellwise computation of the diffusive flux.
Definition: cs_cdovcb_scaleq.c:1635
void cs_cdovcb_scaleq_finalize(void)
Free buffers and generic structures related to CDO vertex+cell-based schemes.
Definition: cs_cdovcb_scaleq.c:543
double * cs_cdovcb_scaleq_get_cell_values(const void *builder)
Get the computed values at cell centers (DoF used in the linear system are located at primal vertices...
Definition: cs_cdovcb_scaleq.c:1436
void cs_cdovcb_scaleq_build_system(const cs_mesh_t *mesh, const cs_real_t *field_val, double dt_cur, void *builder, cs_real_t *rhs, cs_matrix_t *matrix)
Build the linear system arising from a scalar convection/diffusion equation with a CDO vertex+cell-ba...
Definition: cs_cdovcb_scaleq.c:1023
Definition: mesh.f90:26