Skip to content

Commit

Permalink
Merge branch 'medge_integration' of https://github.com/cfsengineering…
Browse files Browse the repository at this point in the history
…/CEASIOMpy into medge_integration
  • Loading branch information
mengmengzhang2019 committed Jan 18, 2024
2 parents 5ad406f + b56b7eb commit 4360f77
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 456 deletions.
12 changes: 9 additions & 3 deletions ceasiompy/CPACS2GMSH/cpacs2gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
GMSH_REFINE_TRUNCATED_XPATH,
GMSH_SYMMETRY_XPATH,
SU2MESH_XPATH,
EDGE_MESH_XPATH,
)
from cpacspy.cpacsfunctions import create_branch, get_value_or_default
from cpacspy.cpacspy import CPACS
Expand Down Expand Up @@ -98,7 +99,7 @@ def cpacs2gmsh(cpacs_path, cpacs_out_path):

# Run mesh generation
export_brep(cpacs, brep_dir, (intake_percent, exhaust_percent))
mesh_path, _ = generate_gmsh(
su2mesh_path, _, cgnsmesh_path = generate_gmsh(
cpacs,
cpacs_path,
brep_dir,
Expand All @@ -119,11 +120,16 @@ def cpacs2gmsh(cpacs_path, cpacs_out_path):
testing_gmsh=False,
)

if mesh_path.exists():
if su2mesh_path.exists():
create_branch(cpacs.tixi, SU2MESH_XPATH)
cpacs.tixi.updateTextElement(SU2MESH_XPATH, str(mesh_path))
cpacs.tixi.updateTextElement(SU2MESH_XPATH, str(su2mesh_path))
log.info("SU2 Mesh has been correctly generated.")

if cgnsmesh_path.exists():
create_branch(cpacs.tixi, EDGE_MESH_XPATH)
cpacs.tixi.updateTextElement(EDGE_MESH_XPATH, str(cgnsmesh_path))
log.info("EDGE Mesh has been correctly generated.")

# Save CPACS
cpacs.save_cpacs(cpacs_out_path, overwrite=True)

Expand Down
6 changes: 5 additions & 1 deletion ceasiompy/CPACS2GMSH/func/generategmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,11 @@ def generate_gmsh(
if not testing_gmsh:
gmsh.clear()
gmsh.finalize()
return su2mesh_path, aircraft_parts
return (
su2mesh_path,
aircraft_parts,
cgnsmesh_path,
)


# =================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion ceasiompy/CPACS2GMSH/tests/test_generatemesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_assignation():

export_brep(cpacs, TEST_OUT_PATH)

_, aircraft_parts = generate_gmsh(
_, aircraft_parts, _ = generate_gmsh(
cpacs=cpacs,
cpacs_path=CPACS_IN_PATH,
brep_dir=TEST_OUT_PATH,
Expand Down
2 changes: 1 addition & 1 deletion ceasiompy/CPACS2GMSH/tests/test_wingclassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_classify_wing():

export_brep(cpacs, TEST_OUT_PATH)

_, aircraft_parts = generate_gmsh(
_, aircraft_parts, _ = generate_gmsh(
cpacs=cpacs,
cpacs_path=CPACS_IN_PATH,
brep_dir=TEST_OUT_PATH,
Expand Down
253 changes: 13 additions & 240 deletions ceasiompy/EdgeRun/__specs__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,16 @@
from ceasiompy.utils.commonxpath import (
AEROPERFORMANCE_XPATH,
GEOM_XPATH,
PROP_XPATH,
RANGE_XPATH,
REF_XPATH,
EDGE_ACTUATOR_DISK_XPATH,
EDGE_AEROMAP_UID_XPATH,
EDGE_BC_FARFIELD_XPATH,
EDGE_BC_WALL_XPATH,
EDGE_CFL_NB_XPATH,
EDGE_CFL_ADAPT_XPATH,
EDGE_CFL_ADAPT_PARAM_DOWN_XPATH,
EDGE_CFL_ADAPT_PARAM_UP_XPATH,
EDGE_CFL_MIN_XPATH,
EDGE_CFL_MAX_XPATH,
EDGE_CONTROL_SURF_XPATH,
EDGE_DAMPING_DER_XPATH,
EDGE_EXTRACT_LOAD_XPATH,
EDGE_FIXED_CL_XPATH,
EDGE_MAX_ITER_XPATH,
EDGE_MG_LEVEL_XPATH,
EDGE_NB_CPU_XPATH,
EDGE_ROTATION_RATE_XPATH,
EDGE_TARGET_CL_XPATH,
EDGE_UPDATE_WETTED_AREA_XPATH,
EDGE_MESH_XPATH,
EDGE_SOLVER,
)
from ceasiompy.utils.moduleinterfaces import CPACSInOut

Expand Down Expand Up @@ -58,18 +44,6 @@
gui_group="Aeromap settings",
)

# cpacs_inout.add_input(
# var_name="mesh_upload",
# var_type=str,
# default_value="your path",
# unit=None,
# descr="Name of the mesh to upload",
# xpath=SU2MESH_XPATH,
# gui=True,
# gui_name="Path of the mesh",
# gui_group="Mesh upload",
# )

cpacs_inout.add_input(
var_name="ref_len",
var_type=float,
Expand Down Expand Up @@ -131,18 +105,6 @@
gui_group="If fixed CL",
)

cpacs_inout.add_input(
var_name="target_cl",
var_type=float,
default_value=1.0,
unit="1",
descr="Value of CL to achieve to have a level flight with the given conditions",
xpath=EDGE_TARGET_CL_XPATH,
gui=False,
gui_name=None,
gui_group=None,
)

cpacs_inout.add_input(
var_name="fixed_cl",
var_type=str,
Expand All @@ -155,42 +117,6 @@
gui_group=None,
)

cpacs_inout.add_input(
var_name="damping_der",
var_type=bool,
default_value=False,
unit="1",
descr="To check if damping derivatives should be calculated or not",
xpath=EDGE_DAMPING_DER_XPATH,
gui=True,
gui_name="Damping Derivatives",
gui_group="Aeromap Options",
)

cpacs_inout.add_input(
var_name="rotation_rate",
var_type=float,
default_value=1.0,
unit="rad/s",
descr="Rotation rate use to calculate damping derivatives",
xpath=EDGE_ROTATION_RATE_XPATH,
gui=True,
gui_name="Rotation Rate",
gui_group="Aeromap Options",
)

cpacs_inout.add_input(
var_name="control_surf",
var_type=bool,
default_value=False,
unit="1",
descr="To check if control surfaces deflections should be calculated or not",
xpath=EDGE_CONTROL_SURF_XPATH,
gui=True,
gui_name="Control Surfaces",
gui_group="Aeromap Options",
)

cpacs_inout.add_input(
var_name="nb_proc",
var_type=int,
Expand Down Expand Up @@ -227,66 +153,6 @@
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_adapt",
var_type=bool,
default_value=False,
unit="1",
descr="CFL Adaptation",
xpath=EDGE_CFL_ADAPT_XPATH,
gui=True,
gui_name="CFL Adaptation",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_adapt_param_factor_down",
var_type=float,
default_value=0.5,
unit="1",
descr="CFL Adaptation Factor Down",
xpath=EDGE_CFL_ADAPT_PARAM_DOWN_XPATH,
gui=True,
gui_name="CFL Adaptation Factor Down",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_adapt_param_factor_up",
var_type=float,
default_value=1.5,
unit="1",
descr="CFL Adaptation Factor Up",
xpath=EDGE_CFL_ADAPT_PARAM_UP_XPATH,
gui=True,
gui_name="CFL Adaptation Factor Up",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_adapt_param_min",
var_type=float,
default_value=0.5,
unit="1",
descr="CFL Minimum Value",
xpath=EDGE_CFL_MIN_XPATH,
gui=True,
gui_name="CFL Min Value",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_adapt_param_max",
var_type=float,
default_value=100,
unit="1",
descr="CFL Maximum Value",
xpath=EDGE_CFL_MAX_XPATH,
gui=True,
gui_name="CFL Max Value",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="mg_level",
var_type=int,
Expand All @@ -299,6 +165,18 @@
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="calculation_type",
var_type=list,
default_value=["RANS", "Euler"],
unit="1",
descr="Chose if perform a RANS or an Euler calculation",
xpath=EDGE_SOLVER,
gui=True,
gui_name="Solver for calculation",
gui_group="EDGE parameters",
)

cpacs_inout.add_input(
var_name="EDGE_mesh_path",
var_type="pathtype",
Expand All @@ -311,93 +189,6 @@
gui_group="Inputs",
)

cpacs_inout.add_input(
var_name="update_wetted_area",
var_type=bool,
default_value=False,
unit="1",
descr="Option to update the wetted area from the latest EDGE result.",
xpath=EDGE_UPDATE_WETTED_AREA_XPATH,
gui=True,
gui_name="Update Wetted Area",
gui_group="Results",
)

cpacs_inout.add_input(
var_name="check_extract_loads",
var_type=bool,
default_value=False,
unit="1",
descr="Option to extract loads (forces in each point) from results",
xpath=EDGE_EXTRACT_LOAD_XPATH,
gui=True,
gui_name="Extract loads",
gui_group="Results",
)

# Actuator disk

cpacs_inout.add_input(
var_name="include_actuator_disk",
var_type=bool,
default_value=False,
unit="1",
descr="To check if actuator disk(s) should be included in the EDGE calculation",
xpath=EDGE_ACTUATOR_DISK_XPATH,
gui=True,
gui_name="Include actuator disk(s)",
gui_group="Actuator disk",
)

cpacs_inout.add_input(
var_name="thrust",
var_type=float,
default_value=3000,
unit="N",
descr="Aircraft thrust",
xpath=PROP_XPATH + "/propeller/thrust",
gui=True,
gui_name="Thrust",
gui_group="Actuator disk",
)

# cpacs_inout.add_input(
# var_name="n",
# var_type=float,
# default_value=33,
# unit="1/s",
# descr="Propeller rotational velocity",
# xpath=PROP_XPATH + "/propeller/rotational_velocity",
# gui=True,
# gui_name="Rotational velocity setting",
# gui_group="Actuator disk",
# )

cpacs_inout.add_input(
var_name="prandtl",
var_type=bool,
default_value=False,
unit=None,
descr="Enable or disable the tip loss correction of Prandtl",
xpath=PROP_XPATH + "/propeller/blade/loss",
gui=True,
gui_name="Tip loss correction",
gui_group="Actuator disk",
)

# cpacs_inout.add_input(
# var_name="blades_number",
# var_type=int,
# default_value=3,
# unit=None,
# descr="Number of propeller blades",
# xpath=PROP_XPATH + "/propeller/bladeNumber",
# gui=True,
# gui_name="Propeller blades numbers",
# gui_group="Actuator disk",
# )


# ----- Output -----

cpacs_inout.add_output(
Expand All @@ -409,24 +200,6 @@
xpath=GEOM_XPATH + "/analyses/wettedArea",
)

cpacs_inout.add_output(
var_name="bc_wall_list",
var_type=list,
default_value=None,
unit="1",
descr="Wall boundary conditions found in the EDGE mesh",
xpath=EDGE_BC_WALL_XPATH,
)

cpacs_inout.add_output(
var_name="bc_farfield_list",
var_type=list,
default_value=None,
unit="1",
descr="Farfield boundary conditions found in the EDGE mesh (for off engines)",
xpath=EDGE_BC_FARFIELD_XPATH,
)

cpacs_inout.add_output(
var_name="aeromap_EDGE", # name to change...
# var_type=CPACS_aeroMap, # no type pour output, would it be useful?
Expand Down
Loading

0 comments on commit 4360f77

Please sign in to comment.