9.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-2026 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 "base/cs_field.h"
33#include "base/cs_restart.h"
34#include "cdo/cs_cdo_toolbox.h"
37
38/*============================================================================
39 * Macro definitions
40 *============================================================================*/
41
42/*============================================================================
43 * Type definitions
44 *============================================================================*/
45
46/*----------------------------------------------------------------------------
47 * Function pointer types
48 *----------------------------------------------------------------------------*/
49
50/*----------------------------------------------------------------------------*/
62/*----------------------------------------------------------------------------*/
63
64typedef void *
66 int var_id,
67 int bflux_id,
69
70/*----------------------------------------------------------------------------*/
78/*----------------------------------------------------------------------------*/
79
80typedef void *
81(cs_equation_free_context_t)(void *scheme_context);
82
83/*----------------------------------------------------------------------------*/
94/*----------------------------------------------------------------------------*/
95
96typedef void
98 const int field_id,
99 const cs_mesh_t *mesh,
100 const cs_equation_param_t *eqp,
102 void *context);
103
104/*----------------------------------------------------------------------------*/
115/*----------------------------------------------------------------------------*/
116
117typedef void
118(cs_equation_solve_t)(bool cur2prev,
119 const cs_mesh_t *mesh,
120 const int field_id,
121 const cs_equation_param_t *eqp,
123 void *eqc);
124
125/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
138typedef void
140 const cs_mesh_t *mesh,
141 const cs_equation_param_t *eqp,
143 void *context,
144 cs_real_t field_val[]);
145
146/*----------------------------------------------------------------------------*/
156/*----------------------------------------------------------------------------*/
157
158typedef void
160 const cs_real_t *field_val,
161 const cs_equation_param_t *eqp,
163 void *context);
164
165/*----------------------------------------------------------------------------*/
175/*----------------------------------------------------------------------------*/
176
177typedef void
179 void *eq_to_cast,
180 cs_real_t *p_x[]);
181
182/*----------------------------------------------------------------------------*/
194/*----------------------------------------------------------------------------*/
195
196typedef void
198 const cs_real_t *rhs,
199 const cs_equation_param_t *eqp,
201 void *context,
202 cs_real_t *field_val);
203
204/*----------------------------------------------------------------------------*/
215/*----------------------------------------------------------------------------*/
216
220 void *context);
221
222/*----------------------------------------------------------------------------*/
236/*----------------------------------------------------------------------------*/
237
238typedef void
241 void *context,
242 const cs_property_t *property,
243 const cs_real_t *pot,
244 cs_flag_t loc_res,
245 cs_real_t *res);
246
247/*----------------------------------------------------------------------------*/
255/*----------------------------------------------------------------------------*/
256
257typedef void
260 void *context);
261
262/*----------------------------------------------------------------------------*/
270/*----------------------------------------------------------------------------*/
271
272typedef void
274 cs_cell_builder_t **cb);
275
276/*----------------------------------------------------------------------------*/
288/*----------------------------------------------------------------------------*/
289
290typedef cs_real_t *
291(cs_equation_get_values_t)(void *scheme_context,
292 bool previous);
293
294/*----------------------------------------------------------------------------*/
303/*----------------------------------------------------------------------------*/
304
305typedef void
307 const char *eqname,
308 void *scheme_context);
309
310/*----------------------------------------------------------------------------
311 * Structure type
312 *----------------------------------------------------------------------------*/
313
320
335 int id;
339
340 /* Timer statistic for a coarse profiling */
341
349
366
372
429
433
438
441
446
448
449 /* Deprecated functions --> use rather solve() and solve_steady_state()
450 * Only HHO schemes rely on these functions
451 */
452
457
462};
463
464/*============================================================================
465 * Public function prototypes
466 *============================================================================*/
467
468#endif /* CS_EQUATION_PRIV_H */
#define restrict
Definition: cs_defs.h:148
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
unsigned short int cs_flag_t
Definition: cs_defs.h:334
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:306
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:218
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:197
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:118
void *() cs_equation_free_context_t(void *scheme_context)
Destroy a scheme data structure.
Definition: cs_equation_priv.h:81
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:159
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,...
Definition: cs_equation_priv.h:291
void *() cs_equation_init_context_t(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:65
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:258
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:139
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....
Definition: cs_equation_priv.h:273
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:239
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:97
void() cs_equation_prepare_solve_t(const cs_mesh_t *mesh, 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:178
struct _cs_restart_t cs_restart_t
Definition: cs_restart.h:91
double precision, dimension(:,:), pointer solu
Definition: atincl.f90:260
Definition: mesh.f90:26
Definition: cs_equation_priv.h:319
cs_equation_init_values_t * init_field_values
Definition: cs_equation_priv.h:430
cs_equation_get_builders_t * get_cw_build_structures
Definition: cs_equation_priv.h:447
cs_equation_solve_t * solve_steady_state
Definition: cs_equation_priv.h:431
void * scheme_context
Definition: cs_equation_priv.h:371
cs_equation_solve_t * solve
Definition: cs_equation_priv.h:432
cs_equation_get_values_t * get_edge_values
Definition: cs_equation_priv.h:444
cs_equation_builder_t * builder
Definition: cs_equation_priv.h:365
cs_equation_restart_t * write_restart
Definition: cs_equation_priv.h:440
int field_id
Definition: cs_equation_priv.h:337
cs_equation_extra_op_t * postprocess
Definition: cs_equation_priv.h:436
cs_equation_get_values_t * get_face_values
Definition: cs_equation_priv.h:443
int boundary_flux_id
Definition: cs_equation_priv.h:338
char *restrict varname
Definition: cs_equation_priv.h:336
cs_equation_restart_t * read_restart
Definition: cs_equation_priv.h:439
cs_equation_param_t * param
Definition: cs_equation_priv.h:348
cs_equation_free_context_t * free_context
Definition: cs_equation_priv.h:428
int main_ts_id
Definition: cs_equation_priv.h:342
int id
Definition: cs_equation_priv.h:335
cs_equation_init_context_t * init_context
Definition: cs_equation_priv.h:427
cs_equation_prepare_solve_t * prepare_solving
Definition: cs_equation_priv.h:455
cs_equation_get_values_t * get_vertex_values
Definition: cs_equation_priv.h:445
cs_equation_extra_op_t * current_to_previous
Definition: cs_equation_priv.h:437
cs_equation_set_dir_bc_t * set_dir_bc
Definition: cs_equation_priv.h:453
cs_equation_get_values_t * get_cell_values
Definition: cs_equation_priv.h:442
cs_equation_apply_sitffness_t * apply_stiffness
Definition: cs_equation_priv.h:435
cs_equation_update_field_t * update_field
Definition: cs_equation_priv.h:456
cs_equation_get_balance_t * compute_balance
Definition: cs_equation_priv.h:434
cs_equation_build_system_t * build_system
Definition: cs_equation_priv.h:454
Definition: cs_cdo_toolbox.h:64
Set of local and temporary buffers.
Definition: cs_cdo_local.h:56
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:163
Store common elements used when building an algebraic system related to an equation.
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:190
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.