2
/* Code_Saturne version 2.1.0-alpha1 */
4
/*============================================================================
6
* This file is part of the Code_Saturne Kernel, element of the
7
* Code_Saturne CFD tool.
9
* Copyright (C) 1998-2011 EDF S.A., France
11
* contact: saturne-support@edf.fr
13
* The Code_Saturne Kernel is free software; you can redistribute it
14
* and/or modify it under the terms of the GNU General Public License
15
* as published by the Free Software Foundation; either version 2 of
16
* the License, or (at your option) any later version.
18
* The Code_Saturne Kernel is distributed in the hope that it will be
19
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with the Code_Saturne Kernel; if not, write to the
25
* Free Software Foundation, Inc.,
26
* 51 Franklin St, Fifth Floor,
27
* Boston, MA 02110-1301 USA
29
*============================================================================*/
31
/*============================================================================
32
* Define (conforming or non-conforming) mesh joinings.
33
*============================================================================*/
35
#if defined(HAVE_CONFIG_H)
36
#include "cs_config.h"
39
/*----------------------------------------------------------------------------
40
* Standard C library headers
41
*----------------------------------------------------------------------------*/
43
/*----------------------------------------------------------------------------
45
*----------------------------------------------------------------------------*/
49
/*----------------------------------------------------------------------------
51
*----------------------------------------------------------------------------*/
53
#include "fvm_writer.h"
55
/*----------------------------------------------------------------------------
57
*----------------------------------------------------------------------------*/
61
#include "cs_selector.h"
65
/*----------------------------------------------------------------------------
66
* Header for the current file
67
*----------------------------------------------------------------------------*/
69
#include "cs_prototypes.h"
71
/*----------------------------------------------------------------------------*/
75
/*============================================================================
76
* User function definitions
77
*============================================================================*/
79
/*----------------------------------------------------------------------------
80
* Define post-processing writers.
82
* The default output format and frequency may be configured, and additional
83
* post-processing writers allowing outputs in different formats or with
84
* different format options and output frequency than the main writer may
86
*----------------------------------------------------------------------------*/
89
cs_user_postprocess_writers(void)
91
/* Every writer has a a strictly positive or negative id. Negative ids
92
* are for predefined writers, positive ids for user writers.
93
* All predefined writers use the settings from writer -1, and
94
* redefining that writer here allows changing from the default or GUI
97
* Defining or configuring a writer is done by calling the
98
* cs_post_define_writer() function, whose arguments are:
99
* writer_id <-- number of writer to create (< 0 reserved, > 0 for user)
100
* case_name <-- associated case name
101
* dir_name <-- associated directory name
102
* fmt_name <-- associated format name
103
* fmt_opts <-- associated format options string
104
* time_dep <-- FVM_WRITER_FIXED_MESH if mesh definitions are fixed,
105
* FVM_WRITER_TRANSIENT_COORDS if coordinates change,
106
* FVM_WRITER_TRANSIENT_CONNECT if connectivity changes
107
* output_at_end <-- force output at calculation end if not 0
108
* frequency_n <-- default output frequency in time-steps, or < 0
109
* frequency_t <-- default output frequency in seconds, or < 0
110
* (has priority over frequency_n)
112
* Allowed output format names: "EnSight Gold", "MED", or "CGNS".
113
* (EnSight output is built-in; MED or CGNS are only available if the
114
* code was built with these optional libraries)
116
* An output options string may contain options (separated by whitespace
117
* or commas) from the following list:
118
* 'text' (text format, for EnSight)
119
* 'big_endian' (forces binary EnSight output to 'big-endian' mode)
120
* 'discard_polygons' (ignore polygon-type faces)
121
* 'discard_polyhedra' (ignore polyhedron-type cells)
122
* 'divide_polygons' (subdivides polygon-type faces)
123
* 'divide_polyhedra' (subdivides polyhedron-type cells)
124
* 'split_tensors' (writes tensors as separate scalars) */
126
/* Default writer time dependency */
128
fvm_writer_time_dep_t time_dep = FVM_WRITER_FIXED_MESH;
130
/* Default time step or physical time based output frequencies */
132
cs_bool_t output_at_end = true;
136
/* Default output format and options */
138
const char format_name[] = "EnSight Gold";
139
const char format_options[] = "";
141
/* Define additional writers */
142
/* ------------------------- */
146
cs_post_define_writer(1, /* writer_id */
147
"tinf21", /* writer name */
148
"postprocessing", /* directory name */
149
"EnSight Gold", /* format name */
150
"discard_polygons, discard_polyhedra",
151
FVM_WRITER_TRANSIENT_CONNECT,
157
/*----------------------------------------------------------------------------
158
* Define post-processing meshes.
160
* The main post-processing meshes may be configured, and additional
161
* post-processing meshes may be defined as a subset of the main mesh's
162
* cells or faces (both interior and boundary).
163
*----------------------------------------------------------------------------*/
166
cs_user_postprocess_meshes(void)
168
/* Post-processing meshes may be defined using one of several functions,
169
* whose protypes are defined in cs_post.h; these functions are:
171
* Functions simplest to use are cs_post_define_volume_mesh() and
172
* cs_post_define_surface_mesh(), which allow defining volume or surface
173
* post-processing meshes using selection criteria.
175
* parameters for cs_post_define_volume_mesh():
176
* mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
177
* mesh_name <-- associated mesh name
178
* cell_criteria <-- selection criteria for cells
179
* add_groups <-- if true, add group information if present
180
* auto_variables <-- if true, automatic output of main variables
181
* n_writers <-- number of associated writers
182
* writer_ids <-- ids of associated writers
184
* parameters for cs_post_define_surface_mesh():
185
* mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
186
* mesh_name <-- associated mesh name
187
* i_face_criteria <-- selection criteria for interior faces
188
* b_face_criteria <-- selection criteria for boundary faces
189
* add_groups <-- if true, add group information if present
190
* auto_variables <-- if true, automatic output of main variables
191
* n_writers <-- number of associated writers
192
* writer_ids <-- ids of associated writers
194
* If no writer is associated to a mesh, it is not output, and its
195
* construction may be avoided altogether (at least when defined
196
* by one of the above functions).
198
* More advanced functions are described along with examples below. */
200
/*--------------------------------------------------------------------------*/
202
/* Select interior faces with y = 0. */
206
const int n_writers = 2;
207
const int writer_ids[] = {-1}; /* Associate to default writer */
209
/* Select cells with y = 0 */
210
const char *interior_criteria = "plane[0, -1, 0, 0.0, "
212
const char *boundary_criteria = NULL;
214
cs_post_define_surface_mesh(1, /* mesh id */
218
false, /* add_groups */
219
false, /* auto_variables */
225
/*--------------------------------------------------------------------------*/
227
/* Select no cells, will select cells with T < 21 degrees in 'usmpst' */
231
const int n_writers = 1;
232
const int writer_ids[] = {1}; /* Associate to writer 1 */
234
cs_post_define_volume_mesh(2, /* mesh id */
237
false, /* add_groups */
238
true, /* auto_variables */
246
/*----------------------------------------------------------------------------
247
* Override default frequency or calculation end based output.
249
* This allows fine-grained control of activation or deactivation,
252
* nt_max_abs <-- maximum time step number
253
* nt_cur_abs <-- current time step number
254
* t_cur_abs <-- absolute time at the current time step
255
*----------------------------------------------------------------------------*/
258
cs_user_postprocess_activate(int nt_max_abs,
262
/* Use the cs_post_activate_writer() function to force the
263
* "active" or "inactive" flag for a specific writer or for all
264
* writers for the current time step.
266
* the parameters for cs_post_activate_writer() are:
267
* writer_id <-- writer id, or 0 for all writers
268
* activate <-- false to deactivate, true to activate */
270
if (false) { /* example: deactivate all output before time step 1000 */
272
if (nt_max_abs < 1000) {
273
int writer_id = 0; /* 0: all writers */
274
cs_post_activate_writer(writer_id, false);
280
/*============================================================================
281
* Fortran-callable wrapper for user function definitions (do not remove).
282
*============================================================================*/
284
/*----------------------------------------------------------------------------
285
* User override of default frequency or calculation end based output.
289
* subroutine pstusn (ntmabs, ntcabs, ttcabs)
292
* integer ntmabs : <-- : maximum time step number
293
* integer ntcabs : <-- : current time step number
294
* double precision ttcabs : <-- : absolute time at the current time step
295
*----------------------------------------------------------------------------*/
297
void CS_PROCF (pstusn, PSTUSN)
299
const cs_int_t *ntmabs,
300
const cs_int_t *ntcabs,
301
const cs_real_t *ttcabs
304
cs_user_postprocess_activate(*ntmabs, *ntcabs, *ttcabs);
307
/*----------------------------------------------------------------------------*/