Welcome to StoveOpt’s documentation!¶
Created on Sun May 19 18:18:31 2019
@author: Lee
-
post_processor.
average_pot_temperature
(list_temps, length_case_list, list_velocities, case_list)[source]¶ Compute average temperatures of each of the case temperature arrays previously extracted with data_import()
Parameters: - dir_list (dict) – Dictionary of directory titles in the ‘foamfiles’ directory that begin with string ‘case_’
- case_list (dir) – Dictionary of case file paths. Appended iteratively with dir_list entries.
- length_case_list (int) – Number of excecuted case files existing in foamfiles directory
- list_temps (array) – Populated with results from probing the CFD simulation around entire pot geometry
- list_velocities (array) – Populated with velocity values written to “details” file in individual case files
Returns: Numpy array where column 1 is case title (str), second column is velocites for respective case, and third column is computed average pot temperature for specific case
Return type: new_recarr (array)
-
post_processor.
compute_neighboring_velocities
(array_sorted, T_max, velocity_max, T_max_index, length_case_list, velocity_column, temperature_column)[source]¶ Use the maximum data solved for previously to compute 4 new neighboring velocities
Parameters: - T_max (float) – Maximum average pot temperature of all analyzed cases within foamfiles directory
- velocity_max (float) – Secondary air flow velocity associated with maximum average pot temperature
- T_max_index (int) – Index associated with maximum temperature.
- velocity_column (array) – Column array with case velocities
- temperature_column (array) – Column array with average temperatures
- array_sorted (array) – Numpy array of sorted velocities (column 1), and average pot temperatures (column 2)
Returns: Numpy array listing four velocities to be added to the case queue
Return type: v_cases_total_vector (array)
-
post_processor.
data_import
()[source]¶ input a list of filenames to be pulled, put out an array of temperature data. search the foamfiles directory for fnames that start with case_ and tally the number for looping through the file. loop through each and pull data from the files (3) convert to numpy arrays (4) store.
Parameters: None – Returns: Dictionary of directory titles in the ‘foamfiles’ directory that begin with string ‘case_’ case_list (dir): Dictionary of case file paths. Appended iteratively with dir_list entries.
length_case_list (int): Number of excecuted case files existing in foamfiles directory
list_temps (array): Populated with results from probing the CFD simulation around entire pot geometry
list_velocities (array): Populated with velocity values written to “details” file in individual case files
Return type: dir_list (dict)
-
post_processor.
evaluate_optimal
(array_sorted, length_case_list)[source]¶ The function evaluates the temperature and velocity data, and uses the information to identify where the optimals live within the range analayzed
Parameters: - array_sorted (array) – Numpy array of sorted velocities (column 1), and average pot temperatures (column 2)
- length_case_list (int) – Number of excecuted case files existing in foamfiles directory
Returns: Maximum average pot temperature of all analyzed cases within foamfiles directory
velocity_max (float): Secondary air flow velocity associated with maximum average pot temperature
T_max_index (int): Index associated with maximum temperature.
velocity_column (array): Column array with case velocities
temperature_column (array): Column array with average temperatures
Return type: T_max (float)
-
post_processor.
parse_and_sort_array
(new_recarr, length_case_list)[source]¶ Sort new_recarr array based on velocities, return the array with a new name
Parameters: - new_recarr (array) – Numpy array where column 1 is case title (str), second column is velocites for respective case, and third column is computed average pot temperature for specific case
- length_case_list (int) – Number of excecuted case files existing in foamfiles directory
Returns: Numpy array. Same data as new_recarr, but sorted based on velocities (least to greatest along column 2)
Return type: array_sorted (array)
-
post_processor.
plot_variables
(array_sorted, T_max, velocity_max, T_max_index, velocity_column, temperature_column)[source]¶ Parameters: - T_max (float) – Maximum average pot temperature of all analyzed cases within foamfiles directory
- velocity_max (float) – Secondary air flow velocity associated with maximum average pot temperature
- T_max_index (int) – Index associated with maximum temperature.
- velocity_column (array) – Column array with case velocities
- temperature_column (array) – Column array with average temperatures
- array_sorted (array) – Numpy array of sorted velocities (column 1), and average pot temperatures (column 2)
Returns: None
Created on Thu May 23 11:06:19 2019
@author: Lee
-
new_case_setup.
add_templates
(full_case_paths)[source]¶ Add the template files to the new case directories
Parameters: full_case_paths (dict) – List of full paths for new cases to be added. Compatible with windows os. Returns: List of paths leading to initial condition files for each newly added case constant_file_paths (dict): List of paths leading to solver files for each newly added case
system_file_paths (dict): List of paths leading to mesh, schemes, time step and outfil writing files for each newly added case
Return type: zero_file_paths (dict)
-
new_case_setup.
create_case_directories
(case_name_list)[source]¶ Create the directories for next batch of simulations within the foamfiles dir
Parameters: case_name_list (dict) – List of strings each corresponding to a new case file. Named based on velocity values converted to string. Returns: List of full paths for new cases to be added. Compatible with windows os. Return type: full_case_paths (dict)
-
new_case_setup.
define_new_case_names
(v_cases_total_vector)[source]¶ Create new case_ folders in the foamfiles folder. Named based on velocities computed in post_processor
Parameters: v_cases_total_vector (array) – Numpy array listing four velocities to be added to the case queue Returns: List of strings each corresponding to a new case file. Named based on velocity values converted to string. v_cases_total_vector_string (dict): Velocities converted to string dtype
v_boundary_strings (dict): Velocty data converted to string compatible with boundary condition file
Return type: case_name_list (dict)
-
new_case_setup.
edit_details_files
(zero_file_paths, v_boundary_strings)[source]¶ Open and edit the newly created 0 case files. Edit the empty details file with the velocity strings
Parameters: Returns: None
-
new_case_setup.
edit_iterative_boundary_conditions
(zero_file_paths, constant_file_paths, system_file_paths, v_boundary_strings)[source]¶ Parameters: - zero_file_paths (dict) – List of paths leading to initial condition files for each newly added case
- v_boundary_strings (dict) – Velocity strings to be added to details files for respective case
- constant_file_paths (dict) – List of paths leading to solver files for each newly added case
- system_file_paths (dict) – List of paths leading to mesh, schemes, time step and outfil writing files for each newly added case
Created on Mon Apr 22 15:39:27 2019
@author: Lee
-
import_geometry.
correct_arguments
(args)[source]¶ Goal is to convert the geometry file argument to working syntax: Single quote, back slash
Parameters: args (dictionary) – Object contains the contents of the input file specified by the user
-
import_geometry.
create_additional_front_points
(pt6x, pt7x, pt14x, pt9z, pt15x, pt8z, pt14z, pt9x, pt8x, pt15z)[source]¶ Create pot surface points to create faces–Naming them 21(L)-22(R) to not collide with current fuel vert numbers
Parameters: points (float) – cookstove geometry Returns: series of points created as the back plane of the stove. Used to create a 2D geometry Return type: points (float)
-
import_geometry.
create_back_points
(shift, pt1xstr, pt1zstr, pt1ystr, pt2xstr, pt2zstr, pt2ystr, pt3xstr, pt3zstr, pt3ystr, pt4xstr, pt4zstr, pt4ystr, pt5xstr, pt5zstr, pt5ystr, pt6xstr, pt6zstr, pt6ystr, pt7xstr, pt7zstr, pt7ystr, pt8xstr, pt8zstr, pt8ystr, pt9xstr, pt9zstr, pt9ystr, pt10xstr, pt10zstr, pt10ystr, pt11xstr, pt11zstr, pt11ystr, pt12xstr, pt12zstr, pt12ystr, pt13xstr, pt13zstr, pt13ystr, pt14xstr, pt14zstr, pt14ystr, pt15xstr, pt15zstr, pt15ystr, pt0xstr, pt0zstr, pt0ystr, pt16xstr, pt16zstr, pt16ystr, pt17xstr, pt17zstr, pt17ystr, pt18xstr, pt18zstr, pt18ystr, pt19xstr, pt19zstr, pt19ystr, pt20xstr, pt20zstr, pt20ystr, pt21xstr, pt21zstr, pt21ystr, pt44xstr, pt44zstr, pt44ystr, pt46xstr, pt46zstr, pt46ystr, pt48xstr, pt48zstr, pt48ystr, pt50xstr, pt50ystr, pt50zstr)[source]¶ Back coordinates of the cookstove–simply shifting the x2 (y) coordinate back by a value shift
Parameters: back points (concatenated) – The x,y,z values of back points concatenated into single vertice location
-
import_geometry.
create_fuel_blocks
(pt0x, pt1x)[source]¶ Creates geometry for the fuel block with the following assumptions: Rectangular fuel source, Centered along the vertical axis of the combustion chamber, Width of fuel block is half the diameter of the combustion chamber, Assumed fuel height of 3 inches (0.0762 m), bottom of the fuel is 3 inches off the ground.
Parameters: - pt0x (float) – origin x-coordinate of cookstove geometry
- pt1x – Bottom east vertice of cookstove combustion chamber
-
import_geometry.
extract_geometry
(file_path)[source]¶ Pulling Data from excel workbook
Parameters: file_path (str) – full file path for input stove geometry defined by user in input yaml file. Returns: A series of points pulled from the user defined geometry Return type: pt#i (float)
-
import_geometry.
locate_geometry
(args)[source]¶ Pull file path and name from the input file (command line argument)
Parameters: args (dictionary) – Object contains the contents of the input file specified by the user Returns: full file path for input stove geometry defined by user in input yaml file. Return type: file_path (str)
-
import_geometry.
points_to_strings
(pt1x, pt1z, pt1y, pt2x, pt2z, pt2y, pt3x, pt3z, pt3y, pt4x, pt4z, pt4y, pt5x, pt5z, pt5y, pt6x, pt6z, pt6y, pt7x, pt7z, pt7y, pt8x, pt8z, pt8y, pt9x, pt9z, pt9y, pt10x, pt10z, pt10y, pt11x, pt11z, pt11y, pt12x, pt12z, pt12y, pt13x, pt13z, pt13y, pt14x, pt14z, pt14y, pt15x, pt15z, pt15y, pt0x, pt0z, pt0y, pt17x, pt18x, pt19x, pt16x, pt17z, pt18z, pt19z, pt16z, pt17y, pt18y, pt19y, pt16y, pt20x, pt20z, pt20y, pt21x, pt21z, pt21y, pt44x, pt44z, pt44y, pt46x, pt46z, pt46y, pt48x, pt48y, pt48z, pt50x, pt50y, pt50z)[source]¶ Take in the raw vertice information from spreadsheet, and format the floats into strings->For front vertices
Parameters: points (float) – all front coordinates Returns: Coordinates converted to strings compatible with openfoam convention (length 5). Return type: points as strings (str)
-
import_geometry.
vertice_concatenate
(pt1xstr, pt1zstr, pt1ystr, pt2xstr, pt2zstr, pt2ystr, pt3xstr, pt3zstr, pt3ystr, pt4xstr, pt4zstr, pt4ystr, pt5xstr, pt5zstr, pt5ystr, pt6xstr, pt6zstr, pt6ystr, pt7xstr, pt7zstr, pt7ystr, pt8xstr, pt8zstr, pt8ystr, pt9xstr, pt9zstr, pt9ystr, pt10xstr, pt10zstr, pt10ystr, pt11xstr, pt11zstr, pt11ystr, pt12xstr, pt12zstr, pt12ystr, pt13xstr, pt13zstr, pt13ystr, pt14xstr, pt14zstr, pt14ystr, pt15xstr, pt15zstr, pt15ystr, pt0xstr, pt0zstr, pt0ystr, pt16xstr, pt16zstr, pt16ystr, pt17xstr, pt17zstr, pt17ystr, pt18xstr, pt18zstr, pt18ystr, pt19xstr, pt19zstr, pt19ystr, pt20xstr, pt20zstr, pt20ystr, pt21xstr, pt21zstr, pt21ystr, pt44xstr, pt44zstr, pt44ystr, pt46xstr, pt46zstr, pt46ystr, pt48xstr, pt48zstr, pt48ystr, pt50xstr, pt50zstr, pt50ystr)[source]¶ Convert the individual vertex strings and concatenate to the format required for blockmeshdict file
Parameters: as strings (points) – Coordinates converted to strings compatible with openfoam convention (length 5). Returns: The x,y,z values of front points concatenated into single vertice location Return type: concatenated front points (str)
Created on Thu Apr 25 11:26:04 2019
@author: Lee
-
create_blockmeshfile.
edit_blockmesh_template
(saveName, pt0str, pt1str, pt2str, pt3str, pt4str, pt5str, pt6str, pt7str, pt8str, pt9str, pt10str, pt11str, pt12str, pt13str, pt14str, pt15str, pt16str, pt17str, pt18str, pt19str, pt20str, pt21str, pt22str, pt23str, pt24str, pt25str, pt26str, pt27str, pt28str, pt29str, pt30str, pt31str, pt32str, pt33str, pt34str, pt35str, pt36str, pt37str, pt38str, pt39str, pt40str, pt41str, pt42str, pt43str, pt44str, pt45str, pt46str, pt47str, pt48str, pt49str, pt50str, pt51str)[source]¶ open the blockmeshtemplate for edit, locate the positions needed, and overwrite the vertice lines
-
create_blockmeshfile.
locate_blockmesh_template
(block_mesh_template_fname)[source]¶ the function uses the StoveOpt path and blockmesh template name to open the template version of the blockMeshDict file for editing in the system folder
-
create_blockmeshfile.
modify_controlDict
(pt10str, pt11str, pt9str, pt48str, pt44str, pt14str, pt20str, pt6str, pt21str, pt7str, pt46str, pt15str, pt8str, pt50str, pt12str, pt13str)[source]¶ Add the points to the controlDict file for the temperature data, and emissions data
-
create_blockmeshfile.
move_bmesh_to_templatecase
(saveName)[source]¶ Copy the previously edited blockmesh file to the template case system folder
-
create_blockmeshfile.
rename_blockmesh
(saveName, blockmesh_template)[source]¶ Moving the file and renaming–Need to add an existence check
-
create_blockmeshfile.
replace_template
(path_StoveOpt_master, block_mesh_template_fname, dir_steps)[source]¶ Move the template from the backup folder into the system folder for future edits Does not excecute if the template file is already there
-
create_blockmeshfile.
update_blockmesh
(blockmesh_template, system_folder)[source]¶ Used to create (but not assign) a new name for the blockmesh file saving name to the blockMeshDict required for running–in the system folder