My Project
programmer's documentation
cs_cdofb_scaleq.h
Go to the documentation of this file.
1 #ifndef __CS_CDOFB_SCALEQ_H__
2 #define __CS_CDOFB_SCALEQ_H__
3 
4 /*============================================================================
5  * Build an algebraic CDO face-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-2019 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 
31 #include "cs_defs.h"
32 
33 /*----------------------------------------------------------------------------
34  * Standard C library headers
35  *----------------------------------------------------------------------------*/
36 
37 /*----------------------------------------------------------------------------
38  * Local headers
39  *----------------------------------------------------------------------------*/
40 
41 #include "cs_base.h"
42 #include "cs_cdo_connect.h"
43 #include "cs_cdo_local.h"
44 #include "cs_cdo_quantities.h"
45 #include "cs_cdofb_priv.h"
46 #include "cs_equation_common.h"
47 #include "cs_equation_param.h"
48 #include "cs_field.h"
49 #include "cs_matrix.h"
50 #include "cs_mesh.h"
51 #include "cs_restart.h"
52 #include "cs_source_term.h"
53 #include "cs_time_step.h"
54 
55 /*----------------------------------------------------------------------------*/
56 
58 
59 /*============================================================================
60  * Macro definitions
61  *============================================================================*/
62 
63 /*============================================================================
64  * Type definitions
65  *============================================================================*/
66 
67 /* Algebraic system for CDO face-based discretization */
68 typedef struct _cs_cdofb_t cs_cdofb_scaleq_t;
69 
70 /*============================================================================
71  * Public function prototypes
72  *============================================================================*/
73 
74 /*----------------------------------------------------------------------------*/
81 /*----------------------------------------------------------------------------*/
82 
83 bool
85 
86 /*----------------------------------------------------------------------------*/
97 /*----------------------------------------------------------------------------*/
98 
99 void
101  const cs_cdo_connect_t *connect,
102  const cs_time_step_t *time_step,
103  const cs_matrix_structure_t *ms);
104 
105 /*----------------------------------------------------------------------------*/
111 /*----------------------------------------------------------------------------*/
112 
113 const cs_matrix_structure_t *
115 
116 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 
125 void
127  cs_cell_builder_t **cb);
128 
129 /*----------------------------------------------------------------------------*/
134 /*----------------------------------------------------------------------------*/
135 
136 void
138 
139 /*----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------*/
152 
153 void *
155  int var_id,
156  int bflux_id,
157  cs_equation_builder_t *eqb);
158 
159 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
169 void *
170 cs_cdofb_scaleq_free_context(void *data);
171 
172 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 void
189  const int field_id,
190  const cs_mesh_t *mesh,
191  const cs_equation_param_t *eqp,
193  void *context);
194 
195 /*----------------------------------------------------------------------------*/
207 /*----------------------------------------------------------------------------*/
208 
209 void
211  const int field_id,
212  const cs_equation_param_t *eqp,
214  void *context);
215 
216 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
231 void
233  const int field_id,
234  const cs_equation_param_t *eqp,
236  void *context);
237 
238 /*----------------------------------------------------------------------------*/
251 /*----------------------------------------------------------------------------*/
252 
253 void
255  const int field_id,
256  const cs_equation_param_t *eqp,
258  void *context);
259 
260 /*----------------------------------------------------------------------------*/
272 /*----------------------------------------------------------------------------*/
273 
277  void *context);
278 
279 /*----------------------------------------------------------------------------*/
291 /*----------------------------------------------------------------------------*/
292 
293 void
295  const cs_equation_param_t *eqp,
296  const cs_real_t *pot_f,
297  const cs_real_t *pot_c,
299  cs_real_t *bflux);
300 
301 /*----------------------------------------------------------------------------*/
311 /*----------------------------------------------------------------------------*/
312 
313 void
314 cs_cdofb_scaleq_extra_op(const char *eqname,
315  const cs_field_t *field,
316  const cs_equation_param_t *eqp,
318  void *data);
319 
320 /*----------------------------------------------------------------------------*/
332 /*----------------------------------------------------------------------------*/
333 
334 cs_real_t *
335 cs_cdofb_scaleq_get_cell_values(void *context);
336 
337 /*----------------------------------------------------------------------------*/
347 /*----------------------------------------------------------------------------*/
348 
349 cs_real_t *
350 cs_cdofb_scaleq_get_face_values(void *context);
351 
352 /*----------------------------------------------------------------------------*/
361 /*----------------------------------------------------------------------------*/
362 
363 void
365  const char *eqname,
366  void *scheme_context);
367 
368 /*----------------------------------------------------------------------------*/
377 /*----------------------------------------------------------------------------*/
378 
379 void
381  const char *eqname,
382  void *scheme_context);
383 
384 /*----------------------------------------------------------------------------*/
385 
387 
388 #endif /* __CS_CDOFB_SCALEQ_H__ */
cs_cdofb_scaleq_solve_implicit
void cs_cdofb_scaleq_solve_implicit(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 convection/diffusion/reaction equation with a...
Definition: cs_cdofb_scaleq.c:1387
cs_cdofb_scaleq_finalize_common
void cs_cdofb_scaleq_finalize_common(void)
Free work buffer and general structure related to CDO face-based schemes.
Definition: cs_cdofb_scaleq.c:764
cs_defs.h
cs_equation_balance_t
Definition: cs_equation_common.h:156
cs_cdofb_scaleq_write_restart
void cs_cdofb_scaleq_write_restart(cs_restart_t *restart, const char *eqname, void *scheme_context)
Write additional arrays (not defined as fields) but useful for the checkpoint/restart process.
Definition: cs_cdofb_scaleq.c:2437
cs_cdofb_priv.h
cs_equation_common.h
field
Definition: field.f90:27
cs_matrix_structure_t
struct _cs_matrix_structure_t cs_matrix_structure_t
Definition: cs_matrix.h:86
cs_cdofb_scaleq_init_context
void * cs_cdofb_scaleq_init_context(const cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
Initialize a cs_cdofb_scaleq_t structure storing data useful for building and managing such a scheme.
Definition: cs_cdofb_scaleq.c:800
cs_source_term.h
cs_cdofb_scaleq_init_common
void cs_cdofb_scaleq_init_common(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step, const cs_matrix_structure_t *ms)
Allocate work buffer and general structures related to CDO scalar-valued face-based schemes....
Definition: cs_cdofb_scaleq.c:678
cs_cdofb_scaleq_free_context
void * cs_cdofb_scaleq_free_context(void *data)
Destroy a cs_cdofb_scaleq_t structure.
Definition: cs_cdofb_scaleq.c:1062
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_cdo_quantities.h
mesh
Definition: mesh.f90:26
cs_mesh.h
cs_equation_param_t
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:148
cs_cdofb_scaleq_balance
cs_equation_balance_t * cs_cdofb_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_cdofb_scaleq.c:1898
cs_time_step_t
time step descriptor
Definition: cs_time_step.h:51
cs_cdofb_scaleq_solve_theta
void cs_cdofb_scaleq_solve_theta(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 convection/diffusion/reaction equation with a...
Definition: cs_cdofb_scaleq.c:1619
cs_field.h
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:94
cs_restart_t
struct _cs_restart_t cs_restart_t
Definition: cs_restart.h:87
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_cell_builder_t
Set of local and temporary buffers useful for building the algebraic system with a cellwise process....
Definition: cs_cdo_local.h:56
cs_cdofb_scaleq_read_restart
void cs_cdofb_scaleq_read_restart(cs_restart_t *restart, const char *eqname, void *scheme_context)
Read additional arrays (not defined as fields) but useful for the checkpoint/restart process.
Definition: cs_cdofb_scaleq.c:2356
cs_cdo_connect.h
cs_time_step.h
cs_cdofb_scaleq_init_values
void cs_cdofb_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_cdofb_scaleq.c:1098
cs_equation_builder_t
Store common elements used when building an algebraic system related to an equation.
Definition: cs_equation_common.h:61
cs_cdofb_scaleq_get_face_values
cs_real_t * cs_cdofb_scaleq_get_face_values(void *context)
Retrieve an array of values at mesh faces for the current context. The lifecycle of this array is man...
Definition: cs_cdofb_scaleq.c:2334
cs_cdofb_scaleq_get
void cs_cdofb_scaleq_get(cs_cell_sys_t **csys, cs_cell_builder_t **cb)
Retrieve work buffers used for building a CDO system cellwise.
Definition: cs_cdofb_scaleq.c:742
cs_cdofb_scaleq_matrix_structure
const cs_matrix_structure_t * cs_cdofb_scaleq_matrix_structure(void)
Get the pointer to the related cs_matrix_structure_t.
Definition: cs_cdofb_scaleq.c:727
cs_cdofb_scaleq_solve_steady_state
void cs_cdofb_scaleq_solve_steady_state(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_cdofb_scaleq.c:1202
cs_cdofb_scaleq_boundary_diff_flux
void cs_cdofb_scaleq_boundary_diff_flux(const cs_real_t t_eval, const cs_equation_param_t *eqp, const cs_real_t *pot_f, const cs_real_t *pot_c, cs_equation_builder_t *eqb, cs_real_t *bflux)
Compute the diffusive flux across each boundary face. Case of scalar-valued CDO-Fb schemes.
Definition: cs_cdofb_scaleq.c:2120
cs_cdofb_scaleq_extra_op
void cs_cdofb_scaleq_extra_op(const char *eqname, const cs_field_t *field, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *data)
Predefined extra-operations related to this equation.
Definition: cs_cdofb_scaleq.c:2258
cs_matrix.h
cs_equation_param.h
Structure and routines handling the specific settings related to a cs_equation_t structure.
_cs_cdofb_t
Definition: cs_cdofb_priv.h:51
cs_cell_sys_t
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:93
cs_restart.h
cs_field_t
Field descriptor.
Definition: cs_field.h:124
cs_cdofb_scaleq_is_initialized
bool cs_cdofb_scaleq_is_initialized(void)
Check if the generic structures for building a CDO-Fb scheme are allocated.
Definition: cs_cdofb_scaleq.c:656
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h
cs_cdofb_scaleq_get_cell_values
cs_real_t * cs_cdofb_scaleq_get_cell_values(void *context)
Get the computed values at mesh cells from the inverse operation w.r.t. the static condensation (DoF ...
Definition: cs_cdofb_scaleq.c:2313
cs_cdo_local.h