7.2
general documentation
cs_equation_priv.h
Go to the documentation of this file.
1 #ifndef __CS_EQUATION_PRIV_H__
2 #define __CS_EQUATION_PRIV_H__
3 
4 /*============================================================================
5  * Functions to handle cs_equation_t structure and its related structures
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2022 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_cdo_toolbox.h"
33 #include "cs_equation_param.h"
34 #include "cs_equation_builder.h"
35 #include "cs_field.h"
36 #include "cs_restart.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /*============================================================================
47  * Type definitions
48  *============================================================================*/
49 
50 /*----------------------------------------------------------------------------
51  * Function pointer types
52  *----------------------------------------------------------------------------*/
53 
54 /*----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------*/
67 
68 typedef void *
70  int var_id,
71  int bflux_id,
73 
74 /*----------------------------------------------------------------------------*/
82 /*----------------------------------------------------------------------------*/
83 
84 typedef void *
85 (cs_equation_free_context_t)(void *scheme_context);
86 
87 /*----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------*/
99 
100 typedef void
102  const int field_id,
103  const cs_mesh_t *mesh,
104  const cs_equation_param_t *eqp,
106  void *context);
107 
108 /*----------------------------------------------------------------------------*/
119 /*----------------------------------------------------------------------------*/
120 
121 typedef void
122 (cs_equation_solve_t)(bool cur2prev,
123  const cs_mesh_t *mesh,
124  const int field_id,
125  const cs_equation_param_t *eqp,
127  void *eqc);
128 
129 /*----------------------------------------------------------------------------*/
140 /*----------------------------------------------------------------------------*/
141 
142 typedef void
144  const cs_mesh_t *mesh,
145  const cs_equation_param_t *eqp,
147  void *context,
148  cs_real_t field_val[]);
149 
150 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
162 typedef void
164  const cs_real_t *field_val,
165  const cs_equation_param_t *eqp,
167  void *context);
168 
169 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
180 typedef void
181 (cs_equation_prepare_solve_t)(void *eq_to_cast,
182  cs_real_t *p_x[]);
183 
184 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 typedef void
200  const cs_real_t *rhs,
201  const cs_equation_param_t *eqp,
203  void *context,
204  cs_real_t *field_val);
205 
206 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 typedef cs_cdo_balance_t *
222  void *context);
223 
224 /*----------------------------------------------------------------------------*/
238 /*----------------------------------------------------------------------------*/
239 
240 typedef void
243  void *context,
244  const cs_property_t *property,
245  const cs_real_t *pot,
246  cs_flag_t loc_res,
247  cs_real_t *res);
248 
249 /*----------------------------------------------------------------------------*/
257 /*----------------------------------------------------------------------------*/
258 
259 typedef void
262  void *context);
263 
264 /*----------------------------------------------------------------------------*/
272 /*----------------------------------------------------------------------------*/
273 
274 typedef void
276  cs_cell_builder_t **cb);
277 
278 /*----------------------------------------------------------------------------*/
290 /*----------------------------------------------------------------------------*/
291 
292 typedef cs_real_t *
293 (cs_equation_get_values_t)(void *scheme_context,
294  bool previous);
295 
296 /*----------------------------------------------------------------------------*/
305 /*----------------------------------------------------------------------------*/
306 
307 typedef void
309  const char *eqname,
310  void *scheme_context);
311 
312 /*----------------------------------------------------------------------------
313  * Structure type
314  *----------------------------------------------------------------------------*/
315 
322 
337  int id;
339  int field_id;
341 
342  /* Timer statistic for a coarse profiling */
343 
351 
368 
374 
431 
435 
440 
443 
448 
450 
451  /* Deprecated functions --> use rather solve() and solve_steady_state()
452  * Only HHO schemes rely on these functions
453  */
454 
459 
464 };
465 
466 /*============================================================================
467  * Public function prototypes
468  *============================================================================*/
469 
470 
471 /*----------------------------------------------------------------------------*/
472 
474 
475 #endif /* __CS_EQUATION_PRIV_H__ */
cs_equation_set_dir_bc_t * set_dir_bc
Definition: cs_equation_priv.h:455
Store common elements used when building an algebraic system related to an equation.
cs_equation_get_balance_t * compute_balance
Definition: cs_equation_priv.h:436
#define restrict
Definition: cs_defs.h:142
cs_equation_get_values_t * get_face_values
Definition: cs_equation_priv.h:445
cs_equation_update_field_t * update_field
Definition: cs_equation_priv.h:458
cs_equation_init_values_t * init_field_values
Definition: cs_equation_priv.h:432
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:186
int field_id
Definition: cs_equation_priv.h:339
void() cs_equation_get_builders_t(cs_cell_sys_t **csys, cs_cell_builder_t **cb)
Retrieve cellwise structure including work buffers used to build a CDO system cellwise. Generic prototype for all CDO schemes.
Definition: cs_equation_priv.h:275
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
cs_equation_get_values_t * get_cell_values
Definition: cs_equation_priv.h:444
cs_equation_solve_t * solve
Definition: cs_equation_priv.h:434
void() cs_equation_prepare_solve_t(void *eq_to_cast, cs_real_t *p_x[])
Carry out operations for allocating and/or initializing the solution array and the right hand side of...
Definition: cs_equation_priv.h:181
int boundary_flux_id
Definition: cs_equation_priv.h:340
cs_equation_extra_op_t * current_to_previous
Definition: cs_equation_priv.h:439
cs_equation_param_t * param
Definition: cs_equation_priv.h:350
cs_equation_restart_t * read_restart
Definition: cs_equation_priv.h:441
cs_equation_get_builders_t * get_cw_build_structures
Definition: cs_equation_priv.h:449
void() cs_equation_init_values_t(cs_real_t t_eval, const int field_id, const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Initialize the variable field values related to an equation.
Definition: cs_equation_priv.h:101
void * scheme_context
Definition: cs_equation_priv.h:373
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
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:147
void() cs_equation_restart_t(cs_restart_t *restart, const char *eqname, void *scheme_context)
Generic prototype dedicated to read or write additional arrays (not defined as fields) useful for the...
Definition: cs_equation_priv.h:308
void *() cs_equation_init_context_t(const cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
Initialize a scheme data structure used during the building of the algebraic system.
Definition: cs_equation_priv.h:69
Definition: cs_mesh.h:84
cs_cdo_balance_t *() cs_equation_get_balance_t(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Compute the balance for an equation over the full computational domain between time t_cur and t_cur +...
Definition: cs_equation_priv.h:220
void() cs_equation_apply_sitffness_t(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, const cs_property_t *property, const cs_real_t *pot, cs_flag_t loc_res, cs_real_t *res)
Compute the cellwise stiffness matrix associated to the property given as a parameter and apply it to...
Definition: cs_equation_priv.h:241
void *() cs_equation_free_context_t(void *scheme_context)
Destroy a scheme data structure.
Definition: cs_equation_priv.h:85
struct _cs_restart_t cs_restart_t
Definition: cs_restart.h:93
Set of local and temporary buffers.
Definition: cs_cdo_local.h:60
cs_equation_builder_t * builder
Definition: cs_equation_priv.h:367
cs_equation_restart_t * write_restart
Definition: cs_equation_priv.h:442
void() cs_equation_set_dir_bc_t(cs_real_t t_eval, const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, cs_real_t field_val[])
Set the Dirichlet boundary stemming from the settings.
Definition: cs_equation_priv.h:143
cs_real_t *() cs_equation_get_values_t(void *scheme_context, bool previous)
Compute or retrieve an array of values at a given mesh location Currently, vertices, cells or faces are possible locations The lifecycle of this array is managed by the code. So one does not have to free the return pointer.
Definition: cs_equation_priv.h:293
double precision, dimension(:,:), allocatable solu
Definition: atincl.f90:321
cs_equation_get_values_t * get_vertex_values
Definition: cs_equation_priv.h:447
Definition: cs_cdo_toolbox.h:68
cs_equation_free_context_t * free_context
Definition: cs_equation_priv.h:430
#define END_C_DECLS
Definition: cs_defs.h:511
unsigned short int cs_flag_t
Definition: cs_defs.h:324
cs_equation_solve_t * solve_steady_state
Definition: cs_equation_priv.h:433
cs_equation_extra_op_t * postprocess
Definition: cs_equation_priv.h:438
void() cs_equation_extra_op_t(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Generic prototype for extra-operations related to an equation.
Definition: cs_equation_priv.h:260
cs_equation_apply_sitffness_t * apply_stiffness
Definition: cs_equation_priv.h:437
int main_ts_id
Definition: cs_equation_priv.h:344
void() cs_equation_build_system_t(const cs_mesh_t *mesh, const cs_real_t *field_val, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build a linear system within the CDO framework.
Definition: cs_equation_priv.h:163
cs_equation_build_system_t * build_system
Definition: cs_equation_priv.h:456
void() cs_equation_solve_t(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *eqc)
Build and solve a linear system within the CDO framework.
Definition: cs_equation_priv.h:122
cs_equation_get_values_t * get_edge_values
Definition: cs_equation_priv.h:446
char *restrict varname
Definition: cs_equation_priv.h:338
Structure associated to the definition of a property relying on the cs_xdef_t structure.
int id
Definition: cs_equation_priv.h:337
Definition: cs_equation_priv.h:321
cs_equation_prepare_solve_t * prepare_solving
Definition: cs_equation_priv.h:457
void() cs_equation_update_field_t(const cs_real_t *solu, const cs_real_t *rhs, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, cs_real_t *field_val)
Store solution(s) of the linear system into a field structure Update extra-field values if required (...
Definition: cs_equation_priv.h:199
Definition: mesh.f90:26
cs_equation_init_context_t * init_context
Definition: cs_equation_priv.h:429