programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_time_step.h
Go to the documentation of this file.
1 #ifndef __CS_TIME_STEP_H__
2 #define __CS_TIME_STEP_H__
3 
4 /*============================================================================
5  * Base time step data.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 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 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /* time step descriptor */
49 /*----------------------*/
50 
51 typedef struct {
52 
53  int is_variable; /* 0 if time step is fixed in time,
54  1 if the time step is variable. */
55  int is_local; /* 0 if time step is uniform in space,
56  1 if it is local in space (in which case
57  the time value is only a reference. */
58 
59  int nt_prev; /* absolute time step number reached by previous
60  computation */
61  int nt_cur; /* current absolute time step number */
62  int nt_max; /* maximum absolute time step number */
63 
64  double t_prev; /* physical time reached by previous
65  computation */
66  double t_cur; /* current absolute time */
67  double t_max; /* maximum absolute time */
68 
70 
71 /*============================================================================
72  * Static global variables
73  *============================================================================*/
74 
75 /* Pointer to main time step structure */
76 
77 extern const cs_time_step_t *cs_glob_time_step;
78 
79 /*=============================================================================
80  * Public function prototypes
81  *============================================================================*/
82 
83 /*----------------------------------------------------------------------------
84  * Define whether time step is variable or not
85  *
86  * parameters:
87  * is_variable <-- 0 if time step is variable in time, 1 if it is fixed
88  *----------------------------------------------------------------------------*/
89 
90 void
91 cs_time_step_define_variable(int is_variable);
92 
93 /*----------------------------------------------------------------------------
94  * Define whether time step is local in space or not
95  *
96  * parameters:
97  * is_local <-- 0 if time step is uniform in space, 1 if it is local
98  *----------------------------------------------------------------------------*/
99 
100 void
101 cs_time_step_define_local(int is_local);
102 
103 /*----------------------------------------------------------------------------
104  * Define maximum time step number
105  *
106  * parameters:
107  * nt_max <-- maximum time step number (unlimited if negative)
108  *----------------------------------------------------------------------------*/
109 
110 void
111 cs_time_step_define_nt_max(int nt_max);
112 
113 /*----------------------------------------------------------------------------
114  * Define maximum time value
115  *
116  * parameters:
117  * t_max <-- maximum time value (unlimited if negative)
118  *----------------------------------------------------------------------------*/
119 
120 void
121 cs_time_step_define_t_max(double t_max);
122 
123 /*----------------------------------------------------------------------------
124  * Set time values from previous (usually restarted) calculations
125  *
126  * parameters:
127  * nt_prev <-- previous time step number
128  * t_prev <-- previous physical time
129  *----------------------------------------------------------------------------*/
130 
131 void
132 cs_time_step_define_prev(int nt_prev,
133  double t_prev);
134 
135 /*----------------------------------------------------------------------------
136  * Increment the global time step.
137  *
138  * parameters:
139  * dt <-- time step value to increment
140  *----------------------------------------------------------------------------*/
141 
142 void
143 cs_time_step_increment(double dt);
144 
145 /*----------------------------------------------------------------------------
146  * Redefine the current time values.
147  *
148  * Remark: Using cs_time_step_increment() is preferred, but this function
149  * may be required for reverting to a previous time step.
150  *
151  * parameters:
152  * nt_cur <-- current time step number
153  * t_cur <-- current physical time
154  *----------------------------------------------------------------------------*/
155 
156 void
157 cs_time_step_redefine_cur(int nt_cur,
158  double t_cur);
159 
160 /*----------------------------------------------------------------------------*/
161 
163 
164 #endif /* __CS_TIME_STEP_H__ */
int is_local
Definition: cs_time_step.h:55
int is_variable
Definition: cs_time_step.h:53
void cs_time_step_define_nt_max(int nt_max)
Define maximum time step number.
Definition: cs_time_step.c:222
time step descriptor
Definition: cs_time_step.h:51
void cs_time_step_increment(double dt)
Increment the global time step.
Definition: cs_time_step.c:269
void cs_time_step_define_local(int is_local)
Define whether time step is local in space or not.
Definition: cs_time_step.c:205
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
double t_max
Definition: cs_time_step.h:67
void cs_time_step_redefine_cur(int nt_cur, double t_cur)
Redefine the current time values.
Definition: cs_time_step.c:288
double t_cur
Definition: cs_time_step.h:66
void cs_time_step_define_variable(int is_variable)
Define whether time step is variable or not.
Definition: cs_time_step.c:188
int nt_max
Definition: cs_time_step.h:62
const cs_time_step_t * cs_glob_time_step
#define END_C_DECLS
Definition: cs_defs.h:406
int nt_prev
Definition: cs_time_step.h:59
int nt_cur
Definition: cs_time_step.h:61
void cs_time_step_define_t_max(double t_max)
Define maximum time value.
Definition: cs_time_step.c:236
void cs_time_step_define_prev(int nt_prev, double t_prev)
Set time values from previous (usually restarted) calculations.
Definition: cs_time_step.c:251
double t_prev
Definition: cs_time_step.h:64