Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion Common/DataDrivenConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ class Config_FGM(Config):
__generate_extra_interpolated_burnerflames:bool = True # Generate extra interpolated burner-stabilized flamelets
__generate_equilibrium:bool = DefaultSettings_FGM.include_equilibrium # Generate chemical equilibrium data
__generate_counterflames:bool = DefaultSettings_FGM.include_counterflames # Generate counter-flow diffusion flamelets.
__counterflow_fixed_strain:bool = DefaultSettings_FGM.counterflow_fixed_strain # Fixed-strain mode for counterflow flames.
__counterflow_strain_rate:float = DefaultSettings_FGM.counterflow_strain_rate # Global strain rate [1/s] for fixed-strain mode.

__write_MATLAB_files:bool = False # Write TableGenerator compatible flamelet files.

Expand Down Expand Up @@ -962,7 +964,10 @@ def PrintBanner(self):
if self.__generate_equilibrium:
print("-Chemical equilibrium data")
if self.__generate_counterflames:
print("-Counter-flow diffusion flamelet data")
if self.__counterflow_fixed_strain:
print("-Counter-flow diffusion flamelet data (fixed strain rate: %.1f 1/s)" % self.__counterflow_strain_rate)
else:
print("-Counter-flow diffusion flamelet data (ramp to extinction)")
print("")

print("Flamelet manifold data characteristics: ")
Expand Down Expand Up @@ -1580,6 +1585,51 @@ def GenerateCounterFlames(self):
"""
return self.__generate_counterflames

def SetCounterFlowFixedStrain(self, fixed:bool=True):
"""
Select fixed-strain-rate mode for counter-flow diffusion flames.

When True, one flame is solved per temperature level at the strain rate
set by SetCounterFlowStrainRate. When False (default), the existing
ramp-to-extinction behaviour is used.

:param fixed: enable fixed-strain mode.
:type fixed: bool
"""
self.__counterflow_fixed_strain = fixed
return

def GetCounterFlowFixedStrain(self) -> bool:
"""
Whether fixed-strain mode is enabled for counter-flow flames.

:return: fixed-strain mode is active.
:rtype: bool
"""
return self.__counterflow_fixed_strain

def SetCounterFlowStrainRate(self, strain_rate:float):
"""
Set the global strain rate used in fixed-strain counter-flow flame mode.

:param strain_rate: global strain rate in 1/s.
:type strain_rate: float
:raises Exception: if strain_rate is not strictly positive.
"""
if strain_rate <= 0:
raise Exception("Counter-flow strain rate must be strictly positive.")
self.__counterflow_strain_rate = strain_rate
return

def GetCounterFlowStrainRate(self) -> float:
"""
Return the global strain rate used in fixed-strain counter-flow flame mode.

:return: global strain rate [1/s].
:rtype: float
"""
return self.__counterflow_strain_rate

def GenerateExtraInterpolatedBurnerFlames(self):
"""
Whether the manifold data contains extra interpolated burner-stabilized flame data.
Expand Down
3 changes: 3 additions & 0 deletions Common/Properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ class DefaultSettings_FGM(DefaultProperties):
include_equilibrium:bool = True
include_counterflames:bool = False

counterflow_fixed_strain:bool = False # False = ramp-to-extinction; True = fixed strain rate
counterflow_strain_rate:float = 56.0 # global strain rate [1/s] for fixed-strain mode

affinity_threshold:float = 0.7
output_file_header:str = "flamelet_data"
boundary_file_header:str = "boundary_data"
Expand Down
221 changes: 192 additions & 29 deletions Data_Generation/DataGenerator_FGM.py

Large diffs are not rendered by default.

46 changes: 45 additions & 1 deletion Data_Processing/DataPlotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ class DataPlotter_FGM(DataPlotter_Base):
__data_dir:str = None
__plot_freeflames:bool = DefaultSettings_FGM.include_freeflames
__plot_burnerflames:bool = DefaultSettings_FGM.include_burnerflames
__plot_counterflowflames:bool = DefaultSettings_FGM.include_counterflowflames
__plot_equilibrium:bool = DefaultSettings_FGM.include_equilibrium
__manual_select:bool = True

__color_freeflames:str = 'r'
__color_burnerflames:str = 'm'
__color_counterflowflames:str = 'g'
__color_equilibrium:str = 'b'

__freeflame_displayname = r"Adiabatic flame data"
__burnerflame_displayname = r"Burner-stabilized data"
__counterflowflame_displayname = r"Counterflow flame data"
__equilibrium_displayname = r"Chemical equilibrium data"

__mix_status:list[float] = []
Expand Down Expand Up @@ -52,6 +55,7 @@ def __init__(self, Config_in:Config_FGM=None):
self.__data_dir = self._Config.GetOutputDir()
self.__plot_freeflames = self._Config.GenerateFreeFlames()
self.__plot_burnerflames = self._Config.GenerateBurnerFlames()
self.__plot_counterflowflames = self._Config.GenerateCounterFlames()
self.__plot_equilibrium = self._Config.GenerateEquilibrium()
return

Expand Down Expand Up @@ -94,6 +98,15 @@ def PlotBurnerflames(self, input:bool=DefaultSettings_FGM.include_burnerflames):
self.__plot_burnerflames = input
return

def PlotCounterflowflames(self, input:bool=False):
"""Plot data under counterflowflame_data directory in the flamelet data directory.

:param input: plot counterflow flame data.
:type input: bool
"""
self.__plot_counterflowflames = input
return

def PlotEquilibrium(self, input:bool=DefaultSettings_FGM.include_equilibrium):
"""Plot data under equilibrium_data directory in the flamelet data directory.

Expand Down Expand Up @@ -158,6 +171,18 @@ def _PlotBody(self, plot_variables: list[str]):
plot_label=""
plot_data_burnerflame.append(plot_data)

plot_data_counterflowflame = []
if self.__plot_counterflowflames:
plot_label=self.__counterflowflame_displayname
for f in self.counterflowflame_files:
plot_data = self.__GeneratePlotData(f, plot_variables)
if plot_3D:
self._ax.plot3D(plot_data[:,0],plot_data[:,1],plot_data[:,2],color=self.__color_counterflowflames, label=plot_label, linewidth=2)
else:
self._ax.plot(plot_data[:,0],plot_data[:,1],color=self.__color_counterflowflames, label=plot_label, linewidth=2)
plot_label=""
plot_data_counterflowflame.append(plot_data)

plot_data_eq = []
if self.__plot_equilibrium:
plot_label=self.__equilibrium_displayname
Expand All @@ -170,7 +195,7 @@ def _PlotBody(self, plot_variables: list[str]):
plot_label=""
plot_data_eq.append(plot_data)

return [plot_data_freeflame, plot_data_burnerflame, plot_data_eq]
return [plot_data_freeflame, plot_data_burnerflame, plot_data_counterflowflame, plot_data_eq]


def __GetFileNames(self):
Expand Down Expand Up @@ -220,6 +245,25 @@ def __GetFileNames(self):
for file in filenames:
self.burnerflame_files.append(burnerflame_dir + header + str(round(i, 6)) + "/" +file)

if self.__plot_counterflowflames:
self.counterflowflame_files = []
counterflowflame_dir = self.__data_dir + "/counterflowflame_data/"
if self.__manual_select and len(self.__mix_status) == 0:
filenames = askopenfilenames(initialdir=counterflowflame_dir, title="Choose counterflow flame files to plot")
for file in filenames:
self.counterflowflame_files.append(file)
else:
for i in self.__mix_status:
if self.__manual_select:
filenames = askopenfilenames(initialdir=counterflowflame_dir+ header + str(round(i, 6)), title="Choose counterflow flame files to plot")
for file in filenames:
self.counterflowflame_files.append(file)
else:
filenames = next(os.walk(counterflowflame_dir + header + str(round(i, 6))), (None, None, []))[2]
filenames.sort()
for file in filenames:
self.counterflowflame_files.append(counterflowflame_dir + header + str(round(i, 6)) + "/" +file)

if self.__plot_equilibrium:
self.equilibrium_files = []
equilibrium_dir = self.__data_dir + "/equilibrium_data/"
Expand Down
5 changes: 3 additions & 2 deletions Data_Processing/collectFlameletData.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ def __SizeDataArrays(self):
# Count the number of counter-flow diffusion flamelets.
if self.__include_counterflame:
print("Counting counter-flow diffusion flame data...")
counterflame_files = listdir(self.__flameletdata_dir + "/counterflame_data")
counterflame_files = [f for f in listdir(self.__flameletdata_dir + "/counterflame_data")
if f.endswith('.csv')]
n_counterflames += len(counterflame_files)
for f in counterflame_files:
with open(self.__flameletdata_dir + "/counterflame_data/" + f, 'r') as fid:
Expand Down Expand Up @@ -646,7 +647,7 @@ def __SizeDataArrays(self):

def __InterpolateFlameletData(self, flamelet_dir:str, eq_file:str, i_start:int, i_flamelet_total:int, is_fuzzy:bool=False, is_equilibrium:bool=False):

flamelets = listdir(flamelet_dir + "/" + eq_file)
flamelets = [f for f in listdir(flamelet_dir + "/" + eq_file) if f.endswith('.csv')]
for i_flamelet, f in enumerate(flamelets):
BurningFlamelet:bool = True

Expand Down
Loading
Loading