/usr/include/code_saturne/cs_coupling.h is in code-saturne-include 3.2.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | #ifndef __CS_COUPLING_H__
#define __CS_COUPLING_H__
/*============================================================================
* Common functionnality for various coupling types.
*============================================================================*/
/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2013 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Standard C library headers
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* PLE library headers
*----------------------------------------------------------------------------*/
#include <ple_coupling.h>
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "cs_base.h"
/*----------------------------------------------------------------------------*/
BEGIN_C_DECLS
/*=============================================================================
* Macro definitions
*============================================================================*/
/*============================================================================
* Type definitions
*============================================================================*/
/*=============================================================================
* Global variable definitions
*============================================================================*/
/*============================================================================
* Public function prototypes for Fortran API
*============================================================================*/
/*----------------------------------------------------------------------------
* Synchronize with applications in the same PLE coupling group.
*
* This function should be called before starting a new time step. The
* current time step id is that of the last finished time step, or 0 at
* initialization.
*
* Fortran Interface:
*
* subroutine cplsyn (ntcmabs, ntcabs, dtref)
* *****************
*
* integer ntmabs : <-> : maximum iteration number
* integer ntcabs : <-- : current iteration number
* double precision dtref : <-> : reference time step value
*----------------------------------------------------------------------------*/
void CS_PROCF(cplsyn, CPLSYN)
(
cs_int_t *ntmabs,
const cs_int_t *ntcabs,
cs_real_t *dtref
);
/*----------------------------------------------------------------------------
* Indicate if there are synchronized applications in the same
* PLE coupling group.
*
* Fortran Interface:
*
* subroutine cplact (isync)
* *****************
*
* integer isync : <-- : 1 if synchronized, 0 otherwise
*----------------------------------------------------------------------------*/
void CS_PROCF(cplact, CPLACT)
(
cs_int_t *isync
);
/*============================================================================
* Public function prototypes
*============================================================================*/
#if defined(HAVE_MPI)
/*----------------------------------------------------------------------------
* Discover other applications in the same MPI root communicator.
*
* parameters:
* app_name <-- name of this instance of Code_Saturne.
*----------------------------------------------------------------------------*/
void
cs_coupling_discover_mpi_apps(const char *app_name);
/*----------------------------------------------------------------------------
* Finalize MPI coupling helper structures.
*----------------------------------------------------------------------------*/
void
cs_coupling_finalize(void);
/*----------------------------------------------------------------------------
* Return info on other applications in the same MPI root communicator.
*
* returns:
* info on other applications structure.
*----------------------------------------------------------------------------*/
const ple_coupling_mpi_set_t *
cs_coupling_get_mpi_apps(void);
#endif /* HAVE_MPI */
/*----------------------------------------------------------------------------
* Return the optional synchronization flag for external couplings.
*
* See cs_coupling_set_sync_flag() for details.
*
* returns:
* synchronization flag to apply to couplings
*----------------------------------------------------------------------------*/
int
cs_coupling_get_sync_flag(void);
/*----------------------------------------------------------------------------
* Define an optional synchronization flag for external couplings.
*
* This flag is used by all couplings based on the PLE (Parallel Location
* and Exchange) group synchronization mechanism, which include couplings
* with SYRTHES 4, Code_Saturne, and NEPTUNE_CFD.
*
* It is defined by a mask, so for example flags f1, f2, and f3 may be
* combined using the "f1 | f2 | f2" syntax.
*
* Note also that for Code_Saturne, in the case of a variable time step,
* the reference time step is synchronized at the beginning of each
* iteration, but the actual time step is recomputed later.
*
* Possible flags are:
* PLE_COUPLING_TS_MIN Use smallest time step
* PLE_COUPLING_TS_LEADER Prescribe time step for the group
* (only one member may set this flag)
* PLE_COUPLING_UNSTEADY Inform others that this instance is
* using an unsteady solution approach
* PLE_COUPLING_STEADY Inform others that this instance is
* using a teady solution approach
* PLE_COUPLING_USER_1 User definable flag
* PLE_COUPLING_USER_2 User definable flag
* PLE_COUPLING_USER_3 User definable flag
* PLE_COUPLING_USER_4 User definable flag
*
* To force stopping, PLE_COUPLING_STOP may be set. In this case,
* the calculation will stop at the first synchronization, even if
* this function is called again with another flag.
*
* parameters:
* flag <-- synchronization flag to apply to couplings
*----------------------------------------------------------------------------*/
void
cs_coupling_set_sync_flag(int flag);
/*----------------------------------------------------------------------------
* Return the time step multiplier for external couplings.
*
* See cs_coupling_get_ts_multiplier() for details.
*
* returns:
* time step multiplier for external couplings
*----------------------------------------------------------------------------*/
double
cs_coupling_get_ts_multiplier(void);
/*----------------------------------------------------------------------------
* Define a time step multiplier for external couplings.
*
* The apparent time step for the current instance times (as viewed by
* coupled codes) is equal to the true time step times this multiplier.
*
* If the synchronization flag contains "time step min" (PLE_COUPLING_TS_MIN),
* the apparent time step is used to determine which code has the smallest
* time step.
*
* parameters:
* m <-- time step multipier to aply to couplings
*----------------------------------------------------------------------------*/
void
cs_coupling_set_ts_multiplier(double m);
/*----------------------------------------------------------------------------
* Synchronize with applications in the same PLE coupling group.
*
* This function should be called before starting a new time step. The
* current time step id is that of the last finished time step, or 0 at
* initialization.
*
* Default synchronization flags indicating a new iteration or end of
* calculation are set automatically, but the user may set additional flags
* to this function if necessary.
*
* parameters:
* flags <-- optional additional synchronization flags
* current_ts_id <-- current time step id
* max_ts_id <-> maximum time step id
* ts <-> suggested time step value
*----------------------------------------------------------------------------*/
void
cs_coupling_sync_apps(int flags,
int current_ts_id,
int *max_ts_id,
double *ts);
/*----------------------------------------------------------------------------
* Indicate is synchronization with applications in the same
* PLE group is active.
*
* return:
* true if synchronization is required, false otherwise
*----------------------------------------------------------------------------*/
bool
cs_coupling_is_sync_active(void);
/*----------------------------------------------------------------------------
* Compute extents of a mesh representation
*
* parameters:
* mesh <-- pointer to mesh representation structure
* n_max_extents <-- maximum number of sub-extents (such as element extents)
* to compute, or -1 to query
* tolerance <-- addition to local extents of each element:
* extent = base_extent * (1 + tolerance)
* extents <-> extents associated with mesh:
* x_min, y_min, ..., x_max, y_max, ... (size: 2*dim)
*
* returns:
* the number of extents computed
*----------------------------------------------------------------------------*/
ple_lnum_t
cs_coupling_mesh_extents(const void *mesh,
ple_lnum_t n_max_extents,
double tolerance,
double extents[]);
/*----------------------------------------------------------------------------
* Find elements in a given mesh containing points: updates the
* location[] and distance[] arrays associated with a set of points
* for points that are in an element of this mesh, or closer to one
* than to previously encountered elements.
*
* Location is relative to the id of a given element + 1 in
* concatenated sections of same element dimension.
*
* parameters:
* mesh <-- pointer to mesh representation structure
* tolerance <-- associated tolerance
* n_points <-- number of points to locate
* point_coords <-- point coordinates
* location <-> number of element containing or closest to each
* point (size: n_points)
* distance <-> distance from point to element indicated by
* location[]: < 0 if unlocated, 0 - 1 if inside,
* and > 1 if outside a volume element, or absolute
* distance to a surface element (size: n_points)
*----------------------------------------------------------------------------*/
void
cs_coupling_point_in_mesh(const void *mesh,
double tolerance,
ple_lnum_t n_points,
const ple_coord_t point_coords[],
ple_lnum_t location[],
float distance[]);
/*----------------------------------------------------------------------------
* Find elements in a given mesh containing points: updates the
* location[] and distance[] arrays associated with a set of points
* for points that are in an element of this mesh, or closer to one
* than to previously encountered elements.
*
* Location is relative to parent element numbers.
*
* parameters:
* mesh <-- pointer to mesh representation structure
* tolerance <-- associated tolerance
* n_points <-- number of points to locate
* point_coords <-- point coordinates
* location <-> number of element containing or closest to each
* point (size: n_points)
* distance <-> distance from point to element indicated by
* location[]: < 0 if unlocated, 0 - 1 if inside,
* and > 1 if outside a volume element, or absolute
* distance to a surface element (size: n_points)
*----------------------------------------------------------------------------*/
void
cs_coupling_point_in_mesh_p(const void *mesh,
double tolerance,
ple_lnum_t n_points,
const ple_coord_t point_coords[],
ple_lnum_t location[],
float distance[]);
/*----------------------------------------------------------------------------
* Find elements in a given mesh closest to points: updates the
* location[] and distance[] arrays associated with a set of points
* for points that are closer to an element of this mesh than to previously
* encountered elements.
*
* This function currently only handles elements of lower dimension than
* the spatial dimension.
*
* Location is relative to the id of a given element + 1 in
* concatenated sections of same element dimension.
*
* parameters:
* mesh <-- pointer to mesh representation structure
* n_points <-- number of points to locate
* point_coords <-- point coordinates
* location <-> number of element containing or closest to each
* point (size: n_points)
* distance <-> distance from point to element indicated by
* location[]: < 0 if unlocated, or absolute
* distance to a surface element (size: n_points)
*----------------------------------------------------------------------------*/
void
cs_coupling_point_closest_mesh(const void *mesh,
ple_lnum_t n_points,
const ple_coord_t point_coords[],
ple_lnum_t location[],
float distance[]);
/*----------------------------------------------------------------------------
* Find elements in a given mesh closest to points: updates the
* location[] and distance[] arrays associated with a set of points
* for points that are closer to an element of this mesh than to previously
* encountered elements.
*
* This function currently only handles elements of lower dimension than
* the spatial dimension.
*
* Location is relative to parent element numbers.
*
* parameters:
* mesh <-- pointer to mesh representation structure
* n_points <-- number of points to locate
* point_coords <-- point coordinates
* location <-> number of element containing or closest to each
* point (size: n_points)
* distance <-> distance from point to element indicated by
* location[]: < 0 if unlocated, or absolute
* distance to a surface element (size: n_points)
*----------------------------------------------------------------------------*/
void
cs_coupling_point_closest_mesh_p(const void *mesh,
ple_lnum_t n_points,
const ple_coord_t point_coords[],
ple_lnum_t location[],
float distance[]);
/*----------------------------------------------------------------------------*/
END_C_DECLS
#endif /* __CS_COUPLING_H__ */
|