-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolume-generator.sh
More file actions
executable file
·117 lines (100 loc) · 3.21 KB
/
volume-generator.sh
File metadata and controls
executable file
·117 lines (100 loc) · 3.21 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
#!/bin/bash
# usage:
# ./volume-generator.sh Lev1 Lev5
set -e
set -u
shopt -s nullglob
source ./paths.conf
while [ $# -ge 1 ] ; do
lev=$1
shift
echo `date`
for run in $sdbase ; do
cd $run
echo "================================================================"
echo "Descending into $run"
seg="$(ls --ignore "*.*" \
| grep -E "${lev}_[A-Z]{2,3}" \
| sort -n \
| tail --lines 1)"
vmdir="${run}/${seg}/Run/VolumeMatterData"
# Check to make sure there's h5 files in the vmdir. If there aren't
# any, loop back over previous segments until one is found, then use
# that segment.
if [ -d "${seg}" ]
then
echo "Candidate vmdir is: " $vmdir
lasth5=$(ls -tr "${vmdir}" | grep -i "Vars_Interval" | tail --lines 1)
h=1
while [ ! -f "${vmdir}/${lasth5}" ] ;
do
h=$((h+1))
lastseg="$(ls --ignore "*.*" \
| grep -E "${lev}_[A-Z]{2,3}" \
| sort -n \
| tail --lines $h \
| head --lines 1)"
if [ "$lastseg" == "$seg" ] ; then
break
fi
seg=$lastseg
vmdir="${run}/${seg}/Run/VolumeMatterData"
lasth5=$(ls -tr "${vmdir}" | grep -i "Vars_Interval" | tail --lines 1)
done
else
continue
fi
if [ ! -d "${vmdir}" ] ; then
continue
fi
if [ -f "${vmdir}/${lasth5}" ]
then
echo "Latest written H5 file is: " $lasth5
h5time=$(TimesInH5File "${vmdir}/${lasth5}" \
| awk -F" " '{print $4}' \
| tail --lines 1)
# echo "The latest time is: " $h5time
hytimes=$(ls ${run}/${seg}/Run/HyDomainAtTime*.txt \
| awk -F" " '{print $2}' \
| awk -F".txt" '{print $1}')
# echo "The domain times are: " $hytimes
echo $h5time 1> "${basedir}/tmp/h5time.txt"
echo $hytimes 1> "${basedir}/tmp/hytimes.txt"
export basedir
hytime=$(python "${basedir}/scripts/match-domain-time-to-pv-file.py")
echo "h5time is: " $h5time
echo "hytime is: " $hytime
OLDIFS=$IFS
IFS=$'\n'
hydomain="${run}/${seg}/Run/HyDomainAtTime- ${hytime}.txt"
echo "hydomain is: " $hydomain
echo " "
jobname=$(grep -i "Jobname" "${run}/${seg}/Run/MakeSubmit.input" \
| awk -F" " '{print $3}')
vizdir="${basedir}/viz/${jobname}/${seg}"
if [ ! -d "${vizdir}" ]
then
mkdir -p "${vizdir}"
echo "created viz directory: " $vizdir
ApplyObservers \
-h5prefix Vars \
-UseTimes $h5time \
-NoDomainHistory \
-domaindir "${run}/${seg}/Run" \
-domaininput "HyDomainAtTime- ${hytime}.txt" \
-outputdir "${basedir}/viz/${jobname}/${seg}" \
-c "Subdomain(Items=ReadTensorFromDisk(Input=Rho0Phys;Time=${h5time};DeltaT=0.1;Dim=3;Dir=${run}/${seg}/Run/VolumeMatterData/;RankSymm=;Output=Rho0Phys;H5FilePrefix=Vars;),ReadTensorFromDisk(Input=Temp;Time=${h5time};DeltaT=0.1;Dim=3;Dir=${run}/${seg}/Run/VolumeMatterData/;RankSymm=;Output=Temp;H5FilePrefix=Vars;),)" \
-o "ConvertToVtk(Input=Rho0Phys,Temp; Basename=${h5time}_paraviewdata)"
echo "new paraview data extracted in ${basedir}/viz/${jobname}/${seg}/${h5time}_paraviewdata"
else
echo "Viz directory already exists!: " $vizdir
fi
IFS=$OLDIFS
rm "${basedir}/tmp/h5time.txt"
rm "${basedir}/tmp/hytimes.txt"
else
echo "No H5 files found, continuing to next system.."
continue
fi
done
done