Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add medge as output mesh #287

Open
wants to merge 88 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
f8eb3bf
add medge as output mesh
GBenedett Dec 6, 2023
c5f97cf
improvement
GBenedett Dec 6, 2023
2affe82
add some lines
GBenedett Dec 14, 2023
ac007d1
no FF for pentagrow
GBenedett Jan 8, 2024
99aebef
new file: EdgeRun/files/default.ainp.tmp
mengmengzhang2019 Jan 8, 2024
0ddc476
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Jan 9, 2024
bc500c8
updated the default.ainp.tmp file to the latest version, which allows
mengmengzhang2019 Jan 9, 2024
c7ccbb0
re modulation
GBenedett Jan 10, 2024
1e386b4
modified: test_edgerun.py
mengmengzhang2019 Jan 10, 2024
58610c3
new file: edgerun.py
mengmengzhang2019 Jan 10, 2024
593f989
new file: edgeutils.py
mengmengzhang2019 Jan 11, 2024
cfef301
formatting
GBenedett Jan 11, 2024
d1ff01b
PATH modification
GBenedett Jan 11, 2024
73c9bed
formatting
GBenedett Jan 11, 2024
7bfd49a
formatting
GBenedett Jan 11, 2024
11ccb81
modification
GBenedett Jan 11, 2024
f340306
modified: edgeutils.py
mengmengzhang2019 Jan 11, 2024
727bcf3
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Jan 11, 2024
7ef00af
modified: ../edgerun.py
mengmengzhang2019 Jan 11, 2024
2a9941b
new file: edge_queScript_gen.py
mengmengzhang2019 Jan 12, 2024
ccb6de8
new file: labARstraight_toolInput.xml
mengmengzhang2019 Jan 12, 2024
1d28b27
modified: commonxpath.py
mengmengzhang2019 Jan 12, 2024
354e1cc
Added to copy mesh and aboc files from CPACS filesPath to /grid folder
mengmengzhang2019 Jan 12, 2024
df4ddcc
modified: edge_queScript_gen.py: added
mengmengzhang2019 Jan 13, 2024
474bd0a
modified: edge_queScript_gen.py
mengmengzhang2019 Jan 13, 2024
a78f04b
modified: edgeconfig.py: enable remote preprocessor instead of
mengmengzhang2019 Jan 13, 2024
bcc8d7d
medge spec file
GBenedett Jan 16, 2024
1e01bae
if euler removed
GBenedett Jan 16, 2024
509a1b0
modified: ../../../WKDIR/labARstraight_toolInput.xml
mengmengzhang2019 Jan 17, 2024
f211e17
modified: commonxpath.py
mengmengzhang2019 Jan 17, 2024
7da1fa9
modified: edge_queScript_gen.py
mengmengzhang2019 Jan 17, 2024
4ea7203
edge mesh path added
GBenedett Jan 18, 2024
b56b7eb
spec file for edge
GBenedett Jan 18, 2024
5ad406f
modified: ../func/edgeconfig.py
mengmengzhang2019 Jan 18, 2024
4360f77
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Jan 18, 2024
8168006
edgerun workflow
GBenedett Jan 19, 2024
031aaf3
modified: edgeconfig.py
mengmengzhang2019 Jan 20, 2024
27661f3
modified: edgerun.py
mengmengzhang2019 Jan 20, 2024
957efe7
modified: edgeconfig.py
mengmengzhang2019 Jan 20, 2024
22ca4e5
modified: ../files/default.ainp.tmp
mengmengzhang2019 Jan 20, 2024
3ab5f15
modified: ../edgerun.py
mengmengzhang2019 Jan 22, 2024
5579cba
spec Edge
GBenedett Jan 22, 2024
eb5adbe
Merge branch 'medge_integration' of https://github.com/cfsengineering…
GBenedett Jan 22, 2024
5e0900d
modified: ../edgerun.py
mengmengzhang2019 Jan 22, 2024
a81c52a
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Jan 22, 2024
729ac45
modified: ceasiompy/EdgeRun/edgerun.py
mengmengzhang2019 Jan 23, 2024
f8fd12a
aboc path
GBenedett Jan 24, 2024
0257ecc
edgerun
GBenedett Jan 24, 2024
caf251d
modified: sumoautomesh.py
mengmengzhang2019 Jan 27, 2024
fb5dd24
line 114-117
mengmengzhang2019 Jan 27, 2024
5f5041f
changed back to copy bmsh and aboc to /grid folder
mengmengzhang2019 Jan 27, 2024
d217437
modified: ../../SUMOAutoMesh/sumoautomesh.py
mengmengzhang2019 Jan 27, 2024
c65c60c
changed log.info
mengmengzhang2019 Jan 27, 2024
8c37a4b
modified: edgerun.py
mengmengzhang2019 Jan 27, 2024
e4a1314
modified: edgerun.py
mengmengzhang2019 Jan 27, 2024
a9c837c
modified: func/edgeconfig.py
mengmengzhang2019 Jan 27, 2024
673bcef
edge solver path
GBenedett Jan 29, 2024
7681e30
Merge branch 'medge_integration' of https://github.com/cfsengineering…
GBenedett Jan 29, 2024
e42af2d
edge path
GBenedett Jan 29, 2024
7a6bb83
modified: ceasiomlogger.py
mengmengzhang2019 Jan 29, 2024
7c4ed68
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Jan 29, 2024
c298a75
commented function get_logger()
mengmengzhang2019 Jan 29, 2024
2682071
write an empty logger
mengmengzhang2019 Jan 29, 2024
4a17669
INSEUL changed
GBenedett Jan 29, 2024
7d62233
INSEUL, corrected the code format
mengmengzhang2019 Jan 29, 2024
5633ded
get_value_or_default for edge_solver
mengmengzhang2019 Jan 29, 2024
7803455
modified: edgeconfig.py
mengmengzhang2019 Jan 29, 2024
afb14c9
modified: edgeconfig.py
mengmengzhang2019 Jan 29, 2024
0d2d444
added print to debug
mengmengzhang2019 Jan 29, 2024
279be83
modified: edgeconfig.py
mengmengzhang2019 Jan 29, 2024
6d2d532
changed/updated edge_solver
mengmengzhang2019 Jan 29, 2024
f1f761c
log and gmsh problem solved
GBenedett Feb 1, 2024
ba78f32
nmae changed
GBenedett Feb 1, 2024
912b4df
aboc path
GBenedett Feb 5, 2024
3abf780
formatting
GBenedett Feb 7, 2024
61c06d1
formatting
GBenedett Feb 7, 2024
97cc049
formatting
GBenedett Feb 7, 2024
ad379af
formatting
GBenedett Feb 7, 2024
c33e59f
modified: ceasiompy/utils/ceasiomlogger.py
mengmengzhang2019 Feb 28, 2024
c805d40
Merge branch 'medge_integration' of https://github.com/cfsengineering…
mengmengzhang2019 Feb 28, 2024
a22a598
modified: ceasiompy/utils/ceasiomlogger.py
mengmengzhang2019 Feb 28, 2024
e751d18
modified: ceasiompy/EdgeRun/func/edgeconfig.py
mengmengzhang2019 Feb 28, 2024
3d78c97
modified: ceasiompy/utils/ceasiomlogger.py
mengmengzhang2019 Feb 28, 2024
fedad8d
modified: ceasiompy/utils/ceasiomlogger.py
mengmengzhang2019 Feb 29, 2024
250e70a
modified: ceasiompy/utils/ceasiomlogger.py
mengmengzhang2019 Feb 29, 2024
1d47f78
modified: ceasiompy/EdgeRun/func/edgeconfig.py
mengmengzhang2019 Mar 1, 2024
7ba945e
modified: ceasiompy/EdgeRun/func/edgeconfig.py
mengmengzhang2019 Mar 1, 2024
a110919
modified: ceasiompy/EdgeRun/edgerun.py
mengmengzhang2019 Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,004 changes: 1,004 additions & 0 deletions WKDIR/labARstraight_toolInput.xml

Large diffs are not rendered by default.

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
8 changes: 5 additions & 3 deletions ceasiompy/CPACS2GMSH/func/generategmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ def generate_gmsh(
domain_length = farfield_factor * max(model_dimensions)
farfield = gmsh.model.occ.addSphere(*model_center, domain_length)
gmsh.model.occ.synchronize()

ext_domain = [(3, farfield)]

if symmetry:
Expand All @@ -714,7 +713,6 @@ def generate_gmsh(

_, children_dimtag = gmsh.model.occ.fragment(ext_domain, parts_parent_dimtag)
gmsh.model.occ.synchronize()

log.info("Fragment operation finished")

# fragment produce fragments_dimtag and children_dimtag
Expand Down Expand Up @@ -1111,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
12 changes: 9 additions & 3 deletions ceasiompy/CPACS2GMSH/func/mesh_sizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Developed by CFS ENGINEERING, 1015 Lausanne, Switzerland

This script contains different functions to classify and manipulate wing elements
This script contains different functions to classify and manipulate wing and fuselage elements

Python version: >=3.8

Expand Down Expand Up @@ -35,6 +35,8 @@


def fuselage_size(cpacs_path):
"""Function to get the measure of the fuselage and to obtain a good mesh size"""

tixi = open_tixi(cpacs_path)
if tixi.checkElement(FUSELAGES_XPATH):
fus_cnt = tixi.getNamedChildrenCount(FUSELAGES_XPATH, "fuselage")
Expand Down Expand Up @@ -178,6 +180,8 @@ def fuselage_size(cpacs_path):

# Get overall minimum radius (semi-minor axis for ellipse)
min_radius = min(min_radius, height, width)
if min_radius == 0:
min_radius = 0.0001

mean_circ = sum(circ_list) / len(circ_list)

Expand All @@ -186,12 +190,14 @@ def fuselage_size(cpacs_path):
fuselage_minlen = min(0.1 * fuselage_maxlen, min_radius / 2)

log.info(f"Fuselage maxlen={fuselage_maxlen:.3f} m")
log.info(f"Fuselage minlen={fuselage_minlen:.3f} m")
log.info(f"Fuselage minlen={fuselage_minlen:.4f} m")

return fuselage_maxlen, fuselage_minlen


def wings_size(cpacs_path):
"""Function to get the measure of the wing and to obtain a good mesh size"""

tixi = open_tixi(cpacs_path)
if tixi.checkElement(WINGS_XPATH):
wing_cnt = tixi.getNamedChildrenCount(WINGS_XPATH, "wing")
Expand Down Expand Up @@ -283,6 +289,6 @@ def wings_size(cpacs_path):
wing_minlen = 0.08 * wing_maxlen

log.info(f"Wing maxlen={wing_maxlen:.3f} m")
log.info(f"Wing minlen={wing_minlen:.3f} m")
log.info(f"Wing minlen={wing_minlen:.4f} m")

return wing_maxlen, wing_minlen
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
40 changes: 40 additions & 0 deletions ceasiompy/EdgeRun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<img align="right" height="70" src="../../documents/logos/CEASIOMpy_banner_main.png">

# ModuleTemplate

**Categories:** Template module, Example, Illustration

**State**: :heavy_check_mark:

This is a template module. Its purpose is to illustrate how other modules of CEASIOMpy should be structured, set up and documented.

<p align="center">
<img height="160" src="files/Spirit_of_St._Louis.jpg">
</p>

Example picture. Image in the public domain, from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Spirit_of_St._Louis.jpg)

## Inputs

ModuleTemplate needs no inputs.

## Analyses

ModuleTemplate computes nothing.

## Outputs

ModuleTemplate outputs nothing.

## Installation or requirements

ModuleTemplate is a native CEASIOMpy module, hence it is available and installed by default.

## Limitations

ModuleTemplate is limited in every aspect.

## More information

* <https://en.wikipedia.org/wiki/Spirit_of_St._Louis>
1 change: 1 addition & 0 deletions ceasiompy/EdgeRun/ToolInput/.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added ceasiompy/EdgeRun/__init__.py
Empty file.
222 changes: 222 additions & 0 deletions ceasiompy/EdgeRun/__specs__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
from pathlib import Path

from ceasiompy.utils.commonxpath import (
AEROPERFORMANCE_XPATH,
GEOM_XPATH,
RANGE_XPATH,
REF_XPATH,
EDGE_AEROMAP_UID_XPATH,
EDGE_CFL_NB_XPATH,
EDGE_FIXED_CL_XPATH,
EDGE_MAX_ITER_XPATH,
EDGE_MG_LEVEL_XPATH,
EDGE_NB_CPU_XPATH,
EDGE_MESH_XPATH,
EDGE_SOLVER_XPATH,
EDGE_ABOC_XPATH,
)
from ceasiompy.utils.moduleinterfaces import CPACSInOut

# ===== Module Status =====
# True if the module is active
# False if the module is disabled (not working or not ready)
module_status = True

# ===== Results directory path =====

RESULTS_DIR = Path("Results", "EdgeRun")

# ===== CPACS inputs and outputs =====

cpacs_inout = CPACSInOut()

# ----- Input -----

cpacs_inout.add_input(
var_name="aeromap_uid",
var_type=list,
default_value=None,
unit=None,
descr="Name of the aero map to calculate",
xpath=EDGE_AEROMAP_UID_XPATH,
gui=True,
gui_name="__AEROMAP_SELECTION",
gui_group="Aeromap settings",
)

cpacs_inout.add_input(
var_name="ref_len",
var_type=float,
default_value=None,
unit="m",
descr="Reference length of the aircraft",
xpath=REF_XPATH + "/length",
gui=False,
gui_name=None,
gui_group=None,
)

cpacs_inout.add_input(
var_name="ref_area",
var_type=float,
default_value=None,
unit="m^2",
descr="Reference area of the aircraft",
xpath=REF_XPATH + "/area",
gui=False,
gui_name=None,
gui_group=None,
)

for direction in ["x", "y", "z"]:
cpacs_inout.add_input(
var_name=f"ref_ori_moment_{direction}",
var_type=float,
default_value=0.0,
unit="m",
descr=f"Fuselage scaling on {direction} axis",
xpath=REF_XPATH + f"/point/{direction}",
gui=False,
gui_name=None,
gui_group=None,
)

cpacs_inout.add_input(
var_name="cruise_mach",
var_type=float,
default_value=0.78,
unit="1",
descr="Aircraft cruise Mach number",
xpath=RANGE_XPATH + "/cruiseMach",
gui=False,
gui_name="Cruise Mach",
gui_group="If fixed CL",
)

cpacs_inout.add_input(
var_name="cruise_alt",
var_type=float,
default_value=120000.0,
unit="m",
descr="Aircraft cruise altitude",
xpath=RANGE_XPATH + "/cruiseAltitude",
gui=False,
gui_name="Cruise Altitude",
gui_group="If fixed CL",
)

cpacs_inout.add_input(
var_name="fixed_cl",
var_type=str,
default_value="NO",
unit="-",
descr="FIXED_CL_MODE parameter for SU2",
xpath=EDGE_FIXED_CL_XPATH,
gui=False,
gui_name=None,
gui_group=None,
)

cpacs_inout.add_input(
var_name="nb_proc",
var_type=int,
default_value=64,
unit="1",
descr="Number of proc to use to run EDGE",
xpath=EDGE_NB_CPU_XPATH,
gui=True,
gui_name="Nb of processor",
gui_group="CPU",
)

cpacs_inout.add_input(
var_name="max_iter",
var_type=int,
default_value=200,
unit="1",
descr="Maximum number of iterations performed by EDGE",
xpath=EDGE_MAX_ITER_XPATH,
gui=True,
gui_name="Maximum iterations",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="cfl_nb",
var_type=float,
default_value=1.0,
unit="1",
descr="CFL Number, Courant–Friedrichs–Lewy condition",
xpath=EDGE_CFL_NB_XPATH,
gui=False,
gui_name="CFL Number",
gui_group="EDGE Parameters",
)

cpacs_inout.add_input(
var_name="mg_level",
var_type=int,
default_value=1,
unit="1",
descr="Multi-grid level (0 = no multigrid)",
xpath=EDGE_MG_LEVEL_XPATH,
gui=True,
gui_name="Multigrid Level",
gui_group="EDGE Parameters",
)

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

cpacs_inout.add_input(
var_name="EDGE_mesh_path",
var_type="pathtype",
default_value="-",
unit="1",
descr="Absolute path of the EDGE mesh",
xpath=EDGE_MESH_XPATH,
gui=True,
gui_name="EDGE Mesh",
gui_group="Inputs",
)

cpacs_inout.add_input(
var_name="EDGE_ABOC_path",
var_type="pathtype",
default_value="-",
unit="1",
descr="Absolute path of the EDGE Boundary Condition file",
xpath=EDGE_ABOC_XPATH,
gui=True,
gui_name="EDGE ABOC",
gui_group="Inputs",
)

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

cpacs_inout.add_output(
var_name="wetted_area",
var_type=float,
default_value=None,
unit="m^2",
descr="Aircraft wetted area calculated by EDGE",
xpath=GEOM_XPATH + "/analyses/wettedArea",
)

cpacs_inout.add_output(
var_name="aeromap_EDGE", # name to change...
# var_type=CPACS_aeroMap, # no type pour output, would it be useful?
default_value=None,
unit="-",
descr="aeroMap with aero coefficients calculated by EDGE",
xpath=AEROPERFORMANCE_XPATH + "/aeroMap/aeroPerformanceMap",
)
Loading
Loading