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

Refactoring of AeroFrame module #301

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions ceasiompy/AeroFrame/runaeroframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


TODO:
* make working directories
* Refactoring

"""

Expand Down Expand Up @@ -55,7 +55,6 @@
# =================================================================================================

if __name__ == "__main__":

log.info("----- Start of " + MODULE_NAME + " -----")

af.standard_run(args=af.StdRunArgs(dest=DIR_AEROFRAME_WKDIR, verbose=True))
Expand Down
40 changes: 40 additions & 0 deletions ceasiompy/AeroFrame_new/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/AeroFrame_new/ToolInput/.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ceasiompy/AeroFrame_new/ToolOutput/.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
215 changes: 215 additions & 0 deletions ceasiompy/AeroFrame_new/__specs__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
from ceasiompy.utils.moduleinterfaces import CPACSInOut
from ceasiompy.utils.commonxpath import (
CEASIOMPY_XPATH,
AVL_PLOT_XPATH,
AVL_VORTEX_DISTR_XPATH,
AVL_AEROMAP_UID_XPATH,
AEROPERFORMANCE_XPATH,
FRAMAT_MATERIAL_XPATH,
FRAMAT_SECTION_XPATH,
FRAMAT_MESH_XPATH,
AEROFRAME_SETTINGS
)
from pathlib import Path

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

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

# ===== 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=AVL_AEROMAP_UID_XPATH,
gui=True,
gui_name="__AEROMAP_SELECTION",
gui_group="Aeromap settings",
)

cpacs_inout.add_input(
var_name="panel_distribution",
var_type=list,
default_value=["equal", "cosine", "sine"],
unit=None,
descr=("Select the type of distribution"),
xpath=AVL_VORTEX_DISTR_XPATH + "/Distribution",
gui=True,
gui_name="Choice of distribution",
gui_group="AVL: Vortex Lattice Spacing Distributions",
)

cpacs_inout.add_input(
var_name="chordwise_vort",
var_type=int,
default_value=8,
unit=None,
descr="Select the number of chordwise vortices",
xpath=AVL_VORTEX_DISTR_XPATH + "/Nchordwise",
gui=True,
gui_name="Number of chordwise vortices",
gui_group="AVL: Vortex Lattice Spacing Distributions",
)

cpacs_inout.add_input(
var_name="spanwise_vort",
var_type=int,
default_value=30,
unit=None,
descr="Select the number of spanwise vortices",
xpath=AVL_VORTEX_DISTR_XPATH + "/Nspanwise",
gui=True,
gui_name="Number of spanwise vortices",
gui_group="AVL: Vortex Lattice Spacing Distributions",
)

cpacs_inout.add_input(
var_name="save_plots",
var_type=bool,
default_value=True,
unit=None,
descr="Select to save geometry and results plots",
xpath=AVL_PLOT_XPATH,
gui=True,
gui_name="Save AVL plots",
gui_group="Plots",
)

cpacs_inout.add_input(
var_name="N_beam",
var_type=int,
default_value=15,
unit=None,
descr="Enter number of nodes for the beam mesh.",
xpath=FRAMAT_MESH_XPATH + "/NumberNodes",
gui=True,
gui_name="Number of beam nodes",
gui_group="FramAT: Mesh properties",
)

cpacs_inout.add_input(
var_name="young_modulus",
var_type=float,
default_value=70,
unit=None,
descr="Enter the Young modulus of the wing material in GPa.",
xpath=FRAMAT_MATERIAL_XPATH + "/YoungModulus",
gui=True,
gui_name="Young modulus [GPa]",
gui_group="FramAT: Material properties",
)

cpacs_inout.add_input(
var_name="shear_modulus",
var_type=float,
default_value=26,
unit=None,
descr="Enter the shear modulus of the wing material in GPa.",
xpath=FRAMAT_MATERIAL_XPATH + "/ShearModulus",
gui=True,
gui_name="Shear modulus [GPa]",
gui_group="FramAT: Material properties",
)

cpacs_inout.add_input(
var_name="material_density",
var_type=float,
default_value=1960,
unit=None,
descr="Enter the density of the wing material in kg/m³.",
xpath=FRAMAT_MATERIAL_XPATH + "/Density",
gui=True,
gui_name="Material density [kg/m³]",
gui_group="FramAT: Material properties",
)

cpacs_inout.add_input(
var_name="cross_section_area",
var_type=float,
default_value=-1,
unit=None,
descr="Enter the area of the cross-section in m².",
xpath=FRAMAT_SECTION_XPATH + "/Area",
gui=True,
gui_name="Cross-section area [m²]",
gui_group="FramAT: Cross-section properties",
)

cpacs_inout.add_input(
var_name="cross_section_Ix",
var_type=float,
default_value=-1,
unit=None,
descr="Enter the second moment of area of the cross-section \
about the horizontal axis, in m⁴.",
xpath=FRAMAT_SECTION_XPATH + "/Ix",
gui=True,
gui_name="Second moment of area Ix [m⁴]",
gui_group="FramAT: Cross-section properties",
)

cpacs_inout.add_input(
var_name="cross_section_Iy",
var_type=float,
default_value=-1,
unit=None,
descr="Enter the second moment of area of the cross-section \
about the vertical axis, in m⁴",
xpath=FRAMAT_SECTION_XPATH + "/Iy",
gui=True,
gui_name="Second moment of area Iy [m⁴]",
gui_group="FramAT: Cross-section properties",
)

cpacs_inout.add_input(
var_name="n_iter_max",
var_type=int,
default_value=8,
unit=None,
descr="Enter the maximum number of iterations of the aeroelastic-loop.",
xpath=AEROFRAME_SETTINGS + "/MaxNumberIterations",
gui=True,
gui_name="Maximum number of iterations",
gui_group="AeroFrame: Convergence settings",
)

cpacs_inout.add_input(
var_name="tolerance",
var_type=float,
default_value=1e-3,
unit=None,
descr="Enter the tolerance for convergence of the wing deformation.",
xpath=AEROFRAME_SETTINGS + "/Tolerance",
gui=True,
gui_name="Tolerance",
gui_group="AeroFrame: Convergence settings",
)

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

cpacs_inout.add_output(
var_name="output",
default_value=None,
unit="1",
descr="Description of the output",
xpath=CEASIOMPY_XPATH + "/test/myOutput",
)

cpacs_inout.add_output(
var_name="aeromap_avl", # 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 AVL",
xpath=AEROPERFORMANCE_XPATH + "/aeroMap/aeroPerformanceMap",
)
Loading
Loading