-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunPythonPostprocessVolumetric.sh
More file actions
executable file
·591 lines (549 loc) · 23.3 KB
/
Copy pathrunPythonPostprocessVolumetric.sh
File metadata and controls
executable file
·591 lines (549 loc) · 23.3 KB
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
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
#!/bin/bash
#AEG: This is the internal part of the python posprocessing script
#-----------------------------------------
# General
#FOAMVersion=AEG. Defined in the main calling program
#thisScript=AEG. Defined in the main calling program
#-----------------------------------------
#Names for the case
#domainType=AEG. Defined in the main calling program
#arrayType=AEG. Defined in the main calling program
#arrayDensity=AEG. Defined in the main calling program
#Reynolds=AEG. Defined in the main calling program
#-----------------------------------------
#Working Directories
baseDir=$MYSCRATCH/OpenFOAM/espinosa-$FOAMVersion/run
#previousDir=
#workingDir=AEG. Defined in the main calling program
#nextDir=
functionsD=$MYBASE_AEG/bash_functions
pythonDir=$MYBASE_AEG/PythonPrograms
#-----------------------------------------
#Log files names
cd $baseDir
cd $workingDir
dateString=$(date +%Y-%m-%d.%H.%M.%S)
logRun="${baseDir}/${workingDir}/log_run_VolPY_${SLURM_JOB_ID}_${dateString}"
logJob="${baseDir}/${workingDir}/log_job_VolPY_${SLURM_JOB_ID}_${dateString}"
touch $logJob
#-----------------------------------------
#Spitting the slurm setup
echo "SLURM_JOB_ID = $SLURM_JOB_ID" | tee -a ${logJob}
echo "SLURM_JOB_NAME = $SLURM_JOB_NAME" | tee -a ${logJob}
echo "SLURM_NTASKS = $SLURM_NTASKS" | tee -a ${logJob}
echo "SLURM_NTASKS_PER_NODE = $SLURM_NTASKS_PER_NODE" | tee -a ${logJob}
#-----------------------------------------
#Knowing the computer we are using for this script
THISHOST=$(hostname --short)
echo "THISHOST=${THISHOST}" | tee -a ${logJob}
#-----------------------------------------
# Unloading modules to avoid unexpected crashes
if [ "${THISHOST:0:1}" = "n" ]; then
module unload PrgEnv-cray
module unload PrgEnv-gnu
fi
#-----------------------------------------
# Loading desired module
if [ "${THISHOST:0:1}" = "n" ]; then
# module load PrgEnv-intel
# module load PrgEnv-gnu
echo "For now, not loading modules in magnus" | tee -a ${logJob}
piton=python
elif [ "${THISHOST:0:1}" = "z" ]; then
echo "Loading modules for python and numpy" | tee -a ${logJob}
module load python
module load numpy
piton=python
elif [ "${THISHOST:0:1}" = "B" ]; then
echo "I'm in Behemoth, setting alias python=python3" | tee -a ${logJob}
piton=python3
fi
echo "Have defined piton=${piton}" | tee -a ${logJob}
#-----------------------------------------
#Sourcing the floating point function defininitons
#Global variable to be used as scale=$float_scale in bc floatingPoint functions
float_scale=4
archi=$functionsD/floatingPoint
if [ -e $archi ]; then
echo "Found floatingPoint functions" | tee -a ${logJob}
source $archi
else
echo "NOT FOUND floatingPoint functions" | tee -a ${logJob}
exit 4
fi
#-----------------------------------------
#Sourcing the auxiliary function defininitons
archi=$functionsD/auxiliaryFunctions.sh
if [ -e $archi ]; then
echo "Found auxiliary functions" | tee -a ${logJob}
source $archi
else
echo "NOT FOUND auxiliary functions" | tee -a ${logJob}
exit 4
fi
#------------------------------------------
# Identifying if is there another job with the same name already running
nTocallos=$(squeue --name="$SLURM_JOB_NAME" --state=RUNNING | wc -l)
nTocallos=$(float_eval "$nTocallos")
nTocallos=$(( $nTocallos - 2))
#------------------------------------------
#Checking if there are other pending jobs with the same name
nPendientes=$(squeue --name="$SLURM_JOB_NAME" --state=PENDING | wc -l)
nPendientes=$(float_eval "$nPendientes")
nPendientes=$(( $nPendientes - 1))
#-----------------------------------------
#Logic for cancelling existing running and pending jobs and resubmitting
if [ $nTocallos -ge 2 ] || [ $nPendientes -ge 2 ]; then
echo "TWO OR MORE jobs with the same name are already running. Tocallos=${nTocallos}" | tee -a ${logJob}
echo "or TWO OR MORE jobs with the same name are already pending. Pending=${nPendientes}" | tee -a ${logJob}
echo "All the existing jobs (all running and all pending) with the same name will be cancelled" | tee -a ${logJob}
scancel --name="$SLURM_JOB_NAME"
echo "All Tocallo-Jobs (running and pending) have been cancelled" | tee -a ${logJob}
echo "Now, This job will proceed normally" | tee -a ${logJob}
elif [ $nTocallos -eq 1 ] && [ $nPendientes -le 1 ]; then
echo "ONE job with the same name is already running. Tocallos=${nTocallos}" | tee -a ${logJob}
echo "And one or none jobs with the same name are already pending. Pending=${nPendientes}" | tee -a ${logJob}
echo "Everything looks fine in the queue for that running job and dependants." | tee -a ${logJob}
echo "So That job will be left running" | tee -a ${logJob}
echo "And This job request will be cancelled" | tee -a ${logJob}
echo "Exiting this job request .." | tee -a ${logJob}
exit 1
elif [ $nTocallos -eq 0 ] && [ $nPendientes -eq 1 ]; then
echo "There was a single orphan pending job. Tocallos=${nTocallos}, Pending=${nPendientes}" | tee -a ${logJob}
echo "I will leave it in the queue And This job request will be cancelled" | tee -a ${logJob}
echo "Exiting this job request .." | tee -a ${logJob}
exit 1
else
echo "No Tocallo-Jobs already running exist. Good! Tocallos=${nTocallos}, Pending=${nPendientes}" | tee -a ${logJob}
echo "Now, This job will be proceed to submit a case for running" | tee -a ${logJob}
fi
#-----------------------------------------
#Change directory
echo "Changing to ${baseDir}/${workingDir}" | tee -a ${logJob}
cd $baseDir/$workingDir
#### I used to mv log files like this, but now Im naming them from the beginning
##mv log_run log_run_${SLURM_JOB_ID}
##mv log_job log_job_${SLURM_JOB_ID}
#-----------------------------------------
#Avoiding falling into an infinite loop of recurrent errors which generate huge amount of files
#maxSlurmies= AEG.Defined in the main calling program
echo "Checking slurmies" | tee -a ${logJob}
slurmies=$(find . -maxdepth 1 -name "slurm*" | wc -l)
if [ $slurmies -gt $maxSlurmies ]; then
echo "Exiting because the maximum slurmies have been reached: $slurmies" | tee -a ${logJob}
exit 2
fi
#-----------------------------------------
#Type of analysis to perform
#For analysing the instantaneous time series:
#readInstantaneous=AEG. defined in the calling script
#For analysing the Mean fields:
#readMeans=AEG. defined in the calling script
#-----------------------------------------
#The rps to analyse
#rpArray=AEG. defined in the calling script
#useAllRps=AEG. defined in the calling script
#Using the whole list of rp's defined in the samplingRp.txt file
if [ "$useAllRps" = "true" ]; then
echo "useAllRps=true" | tee -a ${logJob}
echo "Reading rpDataFile:" | tee -a ${logJob}
rpDataFile=${baseDir}/${workingDir}/postProcessing/samplingRp.txt
echo $rpDataFile | tee -a ${logJob}
ii=0
rpArray[$ii]=9999
while read -r line
do
rpArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDataFile
else
echo "useAllRps=false" | tee -a ${logJob}
fi
#Number of rps to analyse
Nrps=${#rpArray[@]}
#-----------------------------------------
#Deciding if sending a following job with dependency
#useDependantCycle=AEG.defined in the calling script
#dependantScript=AEG.defined in the calling script
#Local flag to know if a dependant cycle was already sent to the queue:
localDependantSent=false
#-----------------------------------------
# Running the angular MEAN
if [ "${readMeans}" = "true" ]; then
#-----------------------------------------
#The rps done in Angular
echo "Reading rpDoneAngularMeanFile:" | tee -a ${logJob}
rpDoneAngularMeanFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/AngularMean/doneAngularMean.txt
echo $rpDoneAngularMeanFile | tee -a ${logJob}
doneAngularMeanArray[0]=9999
ii=1
if [ -f "${rpDoneAngularMeanFile}" ]
then
ii=0
while read -r line
do
doneAngularMeanArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneAngularMeanFile
else
echo "rpDoneAngularMeanFile does not exist. Starting Mean Angular process from scratch." | tee -a ${logJob}
fi
NDoneAngularMean=${#doneAngularMeanArray[@]}
#The processing cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing AngularMean rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneAngularMean}; jj++));
do
existingRp=${doneAngularMeanArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The AngularMean rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the AngularMean analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
$piton $pythonDir/ArrayCapture/AngularFlux/AngularAccumulation.py $rpAnalysis $arrayDensity Mean $PWD > "${logRun}_AngularMean_${rpAnalysis}" 2>&1
pyResult=$?
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneAngularMeanFile
fi
fi
done
else
echo "readMeans is set to false, so no Mean Angular process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# Running the volumetric MEAN analysis
if [ "${readMeans}" = "true" ]; then
#The rps done in Volumetric MEAN
echo "Reading rpDoneVolumetricMeanFile:" | tee -a ${logJob}
rpDoneVolumetricMeanFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/VolumetricMean/doneVolumetricMean.txt
echo $rpDoneVolumetricMeanFile | tee -a ${logJob}
doneVolumetricMeanArray[0]=9999
ii=1
if [ -f "${rpDoneVolumetricMeanFile}" ]
then
ii=0
while read -r line
do
doneVolumetricMeanArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneVolumetricMeanFile
else
echo "rpDoneVolumetricMeanFile does not exist. Starting volumetric mean process from scratch." | tee -a ${logJob}
fi
NDoneVolumetricMean=${#doneVolumetricMeanArray[@]}
#The process cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing VolumetricMean rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneVolumetricMean}; jj++));
do
existingRp=${doneVolumetricMeanArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The VolumetricMean rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the volumetricMean analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
date | tee -a ${logJob}
$piton $pythonDir/ArrayCapture/VolumetricFlux/TestVolumetric.py $rpAnalysis $arrayDensity Mean $PWD > "${logRun}_VolumetricMean_${rpAnalysis}" 2>&1
pyResult=$?
date | tee -a ${logJob}
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneVolumetricMeanFile
fi
fi
done
else
echo "readMeans is set to false, so no Mean Volumetric process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# Running the CylindricalVel MEAN analysis
if [ "${readMeans}" = "true" ]; then
#The rps done in CylindricalVel MEAN
echo "Reading rpDoneCylindricalVelMeanFile:" | tee -a ${logJob}
rpDoneCylindricalVelMeanFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/CylindricalVelMean/doneCylindricalVelMean.txt
echo $rpDoneCylindricalVelMeanFile | tee -a ${logJob}
doneCylindricalVelMeanArray[0]=9999
ii=1
if [ -f "${rpDoneCylindricalVelMeanFile}" ]
then
ii=0
while read -r line
do
doneCylindricalVelMeanArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneCylindricalVelMeanFile
else
echo "rpDoneCylindricalVelMeanFile does not exist. Starting CylindricalVel mean process from scratch." | tee -a ${logJob}
fi
NDoneCylindricalVelMean=${#doneCylindricalVelMeanArray[@]}
#The process cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing CylindricalVelMean rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneCylindricalVelMean}; jj++));
do
existingRp=${doneCylindricalVelMeanArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The CylindricalVelMean rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the CylindricalVelMean analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
date | tee -a ${logJob}
$piton $pythonDir/ArrayCapture/CylindricalVelocities/CylindricalVel.py $rpAnalysis $arrayDensity Mean $PWD > "${logRun}_CylindricalVelMean_${rpAnalysis}" 2>&1
pyResult=$?
date | tee -a ${logJob}
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneCylindricalVelMeanFile
fi
fi
done
else
echo "readMeans is set to false, so no Mean CylindricalVel process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# Running the instantaneous angular analysis script for all the rp's
if [ "${readInstantaneous}" = "true" ]; then
#The rps done in Angular
echo "Reading rpDoneAngularFile:" | tee -a ${logJob}
rpDoneAngularFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/Angular/doneAngular.txt
echo $rpDoneAngularFile | tee -a ${logJob}
doneAngularArray[0]=9999
ii=1
if [ -f "${rpDoneAngularFile}" ]
then
ii=0
while read -r line
do
doneAngularArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneAngularFile
else
echo "rpDoneAngularFile does not exist. Starting Instantaneus Angular process from scratch." | tee -a ${logJob}
fi
NDoneAngular=${#doneAngularArray[@]}
#The processing cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing Angular rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneAngular}; jj++));
do
existingRp=${doneAngularArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The Angular rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the Angular analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
$piton $pythonDir/ArrayCapture/AngularFlux/AngularAccumulation.py $rpAnalysis $arrayDensity Normal $PWD > "${logRun}_Angular_${rpAnalysis}" 2>&1
pyResult=$?
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneAngularFile
fi
fi
done
else
echo "readInstantaneous is set to false, so no instantaneous Angular process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# Running the instantaneous volumetric analysis script for all the rp's
if [ "${readInstantaneous}" = "true" ]; then
#The rps done in Volumetric
echo "Reading rpDoneVolumetricFile:" | tee -a ${logJob}
rpDoneVolumetricFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/Volumetric/doneVolumetric.txt
echo $rpDoneVolumetricFile | tee -a ${logJob}
doneVolumetricArray[0]=9999
ii=1
if [ -f "${rpDoneVolumetricFile}" ]
then
ii=0
while read -r line
do
doneVolumetricArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneVolumetricFile
else
echo "rpDoneVolumetricFile does not exist, then starting Volumetric Instantaneous process from scratch." | tee -a ${logJob}
fi
NDoneVolumetric=${#doneVolumetricArray[@]}
#The process cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing Volumetric rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneVolumetric}; jj++));
do
existingRp=${doneVolumetricArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The Volumetric rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the volumetric analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
$piton $pythonDir/ArrayCapture/VolumetricFlux/TestVolumetric.py $rpAnalysis $arrayDensity Normal $PWD > "${logRun}_Volumetric_${rpAnalysis}" 2>&1
pyResult=$?
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneVolumetricFile
fi
fi
done
else
echo "readInstantaneous is set to false, so no instantaneous Volumetric process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# Running the instantaneous CylindricalVel analysis
if [ "${readMeans}" = "true" ]; then
#The rps done in CylindricalVel
echo "Reading rpDoneCylindricalVelFile:" | tee -a ${logJob}
rpDoneCylindricalVelFile=${baseDir}/${workingDir}/postProcessing/pythonFiles/CylindricalVel/doneCylindricalVel.txt
echo $rpDoneCylindricalVelFile | tee -a ${logJob}
doneCylindricalVelArray[0]=9999
ii=1
if [ -f "${rpDoneCylindricalVelFile}" ]
then
ii=0
while read -r line
do
doneCylindricalVelArray[$ii]=$line
ii=$(( $ii + 1 ))
done < $rpDoneCylindricalVelFile
else
echo "rpDoneCylindricalVelFile does not exist. Starting CylindricalVel mean process from scratch." | tee -a ${logJob}
fi
NDoneCylindricalVel=${#doneCylindricalVelArray[@]}
#The process cycle
for ((ii=0; ii<${Nrps}; ii++));
do
rpAnalysis=${rpArray[$ii]}
echo "Analysing CylindricalVel rp=${rpAnalysis}" | tee -a ${logJob}
goForIt=true
for ((jj=0; jj<${NDoneCylindricalVel}; jj++));
do
existingRp=${doneCylindricalVelArray[$jj]}
if float_cond "$existingRp == $rpAnalysis"; then
goForIt=false
echo "The CylindricalVel rp=${rpAnalysis} was already processed fully" | tee -a ${logJob}
fi
done
if [ "${goForIt}" = "true" ]; then
if [ "$useDependantCycle" = "true" ]; then
if [ "$localDependantSent" = "false" ]; then
echo "Sending also the dependant job: ${dependantScript}" | tee -a ${logJob}
sbatch --dependency=afterany:${SLURM_JOB_ID} $dependantScript
localDependantSent=true
fi
else
echo "useDependantCycle=false, therefore NOT SENDING the dependant script" | tee -a ${logJob}
fi
echo "Obtaining the CylindricalVel analysis for the available times" | tee -a ${logJob}
tiempo0=$(($(date +%s%N)/1000000))
date | tee -a ${logJob}
$piton $pythonDir/ArrayCapture/CylindricalVelocities/CylindricalVel.py $rpAnalysis $arrayDensity Normal $PWD > "${logRun}_CylindricalVel_${rpAnalysis}" 2>&1
pyResult=$?
date | tee -a ${logJob}
tiempo1=$(($(date +%s%N)/1000000))
deltaT=$(float_eval "(${tiempo1} - ${tiempo0})/1000.0")
echo "The python script exited with pyResult=${pyResult}" | tee -a ${logJob}
echo "Time used was: ${deltaT} seconds" | tee -a ${logJob}
if [ $pyResult -eq 0 ]; then
echo $rpAnalysis >> $rpDoneCylindricalVelFile
fi
fi
done
else
echo "readMeans is set to false, so no Mean CylindricalVel process will be performed" | tee -a ${logJob}
fi
#-----------------------------------------
# End
echo "Volumetric Python Analysis Finished" | tee -a ${logJob}
exit 0
#-----------------------------------------
#Add a mark for last changes: (for rsync to pick it up with --only-size)
#2018.07.27