File: cs_user_porosity.dox

package info (click to toggle)
code-saturne 7.0.2%2Brepack-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 62,868 kB
  • sloc: ansic: 395,271; f90: 100,755; python: 86,746; cpp: 6,227; makefile: 4,247; xml: 2,389; sh: 1,091; javascript: 69
file content (162 lines) | stat: -rw-r--r-- 6,292 bytes parent folder | download
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
/*============================================================================
 * Code_Saturne documentation page
 *============================================================================*/

/*
  This file is part of Code_Saturne, a general-purpose CFD tool.

  Copyright (C) 1998-2021 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.
*/

/*-----------------------------------------------------------------------------*/

/*!
  \page cs_porosity Examples of data settings for porous media
  (cs_user_porosity.c)

  \section intro_poro Introduction

  This function computes the porosity (volume factor \f$ \epsilon \f$
  when porosity module is activated (iporos = 1 in cs_user_parameters.f90).

  \section cs_user_poro_examples Porosity setting examples
  Here is the list of examples:

  - \subpage base_poro_examples
  - \subpage base_poro_cad_example

*/

/*-----------------------------------------------------------------------------*/

/*!
  \page base_poro_examples Setting porosity values: basic example

  \section base_loc_var_poro Local definitions and initialization

  \subsection mesh_quantities Mesh quantities

  It may be useful to access some mesh adjacencies and  quantities,
  in which case local pointers allow for more readable code:

  \snippet cs_user_porosity.c init_poro_mq

  \subsection properties Associated properties

  Accessing cell porosity property values is required so values may be set:

  \snippet cs_user_porosity.c init_poro_pro

  \section example_porosity Example: define porosity by geometric zones

  Individual cell porosity values can be assigned to each cell, so
  they may be based on groups, geometric criteria, or any other
  time-independent functions:

  \snippet cs_user_porosity.c set_poro_cells_1

  Matching face equivalent surfaces should also be assigned in a
  corresponding manner, for interior faces:

  \snippet cs_user_porosity.c set_poro_i_faces_1

  and for boundary faces:

  \snippet cs_user_porosity.c set_poro_b_faces_1

  \page base_poro_cad_example Setting porosity values from a CAD file

  Using an appropriate CAD representation, it may be possible to
  compute the porosity fields using "common" or "cut" boolean operations
  between cells in the porous zones and the CAD volume. If the CAD
  shape represents the actual fluid volume, the common volume between
  the shape and the porous mesh section's cells will be used. If the
  CAD shape represents the solid volume, it should be cut from the
  pourous mesh section's cells.

  The following example uses functions from the OpenCascade Technology
  (OCCT) libraries (https://dev.opencascade.org/doc/overview/html/index.html),
  and assumes they are installed on the user's machine. As these libraries
  form the backbone of the SALOME platform's CAD features, they are present
  with any generic or common SALOME install, and are available as a package
  in many Linux distributions.

  \section user_poro_cad_compile_link Libraries to compile and link.

  As the OCCT libraries provide a C++ API, interfacing them with code_saturne
  requires a file written in C++, so the following example uses a
  separate C++ file, \ref cs_cad_intersect.cxx to to most of the work.
  This file is also a user example, and may be improved or modified.

  To compile and link, additional compiler flags must be passed to code_saturne.
  They may be defined in <_ref cs_user_scripts.py, and the following
  values are recommended (adapting the paths to the local environment):

  \code{.py}
  occ_include_path = "/opt/occ/7.4.0/include/opencascade"
  occ_lib_paths = ("/opt/occ/7.4.0/lib", "/opt/gl2ps/1.4.0.1/lib")

  occ_libs "-lTKMesh -lTKernel -lTKG2d -lTKG3d -lTKMath -lTKIGES  -lTKXSBase -lTKBin -lTKBool -lTKBO -lTKCDF -lTKBRep -lTKTopAlgo -lTKGeomAlgo -lTKGeomBase -lTKOffset -lTKPrim -lTKSTEP -lTKSTEPBase -lTKSTEPAttr -lTKHLR -lTKFeat"

  domain.compile_cxxflags = "-std=c++11 -I" + occ_include_path;
  domain.compile_libs = ""
  for p in occ_lib_paths:
      domain.compile_libs += "-L" + p + " -Wl,-rpath -Wl," + p + " "
      domain.compile_libs += occ_libs
  \endcode

  \section user_poro_cad_proto Function prototypes.

  As the prototypes for the \ref cs_cad_intersect.cxx are not part of the
  defaul code_saturne installation, do not forget to include the
  \c cs_cad_intersect.h header in the Local headers section of
  the cs_user_porosity.c file:

  \snippet cs_user_porosity-from_cad.c user_poro_cad_proto

  \section user_poro_cad_zone Zone selection

  It is recommended to use the standard zone selection mechanism
  to select cells which may be intersected by the CAD shape, for example:

  \snippet cs_user_porosity-from_cad.c user_poro_cad_zone

  \section user_poro_cad_init Local variables and initialization

  A few local variables may allow a more concise syntax, and
  optional face porosity arrays may be declared as temporary work arrays
  if face factors are required::

  \snippet cs_user_porosity-from_cad.c user_poro_cad_init

  \section user_poro_cad_intersect CAD intersection operation

  The actual CAD intersection is done using the following call
  (adapting the file path to the actual file):

  \snippet cs_user_porosity-from_cad.c user_poro_cad_intersect

  \section user_poro_cad_quantities Computing porous quantities

  Though the cell porosity is directly set by the call above,
  face quantities may be computed from the face porosities.
  The following code also handles the cleanup op local arrays.

  \snippet cs_user_porosity-from_cad.c user_poro_cad_quantities
*/

/*-----------------------------------------------------------------------------*/