diff --git a/ceasiompy/EdgeRun/edgerun.py b/ceasiompy/EdgeRun/edgerun.py index 77b6f43ab..046fbed38 100644 --- a/ceasiompy/EdgeRun/edgerun.py +++ b/ceasiompy/EdgeRun/edgerun.py @@ -24,9 +24,10 @@ get_results_directory, run_software, ) -#from ceasiompy.utils.commonnames import AINP_CFD_NAME, SU2_FORCES_BREAKDOWN_NAME + +# from ceasiompy.utils.commonnames import AINP_CFD_NAME, SU2_FORCES_BREAKDOWN_NAME from ceasiompy.utils.commonnames import AINP_CFD_NAME -from ceasiompy.utils.commonxpath import Edge_NB_CPU_XPATH +from ceasiompy.utils.commonxpath import EDGE_NB_CPU_XPATH from ceasiompy.utils.moduleinterfaces import get_toolinput_file_path, get_tooloutput_file_path from cpacspy.cpacsfunctions import get_value_or_default, open_tixi from ceasiompy.EdgeRun.func.edge_queScript_gen import EdgeScripts @@ -49,11 +50,11 @@ # ================================================================================================= input_que_script_path = get_edge_queScript_template() -def run_Edge_multi(wkdir, nb_proc=2): +def run_edge_multi(wkdir, nb_proc=2): """Function to run a multiple Edge calculation. - Function 'run_Edge_multi' will run in the given working directory Edge calculations. The working - directory must have a folder structure created by 'SU2Config'/ 'EdgeConfig' module. + Function 'run_edge_multi' will run in the given working directory Edge calculations. + The working directory must have a folder structure created by 'SU2Config'/ 'EdgeConfig' module. Args: wkdir (Path): Path to the working directory @@ -68,7 +69,6 @@ def run_Edge_multi(wkdir, nb_proc=2): raise OSError(f"No Case directory has been found in the working directory: {wkdir}") for config_dir in sorted(case_dir_list): - config_cfd = [c for c in config_dir.iterdir() if c.name == AINP_CFD_NAME] if not config_cfd: @@ -84,6 +84,7 @@ def run_Edge_multi(wkdir, nb_proc=2): software_name="edge_mpi_run", arguments=[config_cfd[0], str(nb_proc)], wkdir=config_dir, +<<<<<<< HEAD with_mpi=True, # nb_proc ) @@ -91,9 +92,17 @@ def run_Edge_multi(wkdir, nb_proc=2): #forces_breakdown_file = Path(config_dir, SU2_FORCES_BREAKDOWN_NAME) #if not forces_breakdown_file.exists(): +======= + with_mpi=False, + # nb_proc + ) + + # forces_breakdown_file = Path(config_dir, SU2_FORCES_BREAKDOWN_NAME) + # if not forces_breakdown_file.exists(): +>>>>>>> 11ccb81e114b69bf4ab99efd08c252c4ab3ecd0f # raise ValueError( - # "The SU2_CFD calculation has not ended correctly," - # f"{SU2_FORCES_BREAKDOWN_NAME} is missing!" + # "The SU2_CFD calculation has not ended correctly," + # f"{SU2_FORCES_BREAKDOWN_NAME} is missing!" # ) @@ -103,11 +112,10 @@ def run_Edge_multi(wkdir, nb_proc=2): def main(cpacs_path, cpacs_out_path): - log.info("----- Start of " + MODULE_NAME + " -----") tixi = open_tixi(cpacs_path) - nb_proc = get_value_or_default(tixi, Edge_NB_CPU_XPATH, get_reasonable_nb_cpu()) + nb_proc = get_value_or_default(tixi, EDGE_NB_CPU_XPATH, get_reasonable_nb_cpu()) results_dir = get_results_directory("EdgeRun") @@ -115,14 +123,13 @@ def main(cpacs_path, cpacs_out_path): cpacs_tmp_cfg = Path(cpacs_out_path.parent, "ConfigTMP.xml") generate_edge_cfd_ainp(cpacs_path, cpacs_tmp_cfg, results_dir) - run_Edge_multi(results_dir, nb_proc) - #get_su2_results(cpacs_tmp_cfg, cpacs_out_path, results_dir) + run_edge_multi(results_dir, nb_proc) + # get_su2_results(cpacs_tmp_cfg, cpacs_out_path, results_dir) log.info("----- End of " + MODULE_NAME + " -----") if __name__ == "__main__": - cpacs_path = get_toolinput_file_path(MODULE_NAME) cpacs_out_path = get_tooloutput_file_path(MODULE_NAME) diff --git a/ceasiompy/EdgeRun/func/edgeconfig.py b/ceasiompy/EdgeRun/func/edgeconfig.py index 2e3421c63..2708a7f10 100644 --- a/ceasiompy/EdgeRun/func/edgeconfig.py +++ b/ceasiompy/EdgeRun/func/edgeconfig.py @@ -12,7 +12,7 @@ TODO: - * + * """ @@ -35,6 +35,7 @@ # write_actuator_disk_data, # write_header, # ) + from ceasiompy.EdgeRun.func.edgeutils import get_edge_ainp_template from ceasiompy.utils.ceasiomlogger import get_logger from ceasiompy.utils.commonnames import ( @@ -44,13 +45,13 @@ GMSH_SYMMETRY_XPATH, PROP_XPATH, RANGE_XPATH, - EdgeMESH_XPATH, - Edge_AEROMAP_UID_XPATH, - Edge_CFL_NB_XPATH, - Edge_MAX_ITER_XPATH, - Edge_MG_LEVEL_XPATH, - Edge_NB_CPU_XPATH, - Edge_FIXED_CL_XPATH, + EDGE_MESH_XPATH, + EDGE_AEROMAP_UID_XPATH, + EDGE_CFL_NB_XPATH, + EDGE_MAX_ITER_XPATH, + EDGE_MG_LEVEL_XPATH, + EDGE_NB_CPU_XPATH, + EDGE_FIXED_CL_XPATH, ) # from ceasiompy.utils.configfiles import ConfigFile @@ -99,12 +100,12 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): cpacs = CPACS(cpacs_path) - edge_mesh = Path(get_value(cpacs.tixi, EdgeMESH_XPATH)) + edge_mesh = Path(get_value(cpacs.tixi, EDGE_MESH_XPATH)) if not edge_mesh.is_file(): raise FileNotFoundError(f"M-Edge mesh file {edge_mesh} not found") # Get the fixedCL value from CPACS - fixed_cl = get_value_or_default(cpacs.tixi, Edge_FIXED_CL_XPATH, "NO") + fixed_cl = get_value_or_default(cpacs.tixi, EDGE_FIXED_CL_XPATH, "NO") if fixed_cl == "NO": # Get the first aeroMap as default one or create automatically one aeromap_list = cpacs.get_aeromap_uid_list() @@ -113,7 +114,7 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): aeromap_default = aeromap_list[0] log.info(f"The aeromap is {aeromap_default}") - aeromap_uid = get_value_or_default(cpacs.tixi, Edge_AEROMAP_UID_XPATH, aeromap_default) + aeromap_uid = get_value_or_default(cpacs.tixi, EDGE_AEROMAP_UID_XPATH, aeromap_default) activate_aeromap = cpacs.get_aeromap_by_uid(aeromap_uid) alt_list = activate_aeromap.get("altitude").tolist() @@ -137,7 +138,7 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): aos_list = [0.0] aeromap_uid = get_value_or_default( - cpacs.tixi, Edge_AEROMAP_UID_XPATH, "DefaultAeromap" + cpacs.tixi, EDGE_AEROMAP_UID_XPATH, "DefaultAeromap" ) log.info(f"{aeromap_uid} has been created") @@ -145,7 +146,7 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): log.info("Configuration file for fixed CL calculation will be created.") fixed_cl_aeromap = cpacs.create_aeromap("aeroMap_fixedCL_SU2") - fixed_cl_aeromap.description = f"AeroMap created for SU2 fixed CL value of {target_cl}" + # fixed_cl_aeromap.description = f"AeroMap created for SU2 fixed CL value of {target_cl}" mach = get_value_or_default(cpacs.tixi, RANGE_XPATH + "/cruiseMach", 0.78) alt = get_value_or_default(cpacs.tixi, RANGE_XPATH + "/cruiseAltitude", 12000) @@ -175,10 +176,10 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): # Settings - ITMAX = int(get_value_or_default(cpacs.tixi, Edge_MAX_ITER_XPATH, 200)) - CFL = get_value_or_default(cpacs.tixi, Edge_CFL_NB_XPATH, 1.5) - NGRID = int(get_value_or_default(cpacs.tixi, Edge_MG_LEVEL_XPATH, 3)) - NPART = int(get_value_or_default(cpacs.tixi, Edge_NB_CPU_XPATH, 32)) + ITMAX = int(get_value_or_default(cpacs.tixi, EDGE_MAX_ITER_XPATH, 200)) + CFL = get_value_or_default(cpacs.tixi, EDGE_CFL_NB_XPATH, 1.5) + NGRID = int(get_value_or_default(cpacs.tixi, EDGE_MG_LEVEL_XPATH, 3)) + NPART = int(get_value_or_default(cpacs.tixi, EDGE_NB_CPU_XPATH, 32)) INSEUL = 0 # Parameters which will vary for the different cases (alt,mach,aoa,aos) @@ -197,8 +198,8 @@ def generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir): speedofsound = Atm.speed_of_sound[0] airspeed = mach * speedofsound - aoa_rad = math.radians(aoa) - aos_rad = math.radians(aos) + # aoa_rad = math.radians(aoa) + # aos_rad = math.radians(aos) UFREE = airspeed * math.cos(aos) * math.cos(aoa) WFREE = airspeed * math.cos(aos) * math.sin(aoa) diff --git a/ceasiompy/EdgeRun/func/edgeutils.py b/ceasiompy/EdgeRun/func/edgeutils.py index 3ee8f0c65..3b4d67d7e 100644 --- a/ceasiompy/EdgeRun/func/edgeutils.py +++ b/ceasiompy/EdgeRun/func/edgeutils.py @@ -44,12 +44,13 @@ # FUNCTIONS # ================================================================================================= + def get_edge_ainp_template(): """Return path of the M-Edge ainp template corresponding to the M-Edge version.""" -# su2_version = get_su2_version() + # su2_version = get_su2_version() edge_dir = get_module_path("EdgeRun") - edge_ainp_template_path = Path(edge_dir, "files", f"default.ainp.tmp") + edge_ainp_template_path = Path(edge_dir, "files", "default.ainp.tmp") if not edge_ainp_template_path.is_file(): raise FileNotFoundError( f"The M-Edge ainp template '{edge_ainp_template_path}' has not been found!" @@ -102,11 +103,6 @@ def get_su2_aerocoefs(force_file): velocity = float(line.split(" ")[7]) return cl, cd, cs, cmd, cms, cml, velocity -"""""" - - - - # ================================================================================================= @@ -114,5 +110,4 @@ def get_su2_aerocoefs(force_file): # ================================================================================================= if __name__ == "__main__": - print("Nothing to execute!") diff --git a/ceasiompy/EdgeRun/tests/ToolInput/simpletest_cpacs.xml b/ceasiompy/EdgeRun/tests/ToolInput/simpletest_cpacs.xml deleted file mode 100644 index b407294db..000000000 --- a/ceasiompy/EdgeRun/tests/ToolInput/simpletest_cpacs.xml +++ /dev/null @@ -1,576 +0,0 @@ - - -
- Cpacs2Test - Simple Wing for unit testing - Martin Siggel - 2012-10-09T15:12:47 - 0.2 - 3.0 - - - Converted to cpacs 3.0 using cpacs2to3 - does not include structure update - cpacs2to3 - 2018-01-15T09:22:57 - 0.2 - 3.0 - - - Add this update - Aidan - 2018-10-03T09:00:01 - 0.3 - 3.0 - - -
- - - - Cpacs2Test - - 1 - 1 - - 0 - 0 - 0 - - - - - name - description - - - 1.0 - 0.5 - 0.5 - - - 0.0 - 0.0 - 0.0 - - - 0.0 - 0.0 - 0.0 - - - -
- D150_Fuselage_1Section1 - - - 1.0 - 1.0 - 1.0 - - - 0.0 - 0.0 - 0.0 - - - 0 - 0 - 0 - - - - - D150_Fuselage_1Section1 - fuselageCircleProfileuID - - - 1.0 - 1.0 - 1.0 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- D150_Fuselage_1Section2 - - - 1.0 - 1.0 - 1.0 - - - 0.0 - 0.0 - 0.0 - - - 0.5 - 0 - 0 - - - - - D150_Fuselage_1Section2 - fuselageCircleProfileuID - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- D150_Fuselage_1Section3 - - - 1.0 - 1.0 - 1.0 - - - 0.0 - 0.0 - 0.0 - - - 0 - 0 - 0 - - - - - D150_Fuselage_1Section3 - fuselageCircleProfileuID - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- D150_Fuselage_1Section4 - - - 1.0 - 1.0 - 1.0 - - - 0.0 - 0.0 - 0.0 - - - 0 - 0 - 0 - - - - - D150_Fuselage_1Section4 - fuselageCircleProfileuID - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- - - D150_Fuselage_1Positioning1 - -0.5 - 90 - 0 - D150_Fuselage_1Section1ID - - - D150_Fuselage_1Positioning3 - 2 - 90 - 0 - D150_Fuselage_1Section1ID - D150_Fuselage_1Section2ID - - - D150_Fuselage_1Positioning3 - 2 - 90 - 0 - D150_Fuselage_1Section2ID - D150_Fuselage_1Section3ID - - - D150_Fuselage_1Positioning4 - 2 - 90 - 0 - D150_Fuselage_1Section3ID - D150_Fuselage_1Section4ID - - - - - D150_Fuselage_1Segment1 - D150_Fuselage_1Section1IDElement1 - D150_Fuselage_1Section2IDElement1 - - - D150_Fuselage_1Segment2 - D150_Fuselage_1Section2IDElement1 - D150_Fuselage_1Section3IDElement1 - - - D150_Fuselage_1Segment3 - D150_Fuselage_1Section3IDElement1 - D150_Fuselage_1Section4IDElement1 - - -
-
- - - Wing - SimpleFuselage - This wing has been generated to test CATIA2CPACS. - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - -
- Cpacs2Test - Wing Section 1 - Cpacs2Test - Wing Section 1 - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - Cpacs2Test - Wing Section 1 Main Element - Cpacs2Test - Wing Section 1 Main Element - NACA0012 - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- Cpacs2Test - Wing Section 2 - Cpacs2Test - Wing Section 2 - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - Cpacs2Test - Wing Section 2 Main Element - Cpacs2Test - Wing Section 2 Main Element - NACA0012 - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - -
-
- Cpacs2Test - Wing Section 3 - Cpacs2Test - Wing Section 3 - - - 1 - 1 - 1 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - Cpacs2Test - Wing Section 3 Main Element - Cpacs2Test - Wing Section 3 Main Element - NACA0012 - - - 0.5 - 0.5 - 0.5 - - - 0 - 0 - 0 - - - 0.5 - 0 - 0 - - - - -
-
- - - Cpacs2Test - Wing Section 1 Positioning - Cpacs2Test - Wing Section 1 Positioning - 0 - 0 - 0 - Cpacs2Test_Wing_Sec1 - - - Cpacs2Test - Wing Section 2 Positioning - Cpacs2Test - Wing Section 2 Positioning - 1 - 0 - 0 - Cpacs2Test_Wing_Sec1 - Cpacs2Test_Wing_Sec2 - - - Cpacs2Test - Wing Section 3 Positioning - Cpacs2Test - Wing Section 3 Positioning - 1 - 0 - 0 - Cpacs2Test_Wing_Sec2 - Cpacs2Test_Wing_Sec3 - - - - - Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element - Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element - Cpacs2Test_Wing_Sec1_El1 - Cpacs2Test_Wing_Sec2_El1 - - - Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element - Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element - Cpacs2Test_Wing_Sec2_El1 - Cpacs2Test_Wing_Sec3_El1 - - - - - Wing_CS1 - Cpacs2Test_Wing_Sec1_El1 - Cpacs2Test_Wing_Sec3_El1 - - - - - MySkinMat - 0.0 - - - - - - - MyCellMat - 0.0 - - - - 0.8 - 0.8 - - - 1.0 - 1.0 - - - 0.0 - 0.0 - - - 0.5 - 0.5 - - - - - - - - MySkinMat - - - - - - -
-
-
-
- - - - NACA0.00.00.12 - NACA 4 Series Profile - - 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 - 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 - -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 - - - - - - Circle - Profile build up from set of Points on Circle where may Dimensions are 1..-1 - - 0.0;0.0;0.0;0.0;0.0 - 0.0;1.0;0.0;-1.0;0.0 - 1.0;0.0;-1.0;0.0;1.0 - - - - -
- -
diff --git a/ceasiompy/EdgeRun/tests/test_edgerun.py b/ceasiompy/EdgeRun/tests/test_edgerun.py index 63d341229..52c23f457 100644 --- a/ceasiompy/EdgeRun/tests/test_edgerun.py +++ b/ceasiompy/EdgeRun/tests/test_edgerun.py @@ -23,8 +23,8 @@ from pathlib import Path # Add the ceasiompy module to the PYTHONPATH -ceasiompy_path = Path("/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/ceasiompy") -sys.path.append(str(ceasiompy_path)) +# ceasiompy_path = Path("/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/ceasiompy") +# sys.path.append(str(ceasiompy_path)) # Now you can import and use the ceasiompy module # import ceasiompy @@ -45,16 +45,14 @@ class TestEdgeConfig(unittest.TestCase): def test_generate_edge_cfd_ainp(self): """Test function for 'ceasiompy.EdgeRun.func.edgeconfig.py'.""" - cpacs_path = Path( - "/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/WKDIR/labARstraight_toolInput.xml" - ) + cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml") cpacs_out_path = MODULE_DIR / "ToolOutput.xml" wkdir = MODULE_DIR / "Results/Edge" if not os.path.exists(wkdir): os.makedirs(wkdir) - generate_edge_cfd_ainp(cpacs_path, cpacs_out_path, wkdir) + generate_edge_cfd_ainp(cpacs_in_path, cpacs_out_path, wkdir) # ================================================================================================= @@ -65,4 +63,4 @@ def test_generate_edge_cfd_ainp(self): print("Test configfile.py") print("To run test use the following command:") print(">> pytest -v") -""" \ No newline at end of file +""" diff --git a/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py b/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py index a8d11e79e..62cc9d814 100644 --- a/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py +++ b/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py @@ -23,15 +23,15 @@ from pathlib import Path # Add the ceasiompy module to the PYTHONPATH -ceasiompy_path = Path("/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/ceasiompy") -sys.path.append(str(ceasiompy_path)) +# ceasiompy_path = Path("/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/ceasiompy") +# sys.path.append(str(ceasiompy_path)) # Now you can import and use the ceasiompy module # import ceasiompy from ceasiompy.EdgeRun.func.edgeconfig import generate_edge_cfd_ainp import os -from ceasiompy.EdgeRun.edgerun import run_Edge_multi -from ceasiompy.utils.commonxpath import Edge_NB_CPU_XPATH +from ceasiompy.EdgeRun.edgerun import run_edge_multi +from ceasiompy.utils.commonxpath import EDGE_NB_CPU_XPATH # from ceasiompy.utils.create_ainpfile import CreateAinp @@ -47,16 +47,14 @@ class TestEdgeConfig(unittest.TestCase): def test_generate_edge_cfd_ainp(self): """Test function for 'ceasiompy.EdgeRun.func.edgeconfig.py'.""" - cpacs_path = Path( - "/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/WKDIR/labARstraight_toolInput.xml" - ) - cpacs_out_path = MODULE_DIR / "ToolOutput.xml" + # cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml") + # cpacs_out_path = MODULE_DIR / "ToolOutput.xml" wkdir = MODULE_DIR / "Results/Edge" if not os.path.exists(wkdir): os.makedirs(wkdir) - run_Edge_multi(wkdir) + run_edge_multi(wkdir) # ================================================================================================= @@ -67,4 +65,4 @@ def test_generate_edge_cfd_ainp(self): print("Test configfile.py") print("To run test use the following command:") print(">> pytest -v") -""" \ No newline at end of file +""" diff --git a/ceasiompy/utils/commonxpath.py b/ceasiompy/utils/commonxpath.py index 7b29eadbc..1e0fe9cbd 100644 --- a/ceasiompy/utils/commonxpath.py +++ b/ceasiompy/utils/commonxpath.py @@ -78,7 +78,7 @@ OPTWKDIR_XPATH = CEASIOMPY_XPATH + "/filesPath/optimPath" SMFILE_XPATH = CEASIOMPY_XPATH + "/filesPath/SMpath" SU2MESH_XPATH = CEASIOMPY_XPATH + "/filesPath/su2Mesh" -EdgeMESH_XPATH = CEASIOMPY_XPATH + "/filesPath/edgeMesh" +EDGE_MESH_XPATH = CEASIOMPY_XPATH + "/filesPath/edgeMesh" SUMOFILE_XPATH = CEASIOMPY_XPATH + "/filesPath/sumoFilePath" WKDIR_XPATH = CEASIOMPY_XPATH + "/filesPath/wkdirPath" @@ -143,14 +143,14 @@ SU2_ACTUATOR_DISK_XPATH = SU2_XPATH + "/options/includeActuatorDisk" -# m-Edge -Edge_XPATH = CEASIOMPY_XPATH + "/aerodynamics/m-edge" -Edge_AEROMAP_UID_XPATH = Edge_XPATH + "/aeroMapUID" -Edge_NB_CPU_XPATH = Edge_XPATH + "/settings/nbCPU" -Edge_MAX_ITER_XPATH = Edge_XPATH + "/settings/maxIter" -Edge_CFL_NB_XPATH = Edge_XPATH + "/settings/cflNumber/value" -Edge_MG_LEVEL_XPATH = Edge_XPATH + "/settings/multigridLevel" -Edge_FIXED_CL_XPATH = Edge_XPATH + "/fixedCL" +# EDGE +EDGE_XPATH = CEASIOMPY_XPATH + "/aerodynamics/m-edge" +EDGE_AEROMAP_UID_XPATH = EDGE_XPATH + "/aeroMapUID" +EDGE_NB_CPU_XPATH = EDGE_XPATH + "/settings/nbCPU" +EDGE_MAX_ITER_XPATH = EDGE_XPATH + "/settings/maxIter" +EDGE_CFL_NB_XPATH = EDGE_XPATH + "/settings/cflNumber/value" +EDGE_MG_LEVEL_XPATH = EDGE_XPATH + "/settings/multigridLevel" +EDGE_FIXED_CL_XPATH = EDGE_XPATH + "/fixedCL" # RANGE RANGE_LD_RATIO_XPATH = CEASIOMPY_XPATH + "/ranges/lDRatio" diff --git a/ceasiompy/utils/create_ainpfile.py b/ceasiompy/utils/create_ainpfile.py index 1d26a8df6..5f6900295 100644 --- a/ceasiompy/utils/create_ainpfile.py +++ b/ceasiompy/utils/create_ainpfile.py @@ -32,45 +32,67 @@ class CreateAinp: def __init__(self): self.template_file = get_edge_ainp_template() - - def _write_file(self,content,output_file_path): - #output_file_path = os.path.join(output_folder, 'Edge.ainp') - with open(output_file_path,'w') as f: - f.write(content) + def _write_file(self, content, output_file_path): + # output_file_path = os.path.join(output_folder, 'Edge.ainp') + with open(output_file_path, "w") as f: + f.write(content) - def create_ainp(self,UFREE, VFREE, WFREE, TFREE, PFREE, SREF, CREF, BREF, IXMP, IDCLP, IDCDP, IDCCP, IDCMP, IDCNP, IDCRP, NPART, ITMAX, INSEUL, NGRID, CFL,output_folder): - #template_file_path = get_edge_ainp_template() - with open(self.template_file,'r') as f: + def create_ainp( + self, + UFREE, + VFREE, + WFREE, + TFREE, + PFREE, + SREF, + CREF, + BREF, + IXMP, + IDCLP, + IDCDP, + IDCCP, + IDCMP, + IDCNP, + IDCRP, + NPART, + ITMAX, + INSEUL, + NGRID, + CFL, + output_folder, + ): + # template_file_path = get_edge_ainp_template() + with open(self.template_file, "r") as f: template_content = f.read() - - # Define a dictionary for keyword-value pairs + + # Define a dictionary for keyword-value pairs replacements = { - '__UFREE__': str(UFREE), - '__VFREE__': str(VFREE), - '__WFREE__': str(WFREE), - '__TFREE__': str(TFREE), - '__PFREE__': str(PFREE), - '__SREF__': str(SREF), - '__CREF__': str(CREF), - '__BREF__': str(BREF), - '__IXMP__': f"{IXMP[0]} {IXMP[1]} {IXMP[2]}", - '__IDCLP__': IDCLP, - '__IDCDP__': IDCDP, - '__IDCCP__': IDCCP, - '__IDCMP__': IDCMP, - '__IDCNP__': IDCNP, - '__IDCRP__': IDCRP, - '__NPART__': str(NPART), - '__ITMAX__': str(ITMAX), - '__INSEUL__': str(INSEUL), - '__NGRID__': str(NGRID), - '__CFL__': str(CFL) + "__UFREE__": str(UFREE), + "__VFREE__": str(VFREE), + "__WFREE__": str(WFREE), + "__TFREE__": str(TFREE), + "__PFREE__": str(PFREE), + "__SREF__": str(SREF), + "__CREF__": str(CREF), + "__BREF__": str(BREF), + "__IXMP__": f"{IXMP[0]} {IXMP[1]} {IXMP[2]}", + "__IDCLP__": IDCLP, + "__IDCDP__": IDCDP, + "__IDCCP__": IDCCP, + "__IDCMP__": IDCMP, + "__IDCNP__": IDCNP, + "__IDCRP__": IDCRP, + "__NPART__": str(NPART), + "__ITMAX__": str(ITMAX), + "__INSEUL__": str(INSEUL), + "__NGRID__": str(NGRID), + "__CFL__": str(CFL), } - - # Use regular expression to replace keywords with their corresponding values + + # Use regular expression to replace keywords with their corresponding values edge_content = template_content for keyword, value in replacements.items(): edge_content = re.sub(re.escape(keyword), value, edge_content) - + self._write_file(edge_content, output_folder)