3D-ICE 3.0.0
macros.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is part of 3D-ICE, version 3.1.0 . *
3 * *
4 * 3D-ICE is free software: you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free *
6 * Software Foundation, either version 3 of the License, or any later *
7 * version. *
8 * *
9 * 3D-ICE is distributed in the hope that it will be useful, but WITHOUT *
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
12 * more details. *
13 * *
14 * You should have received a copy of the GNU General Public License along *
15 * with 3D-ICE. If not, see <http://www.gnu.org/licenses/>. *
16 * *
17 * Copyright (C) 2021 *
18 * Embedded Systems Laboratory - Ecole Polytechnique Federale de Lausanne *
19 * All Rights Reserved. *
20 * *
21 * Authors: Arvind Sridhar Alessandro Vincenzi *
22 * Giseong Bak Martino Ruggiero *
23 * Thomas Brunschwiler Eder Zulian *
24 * Federico Terraneo Darong Huang *
25 * Luis Costero Marina Zapater *
26 * David Atienza *
27 * *
28 * For any comment, suggestion or request about 3D-ICE, please register and *
29 * write to the mailing list (see http://listes.epfl.ch/doc.cgi?liste=3d-ice) *
30 * Any usage of 3D-ICE for research, commercial or other purposes must be *
31 * properly acknowledged in the resulting products or publications. *
32 * *
33 * EPFL-STI-IEL-ESL Mail : 3d-ice@listes.epfl.ch *
34 * Batiment ELG, ELG 130 (SUBSCRIPTION IS NECESSARY) *
35 * Station 11 *
36 * 1015 Lausanne, Switzerland Url : http://esl.epfl.ch/3d-ice *
37 ******************************************************************************/
38
39#ifndef _3DICE_MACROS_H_
40#define _3DICE_MACROS_H_
41
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48
49/******************************************************************************/
50
51#include <math.h> // For the math function sqrt
52
53/******************************************************************************/
54
60# define PI 3.14159265358979323846
61
62
63
69# define MAX(a,b) (((a) > (b)) ? (a) : (b))
70
71
72
78# define MIN(a,b) (((a) < (b)) ? (a) : (b))
79
80
81
88# define PARALLEL(x,y) (((x) * (y)) / ((x) + (y)))
89
90/******************************************************************************/
91/******************************************************************************/
92/******************************************************************************/
93
101# define IS_CHANNEL_COLUMN(channel_model, column) \
102 \
103 (channel_model == TDICE_CHANNEL_MODEL_MC_4RM ? (column) & 1 : true)
104
105/******************************************************************************/
106/******************************************************************************/
107/******************************************************************************/
108
129# define CCONV_MC_4RM(nchannels, vhc, fr) \
130 \
131 ((double) ((vhc * fr) / ((double) (nchannels * 2.0))))
132
133
134
158# define CCONV_MC_2RM(nchannels, vhc, fr, porosity, cell_l, channel_l) \
159 \
160 ((double) ( (vhc * fr * porosity * cell_l) \
161 / ( (double) nchannels * 2.0 * channel_l) ))
162
163
164
175# define CCONV_PF(vhc, darcy_velocity, cell_l, cavity_h) \
176 \
177 ((double) ((vhc * darcy_velocity * cell_l * cavity_h) / 2.0))
178
179/******************************************************************************/
180/******************************************************************************/
181/******************************************************************************/
182
183
184
192# define EFFECTIVE_HTC_PF_INLINE(darcy_velocity) \
193 \
194 ((double) ( 1e-12 \
195 / ( 2.527e-05 \
196 / pow((darcy_velocity/1e+06 + 1.35), 0.64) + 1.533e-06)))
197
198
199
207# define EFFECTIVE_HTC_PF_STAGGERED(darcy_velocity) \
208 \
209 ((double) ( 1e-12 \
210 / ( 2.527e-05 \
211 / pow((darcy_velocity/1e+06 + 1.35), 1.52) + 1.533e-06)))
212
213
214
221# define FLOW_RATE_FROM_MLMIN_TO_UM3SEC(fr) (( fr * 1e+12 ) / 60.0)
222
223
224
231# define FLOW_RATE_FROM_UM3SEC_TO_MLMIN(fr) (( fr * 60.0 ) / 1e+12)
232
233
234
240# define POROSITY(diameter, pitch) \
241 \
242 (1.0 - (PI * diameter * diameter / 4.0) / (pitch * pitch))
243
244
245
251# define DIAMETER(porosity, pitch) \
252 \
253 (sqrt (( (1.0 - porosity) * pitch*pitch * 4.0 ) / PI ))
254
255/******************************************************************************/
256
257#ifdef __cplusplus
258}
259#endif
260
261#endif /* _3DICE_MACROS_H_ */