Skip to content

Commit

Permalink
new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco-Marcucci committed Feb 7, 2024
1 parent 43beb2f commit af40f2b
Show file tree
Hide file tree
Showing 5 changed files with 601 additions and 1 deletion.
29 changes: 29 additions & 0 deletions ceasiompy/SU2Run/func/su2config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# IMPORTS
# =================================================================================================

import numpy as np
from pathlib import Path
from shutil import copyfile

Expand Down Expand Up @@ -64,6 +65,8 @@
SU2_ROTATION_RATE_XPATH,
SU2_TARGET_CL_XPATH,
SU2MESH_XPATH,
ENGINE_TYPE_XPATH,
ENGINE_BC,
)
from ceasiompy.utils.configfiles import ConfigFile
from cpacspy.cpacsfunctions import (
Expand Down Expand Up @@ -294,6 +297,29 @@ def add_actuator_disk(cfg, cpacs, case_dir_path, actuator_disk_file, mesh_marker
f.close()


# adding the results of ThermoData to the config file of su2


def add_thermodata(cfg, cpacs, alt, case_nb, alt_list):

if cpacs.tixi.checkElement(ENGINE_TYPE_XPATH):
log.info("adding engine BC to the SU2 config file")
engine_type = get_value(cpacs.tixi, ENGINE_TYPE_XPATH)
log.info(f"engine type {engine_type}")
alt = alt_list[case_nb]
Atm = Atmosphere(alt)
tot_temp_in = Atm.temperature[0]
tot_pressure_in = Atm.pressure[0]
tot_temp_out = get_value(cpacs.tixi, ENGINE_BC + "/temperatureOutlet").split(";")
tot_pressure_out = get_value(cpacs.tixi, ENGINE_BC + "/pressureOutlet").split(";")
tot_temp_out = tot_temp_out[case_nb]
tot_pressure_out = tot_pressure_out[case_nb]
cfg["INLET_TYPE"] = "TOTAL_CONDITIONS"
cfg[
"MARKER_INLET"
] = f"(INLET_ENGINE, {tot_temp_in}, {tot_pressure_in}, {1},{0},{0}, OUTLET_ENGINE,{tot_temp_out}, {tot_pressure_out}, {1},{0},{0} )"


def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir):
"""Function to create SU2 config file.
Expand Down Expand Up @@ -448,6 +474,7 @@ def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir):
cfg["HISTORY_OUTPUT"] = "(INNER_ITER, RMS_RES, AERO_COEFF)"

# Parameters which will vary for the different cases (alt,mach,aoa,aos)

for case_nb in range(len(alt_list)):
cfg["MESH_FILENAME"] = str(su2_mesh)

Expand All @@ -470,6 +497,8 @@ def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir):
f"_aoa{round(aoa, 1)}_aos{round(aos, 1)}"
)

add_thermodata(cfg, cpacs, alt, case_nb, alt_list)

case_dir_path = Path(wkdir, case_dir_name)
if not case_dir_path.exists():
case_dir_path.mkdir()
Expand Down
Loading

0 comments on commit af40f2b

Please sign in to comment.