My Project
programmer's documentation
Loading...
Searching...
No Matches
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 * Routines 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-2019 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_equation_param.h"
33#include "cs_equation_common.h"
34#include "cs_field.h"
35#include "cs_param.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
68typedef void *
70 int var_id,
71 int bflux_id,
73
74/*----------------------------------------------------------------------------*/
82/*----------------------------------------------------------------------------*/
83
84typedef void *
85(cs_equation_free_context_t)(void *scheme_context);
86
87/*----------------------------------------------------------------------------*/
98/*----------------------------------------------------------------------------*/
99
100typedef void
102 const int field_id,
103 const cs_mesh_t *mesh,
104 const cs_equation_param_t *eqp,
106 void *context);
107
108/*----------------------------------------------------------------------------*/
118/*----------------------------------------------------------------------------*/
119
120typedef void
122 const int field_id,
123 const cs_equation_param_t *eqp,
125 void *eqc);
126
127/*----------------------------------------------------------------------------*/
138/*----------------------------------------------------------------------------*/
139
140typedef void
142 const cs_mesh_t *mesh,
143 const cs_equation_param_t *eqp,
145 void *context,
146 cs_real_t field_val[]);
147
148/*----------------------------------------------------------------------------*/
160/*----------------------------------------------------------------------------*/
161
162typedef void
165 void *data,
166 cs_matrix_t **system_matrix,
167 cs_real_t **system_rhs);
168
169/*----------------------------------------------------------------------------*/
181/*----------------------------------------------------------------------------*/
182
183typedef void
185 const cs_real_t *field_val,
186 const cs_equation_param_t *eqp,
188 void *data,
189 cs_real_t *rhs,
191
192/*----------------------------------------------------------------------------*/
202/*----------------------------------------------------------------------------*/
203
204typedef void
205(cs_equation_prepare_solve_t)(void *eq_to_cast,
206 cs_real_t *p_x[],
207 cs_real_t *p_rhs[]);
208
209/*----------------------------------------------------------------------------*/
221/*----------------------------------------------------------------------------*/
222
223typedef void
225 const cs_real_t *rhs,
226 const cs_equation_param_t *eqp,
228 void *data,
229 cs_real_t *field_val);
230
231/*----------------------------------------------------------------------------*/
242/*----------------------------------------------------------------------------*/
243
247 void *context);
248
249/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
261typedef void
262(cs_equation_extra_op_t)(const char *eqname,
263 const cs_field_t *field,
264 const cs_equation_param_t *eqp,
266 void *data);
267
268/*----------------------------------------------------------------------------*/
279/*----------------------------------------------------------------------------*/
280
281typedef cs_real_t *
282(cs_equation_get_values_t)(void *scheme_context);
283
284/*----------------------------------------------------------------------------*/
293/*----------------------------------------------------------------------------*/
294
295typedef void
297 const char *eqname,
298 void *scheme_context);
299
300/*----------------------------------------------------------------------------
301 * Structure type
302 *----------------------------------------------------------------------------*/
303
311
312 int id;
313
314 cs_equation_param_t *param; /* Set of parameters related to an equation */
315
316 /* Variable attached to this equation is defined as a cs_field_t structure */
320
321 /* Algebraic system */
322 /* ---------------- */
323
324 /* There are possibly two different sizes for the linear system to handle
325 - One for "scatter"-type operations based on the number of geometrical
326 entities owned by the local instance of the mesh
327 - One for "gather"-type operations based on a balance of the number of
328 DoFs from a algebraic point of view. In parallel runs, these two sizes
329 can be different.
330 n_sles_gather_elts <= n_sles_scatter_elts
331 */
332
335
336 /* Right-hand side defined by a local cellwise building. This may be
337 different from the rhs given to cs_sles_solve() in parallel mode. */
339
340 /* Matrix to inverse with cs_sles_solve() The matrix size can be different
341 from the rhs size in parallel mode since the decomposition is different */
343
344 /* Range set to handle parallelism. Shared with cs_cdo_connect_t struct.*/
346
347 /* \var builder
348 * Common members for building the algebraic system between the numerical
349 * schemes
350 */
352
353 /* Data depending on the numerical scheme (cast on-the-fly) */
355
356 /* Pointer to functions (see prototypes just above) */
359
363
368
372
373 /* Deprecated functions --> use rather solve() and solve_steady_state() */
379
380 /* Timer statistic for a coarse profiling */
381 int main_ts_id; /* Id of the main timer stats for this equation */
382
383};
384
385/*============================================================================
386 * Public function prototypes
387 *============================================================================*/
388
389
390/*----------------------------------------------------------------------------*/
391
393
394#endif /* __CS_EQUATION_PRIV_H__ */
#define restrict
Definition cs_defs.h:127
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
Structure and routines handling the specific settings related to a cs_equation_t structure.
void() cs_equation_solve_t(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:121
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:296
cs_real_t *() cs_equation_get_values_t(void *scheme_context)
Compute or retrieve an array of values at a given mesh location Currently, vertices,...
Definition cs_equation_priv.h:282
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 *data, cs_real_t *rhs, cs_matrix_t *matrix)
Build a linear system within the CDO framework.
Definition cs_equation_priv.h:184
void *() cs_equation_free_context_t(void *scheme_context)
Destroy a scheme data structure.
Definition cs_equation_priv.h:85
void() cs_equation_extra_op_t(const char *eqname, const cs_field_t *field, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data)
Extra-operation related to this equation.
Definition cs_equation_priv.h:262
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
void() cs_equation_initialize_system_t(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_equation_priv.h:163
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 *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_equation_priv.h:224
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:141
void() cs_equation_prepare_solve_t(void *eq_to_cast, cs_real_t *p_x[], cs_real_t *p_rhs[])
Carry out operations for allocating and/or initializing the solution array and the right hand side of...
Definition cs_equation_priv.h:205
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
cs_equation_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:245
struct _cs_matrix_t cs_matrix_t
Definition cs_matrix.h:90
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_restart_t cs_restart_t
Definition cs_restart.h:87
Definition field.f90:27
Definition mesh.f90:26
Definition cs_equation_priv.h:310
int field_id
Definition cs_equation_priv.h:318
cs_equation_restart_t * write_restart
Definition cs_equation_priv.h:367
cs_equation_extra_op_t * postprocess
Definition cs_equation_priv.h:365
void * scheme_context
Definition cs_equation_priv.h:354
cs_real_t * rhs
Definition cs_equation_priv.h:338
cs_lnum_t n_sles_scatter_elts
Definition cs_equation_priv.h:333
cs_equation_solve_t * solve_steady_state
Definition cs_equation_priv.h:361
cs_lnum_t n_sles_gather_elts
Definition cs_equation_priv.h:334
cs_matrix_t * matrix
Definition cs_equation_priv.h:342
cs_equation_initialize_system_t * initialize_system
Definition cs_equation_priv.h:374
int boundary_flux_id
Definition cs_equation_priv.h:319
cs_equation_builder_t * builder
Definition cs_equation_priv.h:351
int main_ts_id
Definition cs_equation_priv.h:381
cs_equation_param_t * param
Definition cs_equation_priv.h:314
int id
Definition cs_equation_priv.h:312
char *restrict varname
Definition cs_equation_priv.h:317
cs_equation_prepare_solve_t * prepare_solving
Definition cs_equation_priv.h:377
const cs_range_set_t * rset
Definition cs_equation_priv.h:345
cs_equation_get_values_t * get_face_values
Definition cs_equation_priv.h:369
cs_equation_get_balance_t * compute_balance
Definition cs_equation_priv.h:364
cs_equation_solve_t * solve
Definition cs_equation_priv.h:362
cs_equation_free_context_t * free_context
Definition cs_equation_priv.h:358
cs_equation_set_dir_bc_t * set_dir_bc
Definition cs_equation_priv.h:375
cs_equation_init_context_t * init_context
Definition cs_equation_priv.h:357
cs_equation_update_field_t * update_field
Definition cs_equation_priv.h:378
cs_equation_restart_t * read_restart
Definition cs_equation_priv.h:366
cs_equation_init_values_t * init_field_values
Definition cs_equation_priv.h:360
cs_equation_get_values_t * get_cell_values
Definition cs_equation_priv.h:370
cs_equation_build_system_t * build_system
Definition cs_equation_priv.h:376
cs_equation_get_values_t * get_vertex_values
Definition cs_equation_priv.h:371
Definition cs_equation_common.h:156
Store common elements used when building an algebraic system related to an equation.
Definition cs_equation_common.h:61
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition cs_equation_param.h:148
Field descriptor.
Definition cs_field.h:124
Definition cs_mesh.h:63
Definition cs_range_set.h:57