Skip to content

Commit

Permalink
start working on front_tracker script
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Jan 28, 2025
1 parent e7ec7f0 commit 2469210
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Exec/science/xrb_spherical/analysis/front_tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env python3

import sys
import glob
import yt
import numpy as np
from yt.frontends.boxlib.api import CastroDataset

'''
This file tracks the flame front and writes them into a txt file.
Usage: ./front_tracker.py plotFiles_*
'''

def track_flame_front(ds):
'''
This script tracks the flame front position for a given dataset.
It returns a tuple of the form: (Time, Theta)
Note: time is in milisecond.
'''

time = ds.current_time.in_units("ms")

# How to determine the flame front?
# 1) Global max temperature: this can be used to track initial
# detonation resulted from the initial temperature perturbation
# 2) Use vertically averaged max enuc to determine the actual flame front


return timeTheta


if __name__ == "__main__":

ts = sys.argv[1:]

timeThetaArray = []
for fname in ts:
ds = CastroDataset(fname)

# Get tuple in form (theta, time)
timeTheta= track_flame_front(ds)
timeThetaArray.append(timeTheta)

# Sort array by time and write to file
timeThetaArray.sort()
timeThetaArray = np.array(timeThetaArray)

np.savetxt('front_tracking.dat', timeThetaArray, delimiter=',')

0 comments on commit 2469210

Please sign in to comment.