API
- class mdss.src.main.post_process(out_dir: str, plot_options: dict = {})[source]
Performs post-processing operations for simulation results.
This class provides functionality to visualize and compare aerodynamic performance data such as Lift Coefficient (C<sub>L</sub>) and Drag Coefficient (C<sub>D</sub>) against Angle of Attack (Alpha), based on the simulation configuration provided via a YAML file.
Inputs
- out_dir: str
Path to the output directory. The output directory should contain the final out file from the simulation.
- custom_compare(custom_compare_info: dict, plt_name: str)[source]
Generates a combined plot comparing specific scenarios across hierarchies and cases.
This method creates a figure with two subplots: one for C<sub>L</sub> vs Alpha and another for C<sub>D</sub> vs Alpha. This method creates a figure with two subplots: one for C<sub>L</sub> vs Alpha and another for C<sub>D</sub> vs Alpha. It overlays selected scenarios (across different cases and hierarchies) and creates a shared legend to highlight which scenario each marker represents.
Inputs
- custom_compare_info: dict
A dictionary defining the scenarios to be compared. The structure of the dictionary should be:
{ "hierarchy_name": { "case_name": { "scenarios": ["scenario_name_1", "scenario_name_2"], "mesh_files": ["mesh_level_1", "mesh_level_2"] # Optional } } }
- hierarchy_name: str
Name of the hierarchy the scenario belongs to.
- case_name: str
Name of the case within the hierarchy.
- scenarios: list[str]
List of scenario names to be plotted.
- mesh_files: list[str], optional
List of mesh refinement levels to include for that scenario. If not specified, defaults to all mesh files under the case.
- plt_name: str
Name used for the plot title and the saved file name (PNG format).
Outputs
- PNG File:
A side-by-side comparison plot showing C<sub>L</sub> and C<sub>D</sub> vs Alpha for all selected scenarios. The plot is saved in the output directory specified during initialization.
Notes
Each scenario is plotted using a consistent color, with markers indicating refinement levels.
Experimental data is included when available.
A shared legend (outside the plot) shows scenario identifiers and their corresponding markers.
- gen_case_plots()[source]
Generates plots comparing experimental data with simulation results for each case and hierarchy.
This method loops through all hierarchies, cases, and scenarios in the simulation output, and generates side-by-side plots of C<sub>L</sub> and C<sub>D</sub> versus Angle of Attack (Alpha) for each case. Each scenario is plotted using a distinct marker, and each mesh refinement level is plotted using a different color. Experimental data, if provided, is overlaid for validation.
Outputs
- PNG File:
A comparison plot showing C<sub>L</sub> and C<sub>D</sub> vs Alpha for all scenarios and refinement levels of a case.
- PNG File:
A comparison plot showing C_L and C<sub>D</sub> vs Alpha for all scenarios and refinement levels of a case. The file is saved in the scenario output directory for each case using the case name.
Notes
Experimental data is optional. If not provided, only simulation data is plotted.
Markers distinguish scenarios; colors distinguish mesh refinement levels.
A shared legend is placed outside the figure to indicate scenario markers.
Axis spines are formatted using niceplots.adjust_spines() and figures are saved at high resolution (400 dpi).
Figures are titled using the case name and saved using niceplots.save_figs().
- class mdss.src.main.simulation(yaml_input: str)[source]
Executes aero(structural) simulations using the Top class defined in [aerostruct.py](aerostruct.py).
This class sets up and runs aerodynamic and/or aerostructural simulations based on input parameters provided via a YAML configuration file. It validates the input, manages directories, and handles outputs, including summary files. The simulations are run using subprocesses.
Inputs
- yaml_inputstr
Path to the YAML file or raw YAML string containing simulation configuration and information.
- run()[source]
Executes the simulation on either a local machine or an HPC.
This method checks the simulation settings from the input YAML file. Based on the machine_type, it either runs the simulation locally or generates an HPC job script for execution.
Notes
For local execution, it directly calls run_problem().
For HPC execution, it creates a Python file and a job script, then submits the job.
Helper functions for the “main.py” file. Helps run simulations and manages output files.
- mdss.src.main_helper.execute(simulation)[source]
Runs the aerodynamic and/or aerostructural simulations as subprocesses.
This method iterates through all hierarchies, cases, refinement levels, and angles of attack defined in the input YAML file. Runs the simulation by calling aerostruct.py, and stores the results.
Outputs
- A CSV file:
Contains results for each angle of attack at the current refinement level.
- A YAML file:
Stores simulation data for each angle of attack in the corresponding directory.
- A final YAML file:
Summarizes all simulation results across hierarchies, cases, and refinement levels.
Notes
This method ensures that:
Existing successful simulations are skipped.
Directories are created dynamically if they do not exist.
Simulation results are saved in structured output files.
- mdss.src.main_helper.run_as_subprocess(sim_info, case_info_fpath, scenario_info_fpath, ref_out_dir, aoa_csv_string, aero_grid_fpath, struct_mesh_fpath, comm, record_flag=False)[source]
Executes a set of Angles of Attack using mpirun for local machine and srun for HPC(Great Lakes).
Inputs
- sim_infodict
Dictionary containing simulation details, such as output directory, job name, and nproc.
- case_info_fpathstr
Path to the case info yaml file
- scenario_info_fpathstr
Path to the scenario info yaml file
- ref_out_dirstr
Path to the refinement level directory
- aoa_csv_stringstr
A list of angles of attack, in the form of csv string, that to be simulated in this subprocess
- aero_grid_fpath :
Path to the aero grid file that to be used for this simulation.
- struct_mesh_fpath: str
Path to the structural mesh file that to be used. Pass str(None) when running aero problem.
- commMPI communicator
An MPI communicator object to handle parallelism.
- record_flag: bool=False, Optional
Optional flag, strores ouput of the subprocess in a text file.
Outputs
- None
This function does not return any value but performs the following actions: 1. Creates necessary directories and input files. 2. Launches a subprocess to execute the simulation using mpirun or srun. 3. Prints standard output and error logs from the subprocess for debugging.
Notes
The function ensures the proper setup of the simulation environment for the given angle of attack.
The generated Python script and YAML input file are specific to each simulation run.
Captures and displays stdout and stderr from the subprocess for troubleshooting.
- mdss.src.main_helper.submit_job_on_hpc(sim_info, yaml_file_path, wait_for_job, comm)[source]
Generates and submits job script on an HPC cluster.
This function reads a slurm job script template, updates it with specific HPC parameters and file paths, saves the customized script to the output directory, and submits the job on the HPC cluster.
Inputs
- sim_infodict
Dictionary containing simulation details details.
- yaml_file_pathstr
Path to the YAML file containing simulation information.
- commMPI communicator
An MPI communicator object to handle parallelism.
Outputs
None
Notes
Supports customization for the GL cluster with Slurm job scheduling.
Uses regex to update the job script with provided parameters.
Ensures that the correct Python and YAML file paths are embedded in the job script.