programmer's documentation
cs_equation.h
Go to the documentation of this file.
1 #ifndef __CS_EQUATION_H__
2 #define __CS_EQUATION_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-2015 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_mesh.h"
33 #include "cs_time_step.h"
34 
35 #include "cs_param.h"
36 #include "cs_field.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_equation_priv.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 typedef struct _cs_equation_t cs_equation_t;
53 
54 /*============================================================================
55  * Public function prototypes
56  *============================================================================*/
57 
58 /*----------------------------------------------------------------------------*/
71 /*----------------------------------------------------------------------------*/
72 
73 cs_equation_t *
74 cs_equation_create(const char *eqname,
75  const char *varname,
76  cs_equation_type_t eqtype,
77  cs_param_var_type_t vartype,
78  cs_param_bc_type_t default_bc);
79 
80 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 
90 cs_equation_t *
91 cs_equation_free(cs_equation_t *eq);
92 
93 /*----------------------------------------------------------------------------*/
99 /*----------------------------------------------------------------------------*/
100 
101 void
102 cs_equation_summary(const cs_equation_t *eq);
103 
104 /*----------------------------------------------------------------------------*/
111 /*----------------------------------------------------------------------------*/
112 
113 void
114 cs_equation_last_setup(cs_equation_t *eq);
115 
116 /*----------------------------------------------------------------------------*/
124 /*----------------------------------------------------------------------------*/
125 
126 void
127 cs_equation_set_option(cs_equation_t *eq,
128  const char *keyname,
129  const void *val);
130 
131 /*----------------------------------------------------------------------------*/
140 /*----------------------------------------------------------------------------*/
141 
142 void
143 cs_equation_link(cs_equation_t *eq,
144  const char *keyword,
145  void *pointer);
146 
147 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
158 void
159 cs_equation_set_ic(cs_equation_t *eq,
160  const char *def_key,
161  void *val);
162 
163 /*----------------------------------------------------------------------------*/
176 /*----------------------------------------------------------------------------*/
177 
178 void
179 cs_equation_add_bc(cs_equation_t *eq,
180  const char *ml_name,
181  const char *bc_key,
182  const char *def_key,
183  const void *val);
184 
185 /*----------------------------------------------------------------------------*/
195 /*----------------------------------------------------------------------------*/
196 
197 void
198 cs_equation_add_reaction(cs_equation_t *eq,
199  const char *r_name,
200  const char *type_name,
201  cs_property_t *property);
202 
203 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
218 cs_equation_set_reaction_option(cs_equation_t *eq,
219  const char *r_name,
220  const char *keyname,
221  const char *keyval);
222 
223 /*----------------------------------------------------------------------------*/
235 /*----------------------------------------------------------------------------*/
236 
237 void
238 cs_equation_add_source_term(cs_equation_t *eq,
239  const char *st_name,
240  const char *ml_name,
241  const char *def_key,
242  const void *val);
243 
244 /*----------------------------------------------------------------------------*/
254 /*----------------------------------------------------------------------------*/
255 
256 void
257 cs_equation_set_source_term_option(cs_equation_t *eq,
258  const char *st_name,
259  const char *keyname,
260  const char *keyval);
261 
262 /*----------------------------------------------------------------------------*/
269 /*----------------------------------------------------------------------------*/
270 
271 void
272 cs_equation_create_field(cs_equation_t *eq);
273 
274 /*----------------------------------------------------------------------------*/
285 /*----------------------------------------------------------------------------*/
286 
287 void
289  const cs_cdo_connect_t *connect,
290  const cs_cdo_quantities_t *cdoq,
291  const cs_time_step_t *time_step,
292  cs_equation_t *eq);
293 
294 /*----------------------------------------------------------------------------*/
302 /*----------------------------------------------------------------------------*/
303 
304 bool
305 cs_equation_needs_build(const cs_equation_t *eq);
306 
307 /*----------------------------------------------------------------------------*/
316 /*----------------------------------------------------------------------------*/
317 
318 void
320  const cs_time_step_t *time_step,
321  double dt_cur,
322  cs_equation_t *eq);
323 
324 /*----------------------------------------------------------------------------*/
331 /*----------------------------------------------------------------------------*/
332 
333 void
334 cs_equation_solve(const cs_time_step_t *time_step,
335  cs_equation_t *eq);
336 
337 /*----------------------------------------------------------------------------*/
344 /*----------------------------------------------------------------------------*/
345 
346 void
347 cs_equation_post(const cs_time_step_t *time_step,
348  const cs_equation_t *eq);
349 
350 /*----------------------------------------------------------------------------*/
358 /*----------------------------------------------------------------------------*/
359 
360 bool
361 cs_equation_is_steady(const cs_equation_t *eq);
362 
363 /*----------------------------------------------------------------------------*/
373 /*----------------------------------------------------------------------------*/
374 
375 const cs_real_t *
376 cs_equation_get_face_values(const cs_equation_t *eq);
377 
378 /*----------------------------------------------------------------------------*/
387 /*----------------------------------------------------------------------------*/
388 
389 const char *
390 cs_equation_get_name(const cs_equation_t *eq);
391 
392 /*----------------------------------------------------------------------------*/
400 /*----------------------------------------------------------------------------*/
401 
402 cs_field_t *
403 cs_equation_get_field(const cs_equation_t *eq);
404 
405 /*----------------------------------------------------------------------------*/
414 /*----------------------------------------------------------------------------*/
415 
416 const cs_equation_param_t *
417 cs_equation_get_param(const cs_equation_t *eq);
418 
419 /*----------------------------------------------------------------------------*/
428 /*----------------------------------------------------------------------------*/
429 
430 cs_property_t *
431 cs_equation_get_diffusion_property(const cs_equation_t *eq);
432 
433 /*----------------------------------------------------------------------------*/
442 /*----------------------------------------------------------------------------*/
443 
444 cs_property_t *
445 cs_equation_get_time_property(const cs_equation_t *eq);
446 
447 /*----------------------------------------------------------------------------*/
456 /*----------------------------------------------------------------------------*/
457 
459 cs_equation_get_space_scheme(const cs_equation_t *eq);
460 
461 /*----------------------------------------------------------------------------*/
469 /*----------------------------------------------------------------------------*/
470 
472 cs_equation_get_var_type(const cs_equation_t *eq);
473 
474 /*----------------------------------------------------------------------------*/
482 /*----------------------------------------------------------------------------*/
483 
485 cs_equation_get_type(const cs_equation_t *eq);
486 
487 /*----------------------------------------------------------------------------*/
488 
490 
491 #endif /* __CS_EQUATION_H__ */
cs_equation_t * cs_equation_create(const char *eqname, const char *varname, cs_equation_type_t eqtype, cs_param_var_type_t vartype, cs_param_bc_type_t default_bc)
Define and initialize a new structure to store parameters related to an equation. ...
Definition: cs_equation.c:1285
void cs_equation_add_reaction(cs_equation_t *eq, const char *r_name, const char *type_name, cs_property_t *property)
Define and initialize a new structure to store parameters related to a reaction term.
Definition: cs_equation.c:2348
time step descriptor
Definition: cs_time_step.h:51
cs_property_t * cs_equation_get_time_property(const cs_equation_t *eq)
Return a pointer to the cs_property_t structure associated to the unsteady term for this equation (NU...
Definition: cs_equation.c:3400
Field descriptor.
Definition: cs_field.h:99
void cs_equation_summary(const cs_equation_t *eq)
Summary of a cs_equation_t structure.
Definition: cs_equation.c:1416
Definition: cs_equation_priv.h:100
void cs_equation_solve(const cs_time_step_t *time_step, cs_equation_t *eq)
Solve the linear system for this equation.
Definition: cs_equation.c:3140
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_equation_add_source_term(cs_equation_t *eq, const char *st_name, const char *ml_name, const char *def_key, const void *val)
Define and initialize a new structure to store parameters related to a source term def_key among "val...
Definition: cs_equation.c:2602
Definition: cs_cdo_connect.h:67
void cs_equation_init_system(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *time_step, cs_equation_t *eq)
Initialize the values of a field according to the initial condition related to its equation...
Definition: cs_equation.c:2897
Definition: cs_cdo_quantities.h:86
bool cs_equation_needs_build(const cs_equation_t *eq)
Check if one has to build the linear system.
Definition: cs_equation.c:3034
Definition: cs_mesh.h:62
void cs_equation_link(cs_equation_t *eq, const char *keyword, void *pointer)
Associate a material property or an advection field with an equation for a given term (diffusion...
Definition: cs_equation.c:2159
void cs_equation_set_option(cs_equation_t *eq, const char *keyname, const void *val)
Set a parameter in a cs_equation_t structure attached to keyname.
Definition: cs_equation.c:1810
cs_equation_type_t
Definition: cs_equation_priv.h:61
cs_space_scheme_t
Definition: cs_cdo.h:53
const cs_equation_param_t * cs_equation_get_param(const cs_equation_t *eq)
Return the cs_equation_param_t structure associated to a cs_equation_t structure. ...
Definition: cs_equation.c:3360
void cs_equation_set_reaction_option(cs_equation_t *eq, const char *r_name, const char *keyname, const char *keyval)
Set advanced parameters related to a reaction term keyname among "lumping", "hodge_algo", "hodge_coef"... If r_name is NULL, all reaction terms of the given equation are set according to the couple (keyname, keyval)
Definition: cs_equation.c:2443
void cs_equation_last_setup(cs_equation_t *eq)
Assign a set of pointer functions for managing the cs_equation_t structure during the computation...
Definition: cs_equation.c:1695
cs_property_t * cs_equation_get_diffusion_property(const cs_equation_t *eq)
Return a pointer to the cs_property_t structure associated to the diffusion term for this equation (N...
Definition: cs_equation.c:3380
cs_param_bc_type_t
Definition: cs_param.h:248
const cs_real_t * cs_equation_get_face_values(const cs_equation_t *eq)
Compute the values of the associated field at each face of the mesh If the pointer storing the values...
Definition: cs_equation.c:3301
void cs_equation_add_bc(cs_equation_t *eq, const char *ml_name, const char *bc_key, const char *def_key, const void *val)
Define and initialize a new structure to store parameters related to an equation bc_key among "dirich...
Definition: cs_equation.c:2253
void cs_equation_set_source_term_option(cs_equation_t *eq, const char *st_name, const char *keyname, const char *keyval)
Set members defined by default in a source term structure keyname among "quadrature", "post"...
Definition: cs_equation.c:2693
cs_space_scheme_t cs_equation_get_space_scheme(const cs_equation_t *eq)
Return the type of numerical scheme used for the discretization in space.
Definition: cs_equation.c:3420
cs_param_var_type_t cs_equation_get_var_type(const cs_equation_t *eq)
Return the type of variable solved by this equation.
Definition: cs_equation.c:3439
cs_equation_type_t cs_equation_get_type(const cs_equation_t *eq)
Return the type of equation for the given equation structure.
Definition: cs_equation.c:3458
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
cs_param_var_type_t
Definition: cs_param.h:97
void cs_equation_create_field(cs_equation_t *eq)
Create a field structure related to this cs_equation_t structure to an equation.
Definition: cs_equation.c:2813
cs_field_t * cs_equation_get_field(const cs_equation_t *eq)
Return the field structure associated to a cs_equation_t structure.
Definition: cs_equation.c:3340
void cs_equation_set_ic(cs_equation_t *eq, const char *def_key, void *val)
Define the initial condition of the unknown related to this equation def_key is among "value"...
Definition: cs_equation.c:2208
void cs_equation_post(const cs_time_step_t *time_step, const cs_equation_t *eq)
Post-processing related to this equation.
Definition: cs_equation.c:3230
const char * cs_equation_get_name(const cs_equation_t *eq)
Return the name related to the given cs_equation_t structure to an equation.
Definition: cs_equation.c:3321
Definition: mesh.f90:26
void cs_equation_build_system(const cs_mesh_t *m, const cs_time_step_t *time_step, double dt_cur, cs_equation_t *eq)
Build the linear system for this equation.
Definition: cs_equation.c:3051
cs_equation_t * cs_equation_free(cs_equation_t *eq)
Destroy a cs_equation_t structure.
Definition: cs_equation.c:1356
bool cs_equation_is_steady(const cs_equation_t *eq)
Return true is the given equation is steady otherwise false.
Definition: cs_equation.c:3278