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

ThermoData branch #294

Merged
merged 57 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
028511c
ThermoData branch
GBenedett Feb 5, 2024
43beb2f
test commit
Francesco-Marcucci Feb 7, 2024
af40f2b
new commit
Francesco-Marcucci Feb 7, 2024
b97865b
new commit
Francesco-Marcucci Feb 7, 2024
a968071
new commit
Francesco-Marcucci Feb 7, 2024
c0decca
new commit
Francesco-Marcucci Feb 7, 2024
9727197
new commit
Francesco-Marcucci Feb 7, 2024
4162727
fixing some problems for merging
Francesco-Marcucci Feb 7, 2024
204af4a
solving some issue for merging
Francesco-Marcucci Feb 7, 2024
ed669c4
solving config file generation single condition
Francesco-Marcucci Feb 7, 2024
7495857
solving flake8 issues
Francesco-Marcucci Feb 7, 2024
a1f72a9
solving flake8 issues
Francesco-Marcucci Feb 7, 2024
2a60062
solving Codacy issues
Francesco-Marcucci Feb 7, 2024
59c640d
solving Codacy issues
Francesco-Marcucci Feb 7, 2024
46472dc
removing complexity from the code
Francesco-Marcucci Feb 7, 2024
1b96559
start adding rans cfg file
Francesco-Marcucci Feb 8, 2024
ef7afb1
working on the rans config file
Francesco-Marcucci Feb 8, 2024
166182c
trying to solve issues with flake8
Francesco-Marcucci Feb 8, 2024
2412353
adding rans simulation
Francesco-Marcucci Feb 8, 2024
7f1ce4d
improving rans su2run
Francesco-Marcucci Feb 8, 2024
c045d2a
improving rans simulations
Francesco-Marcucci Feb 8, 2024
345627f
reordered
GBenedett Feb 8, 2024
28bf2a1
fix tests
GBenedett Feb 8, 2024
c22ed03
start adding tests
Francesco-Marcucci Feb 9, 2024
543e5c7
mod
GBenedett Feb 9, 2024
da53973
solving test issues
Francesco-Marcucci Feb 9, 2024
e77a361
solving flake8 issues
Francesco-Marcucci Feb 9, 2024
01eb338
codacy and names
GBenedett Feb 13, 2024
ae39371
codacy enumerate
GBenedett Feb 13, 2024
c20d387
adding correct unit to net force
Francesco-Marcucci Feb 14, 2024
2751a67
setting correct units
Francesco-Marcucci Feb 15, 2024
f732242
pycycle module added to python environment
GBenedett Feb 19, 2024
b3d8964
fixing pycycle issues
Francesco-Marcucci Feb 19, 2024
bc998d1
cpacs files
Francesco-Marcucci Feb 19, 2024
2c404ab
add redmi to ThermoData
Francesco-Marcucci Feb 20, 2024
0ca7ffb
changing first page redmi to add thermodata module
Francesco-Marcucci Feb 20, 2024
8d72d11
changing redmi Thermodata logo
Francesco-Marcucci Feb 20, 2024
33056d7
fixing rans issues
Francesco-Marcucci Feb 20, 2024
d837270
changing the redmi
Francesco-Marcucci Feb 21, 2024
bef87b6
ThermoData README changes
Francesco-Marcucci Feb 22, 2024
9deb3f1
Update README.md
GBenedett Feb 22, 2024
4e6404e
small change to README
Francesco-Marcucci Feb 22, 2024
09b7d95
Merge branch 'add_ThermoData' of https://github.com/cfsengineering/CE…
Francesco-Marcucci Feb 22, 2024
2cbbfcf
adding automatic reynolds calculation
Francesco-Marcucci Feb 23, 2024
c0406e9
improving the code
Francesco-Marcucci Feb 23, 2024
b2146a0
adding reynolds number calculation
Francesco-Marcucci Feb 27, 2024
95095c6
adding test
Francesco-Marcucci Mar 14, 2024
afddc94
changing folders
Francesco-Marcucci Mar 14, 2024
35645df
improving tests
Francesco-Marcucci Mar 15, 2024
a8317a1
improving_test
Francesco-Marcucci Mar 15, 2024
48581e1
fixing codacy issues
Francesco-Marcucci Mar 18, 2024
854c7a2
Merge remote-tracking branch 'origin' into add_ThermoData
Francesco-Marcucci Mar 18, 2024
39f1a3e
finishing test implementation
Francesco-Marcucci Mar 18, 2024
2ac0da9
adding comments to tests
Francesco-Marcucci Mar 18, 2024
dd968dd
adding default aeromap to ThermoData module
Francesco-Marcucci Mar 20, 2024
3a3bda3
solving codacy issues
Francesco-Marcucci Mar 20, 2024
2611e15
cpacs file removed
GBenedett Apr 15, 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 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ warning: : The module does not work completely as expected. It is not a bug, but
- [Optimisation](ceasiompy/Optimisation/README.md) :x:
- [SMTrain](ceasiompy/SMTrain/README.md) :x:
- [SMUse](ceasiompy/SMUse/README.md) :x:
- [ThermoData](ceasiompy/ThermoData/README.md) :heavy_check_mark:

<img align="right" height="80" src="documents/logos/CEASIOMpy_banner_geometry.png">

Expand Down
2 changes: 1 addition & 1 deletion ceasiompy/CPACS2GMSH/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Multiple options are available with `CPACS2GMSH`, you can see these options if y

General options:

* `Display mesh with GMSHl : False`
* `Display mesh with GMSH : False`
Open the gmsh GUI after the generation of the surface mesh (2D) and the domain mesh (3D). This option is usefully to control the quality of the automated generated mesh or make extra operation with gmsh GUI.

Domain:
Expand Down
13 changes: 13 additions & 0 deletions ceasiompy/SU2Run/__specs__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
SU2_TARGET_CL_XPATH,
SU2_UPDATE_WETTED_AREA_XPATH,
SU2MESH_XPATH,
SU2_CONFIG_RANS_XPATH,
)
from ceasiompy.utils.moduleinterfaces import CPACSInOut

Expand Down Expand Up @@ -203,6 +204,18 @@
gui_group="CPU",
)

cpacs_inout.add_input(
var_name="RANS calculation",
var_type=list,
default_value=["Euler", "RANS"],
unit="1",
descr="Running an Euler or a RANS calculation",
xpath=SU2_CONFIG_RANS_XPATH,
gui=True,
gui_name="Euler or RANS simulation",
gui_group="SU2 Parameters",
)

cpacs_inout.add_input(
var_name="max_iter",
var_type=int,
Expand Down
198 changes: 198 additions & 0 deletions ceasiompy/SU2Run/files/config_template_rans.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SU2 configuration file %
% Case description: VKI turbine %
% Author: Francisco Palacios, Thomas D. Economon %
% Institution: Stanford University %
% Date: Feb 18th, 2013 %
% File Version 8.0.0 "Harrier" %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
%
SOLVER= RANS
%
KIND_TURB_MODEL= SA
%
MATH_PROBLEM= DIRECT
%
RESTART_SOL= NO
%
SYSTEM_MEASUREMENTS= SI

% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
%
MACH_NUMBER= 0.3
%
AOA= 0.0
%
FREESTREAM_PRESSURE= 1.013E5
%
FREESTREAM_OPTION= DENSITY_FS
%
FREESTREAM_DENSITY = 1.255
%
FREESTREAM_TEMPERATURE =288.15
%
REYNOLDS_NUMBER= 4E6
%
REYNOLDS_LENGTH= 1.0

% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
%
REF_ORIGIN_MOMENT_X = 0.00
%
REF_ORIGIN_MOMENT_Y = 0.00
%
REF_ORIGIN_MOMENT_Z = 0.00
%
REF_LENGTH= 45.0
%
REF_AREA= 1
% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE,
% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE)
REF_DIMENSIONALIZATION= FREESTREAM_PRESS_EQ_ONE
%
% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------%
%
MARKER_HEATFLUX = (S4CreatedbyGmsh, 0.0)
%
MARKER_FAR= (S3Farfield)
%
%MARKER_SYM =()
%
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
%
% Marker(s) of the surface to be plotted or designed
MARKER_PLOTTING= (S4CreatedbyGmsh)
%
% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated
MARKER_MONITORING= (S4CreatedbyGmsh)

% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
%
NUM_METHOD_GRAD= GREEN_GAUSS
%
CFL_NUMBER= 1
%
CFL_ADAPT= NO
%
CFL_ADAPT_PARAM= ( 0.5, 1, 1.0, 100.0 )
%
ITER = 5000

% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X,
% MOMENT_Y, MOMENT_Z, EFFICIENCY, BUFFET,
% EQUIVALENT_AREA, NEARFIELD_PRESSURE,
% FORCE_X, FORCE_Y, FORCE_Z, THRUST,
% TORQUE, TOTAL_HEATFLUX,
% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE,
% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE,
% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH)
% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order.
OBJECTIVE_FUNCTION= DRAG

% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
% Linear solver or smoother for implicit formulations:
% BCGSTAB, FGMRES, RESTARTED_FGMRES, CONJUGATE_GRADIENT (self-adjoint problems only), SMOOTHER.
LINEAR_SOLVER= FGMRES
%
% Preconditioner of the Krylov linear solver or type of smoother (ILU, LU_SGS, LINELET, JACOBI)
LINEAR_SOLVER_PREC= ILU
%
% Minimum error of the linear solver for implicit formulations
LINEAR_SOLVER_ERROR= 1E-12
%
% Max number of iterations of the linear solver for the implicit formulation
LINEAR_SOLVER_ITER= 3
%
% Number of elements to apply the criteria
CONV_CAUCHY_ELEMS= 1000
%
% Epsilon to control the series convergence
CONV_CAUCHY_EPS= 1E-10
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP,
% AUSMPLUSUP2, HLLC, TURKEL_PREC, MSW, FDS, SLAU, SLAU2)
CONV_NUM_METHOD_FLOW= JST
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT)
TIME_DISCRE_FLOW= EULER_IMPLICIT
%
% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------%
% Convective numerical method (SCALAR_UPWIND)
CONV_NUM_METHOD_TURB= SCALAR_UPWIND
%
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations.
% Required for 2nd order upwind schemes (NO, YES)
MUSCL_TURB= NO
%
% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG,
% BARTH_JESPERSEN, VAN_ALBADA_EDGE)
SLOPE_LIMITER_TURB= VENKATAKRISHNAN
%
% Time discretization (EULER_IMPLICIT)
TIME_DISCRE_TURB= EULER_IMPLICIT
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
%
% Multi-Grid Levels (0 = no multi-grid)
MGLEVEL = 3
%
% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE)
MGCYCLE = W_CYCLE
%
% Multi-Grid PreSmoothing Level
MG_PRE_SMOOTH = ( 1.0, 2.0, 3.0, 3.0 )
%
% Multi-Grid PostSmoothing Level
MG_POST_SMOOTH = ( 0.0, 0.0, 0.0, 0.0 )
%
% Jacobi implicit smoothing of the correction
MG_CORRECTION_SMOOTH = ( 0.0, 0.0, 0.0, 0.0 )
%
% Damping factor for the residual restriction
MG_DAMP_RESTRICTION = 0.9
%
% Damping factor for the correction prolongation
MG_DAMP_PROLONGATION = 0.9
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
%
% Min value of the residual (log10 of the residual)
CONV_RESIDUAL_MINVAL= -12
%
% Start convergence criteria at iteration number
CONV_STARTITER= 10
%

% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
%
MESH_FILENAME= labair_penta.su2
%
MESH_FORMAT= SU2
%
MESH_OUT_FILENAME= mesh_out.su2
%
SOLUTION_FILENAME= solution_flow.dat
%
HISTORY_OUTPUT = (INNER_ITER, RMS_RES, AERO_COEFF)
%
TABULAR_FORMAT= CSV
%
CONV_FILENAME= history
%
RESTART_FILENAME= restart_flow.dat
%
RESTART_ADJ_FILENAME= restart_adj.dat
%
VOLUME_FILENAME= flow
%
SURFACE_FILENAME= surface_flow
%
OUTPUT_WRT_FREQ= 100
%
BREAKDOWN_FILENAME = forces_breakdown_def.dat
%
WRT_FORCES_BREAKDOWN = YES
%
SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG)
35 changes: 34 additions & 1 deletion ceasiompy/SU2Run/func/su2config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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 +296,34 @@ 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]
if len(alt_list) > 1:
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]
else:
tot_temp_out = get_value(cpacs.tixi, ENGINE_BC + "/temperatureOutlet")
tot_pressure_out = get_value(cpacs.tixi, ENGINE_BC + "/pressureOutlet")
cfg["INLET_TYPE"] = "TOTAL_CONDITIONS"
cfg["MARKER_INLET"] = (
f"(INLET_ENGINE, {tot_temp_in}, {tot_pressure_in}, {1},{0},{0}, "
f"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 @@ -341,7 +371,7 @@ def generate_su2_cfd_config(cpacs_path, cpacs_out_path, wkdir):

if aeromap_list:
aeromap_default = aeromap_list[0]
log.info(f'The aeromap is {aeromap_default}')
log.info(f"The aeromap is {aeromap_default}")

aeromap_uid = get_value_or_default(cpacs.tixi, SU2_AEROMAP_UID_XPATH, aeromap_default)

Expand Down Expand Up @@ -448,6 +478,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 +501,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
Loading