9.2
general documentation
cs_cdovb_scaleq.h
Go to the documentation of this file.
1#ifndef CS_CDOVB_SCALEQ_H
2#define CS_CDOVB_SCALEQ_H
3
4/*============================================================================
5 * Build an algebraic CDO vertex-based system for unsteady convection diffusion
6 * reaction of scalar-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-2026 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 "alge/cs_matrix.h"
34#include "base/cs_base.h"
35#include "base/cs_field.h"
36#include "base/cs_time_step.h"
37#include "cdo/cs_cdo_connect.h"
38#include "cdo/cs_cdo_local.h"
40#include "cdo/cs_cdo_toolbox.h"
43#include "cdo/cs_source_term.h"
44#include "mesh/cs_mesh.h"
45
46/*============================================================================
47 * Macro definitions
48 *============================================================================*/
49
50/*============================================================================
51 * Public function prototypes
52 *============================================================================*/
53
54/*----------------------------------------------------------------------------*/
61/*----------------------------------------------------------------------------*/
62
63bool
65
66/*----------------------------------------------------------------------------*/
75/*----------------------------------------------------------------------------*/
76
77void
79 const cs_cdo_connect_t *connect,
80 const cs_time_step_t *time_step);
81
82/*----------------------------------------------------------------------------*/
89/*----------------------------------------------------------------------------*/
90
91void
94
95/*----------------------------------------------------------------------------*/
100/*----------------------------------------------------------------------------*/
101
102void
104
105/*----------------------------------------------------------------------------*/
117/*----------------------------------------------------------------------------*/
118
119void *
121 int var_id,
122 int bflux_id,
124
125/*----------------------------------------------------------------------------*/
133/*----------------------------------------------------------------------------*/
134
135void *
136cs_cdovb_scaleq_free_context(void *scheme_context);
137
138/*----------------------------------------------------------------------------*/
151/*----------------------------------------------------------------------------*/
152
153void
155 const cs_mesh_t *mesh,
156 const cs_equation_param_t *eqp,
158 cs_flag_t vtx_bc_flag[]);
159
160/*----------------------------------------------------------------------------*/
171/*----------------------------------------------------------------------------*/
172
173void
175 cs_real_t t_eval,
176 const cs_equation_param_t *eqp,
178 void *context);
179
180/*----------------------------------------------------------------------------*/
204/*----------------------------------------------------------------------------*/
205
206double
208 cs_lnum_t c_id,
209 bool diag_block,
210 const cs_real_t f_val[],
211 const cs_equation_param_t *eqp,
213 void *context,
215 cs_cell_sys_t *csys);
216
217/*----------------------------------------------------------------------------*/
246/*----------------------------------------------------------------------------*/
247
248double
250 cs_lnum_t c_id,
251 bool diag_block,
252 const cs_real_t f_val[],
253 const cs_equation_param_t *eqp,
255 void *context,
257 cs_cell_sys_t *csys);
258
259/*----------------------------------------------------------------------------*/
272/*----------------------------------------------------------------------------*/
273
274void
276 const int field_id,
277 const cs_mesh_t *mesh,
278 const cs_equation_param_t *eqp,
280 void *context);
281
282/*----------------------------------------------------------------------------*/
295/*----------------------------------------------------------------------------*/
296
297void
299 const cs_mesh_t *mesh,
300 const int field_id,
301 const cs_equation_param_t *eqp,
303 void *context);
304
305/*----------------------------------------------------------------------------*/
323/*----------------------------------------------------------------------------*/
324
325void
327 const cs_mesh_t *mesh,
328 const int field_id,
329 const cs_equation_param_t *eqp,
331 void *context);
332
333/*----------------------------------------------------------------------------*/
347/*----------------------------------------------------------------------------*/
348
349void
351 const cs_mesh_t *mesh,
352 const int field_id,
353 const cs_equation_param_t *eqp,
355 void *context);
356
357/*----------------------------------------------------------------------------*/
376/*----------------------------------------------------------------------------*/
377
378void
380 const cs_mesh_t *mesh,
381 const int field_id,
382 const cs_equation_param_t *eqp,
384 void *context);
385
386/*----------------------------------------------------------------------------*/
400/*----------------------------------------------------------------------------*/
401
402void
403cs_cdovb_scaleq_solve_theta(bool cur2prev,
404 const cs_mesh_t *mesh,
405 const int field_id,
406 const cs_equation_param_t *eqp,
408 void *context);
409
410/*----------------------------------------------------------------------------*/
422/*----------------------------------------------------------------------------*/
423
424cs_real_t *
426 bool previous);
427
428/*----------------------------------------------------------------------------*/
441/*----------------------------------------------------------------------------*/
442
443cs_real_t *
445 bool previous);
446
447/*----------------------------------------------------------------------------*/
462/*----------------------------------------------------------------------------*/
463
464cs_real_t *
467 void *context);
468
469/*----------------------------------------------------------------------------*/
481/*----------------------------------------------------------------------------*/
482
486 void *context);
487
488/*----------------------------------------------------------------------------*/
503/*----------------------------------------------------------------------------*/
504
505void
508 void *context,
509 const cs_property_t *pty,
510 const cs_real_t *pot,
511 cs_flag_t res_loc,
512 cs_real_t *res);
513
514/*----------------------------------------------------------------------------*/
532/*----------------------------------------------------------------------------*/
533
534void
536 const cs_equation_param_t *eqp,
537 const cs_property_t *diff_pty,
538 const cs_real_t t_eval,
540 void *context,
541 cs_real_t *vf_flux);
542
543/*----------------------------------------------------------------------------*/
557/*----------------------------------------------------------------------------*/
558
559void
561 const cs_real_t *pdi,
562 const cs_equation_param_t *eqp,
563 int ml_id,
565 void *context,
566 double *d_flux,
567 double *c_flux);
568
569/*----------------------------------------------------------------------------*/
583/*----------------------------------------------------------------------------*/
584
585void
587 const cs_equation_param_t *eqp,
588 const cs_property_t *diff_pty,
589 cs_real_t t_eval,
591 void *eq_context,
592 cs_real_t *diff_flux);
593
594/*----------------------------------------------------------------------------*/
608/*----------------------------------------------------------------------------*/
609
610void
612 const cs_equation_param_t *eqp,
613 const cs_property_t *diff_pty,
614 cs_real_t t_eval,
616 void *eq_context,
617 cs_real_t *diff_flux);
618
619/*----------------------------------------------------------------------------*/
628/*----------------------------------------------------------------------------*/
629
630void
633 void *context);
634
635/*----------------------------------------------------------------------------*/
643/*----------------------------------------------------------------------------*/
644
645void
648 void *context);
649
650#endif /* CS_CDOVB_SCALEQ_H */
time step descriptor
Definition: cs_time_step.h:60
void cs_cdovb_scaleq_solve_steady_state(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build and solve the linear system arising from a scalar steady-state convection/diffusion/reaction eq...
Definition: cs_cdovb_scaleq.cpp:2738
void cs_cdovb_scaleq_init_sharing(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Allocate work buffer and general structures related to CDO vertex-based schemes. Set shared pointers.
Definition: cs_cdovb_scaleq.cpp:1362
void cs_cdovb_scaleq_diff_flux_in_cells(const cs_real_t *values, const cs_equation_param_t *eqp, const cs_property_t *diff_pty, cs_real_t t_eval, cs_equation_builder_t *eqb, void *eq_context, cs_real_t *diff_flux)
Cellwise and threaded computation of an approximation of a constant diffusive flux (a vector) in each...
Definition: cs_cdovb_scaleq.cpp:5208
void cs_cdovb_scaleq_finalize_sharing(void)
Free work buffer and general structure related to CDO vertex-based schemes.
Definition: cs_cdovb_scaleq.cpp:1429
void * cs_cdovb_scaleq_free_context(void *scheme_context)
Destroy a cs_cdovb_scaleq_t structure.
Definition: cs_cdovb_scaleq.cpp:2123
void cs_cdovb_scaleq_get(cs_cell_sys_t **csys, cs_cell_builder_t **cb)
Retrieve work buffers used for building a CDO system cellwise.
Definition: cs_cdovb_scaleq.cpp:1412
void cs_cdovb_scaleq_apply_stiffness(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, const cs_property_t *pty, const cs_real_t *pot, cs_flag_t res_loc, cs_real_t *res)
Compute the cellwise stiffness matrix associated to the property given as a parameter and multiply it...
Definition: cs_cdovb_scaleq.cpp:4616
void cs_cdovb_scaleq_boundary_diff_flux(const cs_real_t *values, const cs_equation_param_t *eqp, const cs_property_t *diff_pty, const cs_real_t t_eval, cs_equation_builder_t *eqb, void *context, cs_real_t *vf_flux)
Compute for each vertex of a boundary face, the portion of diffusive flux across the boundary face....
Definition: cs_cdovb_scaleq.cpp:4780
cs_real_t * cs_cdovb_scaleq_get_cell_values(void *context, bool previous)
Compute an array of values at mesh cells by interpolating the variable field associated to the given ...
Definition: cs_cdovb_scaleq.cpp:4120
cs_real_t * cs_cdovb_scaleq_get_source_term_values(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Retrieve the array storing the source term values at dual mesh cells. If this array does not exist,...
Definition: cs_cdovb_scaleq.cpp:4173
void cs_cdovb_scaleq_current_to_previous(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Operate a current to previous operation for the field associated to this equation and potentially for...
Definition: cs_cdovb_scaleq.cpp:5517
void cs_cdovb_scaleq_init_properties(int t_id, cs_real_t t_eval, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Set the main properties before the main loop on cells. Case of scalar-valued CDO-Vb schemes.
Definition: cs_cdovb_scaleq.cpp:2208
void cs_cdovb_scaleq_solve_steady_state_incr(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build and solve the linear system arising from a scalar steady-state convection/diffusion/reaction eq...
Definition: cs_cdovb_scaleq.cpp:2974
void cs_cdovb_scaleq_diff_flux_dfaces(const cs_real_t *values, const cs_equation_param_t *eqp, const cs_property_t *diff_pty, cs_real_t t_eval, cs_equation_builder_t *eqb, void *eq_context, cs_real_t *diff_flux)
Cellwise and threaded computation of the diffusive flux accross dual faces (a scalar) in each cell....
Definition: cs_cdovb_scaleq.cpp:5357
void cs_cdovb_scaleq_solve_theta(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build and solve the linear system arising from a scalar unsteady convection/diffusion/reaction equati...
Definition: cs_cdovb_scaleq.cpp:3792
cs_real_t * cs_cdovb_scaleq_get_vertex_values(void *context, bool previous)
Retrieve an array of values at mesh vertices for the variable field associated to the given context T...
Definition: cs_cdovb_scaleq.cpp:4089
void * cs_cdovb_scaleq_init_context(cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
Initialize a cs_cdovb_scaleq_t structure storing data useful for building and managing such a scheme.
Definition: cs_cdovb_scaleq.cpp:1465
void cs_cdovb_scaleq_solve_implicit(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build and solve the linear system arising from a scalar unsteady convection/diffusion/reaction equati...
Definition: cs_cdovb_scaleq.cpp:3247
cs_cdo_balance_t * cs_cdovb_scaleq_balance(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_cdovb_scaleq.cpp:4279
void cs_cdovb_scaleq_setup(cs_real_t t_eval, const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, cs_flag_t vtx_bc_flag[])
Set the boundary conditions known from the settings Define an indirection array for the enforcement o...
Definition: cs_cdovb_scaleq.cpp:2162
void cs_cdovb_scaleq_extra_post(const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Predefined extra-operations related to this equation.
Definition: cs_cdovb_scaleq.cpp:5541
bool cs_cdovb_scaleq_is_initialized(void)
Check if the generic structures for building a CDO-Vb scheme are allocated.
Definition: cs_cdovb_scaleq.cpp:1342
double cs_cdovb_scaleq_build_block_implicit_incr(int t_id, cs_lnum_t c_id, bool diag_block, const cs_real_t f_val[], const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Build the cell system for the given cell id when the build occurs in a coupled system....
Definition: cs_cdovb_scaleq.cpp:2442
void cs_cdovb_scaleq_solve_implicit_incr(bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
Build and solve the linear system arising from a scalar unsteady convection/diffusion/reaction equati...
Definition: cs_cdovb_scaleq.cpp:3498
void cs_cdovb_scaleq_flux_across_plane(const cs_real_t normal[], const cs_real_t *pdi, const cs_equation_param_t *eqp, int ml_id, cs_equation_builder_t *eqb, void *context, double *d_flux, double *c_flux)
Compute the diffusive and convective flux across a list of faces Case of scalar-valued CDO-Vb schemes...
Definition: cs_cdovb_scaleq.cpp:5035
void cs_cdovb_scaleq_init_values(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)
Set the initial values of the variable field taking into account the boundary conditions....
Definition: cs_cdovb_scaleq.cpp:2620
double cs_cdovb_scaleq_build_block_implicit(int t_id, cs_lnum_t c_id, bool diag_block, const cs_real_t f_val[], const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Build the cell system for the given cell id when the build occurs in a coupled system....
Definition: cs_cdovb_scaleq.cpp:2260
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
unsigned short int cs_flag_t
Definition: cs_defs.h:334
Definition: mesh.f90:26
Definition: cs_cdo_toolbox.h:64
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
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.