Skip to content

Commit 2469210

Browse files
committed
start working on front_tracker script
1 parent e7ec7f0 commit 2469210

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import glob
5+
import yt
6+
import numpy as np
7+
from yt.frontends.boxlib.api import CastroDataset
8+
9+
'''
10+
This file tracks the flame front and writes them into a txt file.
11+
12+
Usage: ./front_tracker.py plotFiles_*
13+
'''
14+
15+
def track_flame_front(ds):
16+
'''
17+
This script tracks the flame front position for a given dataset.
18+
It returns a tuple of the form: (Time, Theta)
19+
Note: time is in milisecond.
20+
'''
21+
22+
time = ds.current_time.in_units("ms")
23+
24+
# How to determine the flame front?
25+
# 1) Global max temperature: this can be used to track initial
26+
# detonation resulted from the initial temperature perturbation
27+
# 2) Use vertically averaged max enuc to determine the actual flame front
28+
29+
30+
return timeTheta
31+
32+
33+
if __name__ == "__main__":
34+
35+
ts = sys.argv[1:]
36+
37+
timeThetaArray = []
38+
for fname in ts:
39+
ds = CastroDataset(fname)
40+
41+
# Get tuple in form (theta, time)
42+
timeTheta= track_flame_front(ds)
43+
timeThetaArray.append(timeTheta)
44+
45+
# Sort array by time and write to file
46+
timeThetaArray.sort()
47+
timeThetaArray = np.array(timeThetaArray)
48+
49+
np.savetxt('front_tracking.dat', timeThetaArray, delimiter=',')

0 commit comments

Comments
 (0)