-
Notifications
You must be signed in to change notification settings - Fork 2
/
massFlowRate.C
524 lines (475 loc) · 11.8 KB
/
massFlowRate.C
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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
/*--------------------------------*- C++ -*-----------------------------------*\
| | |
|Continuum Flow Mathematics | ANSYS FLUENT: User Defined Functions |
|* * * * ** * ** | Version: 1.0 |
| ** * * ** * * | Discription: |
| * ** * * * * |UDF for specifying mass flow rate profile based |
| * * |on Physical time steps for mass flow rate |
| * |boundary. THIS IS FOR CONTRACTION 1 DEVICE, |
|* * * * * * |WHERE 0.5 IS INLET, AND 0.375 IS OUTLET with |
| *** * * |gas flow rate 1 SLDPM. |
| * * * |ANSYS UDF functions for the TWO PHASE FLOW for |
| * * ** |the given accessible data. |
| | |
| * | |
| * * | |
\*----------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
/******************************************************************************/
#include "udf.h"
/*Inlet Mass Flow Rate Profile*/
DEFINE_PROFILE(td_mass_inlet_2_A,t,nv)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
if(flow_time < 302)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.004708 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.004708;
}
end_f_loop(f,t)
}
else if(flow_time < 602 && flow_time > 301)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.010109 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.010109;
}
end_f_loop(f,t)
}
else if(flow_time < 902 && flow_time > 601)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.015006 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.015006;
}
end_f_loop(f,t)
}
else if(flow_time < 1202 && flow_time > 901)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.017608 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.017608;
}
end_f_loop(f,t)
}
else if(flow_time < 1502 && flow_time > 1201)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.020204 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.020204;
}
end_f_loop(f,t)
}
else if(flow_time < 1802 && flow_time > 1501)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.022639 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.022639;
}
end_f_loop(f,t)
}
else if(flow_time < 2102 && flow_time > 1801)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.024463 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.024463;
}
end_f_loop(f,t)
}
else if(flow_time < 2402 && flow_time > 2101)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.026513 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.026513;
}
end_f_loop(f,t)
}
else if(flow_time < 2702 && flow_time > 2401)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted mass flow rate set at 0.028398 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.028398;
}
end_f_loop(f,t)
}
else
{
printf("Time = %f sec. \n",flow_time);
printf("targeted mass flow rate set at 0.030066 kg/s \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.030066;
}
end_f_loop(f,t)
}
}
/*Pressure for INLET Profile for specified mass flow rate*/
DEFINE_PROFILE(td_pressure_Inlet_2_F,t,nv)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
/*Flow rate at 0.005*/
if(flow_time < 302)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 18601.284 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 18601.284;
}
end_f_loop(f,t)
}
/*Flow rate at 0.01*/
else if(flow_time < 602 && flow_time > 301)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 42035.890 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 42035.890;
}
end_f_loop(f,t)
}
/*Flow rate at 0.015*/
else if(flow_time < 902 && flow_time > 601)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 69526.492 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 69526.492;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0175*/
else if(flow_time < 1202 && flow_time > 901)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 88419.422 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 88419.422;
}
end_f_loop(f,t)
}
/*Flow rate at 0.02*/
else if(flow_time < 1502 && flow_time > 1201)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 108072.6976 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 108072.697;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0225*/
else if(flow_time < 1802 && flow_time > 1501)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 125555.648 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 125555.648;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0245*/
else if(flow_time < 2102 && flow_time > 1801)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 139173.627 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 139173.627;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0265*/
else if(flow_time < 2402 && flow_time > 2101)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 155203.318 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 155203.318;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0285*/
else if(flow_time < 2702 && flow_time > 2401)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 171203.379 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 171203.379;
}
end_f_loop(f,t)
}
/*Flow rate at 0.03*/
else
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at Inlet set at 185756.108 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 185756.108;
}
end_f_loop(f,t)
}
}
/*Pressure Outlet Profile for specified mass flow rate*/
DEFINE_PROFILE(td_pressure_outlet_2_F,t,nv)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
/*Flow rate at 0.005*/
if(flow_time < 302)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 18081.750 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 18081.750;
}
end_f_loop(f,t)
}
/*Flow rate at 0.01*/
else if(flow_time < 602 && flow_time > 301)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 41538.104 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 41538.104;
}
end_f_loop(f,t)
}
/*Flow rate at 0.015*/
else if(flow_time < 902 && flow_time > 601)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 69013.911 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 69013.911;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0175*/
else if(flow_time < 1202 && flow_time > 901)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 87925.546 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 87925.546;
}
end_f_loop(f,t)
}
/*Flow rate at 0.02*/
else if(flow_time < 1502 && flow_time > 1201)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 107532.462 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 107532.4629;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0225*/
else if(flow_time < 1802 && flow_time > 1501)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 125052.814 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 125052.814;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0245*/
else if(flow_time < 2102 && flow_time > 1801)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 138767.087 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 138767.087;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0265*/
else if(flow_time < 2402 && flow_time > 2101)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 154665.835 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 154665.835;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0285*/
else if(flow_time < 2702 && flow_time > 2401)
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 170553.468 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 170553.468;
}
end_f_loop(f,t)
}
/*Flow rate at 0.03*/
else
{
printf("Time = %f sec. \n",flow_time);
printf("Targeted Pressure at outlet set at 185165.554 Pa \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 185165.554;
}
end_f_loop(f,t)
}
}
/*This part of code describes about the velocity slip ratio which is required for the two phase calculations*/
DEFINE_PROFILE(td_Velocity_slip_ratio,t,nv)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
/*Flow rate at 0.005*/
if(flow_time < 302)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 3.53976 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 3.53976;
}
end_f_loop(f,t)
}
/*Flow rate at 0.010*/
else if(flow_time < 602 && flow_time > 301)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 1.64864 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 1.64864;
}
end_f_loop(f,t)
}
/*Flow rate at 0.015*/
else if(flow_time < 902 && flow_time > 601)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 1.11059 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 1.11059;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0175*/
else if(flow_time < 1202 && flow_time > 901)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.94648 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.94648;
}
end_f_loop(f,t)
}
/*Flow rate at 0.02*/
else if(flow_time < 1502 && flow_time > 1201)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.82488 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.82488;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0225*/
else if(flow_time < 1802 && flow_time > 1501)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.73617 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.73617;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0245*/
else if(flow_time < 2102 && flow_time > 1801)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.68126 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.68126;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0265*/
else if(flow_time < 2402 && flow_time > 2101)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.62859 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.62859;
}
end_f_loop(f,t)
}
/*Flow rate at 0.0285*/
else if(flow_time < 2702 && flow_time > 2401)
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.58686 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.58686;
}
end_f_loop(f,t)
}
/*Flow rate at 0.03*/
else
{
printf("Time = %f sec. \n",flow_time);
printf("Velocity slip ratio set at 0.55432 \n");
begin_f_loop(f,t)
{
F_PROFILE(f,t,nv) = 0.55432;
}
end_f_loop(f,t)
}
}
/******************************************************************************
********************************************************************************/