programmer's 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  * 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_param.h"
33 #include "cs_property.h"
34 #include "cs_advection_field.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /* Term flag */
45 #define CS_EQUATION_LOCKED (1 << 0) /* 1: modification not allowed */
46 #define CS_EQUATION_UNSTEADY (1 << 1) /* 2: unsteady term */
47 #define CS_EQUATION_CONVECTION (1 << 2) /* 4: convection term */
48 #define CS_EQUATION_DIFFUSION (1 << 3) /* 8: diffusion term */
49 #define CS_EQUATION_REACTION (1 << 4) /* 16: reaction term */
50 #define CS_EQUATION_HCONF_ST (1 << 5) /* 32: treatment of the source */
51 
52 /* Post flag */
53 #define CS_EQUATION_POST_PECLET (1 << 0)
54 #define CS_EQUATION_POST_UPWIND_COEF (2 << 0)
55 
56 /*============================================================================
57  * Type definitions
58  *============================================================================*/
59 
60 /* Type of equations managed by the solver */
61 typedef enum {
62 
63  CS_EQUATION_TYPE_USER, // User-defined equation
64  CS_EQUATION_TYPE_GROUNDWATER, // Equation specific to groundwater flows
65  CS_EQUATION_TYPE_PREDEFINED, // General predefined equation
67 
69 
70 /* Type of algorithm to get the solution of an equation */
71 typedef enum {
72 
73  CS_EQUATION_ALGO_CS_ITSOL, /* Used an iterative solver
74  defined by Code_Saturne */
75  CS_EQUATION_ALGO_PETSC_ITSOL, /* Used an iterative solver
76  defined by PETSc */
77  CS_EQUATION_ALGO_UZAWA, // To solve sadle-point system
78  CS_EQUATION_ALGO_NEWTON, // To solve non-linear system
79  CS_EQUATION_ALGO_PICARD, // To solve non-linear system
81 
83 
84 /* Description of the algorithm used to solve an equation */
85 typedef struct {
86 
88 
89  int n_iters;
93 
94  double eps; /* stopping criterion on accuracy */
95 
97 
98 /* Set of parameters to handle an unsteady convection-diffusion-reaction
99  equation with term sources */
100 typedef struct {
101 
102  cs_equation_type_t type; /* predefined, user... */
103  cs_param_var_type_t var_type; /* scalar, vector, tensor... */
104  int verbosity; /* Level of detail to output */
105  int output_freq; /* Write log at this frequency */
106 
107  /* Unsteady-Diffusion-Convection-Source term activated or not */
108  int flag;
109 
110  /* Post-treatment */
111  int post_freq; /* Move this option to cs_field_t ? */
112  cs_flag_t post_flag; /* Type of post-treatment to do */
113 
114  /* Numerical settings */
116 
117  /* Boundary conditions */
119 
120  /* High-level structure to manage/monitor the resolution of this equation */
123 
124  /* Unsteady term discretization and description of the time discretization */
127  cs_property_t *time_property;
128 
129  /* Diffusion term */
131  cs_property_t *diffusion_property;
132 
133  /* Advection term */
135  cs_adv_field_t *advection_field;
136 
137  /* Reaction term (always depend on the unkonws) */
140  cs_property_t **reaction_properties;
141 
142  /* Source term(s) (always in the right-hand side) */
145 
147 
148 /*============================================================================
149  * Public function prototypes
150  *============================================================================*/
151 
152 /*----------------------------------------------------------------------------*/
153 
155 
156 #endif /* __CS_EQUATION_PRIV_H__ */
cs_param_reaction_t * reaction_terms
Definition: cs_equation_priv.h:139
int n_max_iters
Definition: cs_equation_priv.h:90
cs_property_t * diffusion_property
Definition: cs_equation_priv.h:131
cs_adv_field_t * advection_field
Definition: cs_equation_priv.h:135
cs_param_hodge_t time_hodge
Definition: cs_equation_priv.h:126
Definition: cs_equation_priv.h:100
int n_cumulated_iters
Definition: cs_equation_priv.h:91
Definition: cs_equation_priv.h:73
cs_param_var_type_t var_type
Definition: cs_equation_priv.h:103
cs_equation_algo_t algo_info
Definition: cs_equation_priv.h:121
cs_equation_type_t type
Definition: cs_equation_priv.h:102
Definition: cs_equation_priv.h:66
int post_freq
Definition: cs_equation_priv.h:111
Definition: cs_equation_priv.h:85
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
Definition: cs_equation_priv.h:64
int n_iters
Definition: cs_equation_priv.h:89
Definition: cs_param.h:320
double eps
Definition: cs_equation_priv.h:94
int flag
Definition: cs_equation_priv.h:108
Definition: cs_equation_priv.h:78
Definition: cs_param.h:204
cs_equation_type_t
Definition: cs_equation_priv.h:61
cs_space_scheme_t
Definition: cs_cdo.h:53
cs_space_scheme_t space_scheme
Definition: cs_equation_priv.h:115
Definition: cs_equation_priv.h:63
cs_flag_t post_flag
Definition: cs_equation_priv.h:112
int n_reaction_terms
Definition: cs_equation_priv.h:138
Definition: cs_equation_priv.h:65
cs_param_advection_t advection_info
Definition: cs_equation_priv.h:134
cs_param_hodge_t diffusion_hodge
Definition: cs_equation_priv.h:130
Definition: cs_param.h:157
cs_equation_algo_type_t type
Definition: cs_equation_priv.h:87
int n_source_terms
Definition: cs_equation_priv.h:143
Definition: cs_equation_priv.h:75
int verbosity
Definition: cs_equation_priv.h:104
cs_property_t ** reaction_properties
Definition: cs_equation_priv.h:140
cs_equation_algo_type_t
Definition: cs_equation_priv.h:71
int n_max_cumulated_iters
Definition: cs_equation_priv.h:92
cs_param_bc_t * bc
Definition: cs_equation_priv.h:118
cs_param_itsol_t itsol_info
Definition: cs_equation_priv.h:122
Definition: cs_equation_priv.h:80
#define END_C_DECLS
Definition: cs_defs.h:430
int output_freq
Definition: cs_equation_priv.h:105
Definition: cs_equation_priv.h:77
cs_param_var_type_t
Definition: cs_param.h:97
cs_param_source_term_t * source_terms
Definition: cs_equation_priv.h:144
Definition: cs_param.h:223
cs_param_time_t time_info
Definition: cs_equation_priv.h:125
Definition: cs_param.h:294
Definition: cs_equation_priv.h:79
Definition: cs_param.h:130
unsigned short int cs_flag_t
Definition: cs_cdo.h:50
cs_property_t * time_property
Definition: cs_equation_priv.h:127
Definition: cs_param.h:369