Skip to content

Commit

Permalink
Update flame_wave/analysis readme and docs for flame_speed.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 committed Feb 7, 2025
1 parent 94f0ac9 commit 6dd94c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
23 changes: 11 additions & 12 deletions Exec/science/flame_wave/analysis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ user to specify framerate.

### front_tracker.py
Script for measuring the location of a flame or shock front over a sequence of snapshots. Allows the
user to specify the metrics (will only track 1 / 1000th the local enuc maximum by default), whether
to use a global or local maximum, domain bounds, and a few other things. For a usage description and
a full list of valid parameters, type `./front_tracker.py -h`. Should work for any dataset, but has
only been tested on flame wave ones. Restrictions: Currently only tracks along one dimension (the
user can tell it how to eliminate the others - either through slicing or averaging), and only tracks
percentages of the maximum of some field. Outputs to space-delimited data file called
front_tracking.dat by default.
user to specify the metrics (will only track 1 / 1000th the enuc maximum by default), domain bounds,
and a few other things. For a usage description and a full list of valid parameters, type
`./front_tracker.py -h`. Should work for any dataset, but has only been tested on flame wave ones.
Restrictions: Currently only tracks along one dimension (the user can tell it how to eliminate the
others - either through slicing or averaging), and only tracks percentages of the maximum of some
field. Outputs to space-delimited data file called front_tracking.dat by default.

### flame_speed.py
Script for reading in the front tracking dataset, plotting it, and fitting a line to some portion of
it. Usage: `./flame_speed.py data_file starting_index`, where starting index is the index of the
first datapoint to consider when fitting the line. The script prints out the slope of the line, the
r-squared value, and the fit error. The plot will appear squashed when it pops up - the window needs
to be enlarged. Uses `scipy` and `pandas`.
Script for reading in the front tracking dataset generated with `front_tracker.py`, plotting it, and
fitting a line to some portion of it.
Usage: `./flame_speed.py [--tmin TMIN] [--tmax TMAX] data_file column [column...]`, where `TMIN` and
`TMAX` specify the times to consider when fitting the line. The script prints out the slope of the
line, the r-squared value, and the fit error. Uses `scipy` and `pandas`.

### multirays.py
Plot 1D vertical slices of axisymmetric datasets. It generates 3 ortho rays - one at each end of
Expand Down
21 changes: 10 additions & 11 deletions Exec/science/flame_wave/analysis/flame_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
def measure_and_plot(dat, args): # pylint: disable=too-many-locals, too-many-statements
"""
Plots front_location vs. time on the current pyplot figure, as well as any
reasonable linear fits. *tmin* and *tmax* should give a range of times for
which the flame front has stabilized, and the slope obtained from linear
regression will yield an accurate measurement of the front speed.
reasonable linear fits.
"""

slopes = {}
Expand Down Expand Up @@ -123,19 +121,20 @@ def measure_and_plot(dat, args): # pylint: disable=too-many-locals, too-many-st


def main():
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description="Script for plotting and fitting the flame front tracking data generated by front_tracker.py.",
epilog="""TMIN and TMAX should give a range of times for which the flame front
has stabilized, and the slope obtained from linear regression will
yield an accurate measurement of the front speed.""",
)
parser.add_argument("data_file", type=argparse.FileType("r"))
parser.add_argument(
"--tmin",
type=float,
help="ignore everything before this time for the linear regression",
"--tmin", type=float, help="minimum time for the linear regression"
)
parser.add_argument(
"--tmax",
type=float,
help="ignore everything after this time for the linear regression",
"--tmax", type=float, help="maximum time for the linear regression"
)
parser.add_argument("columns", nargs="+")
parser.add_argument("columns", nargs="+", metavar="column")
args = parser.parse_args()

dat = pd.read_csv(args.data_file, sep=r"\s+")
Expand Down

0 comments on commit 6dd94c5

Please sign in to comment.