From 6729586cdf91b4ba884434ac7b8a1be08b4c694b Mon Sep 17 00:00:00 2001 From: GBenedett Date: Thu, 12 Oct 2023 12:18:29 +0200 Subject: [PATCH] aeromap generation improved --- ceasiompy/CPACS2GMSH/__specs__.py | 4 ++-- ceasiompy/SU2Run/func/su2config.py | 27 ++++++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ceasiompy/CPACS2GMSH/__specs__.py b/ceasiompy/CPACS2GMSH/__specs__.py index 62559fadd..d96563164 100644 --- a/ceasiompy/CPACS2GMSH/__specs__.py +++ b/ceasiompy/CPACS2GMSH/__specs__.py @@ -100,7 +100,7 @@ cpacs_inout.add_input( var_name="fuselage_mesh_size", var_type=float, - default_value=0.4, + default_value=0.3, unit="[m]", descr="Value assigned for the fuselage surfaces mesh size", xpath=GMSH_MESH_SIZE_FUSELAGE_XPATH, @@ -194,7 +194,7 @@ cpacs_inout.add_input( var_name="auto_refine", var_type=bool, - default_value=True, + default_value=False, unit="1", descr="Automatically refine the mesh on surfaces that are small compare to the chosen mesh" "size, this option increase the mesh generation time", diff --git a/ceasiompy/SU2Run/func/su2config.py b/ceasiompy/SU2Run/func/su2config.py index 16a59d06f..fdd458203 100644 --- a/ceasiompy/SU2Run/func/su2config.py +++ b/ceasiompy/SU2Run/func/su2config.py @@ -337,8 +337,21 @@ def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir): if fixed_cl == "NO": # Get the first aeroMap as default one or create automatically one - if not cpacs.tixi.checkElement(SU2_AEROMAP_UID_XPATH): - + aeromap_list = cpacs.get_aeromap_uid_list() + + if aeromap_list: + aeromap_default = aeromap_list[0] + log.info(f'The aeromap is {aeromap_default}') + + aeromap_uid = get_value_or_default(cpacs.tixi, SU2_AEROMAP_UID_XPATH, aeromap_default) + + activate_aeromap = cpacs.get_aeromap_by_uid(aeromap_uid) + alt_list = activate_aeromap.get("altitude").tolist() + mach_list = activate_aeromap.get("machNumber").tolist() + aoa_list = activate_aeromap.get("angleOfAttack").tolist() + aos_list = activate_aeromap.get("angleOfSideslip").tolist() + + else: default_aeromap = cpacs.create_aeromap("DefaultAeromap") default_aeromap.description = "AeroMap created automatically" @@ -354,15 +367,7 @@ def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir): aos_list = [0.0] aeromap_uid = "DefaultAeromap" - else: - aeromap_uid = get_value(cpacs.tixi, SU2_AEROMAP_UID_XPATH) - - active_aeromap = cpacs.get_aeromap_by_uid(aeromap_uid) - - alt_list = active_aeromap.get("altitude").tolist() - mach_list = active_aeromap.get("machNumber").tolist() - aoa_list = active_aeromap.get("angleOfAttack").tolist() - aos_list = active_aeromap.get("angleOfSideslip").tolist() + log.info(f"{aeromap_uid} has been created") else: # if fixed_cl == 'YES': log.info("Configuration file for fixed CL calculation will be created.")