From 525c63589ef54eb0df5ab2ca482329e3fd6983d2 Mon Sep 17 00:00:00 2001 From: BenYuan Date: Fri, 1 Nov 2024 15:09:32 +0000 Subject: [PATCH 1/4] Lint fixed. now need to fix unit system conflict --- examples/case_from_multiple_files/main.py | 2 +- examples/case_from_yaml.py | 2 +- examples/case_params_with_units.py | 2 +- examples/change_account_and_submit.py | 2 +- examples/dev/dev_run_case_from_files.py | 2 +- .../dev_run_case_from_files_no_validation.py | 2 +- examples/dev/dev_use_unit_system.py | 4 +- examples/dev/list_cases_all_params.py | 2 +- examples/display_mesh_info.py | 2 +- ...urface_volume_case_airplane_v1_from_csm.py | 56 ----------- ...face_volume_case_airplane_v1_from_egads.py | 56 ----------- examples/list_cases.py | 2 +- .../new_workbench_project_from_geometry.py | 2 +- .../new_workbench_project_from_volume_mesh.py | 2 +- examples/project_from_file_geometry.py | 2 +- ...roject_from_file_geometry_multiple_runs.py | 2 +- examples/project_from_file_volume_mesh.py | 2 +- examples/retrieve_results/actuator_disk.py | 2 +- examples/retrieve_results/alpha_sweep.py | 2 +- examples/retrieve_results/bet_disk.py | 2 +- examples/retrieve_results/convergence.py | 2 +- examples/retrieve_results/forces.py | 2 +- examples/retrieve_results/monitors.py | 2 +- .../retrieve_results/user_defined_dynamics.py | 2 +- .../volumetric_and_surface.py | 2 +- examples/run_case_from_example_mesh.py | 2 +- examples/run_case_from_files.py | 2 +- examples/run_case_from_inputs.py | 2 +- examples/run_case_no_submit_warning.py | 2 +- examples/run_case_unsteady_from_files.py | 2 +- examples/run_case_with_fork.py | 2 +- examples/run_case_with_retry.py | 2 +- examples/show_storage.py | 2 +- examples/submit_case_to_folder.py | 2 +- examples/surface_mesh_airplane_from_files.py | 2 +- examples/surface_mesh_airplane_from_inputs.py | 2 +- examples/surface_mesh_list.py | 2 +- .../volume_mesh_from_surface_mesh_files.py | 2 +- .../volume_mesh_from_surface_mesh_inputs.py | 2 +- flow360/__init__.py | 2 + flow360/component/project.py | 2 +- flow360/component/v1/boundaries.py | 9 +- flow360/component/v1/conversions.py | 3 +- flow360/component/v1/flow360_output.py | 13 ++- flow360/component/v1/flow360_params.py | 94 +++++++++--------- flow360/component/v1/initial_condition.py | 6 +- flow360/component/v1/meshing/params.py | 7 +- .../component/v1/{__init__.py => modules.py} | 52 +++++----- flow360/component/v1/params_base.py | 11 +-- flow360/component/v1/services.py | 3 +- flow360/component/v1/solvers.py | 15 +-- flow360/component/v1/time_stepping.py | 3 +- flow360/component/v1/turbulence_quantities.py | 2 +- flow360/component/v1/updater.py | 2 +- flow360/component/v1/validations.py | 16 ++-- flow360/component/v1/volume_zones.py | 9 +- tests/test_current_flow360_version.py | 2 +- tests/test_environment.py | 2 +- tests/test_results.py | 2 +- tests/test_shared_accounts.py | 2 +- tests/test_utils.py | 2 +- tests/v1/_test_case.py | 2 +- tests/v1/_test_case_submit_solver_version.py | 2 +- tests/v1/_test_validate.py | 2 +- tests/v1/params/test_freestream.py | 2 +- tests/v1/params/test_initial_condition.py | 2 +- tests/v1/params/test_outputs.py | 68 ++++++------- tests/v1/params/test_params_boundary.py | 2 +- tests/v1/params/test_porous_media.py | 2 +- tests/v1/params/test_preconditioner.py | 2 +- tests/v1/params/test_reference_frame.py | 2 +- tests/v1/params/test_rotational_models.py | 2 +- tests/v1/params/test_solvers.py | 2 +- tests/v1/params/test_time_stepping.py | 2 +- tests/v1/params/test_user_defined_dynamics.py | 2 +- .../v1/params/test_validator_aeroacoustics.py | 2 +- tests/v1/params/test_validator_bet_disks.py | 2 +- tests/v1/params/test_validator_boundary.py | 2 +- tests/v1/params/test_validator_cht_solver.py | 2 +- ...est_validator_consistency_ddes_unsteady.py | 2 +- .../test_validator_equation_eval_frequency.py | 2 +- .../test_validator_output_consistency.py | 2 +- .../params/test_validator_periodic_mapping.py | 2 +- tests/v1/params/test_volume_zones.py | 2 +- tests/v1/test_case.py | 2 +- tests/v1/test_case_webapi.py | 2 +- tests/v1/test_dev_flow360_params.py | 2 +- tests/v1/test_flow360_params.py | 2 +- tests/v1/test_folders.py | 2 +- .../v1/test_handle_version_and_unit_system.py | 96 +++++++++---------- tests/v1/test_schema_generator.py | 2 +- tests/v1/test_services_v1.py | 2 +- tests/v1/test_unit_system_v1.py | 2 +- tests/v1/test_updater.py | 2 +- .../v1/test_validator_valid_output_fields.py | 2 +- tests/v1/test_volume_mesh.py | 6 +- tools/integrations/schema_generation.py | 2 +- .../_test_webui_workbench_integration.py | 2 +- tools/integrations/unit_defaults.py | 2 +- 99 files changed, 289 insertions(+), 398 deletions(-) delete mode 100644 examples/geometry_id_surface_volume_case_airplane_v1_from_csm.py delete mode 100644 examples/geometry_id_surface_volume_case_airplane_v1_from_egads.py rename flow360/component/v1/{__init__.py => modules.py} (79%) diff --git a/examples/case_from_multiple_files/main.py b/examples/case_from_multiple_files/main.py index 976c9f8b4..886ad9f72 100644 --- a/examples/case_from_multiple_files/main.py +++ b/examples/case_from_multiple_files/main.py @@ -1,6 +1,6 @@ import os -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl import flow360.component.v1.units as u from flow360.examples import OM6wing diff --git a/examples/case_from_yaml.py b/examples/case_from_yaml.py index 4624409f3..c15b17c4b 100644 --- a/examples/case_from_yaml.py +++ b/examples/case_from_yaml.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/case_params_with_units.py b/examples/case_params_with_units.py index 5d7b53320..5988e0c8b 100644 --- a/examples/case_params_with_units.py +++ b/examples/case_params_with_units.py @@ -1,7 +1,7 @@ import json from pprint import pprint -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360 import log from flow360.component.v1 import units as u from flow360.component.v1.services import validate_model diff --git a/examples/change_account_and_submit.py b/examples/change_account_and_submit.py index e2e2f7e2f..5aefe6def 100644 --- a/examples/change_account_and_submit.py +++ b/examples/change_account_and_submit.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing fl.Env.dev.active() diff --git a/examples/dev/dev_run_case_from_files.py b/examples/dev/dev_run_case_from_files.py index 1a923e9a6..fd1eaea71 100644 --- a/examples/dev/dev_run_case_from_files.py +++ b/examples/dev/dev_run_case_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing fl.Env.dev.active() diff --git a/examples/dev/dev_run_case_from_files_no_validation.py b/examples/dev/dev_run_case_from_files_no_validation.py index 671206ce9..c6dbf1592 100644 --- a/examples/dev/dev_run_case_from_files_no_validation.py +++ b/examples/dev/dev_run_case_from_files_no_validation.py @@ -1,6 +1,6 @@ import os -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing fl.UserConfig.disable_validation() diff --git a/examples/dev/dev_use_unit_system.py b/examples/dev/dev_use_unit_system.py index a40df63c3..78210ef1e 100644 --- a/examples/dev/dev_use_unit_system.py +++ b/examples/dev/dev_use_unit_system.py @@ -6,9 +6,9 @@ import pydantic.v1 as pd import unyt -import flow360.component.v1 as fl -from flow360.component.v1 import Geometry +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u +from flow360.component.v1.modules import Geometry from flow360.component.v1.unit_system import ( AngularVelocityType, AreaType, diff --git a/examples/dev/list_cases_all_params.py b/examples/dev/list_cases_all_params.py index 62bf79927..64e32e138 100644 --- a/examples/dev/list_cases_all_params.py +++ b/examples/dev/list_cases_all_params.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.exceptions import Flow360ValidationError for case in fl.MyCases(limit=10000): diff --git a/examples/display_mesh_info.py b/examples/display_mesh_info.py index f7cfb0b96..24cd263d3 100644 --- a/examples/display_mesh_info.py +++ b/examples/display_mesh_info.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl meshes = fl.MyVolumeMeshes() mesh = meshes[0] diff --git a/examples/geometry_id_surface_volume_case_airplane_v1_from_csm.py b/examples/geometry_id_surface_volume_case_airplane_v1_from_csm.py deleted file mode 100644 index 20e34d494..000000000 --- a/examples/geometry_id_surface_volume_case_airplane_v1_from_csm.py +++ /dev/null @@ -1,56 +0,0 @@ -import os - -import flow360.component.v1 as fl - -fl.Env.preprod.active() - -from flow360.component.geometry_v1 import Geometry -from flow360.component.meshing.params import Farfield, Volume, VolumeMeshingParams -from flow360.examples import Airplane - -# geometry -geometry_draft = Geometry.from_file(Airplane.geometry, name="testing-airplane-csm-geometry") -geometry = geometry_draft.submit() -print(geometry) - -# surface mesh -params = fl.SurfaceMeshingParams(max_edge_length=0.16) - -surface_mesh_draft = fl.SurfaceMesh.create( - geometry_id=geometry.id, - params=params, - name="airplane-surface-mesh-from-geometry-id-v1", - solver_version="mesher-24.2.2", -) -surface_mesh = surface_mesh_draft.submit() - -print(surface_mesh) - -# volume mesh -params = fl.VolumeMeshingParams( - volume=Volume( - first_layer_thickness=1e-5, - growth_rate=1.2, - ), - farfield=Farfield(type="auto"), -) - -volume_mesh_draft = fl.VolumeMesh.create( - surface_mesh_id=surface_mesh.id, - name="airplane-volume-mesh-from-geometry-id-v1", - params=params, - solver_version="mesher-24.2.2", -) -volume_mesh = volume_mesh_draft.submit() -print(volume_mesh) - -# case -params = fl.Flow360Params(Airplane.case_json) -params.boundaries = { - "fluid/farfield": fl.FreestreamBoundary(), - "fluid/fuselage": fl.NoSlipWall(), - "fluid/leftWing": fl.NoSlipWall(), - "fluid/rightWing": fl.NoSlipWall(), -} -case_draft = volume_mesh.create_case("airplane-case-from-csm-geometry-id-v1", params) -case = case_draft.submit() diff --git a/examples/geometry_id_surface_volume_case_airplane_v1_from_egads.py b/examples/geometry_id_surface_volume_case_airplane_v1_from_egads.py deleted file mode 100644 index 81202e845..000000000 --- a/examples/geometry_id_surface_volume_case_airplane_v1_from_egads.py +++ /dev/null @@ -1,56 +0,0 @@ -import os - -import flow360.component.v1 as fl - -fl.Env.preprod.active() - -from flow360.component.geometry_v1 import Geometry -from flow360.component.meshing.params import Farfield, Volume, VolumeMeshingParams -from flow360.examples import Airplane - -# geometry -geometry_draft = Geometry.from_file( - "data/airplane_geometry.egads", name="testing-airplane-egads-geometry" -) -geometry = geometry_draft.submit() -print(geometry) - -# surface mesh -params = fl.SurfaceMeshingParams(max_edge_length=0.16) - -surface_mesh_draft = fl.SurfaceMesh.create( - geometry_id=geometry.id, - params=params, - name="airplane-surface-mesh-from-geometry-id-v1", -) -surface_mesh = surface_mesh_draft.submit() - -print(surface_mesh) - -# volume mesh -params = fl.VolumeMeshingParams( - volume=Volume( - first_layer_thickness=1e-5, - growth_rate=1.2, - ), - farfield=Farfield(type="auto"), -) - -volume_mesh_draft = fl.VolumeMesh.create( - surface_mesh_id=surface_mesh.id, - name="airplane-volume-mesh-from-geometry-id-v1", - params=params, -) -volume_mesh = volume_mesh_draft.submit() -print(volume_mesh) - -# case -params = fl.Flow360Params(Airplane.case_json) -params.boundaries = { - "fluid/farfield": fl.FreestreamBoundary(), - "fluid/fuselage": fl.NoSlipWall(), - "fluid/leftWing": fl.NoSlipWall(), - "fluid/rightWing": fl.NoSlipWall(), -} -case_draft = volume_mesh.create_case("airplane-case-from-egads-geometry-id-v1", params) -case = case_draft.submit() diff --git a/examples/list_cases.py b/examples/list_cases.py index ff7f9851c..01201dff5 100644 --- a/examples/list_cases.py +++ b/examples/list_cases.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl # get all cases: my_cases = fl.MyCases() diff --git a/examples/new_workbench_project_from_geometry.py b/examples/new_workbench_project_from_geometry.py index 1bcf50870..6d41c1c87 100644 --- a/examples/new_workbench_project_from_geometry.py +++ b/examples/new_workbench_project_from_geometry.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.geometry import Geometry from flow360.examples import Airplane diff --git a/examples/new_workbench_project_from_volume_mesh.py b/examples/new_workbench_project_from_volume_mesh.py index a0f02a25e..411b472bf 100644 --- a/examples/new_workbench_project_from_volume_mesh.py +++ b/examples/new_workbench_project_from_volume_mesh.py @@ -1,7 +1,7 @@ import time import flow360.component.simulation.units as u -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.simulation.cloud import run_case from flow360.component.simulation.models.surface_models import ( Freestream, diff --git a/examples/project_from_file_geometry.py b/examples/project_from_file_geometry.py index cfb5700c3..9e0d8aa10 100644 --- a/examples/project_from_file_geometry.py +++ b/examples/project_from_file_geometry.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.project import Project from flow360.component.simulation.meshing_param.params import ( MeshingDefaults, diff --git a/examples/project_from_file_geometry_multiple_runs.py b/examples/project_from_file_geometry_multiple_runs.py index 5dec5b926..90f05282a 100644 --- a/examples/project_from_file_geometry_multiple_runs.py +++ b/examples/project_from_file_geometry_multiple_runs.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.project import Project from flow360.component.simulation.meshing_param.params import ( MeshingDefaults, diff --git a/examples/project_from_file_volume_mesh.py b/examples/project_from_file_volume_mesh.py index ef80aed77..d8d348f1f 100644 --- a/examples/project_from_file_volume_mesh.py +++ b/examples/project_from_file_volume_mesh.py @@ -1,7 +1,7 @@ from matplotlib.pyplot import show import flow360.component.simulation.units as u -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.project import Project from flow360.component.simulation.models.surface_models import ( Freestream, diff --git a/examples/retrieve_results/actuator_disk.py b/examples/retrieve_results/actuator_disk.py index 5f3345a20..7852c0344 100644 --- a/examples/retrieve_results/actuator_disk.py +++ b/examples/retrieve_results/actuator_disk.py @@ -1,6 +1,6 @@ import os -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl import flow360.units as u from flow360.examples import ActuatorDisk diff --git a/examples/retrieve_results/alpha_sweep.py b/examples/retrieve_results/alpha_sweep.py index f0c4bbf0a..257566069 100644 --- a/examples/retrieve_results/alpha_sweep.py +++ b/examples/retrieve_results/alpha_sweep.py @@ -3,7 +3,7 @@ from pylab import plot, show, xlabel, ylabel -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/retrieve_results/bet_disk.py b/examples/retrieve_results/bet_disk.py index 8c775e1b3..0f0dfd45f 100644 --- a/examples/retrieve_results/bet_disk.py +++ b/examples/retrieve_results/bet_disk.py @@ -1,6 +1,6 @@ import os -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl import flow360.component.v1.units as u from flow360.examples import BETDisk diff --git a/examples/retrieve_results/convergence.py b/examples/retrieve_results/convergence.py index 7806e53f6..ef31acd90 100644 --- a/examples/retrieve_results/convergence.py +++ b/examples/retrieve_results/convergence.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Convergence Convergence.get_files() diff --git a/examples/retrieve_results/forces.py b/examples/retrieve_results/forces.py index 20145dbc3..209ed71e1 100644 --- a/examples/retrieve_results/forces.py +++ b/examples/retrieve_results/forces.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/retrieve_results/monitors.py b/examples/retrieve_results/monitors.py index 055e63f0f..9413c2f03 100644 --- a/examples/retrieve_results/monitors.py +++ b/examples/retrieve_results/monitors.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import MonitorsAndSlices MonitorsAndSlices.get_files() diff --git a/examples/retrieve_results/user_defined_dynamics.py b/examples/retrieve_results/user_defined_dynamics.py index c6bd62717..b66eeae65 100644 --- a/examples/retrieve_results/user_defined_dynamics.py +++ b/examples/retrieve_results/user_defined_dynamics.py @@ -1,6 +1,6 @@ from pylab import show -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wingUserDefinedDynamics OM6wingUserDefinedDynamics.get_files() diff --git a/examples/retrieve_results/volumetric_and_surface.py b/examples/retrieve_results/volumetric_and_surface.py index bda7b7b49..4d0343312 100644 --- a/examples/retrieve_results/volumetric_and_surface.py +++ b/examples/retrieve_results/volumetric_and_surface.py @@ -2,7 +2,7 @@ import tarfile import tempfile -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import MonitorsAndSlices MonitorsAndSlices.get_files() diff --git a/examples/run_case_from_example_mesh.py b/examples/run_case_from_example_mesh.py index 44104e850..d2333bf88 100644 --- a/examples/run_case_from_example_mesh.py +++ b/examples/run_case_from_example_mesh.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing vm = fl.VolumeMesh.copy_from_example("2ad77a88-1676-4f89-8652-13bd7e34f257") diff --git a/examples/run_case_from_files.py b/examples/run_case_from_files.py index a27099e44..f19cf310f 100644 --- a/examples/run_case_from_files.py +++ b/examples/run_case_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_from_inputs.py b/examples/run_case_from_inputs.py index 794edd04e..9f9cf31be 100644 --- a/examples/run_case_from_inputs.py +++ b/examples/run_case_from_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_no_submit_warning.py b/examples/run_case_no_submit_warning.py index 102d04cf8..288364682 100644 --- a/examples/run_case_no_submit_warning.py +++ b/examples/run_case_no_submit_warning.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_unsteady_from_files.py b/examples/run_case_unsteady_from_files.py index a041533d2..a8d409faa 100644 --- a/examples/run_case_unsteady_from_files.py +++ b/examples/run_case_unsteady_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Cylinder2D Cylinder2D.get_files() diff --git a/examples/run_case_with_fork.py b/examples/run_case_with_fork.py index 6527552e7..04ce57a18 100644 --- a/examples/run_case_with_fork.py +++ b/examples/run_case_with_fork.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_with_retry.py b/examples/run_case_with_retry.py index bbb92d8db..034bdf102 100644 --- a/examples/run_case_with_retry.py +++ b/examples/run_case_with_retry.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/show_storage.py b/examples/show_storage.py index 949304f85..b2b894863 100644 --- a/examples/show_storage.py +++ b/examples/show_storage.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl fl.Env.preprod.active() diff --git a/examples/submit_case_to_folder.py b/examples/submit_case_to_folder.py index 8cfef0bb5..bcae24217 100644 --- a/examples/submit_case_to_folder.py +++ b/examples/submit_case_to_folder.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing # create folder in ROOT level diff --git a/examples/surface_mesh_airplane_from_files.py b/examples/surface_mesh_airplane_from_files.py index 7447a6851..4d5a8fb4f 100644 --- a/examples/surface_mesh_airplane_from_files.py +++ b/examples/surface_mesh_airplane_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams(Airplane.surface_json) diff --git a/examples/surface_mesh_airplane_from_inputs.py b/examples/surface_mesh_airplane_from_inputs.py index 6ae9d4b17..c9ee58d94 100644 --- a/examples/surface_mesh_airplane_from_inputs.py +++ b/examples/surface_mesh_airplane_from_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams( diff --git a/examples/surface_mesh_list.py b/examples/surface_mesh_list.py index 19aae559e..63d013b3f 100644 --- a/examples/surface_mesh_list.py +++ b/examples/surface_mesh_list.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl my_meshes = fl.MySurfaceMeshes() diff --git a/examples/volume_mesh_from_surface_mesh_files.py b/examples/volume_mesh_from_surface_mesh_files.py index 92a35f460..a295ba5ec 100644 --- a/examples/volume_mesh_from_surface_mesh_files.py +++ b/examples/volume_mesh_from_surface_mesh_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams(Airplane.surface_json) diff --git a/examples/volume_mesh_from_surface_mesh_inputs.py b/examples/volume_mesh_from_surface_mesh_inputs.py index 5ebe9f0ca..be268e6f0 100644 --- a/examples/volume_mesh_from_surface_mesh_inputs.py +++ b/examples/volume_mesh_from_surface_mesh_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams( diff --git a/flow360/__init__.py b/flow360/__init__.py index 85a7d9138..506b7ec8b 100644 --- a/flow360/__init__.py +++ b/flow360/__init__.py @@ -2,6 +2,7 @@ This module is flow360 for simulation based models """ +from flow360.component.project import Project from flow360.component.simulation import services from flow360.component.simulation import units as u from flow360.component.simulation.entity_info import GeometryEntityInfo @@ -116,6 +117,7 @@ ) __all__ = [ + "Project", "u", "SimulationParams", "SI_unit_system", diff --git a/flow360/component/project.py b/flow360/component/project.py index 908d59609..cc9c2912f 100644 --- a/flow360/component/project.py +++ b/flow360/component/project.py @@ -57,7 +57,7 @@ class RootType(Enum): VOLUME_MESH = "VolumeMesh" -class ProjectMeta(pd.BaseModel, extra=pd.Extra.allow): +class ProjectMeta(pd.BaseModel, extra="allow"): """ Metadata class for a project. diff --git a/flow360/component/v1/boundaries.py b/flow360/component/v1/boundaries.py index 043e9dcf4..706b3dec4 100644 --- a/flow360/component/v1/boundaries.py +++ b/flow360/component/v1/boundaries.py @@ -10,13 +10,12 @@ import pydantic.v1 as pd from pydantic.v1 import StrictStr +from flow360.component.types import Axis, Vector +from flow360.component.utils import process_expressions +from flow360.component.v1.params_base import Flow360BaseModel +from flow360.component.v1.turbulence_quantities import TurbulenceQuantitiesType from flow360.component.v1.unit_system import PressureType, VelocityType -from ..types import Axis, Vector -from ..utils import process_expressions -from .params_base import Flow360BaseModel -from .turbulence_quantities import TurbulenceQuantitiesType - BoundaryVelocityType = Union[VelocityType.Vector, Tuple[StrictStr, StrictStr, StrictStr]] BoundaryAxisType = Union[Axis, Tuple[StrictStr, StrictStr, StrictStr]] diff --git a/flow360/component/v1/conversions.py b/flow360/component/v1/conversions.py index 885bdd9ea..020bb0fc6 100644 --- a/flow360/component/v1/conversions.py +++ b/flow360/component/v1/conversions.py @@ -13,8 +13,7 @@ is_flow360_unit, u, ) - -from ...exceptions import Flow360ConfigurationError +from flow360.exceptions import Flow360ConfigurationError class ExtraDimensionedProperty(pd.BaseModel): diff --git a/flow360/component/v1/flow360_output.py b/flow360/component/v1/flow360_output.py index 1a4710b0f..0071acb82 100644 --- a/flow360/component/v1/flow360_output.py +++ b/flow360/component/v1/flow360_output.py @@ -10,11 +10,9 @@ import pydantic.v1 as pd from pydantic.v1 import conlist -from flow360.component.v1.unit_system import Flow360UnitSystem, LengthType - -from ..types import Axis, Coordinate -from ..utils import process_expressions -from .flow360_fields import ( +from flow360.component.types import Axis, Coordinate +from flow360.component.utils import process_expressions +from flow360.component.v1.flow360_fields import ( CommonFieldNames, IsoSurfaceFieldNames, SliceFieldNames, @@ -23,12 +21,13 @@ _distribute_shared_output_fields, get_field_values, ) -from .flow360_legacy import LegacyModel, get_output_fields -from .params_base import ( +from flow360.component.v1.flow360_legacy import LegacyModel, get_output_fields +from flow360.component.v1.params_base import ( Flow360BaseModel, Flow360SortableBaseModel, _self_named_property_validator, ) +from flow360.component.v1.unit_system import Flow360UnitSystem, LengthType OutputFormat = Literal[ "paraview", "tecplot", "both", "paraview,tecplot" diff --git a/flow360/component/v1/flow360_params.py b/flow360/component/v1/flow360_params.py index eafb3dc7d..165cc2381 100644 --- a/flow360/component/v1/flow360_params.py +++ b/flow360/component/v1/flow360_params.py @@ -13,40 +13,12 @@ import pydantic.v1 as pd from typing_extensions import Literal -from flow360.component.v1.unit_system import ( - AngularVelocityType, - AreaType, - DensityType, - Flow360UnitSystem, - LengthType, - PressureType, - SIUnitSystem, - TemperatureType, - UnitSystem, - UnitSystemType, - VelocityType, - ViscosityType, - flow360_unit_system, - u, - unit_system_manager, -) -from flow360.flags import Flags - -from ...error_messages import unit_system_inconsistent_msg, use_unit_system_msg -from ...exceptions import ( - Flow360ConfigError, - Flow360NotImplementedError, - Flow360RuntimeError, -) -from ...log import log -from ...user_config import UserConfig -from ...version import __version__ -from ..types import Axis, Coordinate, Vector -from ..utils import convert_legacy_names, process_expressions -from . import units -from .boundaries import BoundaryType -from .conversions import ExtraDimensionedProperty -from .flow360_legacy import ( +from flow360.component.types import Axis, Coordinate, Vector +from flow360.component.utils import convert_legacy_names, process_expressions +from flow360.component.v1 import units +from flow360.component.v1.boundaries import BoundaryType +from flow360.component.v1.conversions import ExtraDimensionedProperty +from flow360.component.v1.flow360_legacy import ( FreestreamInitialConditionLegacy, LegacyModel, try_add_discriminator, @@ -54,7 +26,7 @@ try_set, try_update, ) -from .flow360_output import ( +from flow360.component.v1.flow360_output import ( AeroacousticOutput, IsoSurfaceOutput, IsoSurfaceOutputLegacy, @@ -69,22 +41,22 @@ VolumeOutput, VolumeOutputLegacy, ) -from .initial_condition import ( +from flow360.component.v1.initial_condition import ( ExpressionInitialCondition, ExpressionInitialConditionLegacy, InitialConditions, ModifiedRestartSolution, ModifiedRestartSolutionLegacy, ) -from .params_base import ( +from flow360.component.v1.params_base import ( Conflicts, Flow360BaseModel, Flow360SortableBaseModel, _self_named_property_validator, flow360_json_encoder, ) -from .physical_properties import _AirModel -from .solvers import ( +from flow360.component.v1.physical_properties import _AirModel +from flow360.component.v1.solvers import ( HeatEquationSolver, HeatEquationSolverLegacy, NavierStokesSolver, @@ -95,10 +67,34 @@ TurbulenceModelSolverLegacy, TurbulenceModelSolverType, ) -from .time_stepping import BaseTimeStepping, SteadyTimeStepping, TimeStepping -from .turbulence_quantities import TurbulenceQuantitiesType, TurbulentViscosityRatio -from .updater import updater -from .validations import ( +from flow360.component.v1.time_stepping import ( + BaseTimeStepping, + SteadyTimeStepping, + TimeStepping, +) +from flow360.component.v1.turbulence_quantities import ( + TurbulenceQuantitiesType, + TurbulentViscosityRatio, +) +from flow360.component.v1.unit_system import ( + AngularVelocityType, + AreaType, + DensityType, + Flow360UnitSystem, + LengthType, + PressureType, + SIUnitSystem, + TemperatureType, + UnitSystem, + UnitSystemType, + VelocityType, + ViscosityType, + flow360_unit_system, + u, + unit_system_manager, +) +from flow360.component.v1.updater import updater +from flow360.component.v1.validations import ( _check_aero_acoustics, _check_bet_disks_3d_coefficients_in_polars, _check_bet_disks_alphas_in_order, @@ -120,13 +116,23 @@ _check_tri_quad_boundaries, _ignore_velocity_type_in_boundaries, ) -from .volume_zones import ( +from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, HeatTransferVolumeZone, PorousMediumBase, ReferenceFrameType, VolumeZoneType, ) +from flow360.error_messages import unit_system_inconsistent_msg, use_unit_system_msg +from flow360.exceptions import ( + Flow360ConfigError, + Flow360NotImplementedError, + Flow360RuntimeError, +) +from flow360.flags import Flags +from flow360.log import log +from flow360.user_config import UserConfig +from flow360.version import __version__ # pylint: disable=invalid-name diff --git a/flow360/component/v1/initial_condition.py b/flow360/component/v1/initial_condition.py index 4d95add02..f023e79c8 100644 --- a/flow360/component/v1/initial_condition.py +++ b/flow360/component/v1/initial_condition.py @@ -9,9 +9,9 @@ import pydantic.v1 as pd from typing_extensions import Literal -from ..utils import process_expressions -from .flow360_legacy import LegacyModel -from .params_base import Flow360BaseModel +from flow360.component.utils import process_expressions +from flow360.component.v1.flow360_legacy import LegacyModel +from flow360.component.v1.params_base import Flow360BaseModel class InitialCondition(Flow360BaseModel): diff --git a/flow360/component/v1/meshing/params.py b/flow360/component/v1/meshing/params.py index fbd1245ac..43dc30505 100644 --- a/flow360/component/v1/meshing/params.py +++ b/flow360/component/v1/meshing/params.py @@ -7,15 +7,14 @@ import pydantic.v1 as pd from typing_extensions import Literal -from flow360.flags import Flags - -from ...types import Axis, Coordinate -from ..params_base import ( +from flow360.component.types import Axis, Coordinate +from flow360.component.v1.params_base import ( Flow360BaseModel, Flow360SortableBaseModel, _self_named_property_validator, flow360_json_encoder, ) +from flow360.flags import Flags class Aniso(Flow360BaseModel): diff --git a/flow360/component/v1/__init__.py b/flow360/component/v1/modules.py similarity index 79% rename from flow360/component/v1/__init__.py rename to flow360/component/v1/modules.py index 1f67643c4..0085450e2 100644 --- a/flow360/component/v1/__init__.py +++ b/flow360/component/v1/modules.py @@ -1,5 +1,5 @@ """ -This module is flow360. +Flow360 V1 (legacy) modules. """ import os @@ -14,23 +14,23 @@ imperial_unit_system, ) -from ... import global_exception_handler -from ...accounts_utils import Accounts -from ...cli import flow360 -from ...cloud.s3_utils import ProgressCallbackInterface -from ...environment import Env -from ...flags import Flags -from ...user_config import UserConfig -from ...version import __solver_version__, __version__ -from ..case import Case -from ..case import CaseList as MyCases -from ..folder import Folder -from ..surface_mesh import SurfaceMesh -from ..surface_mesh import SurfaceMeshList as MySurfaceMeshes -from ..volume_mesh import VolumeMesh -from ..volume_mesh import VolumeMeshList as MyVolumeMeshes -from . import meshing, solvers, units -from .boundaries import ( +from flow360 import global_exception_handler +from flow360.accounts_utils import Accounts +from flow360.cli import flow360 +from flow360.cloud.s3_utils import ProgressCallbackInterface +from flow360.environment import Env +from flow360.flags import Flags +from flow360.user_config import UserConfig +from flow360.version import __solver_version__, __version__ +from flow360.component.case import Case +from flow360.component.case import CaseList as MyCases +from flow360.component.folder import Folder +from flow360.component.surface_mesh import SurfaceMesh +from flow360.component.surface_mesh import SurfaceMeshList as MySurfaceMeshes +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes +from flow360.component.v1 import meshing, solvers, units +from flow360.component.v1.boundaries import ( FreestreamBoundary, HeatFluxWall, IsothermalWall, @@ -53,7 +53,7 @@ VelocityInflow, WallFunction, ) -from .flow360_output import ( +from flow360.component.v1.flow360_output import ( IsoSurfaceOutput, IsoSurfaces, MonitorOutput, @@ -66,7 +66,7 @@ SurfaceOutput, Surfaces, ) -from .flow360_params import ( +from flow360.component.v1.flow360_params import ( ActuatorDisk, AeroacousticOutput, AirDensityTemperature, @@ -96,8 +96,8 @@ ZeroFreestreamFromVelocity, air, ) -from .initial_condition import ExpressionInitialCondition, ModifiedRestartSolution -from .meshing.params import ( +from flow360.component.v1.initial_condition import ExpressionInitialCondition, ModifiedRestartSolution +from flow360.component.v1.meshing.params import ( Aniso, BoxRefinement, CylinderRefinement, @@ -112,7 +112,7 @@ Volume, VolumeMeshingParams, ) -from .solvers import ( +from flow360.component.v1.solvers import ( IncompressibleNavierStokesSolver, KOmegaSST, KOmegaSSTModelConstants, @@ -123,15 +123,15 @@ SpalartAllmaras, SpalartAllmarasModelConstants, ) -from .time_stepping import ( +from flow360.component.v1.time_stepping import ( AdaptiveCFL, RampCFL, SteadyTimeStepping, TimeStepping, UnsteadyTimeStepping, ) -from .turbulence_quantities import TurbulenceQuantities -from .volume_zones import ( +from flow360.component.v1.turbulence_quantities import TurbulenceQuantities +from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, HeatTransferVolumeZone, InitialConditionHeatTransfer, diff --git a/flow360/component/v1/params_base.py b/flow360/component/v1/params_base.py index 5520ce601..d4fec067f 100644 --- a/flow360/component/v1/params_base.py +++ b/flow360/component/v1/params_base.py @@ -21,13 +21,12 @@ from pydantic.v1.fields import ModelField from typing_extensions import Literal +from flow360.component.types import COMMENTS, TYPE_TAG_STR +from flow360.component.v1.conversions import need_conversion, require, unit_converter from flow360.component.v1.unit_system import DimensionedType, is_flow360_unit - -from ...error_messages import do_not_modify_file_manually_msg -from ...exceptions import Flow360FileError, Flow360ValidationError -from ...log import log -from ..types import COMMENTS, TYPE_TAG_STR -from .conversions import need_conversion, require, unit_converter +from flow360.error_messages import do_not_modify_file_manually_msg +from flow360.exceptions import Flow360FileError, Flow360ValidationError +from flow360.log import log def json_dumps(value, *args, **kwargs): diff --git a/flow360/component/v1/services.py b/flow360/component/v1/services.py index 28fcf726d..f017a1593 100644 --- a/flow360/component/v1/services.py +++ b/flow360/component/v1/services.py @@ -7,6 +7,7 @@ import pydantic.v1 as pd +from flow360.component.utils import remove_properties_with_prefix from flow360.component.v1.flow360_params import ( Flow360Params, FreestreamFromVelocity, @@ -29,8 +30,6 @@ ) from flow360.exceptions import Flow360ConfigurationError -from ..utils import remove_properties_with_prefix - unit_system_map = { "SI": SI_unit_system, "CGS": CGS_unit_system, diff --git a/flow360/component/v1/solvers.py b/flow360/component/v1/solvers.py index 5a2513b0e..f3070f0bf 100644 --- a/flow360/component/v1/solvers.py +++ b/flow360/component/v1/solvers.py @@ -11,18 +11,21 @@ import pydantic.v1 as pd from typing_extensions import Literal -from flow360.flags import Flags - -from ..types import Coordinate -from .flow360_legacy import ( +from flow360.component.types import Coordinate +from flow360.component.v1.flow360_legacy import ( LegacyModel, LinearSolverLegacy, set_linear_solver_config_if_none, try_set, try_update, ) -from .params_base import Conflicts, DeprecatedAlias, Flow360BaseModel -from .time_stepping import UnsteadyTimeStepping +from flow360.component.v1.params_base import ( + Conflicts, + DeprecatedAlias, + Flow360BaseModel, +) +from flow360.component.v1.time_stepping import UnsteadyTimeStepping +from flow360.flags import Flags HEAT_EQUATION_EVAL_MAX_PER_PSEUDOSTEP_UNSTEADY = 40 HEAT_EQUATION_EVAL_FREQUENCY_STEADY = 10 diff --git a/flow360/component/v1/time_stepping.py b/flow360/component/v1/time_stepping.py index 55834a4a8..57b7b8bb7 100644 --- a/flow360/component/v1/time_stepping.py +++ b/flow360/component/v1/time_stepping.py @@ -12,10 +12,9 @@ import pydantic.v1 as pd from typing_extensions import Literal +from flow360.component.v1.params_base import DeprecatedAlias, Flow360BaseModel from flow360.component.v1.unit_system import TimeType -from .params_base import DeprecatedAlias, Flow360BaseModel - def _apply_default_to_none(original, default): for field_name in original.__fields__: diff --git a/flow360/component/v1/turbulence_quantities.py b/flow360/component/v1/turbulence_quantities.py index 129a56308..115dfb64a 100644 --- a/flow360/component/v1/turbulence_quantities.py +++ b/flow360/component/v1/turbulence_quantities.py @@ -8,7 +8,7 @@ import pydantic.v1 as pd -from .params_base import Flow360BaseModel +from flow360.component.v1.params_base import Flow360BaseModel class TurbulentKineticEnergy(Flow360BaseModel): diff --git a/flow360/component/v1/updater.py b/flow360/component/v1/updater.py index 0539ae948..fb682c851 100644 --- a/flow360/component/v1/updater.py +++ b/flow360/component/v1/updater.py @@ -4,7 +4,7 @@ import re -from ...exceptions import Flow360NotImplementedError, Flow360RuntimeError +from flow360.exceptions import Flow360NotImplementedError, Flow360RuntimeError def _no_update(params_as_dict): diff --git a/flow360/component/v1/validations.py b/flow360/component/v1/validations.py index 86f8a6a4c..a19738a82 100644 --- a/flow360/component/v1/validations.py +++ b/flow360/component/v1/validations.py @@ -5,8 +5,7 @@ from copy import deepcopy from typing import List, Literal, Optional, Tuple, Union, get_args, get_origin -from ...log import log -from .boundaries import ( +from flow360.component.v1.boundaries import ( RotationallyPeriodic, SlipWall, SolidAdiabaticWall, @@ -14,12 +13,13 @@ TranslationallyPeriodic, WallFunction, ) -from .flow360_fields import _distribute_shared_output_fields -from .initial_condition import ExpressionInitialCondition -from .params_utils import get_all_output_fields -from .solvers import IncompressibleNavierStokesSolver -from .time_stepping import SteadyTimeStepping, UnsteadyTimeStepping -from .volume_zones import HeatTransferVolumeZone +from flow360.component.v1.flow360_fields import _distribute_shared_output_fields +from flow360.component.v1.initial_condition import ExpressionInitialCondition +from flow360.component.v1.params_utils import get_all_output_fields +from flow360.component.v1.solvers import IncompressibleNavierStokesSolver +from flow360.component.v1.time_stepping import SteadyTimeStepping, UnsteadyTimeStepping +from flow360.component.v1.volume_zones import HeatTransferVolumeZone +from flow360.log import log def _ignore_velocity_type_in_boundaries(values): diff --git a/flow360/component/v1/volume_zones.py b/flow360/component/v1/volume_zones.py index 7b57d1c2c..6cb0034e2 100644 --- a/flow360/component/v1/volume_zones.py +++ b/flow360/component/v1/volume_zones.py @@ -14,6 +14,10 @@ from pydantic.v1 import StrictStr from typing_extensions import Literal +from flow360.component.constants import NumericalConstants +from flow360.component.types import Axis, List +from flow360.component.utils import process_expressions +from flow360.component.v1.params_base import Flow360BaseModel from flow360.component.v1.unit_system import ( AngularVelocityType, HeatSourceType, @@ -22,11 +26,6 @@ LengthType, ) -from ..constants import NumericalConstants -from ..types import Axis, List -from ..utils import process_expressions -from .params_base import Flow360BaseModel - class ReferenceFrameBase(Flow360BaseModel): """Base reference frame class""" diff --git a/tests/test_current_flow360_version.py b/tests/test_current_flow360_version.py index e7eb64980..e6a9999ca 100644 --- a/tests/test_current_flow360_version.py +++ b/tests/test_current_flow360_version.py @@ -1,4 +1,4 @@ -from flow360.component.v1 import __version__ +from flow360.component.v1.modules import __version__ def test_version(): diff --git a/tests/test_environment.py b/tests/test_environment.py index 60a823cc5..fe77a3b38 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -1,4 +1,4 @@ -from flow360.component.v1 import Env +from flow360.component.v1.modules import Env def test_version(): diff --git a/tests/test_results.py b/tests/test_results.py index 711601d9e..c654a612f 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -6,7 +6,7 @@ import pandas import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl import flow360.component.v1.units as u1 from flow360 import log from flow360.component.simulation import units as u2 diff --git a/tests/test_shared_accounts.py b/tests/test_shared_accounts.py index c43092473..df9624dbe 100644 --- a/tests/test_shared_accounts.py +++ b/tests/test_shared_accounts.py @@ -2,7 +2,7 @@ import pytest -from flow360.component.v1 import Accounts, Env +from flow360.component.v1.modules import Accounts, Env def test_shared_account(mock_response, monkeypatch): diff --git a/tests/test_utils.py b/tests/test_utils.py index 3da5c8d9c..138be9c37 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -12,7 +12,7 @@ shared_account_confirm_proceed, validate_type, ) -from flow360.component.v1 import Accounts +from flow360.component.v1.modules import Accounts from flow360.component.volume_mesh import VolumeMeshMeta from flow360.exceptions import Flow360TypeError, Flow360ValueError diff --git a/tests/v1/_test_case.py b/tests/v1/_test_case.py index fc9236bce..350026501 100644 --- a/tests/v1/_test_case.py +++ b/tests/v1/_test_case.py @@ -1,6 +1,6 @@ from flow360.component.case import Case -from flow360.component.v1 import Env from flow360.component.v1.flow360_params import Flow360Params, UnsteadyTimeStepping +from flow360.component.v1.modules import Env def test_from_cloud(): diff --git a/tests/v1/_test_case_submit_solver_version.py b/tests/v1/_test_case_submit_solver_version.py index 90e66089e..2277460d5 100644 --- a/tests/v1/_test_case_submit_solver_version.py +++ b/tests/v1/_test_case_submit_solver_version.py @@ -1,6 +1,6 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.examples import OM6wing from flow360.exceptions import Flow360RuntimeError, Flow360ValidationError from flow360.log import set_logging_level diff --git a/tests/v1/_test_validate.py b/tests/v1/_test_validate.py index 08c7a8d07..e8043cf5d 100644 --- a/tests/v1/_test_validate.py +++ b/tests/v1/_test_validate.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.validator import Validator assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_freestream.py b/tests/v1/params/test_freestream.py index 0d037d98e..6e829c96c 100644 --- a/tests/v1/params/test_freestream.py +++ b/tests/v1/params/test_freestream.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( FreestreamFromMach, diff --git a/tests/v1/params/test_initial_condition.py b/tests/v1/params/test_initial_condition.py index 4620f16a8..04487672d 100644 --- a/tests/v1/params/test_initial_condition.py +++ b/tests/v1/params/test_initial_condition.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.initial_condition import ExpressionInitialCondition from tests.utils import to_file_from_file_test diff --git a/tests/v1/params/test_outputs.py b/tests/v1/params/test_outputs.py index 8e8eb2bc7..8ea1e271b 100644 --- a/tests/v1/params/test_outputs.py +++ b/tests/v1/params/test_outputs.py @@ -5,7 +5,7 @@ import pytest import unyt -import flow360.component.v1 as v1 +import flow360.component.v1.modules as modules import flow360.component.v1.units as u from flow360.component.v1.flow360_output import ( IsoSurface, @@ -99,7 +99,7 @@ def test_surface_output(): output_fields=["Cp", "qcriterion"], ) - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( surface_output=SurfaceOutput( output_fields=["Cp"], @@ -107,9 +107,9 @@ def test_surface_output(): output_format="both", ), boundaries={ - "1": v1.NoSlipWall(name="wing"), - "2": v1.SlipWall(name="symmetry"), - "3": v1.FreestreamBoundary(name="freestream"), + "1": modules.NoSlipWall(name="wing"), + "2": modules.SlipWall(name="symmetry"), + "3": modules.FreestreamBoundary(name="freestream"), }, freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) @@ -125,7 +125,7 @@ def test_surface_output(): else: assert surface_item["output_fields"] == ["Cp"] - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( surface_output=SurfaceOutput( output_fields=["Cp", "solutionTurbulence", "nuHat"], @@ -133,9 +133,9 @@ def test_surface_output(): output_format="tecplot", ), boundaries={ - "1": v1.NoSlipWall(name="wing"), - "2": v1.SlipWall(name="symmetry"), - "3": v1.FreestreamBoundary(name="freestream"), + "1": modules.NoSlipWall(name="wing"), + "2": modules.SlipWall(name="symmetry"), + "3": modules.FreestreamBoundary(name="freestream"), }, freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) @@ -163,11 +163,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": modules.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413 * u.inch, 0), output_fields=["Mach"], @@ -178,11 +178,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": modules.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -196,7 +196,7 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal={0, 1}, slice_origin=(0, 0.56413, 0) * u.m, ) @@ -207,7 +207,7 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=(0, 1, 0), slice_origin={0, 0.56413} * u.m, ) @@ -217,11 +217,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=[0, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": v1.Slice( + "sliceName_2": modules.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -234,7 +234,7 @@ def test_slice_output(): to_file_from_file_test(output) output.output_format = "both" - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( slice_output=output, boundaries={}, @@ -251,7 +251,7 @@ def test_slice_output(): else: assert {"Cp", "qcriterion"} == set(slice_item["output_fields"]) - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( slice_output=SliceOutput( output_fields=[ @@ -261,11 +261,11 @@ def test_slice_output(): "solutionTurbulence", ], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=[5, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": v1.Slice( + "sliceName_2": modules.Slice( slice_normal=(0, 1, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -337,7 +337,7 @@ def test_volume_output(): output.output_format = "both" - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( volume_output=output, boundaries={}, @@ -347,7 +347,7 @@ def test_volume_output(): assert set(solver_params.volume_output.output_fields) == {"Cp", "qcriterion"} - with v1.SI_unit_system: + with modules.SI_unit_system: """ Test addition of betMetrics/betMetricsPerDisk from slice output field """ @@ -356,11 +356,11 @@ def test_volume_output(): slice_output=SliceOutput( output_fields=["betMetrics"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": modules.Slice( slice_normal=(0, 1, 0), slice_origin=(50, 0.56413, 0) * u.m, output_fields=["betMetricsPerDisk"], @@ -383,7 +383,7 @@ def test_volume_output(): } output.output_fields = ["qcriterion", "Cp", "solutionTurbulence", "kOmega"] - with v1.SI_unit_system: + with modules.SI_unit_system: """ Test removing duplicate output fields """ @@ -432,7 +432,7 @@ def test_iso_surface_output(): output.output_format = "both" - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( iso_surface_output=output, boundaries={}, @@ -451,7 +451,7 @@ def test_iso_surface_output(): else: assert {"Mach"} == set(iso_surface_item["output_fields"]) - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( iso_surface_output=IsoSurfaceOutput( output_fields=["Mach", "kOmega", "solutionTurbulence"], @@ -505,7 +505,7 @@ def test_monitor_output(): to_file_from_file_test(output) - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( monitor_output=output, boundaries={}, @@ -523,7 +523,7 @@ def test_monitor_output(): else: assert {"Cp", "qcriterion", "Mach"} == set(monitor_item["output_fields"]) - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( monitor_output=MonitorOutput( output_fields=["Cp", "solutionTurbulence", "kOmega"], @@ -548,7 +548,7 @@ def test_monitor_output(): def test_output_fields(): - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params( geometry=Geometry(mesh_unit=1), volume_output=VolumeOutput(output_fields=["Cp", "qcriterion", "my_var"]), @@ -556,7 +556,7 @@ def test_output_fields(): slice_output=SliceOutput( output_fields=["primitiveVars", "my_var", "mutRatio"], slices={ - "sliceName_1": v1.Slice( + "sliceName_1": modules.Slice( slice_normal=[5, 1, 0], slice_origin=(0, 1.56413, 0), output_fields=["Mach"] ), }, @@ -598,7 +598,7 @@ def test_output_fields(): with pytest.raises( pd.ValidationError, match=r"surface_output:, prmitiveVars is not valid output field name." ): - with v1.SI_unit_system: + with modules.SI_unit_system: Flow360Params( surface_output=SurfaceOutput(output_fields=["prmitiveVars", "my_var"]), boundaries={}, @@ -609,7 +609,7 @@ def test_output_fields(): with pytest.raises( pd.ValidationError, match=r"surface_output->wing:, my__var is not valid output field name." ): - with v1.SI_unit_system: + with modules.SI_unit_system: Flow360Params( surface_output=SurfaceOutput( output_fields=["primitiveVars", "my__var"], diff --git a/tests/v1/params/test_params_boundary.py b/tests/v1/params/test_params_boundary.py index 0eb87ce50..faf4eb7fc 100644 --- a/tests/v1/params/test_params_boundary.py +++ b/tests/v1/params/test_params_boundary.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.boundaries import ( FreestreamBoundary, HeatFluxWall, diff --git a/tests/v1/params/test_porous_media.py b/tests/v1/params/test_porous_media.py index d5fd557b6..71d3df5d2 100644 --- a/tests/v1/params/test_porous_media.py +++ b/tests/v1/params/test_porous_media.py @@ -2,8 +2,8 @@ import pytest -from flow360.component.v1 import SI_unit_system from flow360.component.v1.flow360_params import PorousMediumBox +from flow360.component.v1.modules import SI_unit_system from tests.utils import to_file_from_file_test assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_preconditioner.py b/tests/v1/params/test_preconditioner.py index 26f00bd6f..76d5594fb 100644 --- a/tests/v1/params/test_preconditioner.py +++ b/tests/v1/params/test_preconditioner.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import FreestreamFromVelocity diff --git a/tests/v1/params/test_reference_frame.py b/tests/v1/params/test_reference_frame.py index 87861a7f2..05b7a1776 100644 --- a/tests/v1/params/test_reference_frame.py +++ b/tests/v1/params/test_reference_frame.py @@ -3,7 +3,7 @@ import numpy as np import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_rotational_models.py b/tests/v1/params/test_rotational_models.py index 3df57b8a2..8cadcc149 100644 --- a/tests/v1/params/test_rotational_models.py +++ b/tests/v1/params/test_rotational_models.py @@ -3,7 +3,7 @@ import numpy as np import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import ( ActuatorDisk, BETDisk, diff --git a/tests/v1/params/test_solvers.py b/tests/v1/params/test_solvers.py index 8f30ab59b..91636aaec 100644 --- a/tests/v1/params/test_solvers.py +++ b/tests/v1/params/test_solvers.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import ( Flow360Params, HeatEquationSolver, diff --git a/tests/v1/params/test_time_stepping.py b/tests/v1/params/test_time_stepping.py index 60e493c34..a4c484ebd 100644 --- a/tests/v1/params/test_time_stepping.py +++ b/tests/v1/params/test_time_stepping.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( Flow360Params, diff --git a/tests/v1/params/test_user_defined_dynamics.py b/tests/v1/params/test_user_defined_dynamics.py index 6b201fde8..fc7c703a1 100644 --- a/tests/v1/params/test_user_defined_dynamics.py +++ b/tests/v1/params/test_user_defined_dynamics.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import UserDefinedDynamic from tests.utils import to_file_from_file_test diff --git a/tests/v1/params/test_validator_aeroacoustics.py b/tests/v1/params/test_validator_aeroacoustics.py index 845ec0abe..80f182d32 100644 --- a/tests/v1/params/test_validator_aeroacoustics.py +++ b/tests/v1/params/test_validator_aeroacoustics.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.boundaries import NoSlipWall, TranslationallyPeriodic from flow360.component.v1.flow360_output import AeroacousticOutput from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_bet_disks.py b/tests/v1/params/test_validator_bet_disks.py index b5643e9b7..d0e45737f 100644 --- a/tests/v1/params/test_validator_bet_disks.py +++ b/tests/v1/params/test_validator_bet_disks.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import ( BETDisk, BETDiskChord, diff --git a/tests/v1/params/test_validator_boundary.py b/tests/v1/params/test_validator_boundary.py index 4028b3a3d..555042105 100644 --- a/tests/v1/params/test_validator_boundary.py +++ b/tests/v1/params/test_validator_boundary.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.boundaries import NoSlipWall from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_cht_solver.py b/tests/v1/params/test_validator_cht_solver.py index f0b9c0994..40ece962f 100644 --- a/tests/v1/params/test_validator_cht_solver.py +++ b/tests/v1/params/test_validator_cht_solver.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.boundaries import SolidAdiabaticWall, SolidIsothermalWall from flow360.component.v1.flow360_output import ( diff --git a/tests/v1/params/test_validator_consistency_ddes_unsteady.py b/tests/v1/params/test_validator_consistency_ddes_unsteady.py index d268fcbb0..8725863ca 100644 --- a/tests/v1/params/test_validator_consistency_ddes_unsteady.py +++ b/tests/v1/params/test_validator_consistency_ddes_unsteady.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import Flow360Params, SteadyTimeStepping from flow360.component.v1.solvers import SpalartAllmaras diff --git a/tests/v1/params/test_validator_equation_eval_frequency.py b/tests/v1/params/test_validator_equation_eval_frequency.py index 06152ae89..94e80dfbe 100644 --- a/tests/v1/params/test_validator_equation_eval_frequency.py +++ b/tests/v1/params/test_validator_equation_eval_frequency.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import Flow360Params, SteadyTimeStepping from flow360.component.v1.solvers import SpalartAllmaras, TransitionModelSolver diff --git a/tests/v1/params/test_validator_output_consistency.py b/tests/v1/params/test_validator_output_consistency.py index 57ae0d666..1c404d4b0 100644 --- a/tests/v1/params/test_validator_output_consistency.py +++ b/tests/v1/params/test_validator_output_consistency.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.boundaries import FreestreamBoundary, NoSlipWall, WallFunction from flow360.component.v1.flow360_output import SurfaceOutput from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_periodic_mapping.py b/tests/v1/params/test_validator_periodic_mapping.py index 9efdd6472..21995dff4 100644 --- a/tests/v1/params/test_validator_periodic_mapping.py +++ b/tests/v1/params/test_validator_periodic_mapping.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.boundaries import ( NoSlipWall, RotationallyPeriodic, diff --git a/tests/v1/params/test_volume_zones.py b/tests/v1/params/test_volume_zones.py index ae6c5e129..06ad93dfc 100644 --- a/tests/v1/params/test_volume_zones.py +++ b/tests/v1/params/test_volume_zones.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import VolumeZones from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, diff --git a/tests/v1/test_case.py b/tests/v1/test_case.py index 4b775a6a0..28c529933 100644 --- a/tests/v1/test_case.py +++ b/tests/v1/test_case.py @@ -1,6 +1,6 @@ import pytest -from flow360.component.v1 import ( +from flow360.component.v1.modules import ( Case, Flow360Params, FreestreamFromVelocity, diff --git a/tests/v1/test_case_webapi.py b/tests/v1/test_case_webapi.py index 9e633f4f8..6542750ff 100644 --- a/tests/v1/test_case_webapi.py +++ b/tests/v1/test_case_webapi.py @@ -1,6 +1,6 @@ import pytest -from flow360.component.v1 import Case +from flow360.component.v1.modules import Case from flow360.exceptions import Flow360RuntimeError from flow360.log import Logger, log diff --git a/tests/v1/test_dev_flow360_params.py b/tests/v1/test_dev_flow360_params.py index 318212f8c..f96bde1d0 100644 --- a/tests/v1/test_dev_flow360_params.py +++ b/tests/v1/test_dev_flow360_params.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from ..utils import compare_to_ref, to_file_from_file_test diff --git a/tests/v1/test_flow360_params.py b/tests/v1/test_flow360_params.py index d32535df8..97a12be90 100644 --- a/tests/v1/test_flow360_params.py +++ b/tests/v1/test_flow360_params.py @@ -5,7 +5,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( Flow360MeshParams, diff --git a/tests/v1/test_folders.py b/tests/v1/test_folders.py index 08dea5218..8137f5773 100644 --- a/tests/v1/test_folders.py +++ b/tests/v1/test_folders.py @@ -1,4 +1,4 @@ -from flow360.component.v1 import Case, Folder +from flow360.component.v1.modules import Case, Folder from flow360.log import set_logging_level set_logging_level("DEBUG") diff --git a/tests/v1/test_handle_version_and_unit_system.py b/tests/v1/test_handle_version_and_unit_system.py index 92b7d3401..d5fd1791f 100644 --- a/tests/v1/test_handle_version_and_unit_system.py +++ b/tests/v1/test_handle_version_and_unit_system.py @@ -4,9 +4,9 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as v1 +import flow360.component.v1.modules as modules import flow360.component.v1.units as u -from flow360.component.v1 import Flow360Params +from flow360.component.v1.modules import Flow360Params from flow360.exceptions import Flow360NotImplementedError, Flow360RuntimeError params_old_version = { @@ -106,7 +106,7 @@ def test_import_no_unit_system_with_context(): json.dump(params_no_unit_system, temp_file) with pytest.raises(Flow360RuntimeError): - with v1.flow360_unit_system: + with modules.flow360_unit_system: Flow360Params(temp_file.name) @@ -116,7 +116,7 @@ def test_import_with_unit_system_no_context(): params = Flow360Params(temp_file.name) assert params - assert params.unit_system == v1.SI_unit_system + assert params.unit_system == modules.SI_unit_system def test_import_with_unit_system_with_context(): @@ -124,7 +124,7 @@ def test_import_with_unit_system_with_context(): json.dump(params_current_version, temp_file) with pytest.raises(Flow360RuntimeError): - with v1.SI_unit_system: + with modules.SI_unit_system: Flow360Params(temp_file.name) @@ -150,30 +150,30 @@ def test_copy_with_unit_system_with_context(): assert params # passes, the models are consistent - with v1.SI_unit_system: + with modules.SI_unit_system: params_copy = params.copy() assert params_copy # fails, the models are inconsistent - with v1.CGS_unit_system: + with modules.CGS_unit_system: with pytest.raises(Flow360RuntimeError): params_copy = params.copy() def test_create_no_unit_system_no_context(): with pytest.raises(Flow360RuntimeError): - v1.Flow360Params( - geometry=v1.Geometry( + modules.Flow360Params( + geometry=modules.Geometry( ref_area=1 * u.m**2, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), - fluid_properties=v1.air, - freestream=v1.FreestreamFromVelocity(velocity=286 * u.m / u.s), - time_stepping=v1.UnsteadyTimeStepping( + fluid_properties=modules.air, + freestream=modules.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=modules.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=modules.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), @@ -182,40 +182,40 @@ def test_create_no_unit_system_no_context(): def test_create_with_unit_system_no_context(): with pytest.raises(Flow360RuntimeError): - v1.Flow360Params( - geometry=v1.Geometry( + modules.Flow360Params( + geometry=modules.Geometry( ref_area=1 * u.m**2, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), - fluid_properties=v1.air, - freestream=v1.FreestreamFromVelocity(velocity=286 * u.m / u.s), - time_stepping=v1.UnsteadyTimeStepping( + fluid_properties=modules.air, + freestream=modules.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=modules.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=modules.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=modules.SI_unit_system, ) def test_create_no_unit_system_with_context(): - with v1.SI_unit_system: - v1.Flow360Params( - geometry=v1.Geometry( + with modules.SI_unit_system: + modules.Flow360Params( + geometry=modules.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=v1.air, - freestream=v1.FreestreamFromVelocity(velocity=286), - time_stepping=v1.UnsteadyTimeStepping( + fluid_properties=modules.air, + freestream=modules.FreestreamFromVelocity(velocity=286), + time_stepping=modules.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=modules.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), @@ -223,50 +223,50 @@ def test_create_no_unit_system_with_context(): def test_create_with_unit_system_with_context(): - with v1.SI_unit_system: - v1.Flow360Params( - geometry=v1.Geometry( + with modules.SI_unit_system: + modules.Flow360Params( + geometry=modules.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=v1.air, - freestream=v1.FreestreamFromVelocity(velocity=286), - time_stepping=v1.UnsteadyTimeStepping( + fluid_properties=modules.air, + freestream=modules.FreestreamFromVelocity(velocity=286), + time_stepping=modules.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=modules.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=modules.SI_unit_system, ) with pytest.raises(Flow360RuntimeError): - with v1.CGS_unit_system: - v1.Flow360Params( - geometry=v1.Geometry( + with modules.CGS_unit_system: + modules.Flow360Params( + geometry=modules.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=v1.air, - freestream=v1.FreestreamFromVelocity(velocity=286), - time_stepping=v1.UnsteadyTimeStepping( + fluid_properties=modules.air, + freestream=modules.FreestreamFromVelocity(velocity=286), + time_stepping=modules.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=modules.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=modules.SI_unit_system, ) def test_change_version(): - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params(**params_no_hash) with pytest.raises(ValueError): params.version = "changed" @@ -277,7 +277,7 @@ def test_parse_with_version(): json.dump(params_no_hash, temp_file) params = Flow360Params(temp_file.name) - assert params.version == v1.__version__ + assert params.version == modules.__version__ def test_parse_no_version(): @@ -298,12 +298,12 @@ def test_parse_wrong_version(): def test_parse_with_hash(): with pytest.raises(pd.ValidationError): - with v1.SI_unit_system: + with modules.SI_unit_system: Flow360Params(**params_current_version) def test_parse_no_hash(): - with v1.SI_unit_system: + with modules.SI_unit_system: params = Flow360Params(**params_no_hash) assert params_no_hash.get("hash") is None assert not hasattr(params, "hash") @@ -311,5 +311,5 @@ def test_parse_no_hash(): def test_parse_wrong_hash(): with pytest.raises(pd.ValidationError): - with v1.SI_unit_system: + with modules.SI_unit_system: Flow360Params(**params_wrong_hash) diff --git a/tests/v1/test_schema_generator.py b/tests/v1/test_schema_generator.py index cbee1a825..33c5253e9 100644 --- a/tests/v1/test_schema_generator.py +++ b/tests/v1/test_schema_generator.py @@ -1,6 +1,6 @@ import json -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl def test_schema_generators(): diff --git a/tests/v1/test_services_v1.py b/tests/v1/test_services_v1.py index 38e28cf00..d387b0346 100644 --- a/tests/v1/test_services_v1.py +++ b/tests/v1/test_services_v1.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import services diff --git a/tests/v1/test_unit_system_v1.py b/tests/v1/test_unit_system_v1.py index 10b45c987..c9517cf4c 100644 --- a/tests/v1/test_unit_system_v1.py +++ b/tests/v1/test_unit_system_v1.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1 import units as u from flow360.component.v1.params_base import Flow360BaseModel from flow360.component.v1.unit_system import ( diff --git a/tests/v1/test_updater.py b/tests/v1/test_updater.py index 1d781b9f2..c5610361e 100644 --- a/tests/v1/test_updater.py +++ b/tests/v1/test_updater.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_legacy import LinearSolverLegacy from flow360.component.v1.initial_condition import ExpressionInitialCondition from flow360.component.v1.updater import UPDATE_MAP, _find_update_path, _no_update diff --git a/tests/v1/test_validator_valid_output_fields.py b/tests/v1/test_validator_valid_output_fields.py index 4c061874d..952107fd1 100644 --- a/tests/v1/test_validator_valid_output_fields.py +++ b/tests/v1/test_validator_valid_output_fields.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl import flow360.component.v1.units as u from flow360.component.v1.boundaries import FreestreamBoundary, NoSlipWall from flow360.component.v1.flow360_output import ( diff --git a/tests/v1/test_volume_mesh.py b/tests/v1/test_volume_mesh.py index 274a80a95..f3babc1be 100644 --- a/tests/v1/test_volume_mesh.py +++ b/tests/v1/test_volume_mesh.py @@ -1,6 +1,6 @@ import pytest -import flow360.component.v1 as v1 +import flow360.component.v1.modules as modules from flow360.component.utils import CompressionFormat, MeshFileFormat, UGRIDEndianness from flow360.component.v1.boundaries import NoSlipWall from flow360.component.v1.flow360_params import ( @@ -47,7 +47,7 @@ def test_get_no_slip_walls(): assert walls assert len(walls) == 3 - with v1.SI_unit_system: + with modules.SI_unit_system: param = Flow360Params( boundaries={ "fluid/fuselage": NoSlipWall(), @@ -66,7 +66,7 @@ def test_get_no_slip_walls(): def test_validate_cgns(): - with v1.SI_unit_system: + with modules.SI_unit_system: param = Flow360Params( boundaries={ "fluid/fuselage": NoSlipWall(), diff --git a/tools/integrations/schema_generation.py b/tools/integrations/schema_generation.py index 75cb2c11b..03540a84c 100644 --- a/tools/integrations/schema_generation.py +++ b/tools/integrations/schema_generation.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.flow360_params import ( BETDiskChord, BETDiskSectionalPolar, diff --git a/tools/integrations/tests/_test_webui_workbench_integration.py b/tools/integrations/tests/_test_webui_workbench_integration.py index 8cc51c036..2f6e0ecd6 100644 --- a/tools/integrations/tests/_test_webui_workbench_integration.py +++ b/tools/integrations/tests/_test_webui_workbench_integration.py @@ -1,7 +1,7 @@ import json import os -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.simulation.meshing_param.face_params import ( BoundaryLayer, SurfaceRefinement, diff --git a/tools/integrations/unit_defaults.py b/tools/integrations/unit_defaults.py index 8e58f28f7..3d2dd1f98 100644 --- a/tools/integrations/unit_defaults.py +++ b/tools/integrations/unit_defaults.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd -import flow360.component.v1 as fl +import flow360.component.v1.modules as fl from flow360.component.v1.params_base import Flow360BaseModel From cbc63edcec7d383c2fb60b178ece8c1ff4b07c0c Mon Sep 17 00:00:00 2001 From: BenYuan Date: Fri, 1 Nov 2024 16:16:45 +0000 Subject: [PATCH 2/4] Fixed unit system conflict by renaming it --- flow360/component/simulation/conversion.py | 2 +- .../simulation/framework/base_model.py | 6 ++-- flow360/component/simulation/unit_system.py | 2 +- flow360/component/v1/conversions.py | 2 +- flow360/component/v1/modules.py | 32 ++++++++++--------- flow360/component/v1/params_base.py | 2 +- flow360/component/v1/unit_system.py | 2 +- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/flow360/component/simulation/conversion.py b/flow360/component/simulation/conversion.py index 79318a05c..448424843 100644 --- a/flow360/component/simulation/conversion.py +++ b/flow360/component/simulation/conversion.py @@ -118,7 +118,7 @@ def unit_converter(dimension, mesh_unit: u.unyt_quantity, params, required_by: L ------- flow360_conversion_unit_system The conversion unit system for the specified dimension. This unit system allows for - .in_base(unit_system="flow360") conversion. + .in_base(unit_system="flow360_v2") conversion. Raises ------ diff --git a/flow360/component/simulation/framework/base_model.py b/flow360/component/simulation/framework/base_model.py index b3f84bf35..f869fe6ef 100644 --- a/flow360/component/simulation/framework/base_model.py +++ b/flow360/component/simulation/framework/base_model.py @@ -676,7 +676,7 @@ def _convert_dimensions_to_solver( ) # pylint: disable=no-member value.units.registry = flow360_conv_system.registry - solver_values[property_name] = value.in_base(unit_system="flow360") + solver_values[property_name] = value.in_base(unit_system="flow360_v2") log.debug(f" converted to: {solver_values[property_name]}") elif isinstance(value, list) and property_name not in exclude: new_value = [] @@ -690,7 +690,7 @@ def _convert_dimensions_to_solver( ) # pylint: disable=no-member item.units.registry = flow360_conv_system.registry - new_value.append(item.in_base(unit_system="flow360")) + new_value.append(item.in_base(unit_system="flow360_v2")) else: new_value.append(item) solver_values[property_name] = new_value @@ -759,6 +759,6 @@ def preprocess( exclude=exclude, ) elif isinstance(item, unyt_quantity): - solver_values[property_name][i] = item.in_base(unit_system="flow360") + solver_values[property_name][i] = item.in_base(unit_system="flow360_v2") return self.__class__(**solver_values) diff --git a/flow360/component/simulation/unit_system.py b/flow360/component/simulation/unit_system.py index e18d85b63..3c8fd0ff4 100644 --- a/flow360/component/simulation/unit_system.py +++ b/flow360/component/simulation/unit_system.py @@ -1512,7 +1512,7 @@ def __init__(self): ) conversion_system = u.UnitSystem( - "flow360", + "flow360_v2", "flow360_length_unit", "flow360_mass_unit", "flow360_time_unit", diff --git a/flow360/component/v1/conversions.py b/flow360/component/v1/conversions.py index 020bb0fc6..756d6f321 100644 --- a/flow360/component/v1/conversions.py +++ b/flow360/component/v1/conversions.py @@ -134,7 +134,7 @@ def unit_converter(dimension, params, required_by: List[str] = None): ------- flow360_conversion_unit_system The conversion unit system for the specified dimension. This unit system allows for - .in_base(unit_system="flow360") conversion. + .in_base(unit_system="flow360_v1") conversion. Raises ------ diff --git a/flow360/component/v1/modules.py b/flow360/component/v1/modules.py index 0085450e2..8b862d641 100644 --- a/flow360/component/v1/modules.py +++ b/flow360/component/v1/modules.py @@ -6,29 +6,15 @@ from numpy import pi -from flow360.component.v1.unit_system import ( - CGS_unit_system, - SI_unit_system, - UnitSystem, - flow360_unit_system, - imperial_unit_system, -) - from flow360 import global_exception_handler from flow360.accounts_utils import Accounts from flow360.cli import flow360 from flow360.cloud.s3_utils import ProgressCallbackInterface -from flow360.environment import Env -from flow360.flags import Flags -from flow360.user_config import UserConfig -from flow360.version import __solver_version__, __version__ from flow360.component.case import Case from flow360.component.case import CaseList as MyCases from flow360.component.folder import Folder from flow360.component.surface_mesh import SurfaceMesh from flow360.component.surface_mesh import SurfaceMeshList as MySurfaceMeshes -from flow360.component.volume_mesh import VolumeMesh -from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes from flow360.component.v1 import meshing, solvers, units from flow360.component.v1.boundaries import ( FreestreamBoundary, @@ -96,7 +82,10 @@ ZeroFreestreamFromVelocity, air, ) -from flow360.component.v1.initial_condition import ExpressionInitialCondition, ModifiedRestartSolution +from flow360.component.v1.initial_condition import ( + ExpressionInitialCondition, + ModifiedRestartSolution, +) from flow360.component.v1.meshing.params import ( Aniso, BoxRefinement, @@ -131,6 +120,13 @@ UnsteadyTimeStepping, ) from flow360.component.v1.turbulence_quantities import TurbulenceQuantities +from flow360.component.v1.unit_system import ( + CGS_unit_system, + SI_unit_system, + UnitSystem, + flow360_unit_system, + imperial_unit_system, +) from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, HeatTransferVolumeZone, @@ -142,6 +138,12 @@ ReferenceFrameOmegaDegrees, ReferenceFrameOmegaRadians, ) +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes +from flow360.environment import Env +from flow360.flags import Flags +from flow360.user_config import UserConfig +from flow360.version import __solver_version__, __version__ __all__ = [ "Accounts", diff --git a/flow360/component/v1/params_base.py b/flow360/component/v1/params_base.py index d4fec067f..0502c07b9 100644 --- a/flow360/component/v1/params_base.py +++ b/flow360/component/v1/params_base.py @@ -709,7 +709,7 @@ def _convert_dimensions_to_solver( ) # pylint: disable=no-member value.units.registry = flow360_conv_system.registry - solver_values[property_name] = value.in_base(unit_system="flow360") + solver_values[property_name] = value.in_base(unit_system="flow360_v1") log.debug(f" converted to: {solver_values[property_name]}") else: solver_values[property_name] = value diff --git a/flow360/component/v1/unit_system.py b/flow360/component/v1/unit_system.py index be9116f1e..e70e4a675 100644 --- a/flow360/component/v1/unit_system.py +++ b/flow360/component/v1/unit_system.py @@ -1224,7 +1224,7 @@ def __init__(self): ) conversion_system = u.UnitSystem( - "flow360", + "flow360_v1", "flow360_length_unit", "flow360_mass_unit", "flow360_time_unit", From 72c3e678d3997008d52f6421eed308c1f17c4ad3 Mon Sep 17 00:00:00 2001 From: BenYuan Date: Fri, 1 Nov 2024 16:23:57 +0000 Subject: [PATCH 3/4] Moved modules.py to v1.py --- examples/case_from_multiple_files/main.py | 2 +- examples/case_from_yaml.py | 2 +- examples/case_params_with_units.py | 2 +- examples/change_account_and_submit.py | 2 +- examples/dev/dev_run_case_from_files.py | 2 +- .../dev_run_case_from_files_no_validation.py | 2 +- examples/dev/dev_use_unit_system.py | 4 +- examples/dev/list_cases_all_params.py | 2 +- examples/display_mesh_info.py | 2 +- examples/list_cases.py | 2 +- .../new_workbench_project_from_geometry.py | 2 +- .../new_workbench_project_from_volume_mesh.py | 2 +- examples/project_from_file_geometry.py | 2 +- ...roject_from_file_geometry_multiple_runs.py | 2 +- examples/project_from_file_volume_mesh.py | 2 +- examples/retrieve_results/actuator_disk.py | 2 +- examples/retrieve_results/alpha_sweep.py | 2 +- examples/retrieve_results/bet_disk.py | 2 +- examples/retrieve_results/convergence.py | 2 +- examples/retrieve_results/forces.py | 2 +- examples/retrieve_results/monitors.py | 2 +- .../retrieve_results/user_defined_dynamics.py | 2 +- .../volumetric_and_surface.py | 2 +- examples/run_case_from_example_mesh.py | 2 +- examples/run_case_from_files.py | 2 +- examples/run_case_from_inputs.py | 2 +- examples/run_case_no_submit_warning.py | 2 +- examples/run_case_unsteady_from_files.py | 2 +- examples/run_case_with_fork.py | 2 +- examples/run_case_with_retry.py | 2 +- examples/show_storage.py | 2 +- examples/submit_case_to_folder.py | 2 +- examples/surface_mesh_airplane_from_files.py | 2 +- examples/surface_mesh_airplane_from_inputs.py | 2 +- examples/surface_mesh_list.py | 2 +- .../volume_mesh_from_surface_mesh_files.py | 2 +- .../volume_mesh_from_surface_mesh_inputs.py | 2 +- flow360/{component/v1/modules.py => v1.py} | 0 tests/test_current_flow360_version.py | 2 +- tests/test_environment.py | 2 +- tests/test_results.py | 2 +- tests/test_shared_accounts.py | 2 +- tests/test_utils.py | 2 +- tests/v1/_test_case.py | 2 +- tests/v1/_test_case_submit_solver_version.py | 2 +- tests/v1/_test_validate.py | 2 +- tests/v1/params/test_freestream.py | 2 +- tests/v1/params/test_initial_condition.py | 2 +- tests/v1/params/test_outputs.py | 68 ++++++------- tests/v1/params/test_params_boundary.py | 2 +- tests/v1/params/test_porous_media.py | 2 +- tests/v1/params/test_preconditioner.py | 2 +- tests/v1/params/test_reference_frame.py | 2 +- tests/v1/params/test_rotational_models.py | 2 +- tests/v1/params/test_solvers.py | 2 +- tests/v1/params/test_time_stepping.py | 2 +- tests/v1/params/test_user_defined_dynamics.py | 2 +- .../v1/params/test_validator_aeroacoustics.py | 2 +- tests/v1/params/test_validator_bet_disks.py | 2 +- tests/v1/params/test_validator_boundary.py | 2 +- tests/v1/params/test_validator_cht_solver.py | 2 +- ...est_validator_consistency_ddes_unsteady.py | 2 +- .../test_validator_equation_eval_frequency.py | 2 +- .../test_validator_output_consistency.py | 2 +- .../params/test_validator_periodic_mapping.py | 2 +- tests/v1/params/test_volume_zones.py | 2 +- tests/v1/test_case.py | 6 +- tests/v1/test_case_webapi.py | 2 +- tests/v1/test_dev_flow360_params.py | 2 +- tests/v1/test_flow360_params.py | 2 +- tests/v1/test_folders.py | 2 +- .../v1/test_handle_version_and_unit_system.py | 96 +++++++++---------- tests/v1/test_schema_generator.py | 2 +- tests/v1/test_services_v1.py | 2 +- tests/v1/test_unit_system_v1.py | 2 +- tests/v1/test_updater.py | 2 +- .../v1/test_validator_valid_output_fields.py | 2 +- tests/v1/test_volume_mesh.py | 6 +- tools/integrations/schema_generation.py | 2 +- .../_test_webui_workbench_integration.py | 2 +- tools/integrations/unit_defaults.py | 2 +- 81 files changed, 165 insertions(+), 165 deletions(-) rename flow360/{component/v1/modules.py => v1.py} (100%) diff --git a/examples/case_from_multiple_files/main.py b/examples/case_from_multiple_files/main.py index 886ad9f72..d5bd6bf79 100644 --- a/examples/case_from_multiple_files/main.py +++ b/examples/case_from_multiple_files/main.py @@ -1,7 +1,7 @@ import os -import flow360.component.v1.modules as fl import flow360.component.v1.units as u +import flow360.v1 as fl from flow360.examples import OM6wing here = os.path.dirname(os.path.abspath(__file__)) diff --git a/examples/case_from_yaml.py b/examples/case_from_yaml.py index c15b17c4b..e2931473e 100644 --- a/examples/case_from_yaml.py +++ b/examples/case_from_yaml.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/case_params_with_units.py b/examples/case_params_with_units.py index 5988e0c8b..29ace249e 100644 --- a/examples/case_params_with_units.py +++ b/examples/case_params_with_units.py @@ -1,7 +1,7 @@ import json from pprint import pprint -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360 import log from flow360.component.v1 import units as u from flow360.component.v1.services import validate_model diff --git a/examples/change_account_and_submit.py b/examples/change_account_and_submit.py index 5aefe6def..319b4312b 100644 --- a/examples/change_account_and_submit.py +++ b/examples/change_account_and_submit.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing fl.Env.dev.active() diff --git a/examples/dev/dev_run_case_from_files.py b/examples/dev/dev_run_case_from_files.py index fd1eaea71..6cda2fdc4 100644 --- a/examples/dev/dev_run_case_from_files.py +++ b/examples/dev/dev_run_case_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing fl.Env.dev.active() diff --git a/examples/dev/dev_run_case_from_files_no_validation.py b/examples/dev/dev_run_case_from_files_no_validation.py index c6dbf1592..fda7ae454 100644 --- a/examples/dev/dev_run_case_from_files_no_validation.py +++ b/examples/dev/dev_run_case_from_files_no_validation.py @@ -1,6 +1,6 @@ import os -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing fl.UserConfig.disable_validation() diff --git a/examples/dev/dev_use_unit_system.py b/examples/dev/dev_use_unit_system.py index 78210ef1e..9e748129c 100644 --- a/examples/dev/dev_use_unit_system.py +++ b/examples/dev/dev_use_unit_system.py @@ -6,9 +6,8 @@ import pydantic.v1 as pd import unyt -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u -from flow360.component.v1.modules import Geometry from flow360.component.v1.unit_system import ( AngularVelocityType, AreaType, @@ -23,6 +22,7 @@ VelocityType, ViscosityType, ) +from flow360.v1 import Geometry class DataWithUnits(pd.BaseModel): diff --git a/examples/dev/list_cases_all_params.py b/examples/dev/list_cases_all_params.py index 64e32e138..67635dd81 100644 --- a/examples/dev/list_cases_all_params.py +++ b/examples/dev/list_cases_all_params.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.exceptions import Flow360ValidationError for case in fl.MyCases(limit=10000): diff --git a/examples/display_mesh_info.py b/examples/display_mesh_info.py index 24cd263d3..ba12291ea 100644 --- a/examples/display_mesh_info.py +++ b/examples/display_mesh_info.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl meshes = fl.MyVolumeMeshes() mesh = meshes[0] diff --git a/examples/list_cases.py b/examples/list_cases.py index 01201dff5..cc5660487 100644 --- a/examples/list_cases.py +++ b/examples/list_cases.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl # get all cases: my_cases = fl.MyCases() diff --git a/examples/new_workbench_project_from_geometry.py b/examples/new_workbench_project_from_geometry.py index 6d41c1c87..c638b4dc0 100644 --- a/examples/new_workbench_project_from_geometry.py +++ b/examples/new_workbench_project_from_geometry.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.geometry import Geometry from flow360.examples import Airplane diff --git a/examples/new_workbench_project_from_volume_mesh.py b/examples/new_workbench_project_from_volume_mesh.py index 411b472bf..c4b7a8604 100644 --- a/examples/new_workbench_project_from_volume_mesh.py +++ b/examples/new_workbench_project_from_volume_mesh.py @@ -1,7 +1,7 @@ import time import flow360.component.simulation.units as u -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.simulation.cloud import run_case from flow360.component.simulation.models.surface_models import ( Freestream, diff --git a/examples/project_from_file_geometry.py b/examples/project_from_file_geometry.py index 9e0d8aa10..2272e8955 100644 --- a/examples/project_from_file_geometry.py +++ b/examples/project_from_file_geometry.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.project import Project from flow360.component.simulation.meshing_param.params import ( MeshingDefaults, diff --git a/examples/project_from_file_geometry_multiple_runs.py b/examples/project_from_file_geometry_multiple_runs.py index 90f05282a..bec713e1d 100644 --- a/examples/project_from_file_geometry_multiple_runs.py +++ b/examples/project_from_file_geometry_multiple_runs.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.project import Project from flow360.component.simulation.meshing_param.params import ( MeshingDefaults, diff --git a/examples/project_from_file_volume_mesh.py b/examples/project_from_file_volume_mesh.py index d8d348f1f..b1afe07af 100644 --- a/examples/project_from_file_volume_mesh.py +++ b/examples/project_from_file_volume_mesh.py @@ -1,7 +1,7 @@ from matplotlib.pyplot import show import flow360.component.simulation.units as u -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.project import Project from flow360.component.simulation.models.surface_models import ( Freestream, diff --git a/examples/retrieve_results/actuator_disk.py b/examples/retrieve_results/actuator_disk.py index 7852c0344..7ccf1393e 100644 --- a/examples/retrieve_results/actuator_disk.py +++ b/examples/retrieve_results/actuator_disk.py @@ -1,7 +1,7 @@ import os -import flow360.component.v1.modules as fl import flow360.units as u +import flow360.v1 as fl from flow360.examples import ActuatorDisk ActuatorDisk.get_files() diff --git a/examples/retrieve_results/alpha_sweep.py b/examples/retrieve_results/alpha_sweep.py index 257566069..20e79ae9f 100644 --- a/examples/retrieve_results/alpha_sweep.py +++ b/examples/retrieve_results/alpha_sweep.py @@ -3,7 +3,7 @@ from pylab import plot, show, xlabel, ylabel -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/retrieve_results/bet_disk.py b/examples/retrieve_results/bet_disk.py index 0f0dfd45f..e89c343d4 100644 --- a/examples/retrieve_results/bet_disk.py +++ b/examples/retrieve_results/bet_disk.py @@ -1,7 +1,7 @@ import os -import flow360.component.v1.modules as fl import flow360.component.v1.units as u +import flow360.v1 as fl from flow360.examples import BETDisk BETDisk.get_files() diff --git a/examples/retrieve_results/convergence.py b/examples/retrieve_results/convergence.py index ef31acd90..302a22b00 100644 --- a/examples/retrieve_results/convergence.py +++ b/examples/retrieve_results/convergence.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Convergence Convergence.get_files() diff --git a/examples/retrieve_results/forces.py b/examples/retrieve_results/forces.py index 209ed71e1..b6abcb5a2 100644 --- a/examples/retrieve_results/forces.py +++ b/examples/retrieve_results/forces.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/retrieve_results/monitors.py b/examples/retrieve_results/monitors.py index 9413c2f03..e12228e78 100644 --- a/examples/retrieve_results/monitors.py +++ b/examples/retrieve_results/monitors.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import MonitorsAndSlices MonitorsAndSlices.get_files() diff --git a/examples/retrieve_results/user_defined_dynamics.py b/examples/retrieve_results/user_defined_dynamics.py index b66eeae65..08228abdd 100644 --- a/examples/retrieve_results/user_defined_dynamics.py +++ b/examples/retrieve_results/user_defined_dynamics.py @@ -1,6 +1,6 @@ from pylab import show -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wingUserDefinedDynamics OM6wingUserDefinedDynamics.get_files() diff --git a/examples/retrieve_results/volumetric_and_surface.py b/examples/retrieve_results/volumetric_and_surface.py index 4d0343312..f9eeec7c6 100644 --- a/examples/retrieve_results/volumetric_and_surface.py +++ b/examples/retrieve_results/volumetric_and_surface.py @@ -2,7 +2,7 @@ import tarfile import tempfile -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import MonitorsAndSlices MonitorsAndSlices.get_files() diff --git a/examples/run_case_from_example_mesh.py b/examples/run_case_from_example_mesh.py index d2333bf88..c7174d94d 100644 --- a/examples/run_case_from_example_mesh.py +++ b/examples/run_case_from_example_mesh.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing vm = fl.VolumeMesh.copy_from_example("2ad77a88-1676-4f89-8652-13bd7e34f257") diff --git a/examples/run_case_from_files.py b/examples/run_case_from_files.py index f19cf310f..fafdc747b 100644 --- a/examples/run_case_from_files.py +++ b/examples/run_case_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_from_inputs.py b/examples/run_case_from_inputs.py index 9f9cf31be..5455827b6 100644 --- a/examples/run_case_from_inputs.py +++ b/examples/run_case_from_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_no_submit_warning.py b/examples/run_case_no_submit_warning.py index 288364682..6b140a69a 100644 --- a/examples/run_case_no_submit_warning.py +++ b/examples/run_case_no_submit_warning.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_unsteady_from_files.py b/examples/run_case_unsteady_from_files.py index a8d409faa..8a14bc65b 100644 --- a/examples/run_case_unsteady_from_files.py +++ b/examples/run_case_unsteady_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Cylinder2D Cylinder2D.get_files() diff --git a/examples/run_case_with_fork.py b/examples/run_case_with_fork.py index 04ce57a18..299c5072f 100644 --- a/examples/run_case_with_fork.py +++ b/examples/run_case_with_fork.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/run_case_with_retry.py b/examples/run_case_with_retry.py index 034bdf102..66d8053e7 100644 --- a/examples/run_case_with_retry.py +++ b/examples/run_case_with_retry.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/show_storage.py b/examples/show_storage.py index b2b894863..98036432a 100644 --- a/examples/show_storage.py +++ b/examples/show_storage.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl fl.Env.preprod.active() diff --git a/examples/submit_case_to_folder.py b/examples/submit_case_to_folder.py index bcae24217..eccf3c727 100644 --- a/examples/submit_case_to_folder.py +++ b/examples/submit_case_to_folder.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing # create folder in ROOT level diff --git a/examples/surface_mesh_airplane_from_files.py b/examples/surface_mesh_airplane_from_files.py index 4d5a8fb4f..2fc538a53 100644 --- a/examples/surface_mesh_airplane_from_files.py +++ b/examples/surface_mesh_airplane_from_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams(Airplane.surface_json) diff --git a/examples/surface_mesh_airplane_from_inputs.py b/examples/surface_mesh_airplane_from_inputs.py index c9ee58d94..fe1d20f29 100644 --- a/examples/surface_mesh_airplane_from_inputs.py +++ b/examples/surface_mesh_airplane_from_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams( diff --git a/examples/surface_mesh_list.py b/examples/surface_mesh_list.py index 63d013b3f..5e816001d 100644 --- a/examples/surface_mesh_list.py +++ b/examples/surface_mesh_list.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl my_meshes = fl.MySurfaceMeshes() diff --git a/examples/volume_mesh_from_surface_mesh_files.py b/examples/volume_mesh_from_surface_mesh_files.py index a295ba5ec..44e931dd3 100644 --- a/examples/volume_mesh_from_surface_mesh_files.py +++ b/examples/volume_mesh_from_surface_mesh_files.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams(Airplane.surface_json) diff --git a/examples/volume_mesh_from_surface_mesh_inputs.py b/examples/volume_mesh_from_surface_mesh_inputs.py index be268e6f0..19427bef6 100644 --- a/examples/volume_mesh_from_surface_mesh_inputs.py +++ b/examples/volume_mesh_from_surface_mesh_inputs.py @@ -1,4 +1,4 @@ -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams( diff --git a/flow360/component/v1/modules.py b/flow360/v1.py similarity index 100% rename from flow360/component/v1/modules.py rename to flow360/v1.py diff --git a/tests/test_current_flow360_version.py b/tests/test_current_flow360_version.py index e6a9999ca..b18435254 100644 --- a/tests/test_current_flow360_version.py +++ b/tests/test_current_flow360_version.py @@ -1,4 +1,4 @@ -from flow360.component.v1.modules import __version__ +from flow360.v1 import __version__ def test_version(): diff --git a/tests/test_environment.py b/tests/test_environment.py index fe77a3b38..fca0be431 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -1,4 +1,4 @@ -from flow360.component.v1.modules import Env +from flow360.v1 import Env def test_version(): diff --git a/tests/test_results.py b/tests/test_results.py index c654a612f..a2a22c243 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -6,8 +6,8 @@ import pandas import pytest -import flow360.component.v1.modules as fl import flow360.component.v1.units as u1 +import flow360.v1 as fl from flow360 import log from flow360.component.simulation import units as u2 from flow360.component.simulation.operating_condition.operating_condition import ( diff --git a/tests/test_shared_accounts.py b/tests/test_shared_accounts.py index df9624dbe..d6e937e74 100644 --- a/tests/test_shared_accounts.py +++ b/tests/test_shared_accounts.py @@ -2,7 +2,7 @@ import pytest -from flow360.component.v1.modules import Accounts, Env +from flow360.v1 import Accounts, Env def test_shared_account(mock_response, monkeypatch): diff --git a/tests/test_utils.py b/tests/test_utils.py index 138be9c37..06cdd9de8 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -12,9 +12,9 @@ shared_account_confirm_proceed, validate_type, ) -from flow360.component.v1.modules import Accounts from flow360.component.volume_mesh import VolumeMeshMeta from flow360.exceptions import Flow360TypeError, Flow360ValueError +from flow360.v1 import Accounts def test_validate_type(): diff --git a/tests/v1/_test_case.py b/tests/v1/_test_case.py index 350026501..7319d80a9 100644 --- a/tests/v1/_test_case.py +++ b/tests/v1/_test_case.py @@ -1,6 +1,6 @@ from flow360.component.case import Case from flow360.component.v1.flow360_params import Flow360Params, UnsteadyTimeStepping -from flow360.component.v1.modules import Env +from flow360.v1 import Env def test_from_cloud(): diff --git a/tests/v1/_test_case_submit_solver_version.py b/tests/v1/_test_case_submit_solver_version.py index 2277460d5..9094fd1c7 100644 --- a/tests/v1/_test_case_submit_solver_version.py +++ b/tests/v1/_test_case_submit_solver_version.py @@ -1,6 +1,6 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.examples import OM6wing from flow360.exceptions import Flow360RuntimeError, Flow360ValidationError from flow360.log import set_logging_level diff --git a/tests/v1/_test_validate.py b/tests/v1/_test_validate.py index e8043cf5d..bb9503b14 100644 --- a/tests/v1/_test_validate.py +++ b/tests/v1/_test_validate.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.validator import Validator assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_freestream.py b/tests/v1/params/test_freestream.py index 6e829c96c..c74f83035 100644 --- a/tests/v1/params/test_freestream.py +++ b/tests/v1/params/test_freestream.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( FreestreamFromMach, diff --git a/tests/v1/params/test_initial_condition.py b/tests/v1/params/test_initial_condition.py index 04487672d..745e5bc72 100644 --- a/tests/v1/params/test_initial_condition.py +++ b/tests/v1/params/test_initial_condition.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.initial_condition import ExpressionInitialCondition from tests.utils import to_file_from_file_test diff --git a/tests/v1/params/test_outputs.py b/tests/v1/params/test_outputs.py index 8ea1e271b..3bf0a0caa 100644 --- a/tests/v1/params/test_outputs.py +++ b/tests/v1/params/test_outputs.py @@ -5,8 +5,8 @@ import pytest import unyt -import flow360.component.v1.modules as modules import flow360.component.v1.units as u +import flow360.v1 as v1 from flow360.component.v1.flow360_output import ( IsoSurface, IsoSurfaceOutput, @@ -99,7 +99,7 @@ def test_surface_output(): output_fields=["Cp", "qcriterion"], ) - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( surface_output=SurfaceOutput( output_fields=["Cp"], @@ -107,9 +107,9 @@ def test_surface_output(): output_format="both", ), boundaries={ - "1": modules.NoSlipWall(name="wing"), - "2": modules.SlipWall(name="symmetry"), - "3": modules.FreestreamBoundary(name="freestream"), + "1": v1.NoSlipWall(name="wing"), + "2": v1.SlipWall(name="symmetry"), + "3": v1.FreestreamBoundary(name="freestream"), }, freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) @@ -125,7 +125,7 @@ def test_surface_output(): else: assert surface_item["output_fields"] == ["Cp"] - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( surface_output=SurfaceOutput( output_fields=["Cp", "solutionTurbulence", "nuHat"], @@ -133,9 +133,9 @@ def test_surface_output(): output_format="tecplot", ), boundaries={ - "1": modules.NoSlipWall(name="wing"), - "2": modules.SlipWall(name="symmetry"), - "3": modules.FreestreamBoundary(name="freestream"), + "1": v1.NoSlipWall(name="wing"), + "2": v1.SlipWall(name="symmetry"), + "3": v1.FreestreamBoundary(name="freestream"), }, freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) @@ -163,11 +163,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": modules.Slice( + "sliceName_2": v1.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413 * u.inch, 0), output_fields=["Mach"], @@ -178,11 +178,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": modules.Slice( + "sliceName_2": v1.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -196,7 +196,7 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal={0, 1}, slice_origin=(0, 0.56413, 0) * u.m, ) @@ -207,7 +207,7 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=(0, 1, 0), slice_origin={0, 0.56413} * u.m, ) @@ -217,11 +217,11 @@ def test_slice_output(): output = SliceOutput( output_fields=["Cp", "qcriterion"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=[0, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": modules.Slice( + "sliceName_2": v1.Slice( slice_normal=(0, 0, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -234,7 +234,7 @@ def test_slice_output(): to_file_from_file_test(output) output.output_format = "both" - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( slice_output=output, boundaries={}, @@ -251,7 +251,7 @@ def test_slice_output(): else: assert {"Cp", "qcriterion"} == set(slice_item["output_fields"]) - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( slice_output=SliceOutput( output_fields=[ @@ -261,11 +261,11 @@ def test_slice_output(): "solutionTurbulence", ], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=[5, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": modules.Slice( + "sliceName_2": v1.Slice( slice_normal=(0, 1, 1), slice_origin=(0, 0.56413, 0) * u.inch, output_fields=["Mach"], @@ -337,7 +337,7 @@ def test_volume_output(): output.output_format = "both" - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( volume_output=output, boundaries={}, @@ -347,7 +347,7 @@ def test_volume_output(): assert set(solver_params.volume_output.output_fields) == {"Cp", "qcriterion"} - with modules.SI_unit_system: + with v1.SI_unit_system: """ Test addition of betMetrics/betMetricsPerDisk from slice output field """ @@ -356,11 +356,11 @@ def test_volume_output(): slice_output=SliceOutput( output_fields=["betMetrics"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": modules.Slice( + "sliceName_2": v1.Slice( slice_normal=(0, 1, 0), slice_origin=(50, 0.56413, 0) * u.m, output_fields=["betMetricsPerDisk"], @@ -383,7 +383,7 @@ def test_volume_output(): } output.output_fields = ["qcriterion", "Cp", "solutionTurbulence", "kOmega"] - with modules.SI_unit_system: + with v1.SI_unit_system: """ Test removing duplicate output fields """ @@ -432,7 +432,7 @@ def test_iso_surface_output(): output.output_format = "both" - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( iso_surface_output=output, boundaries={}, @@ -451,7 +451,7 @@ def test_iso_surface_output(): else: assert {"Mach"} == set(iso_surface_item["output_fields"]) - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( iso_surface_output=IsoSurfaceOutput( output_fields=["Mach", "kOmega", "solutionTurbulence"], @@ -505,7 +505,7 @@ def test_monitor_output(): to_file_from_file_test(output) - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( monitor_output=output, boundaries={}, @@ -523,7 +523,7 @@ def test_monitor_output(): else: assert {"Cp", "qcriterion", "Mach"} == set(monitor_item["output_fields"]) - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( monitor_output=MonitorOutput( output_fields=["Cp", "solutionTurbulence", "kOmega"], @@ -548,7 +548,7 @@ def test_monitor_output(): def test_output_fields(): - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params( geometry=Geometry(mesh_unit=1), volume_output=VolumeOutput(output_fields=["Cp", "qcriterion", "my_var"]), @@ -556,7 +556,7 @@ def test_output_fields(): slice_output=SliceOutput( output_fields=["primitiveVars", "my_var", "mutRatio"], slices={ - "sliceName_1": modules.Slice( + "sliceName_1": v1.Slice( slice_normal=[5, 1, 0], slice_origin=(0, 1.56413, 0), output_fields=["Mach"] ), }, @@ -598,7 +598,7 @@ def test_output_fields(): with pytest.raises( pd.ValidationError, match=r"surface_output:, prmitiveVars is not valid output field name." ): - with modules.SI_unit_system: + with v1.SI_unit_system: Flow360Params( surface_output=SurfaceOutput(output_fields=["prmitiveVars", "my_var"]), boundaries={}, @@ -609,7 +609,7 @@ def test_output_fields(): with pytest.raises( pd.ValidationError, match=r"surface_output->wing:, my__var is not valid output field name." ): - with modules.SI_unit_system: + with v1.SI_unit_system: Flow360Params( surface_output=SurfaceOutput( output_fields=["primitiveVars", "my__var"], diff --git a/tests/v1/params/test_params_boundary.py b/tests/v1/params/test_params_boundary.py index faf4eb7fc..8e08dd705 100644 --- a/tests/v1/params/test_params_boundary.py +++ b/tests/v1/params/test_params_boundary.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.boundaries import ( FreestreamBoundary, HeatFluxWall, diff --git a/tests/v1/params/test_porous_media.py b/tests/v1/params/test_porous_media.py index 71d3df5d2..27f5bcf95 100644 --- a/tests/v1/params/test_porous_media.py +++ b/tests/v1/params/test_porous_media.py @@ -3,7 +3,7 @@ import pytest from flow360.component.v1.flow360_params import PorousMediumBox -from flow360.component.v1.modules import SI_unit_system +from flow360.v1 import SI_unit_system from tests.utils import to_file_from_file_test assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_preconditioner.py b/tests/v1/params/test_preconditioner.py index 76d5594fb..618610540 100644 --- a/tests/v1/params/test_preconditioner.py +++ b/tests/v1/params/test_preconditioner.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import FreestreamFromVelocity diff --git a/tests/v1/params/test_reference_frame.py b/tests/v1/params/test_reference_frame.py index 05b7a1776..87c1c47b8 100644 --- a/tests/v1/params/test_reference_frame.py +++ b/tests/v1/params/test_reference_frame.py @@ -3,7 +3,7 @@ import numpy as np import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u assertions = unittest.TestCase("__init__") diff --git a/tests/v1/params/test_rotational_models.py b/tests/v1/params/test_rotational_models.py index 8cadcc149..cbe856433 100644 --- a/tests/v1/params/test_rotational_models.py +++ b/tests/v1/params/test_rotational_models.py @@ -3,7 +3,7 @@ import numpy as np import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import ( ActuatorDisk, BETDisk, diff --git a/tests/v1/params/test_solvers.py b/tests/v1/params/test_solvers.py index 91636aaec..296bd42ca 100644 --- a/tests/v1/params/test_solvers.py +++ b/tests/v1/params/test_solvers.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import ( Flow360Params, HeatEquationSolver, diff --git a/tests/v1/params/test_time_stepping.py b/tests/v1/params/test_time_stepping.py index a4c484ebd..baa1b6aa6 100644 --- a/tests/v1/params/test_time_stepping.py +++ b/tests/v1/params/test_time_stepping.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( Flow360Params, diff --git a/tests/v1/params/test_user_defined_dynamics.py b/tests/v1/params/test_user_defined_dynamics.py index fc7c703a1..81a5b9818 100644 --- a/tests/v1/params/test_user_defined_dynamics.py +++ b/tests/v1/params/test_user_defined_dynamics.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import UserDefinedDynamic from tests.utils import to_file_from_file_test diff --git a/tests/v1/params/test_validator_aeroacoustics.py b/tests/v1/params/test_validator_aeroacoustics.py index 80f182d32..e01f570ff 100644 --- a/tests/v1/params/test_validator_aeroacoustics.py +++ b/tests/v1/params/test_validator_aeroacoustics.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.boundaries import NoSlipWall, TranslationallyPeriodic from flow360.component.v1.flow360_output import AeroacousticOutput from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_bet_disks.py b/tests/v1/params/test_validator_bet_disks.py index d0e45737f..6ddae217b 100644 --- a/tests/v1/params/test_validator_bet_disks.py +++ b/tests/v1/params/test_validator_bet_disks.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import ( BETDisk, BETDiskChord, diff --git a/tests/v1/params/test_validator_boundary.py b/tests/v1/params/test_validator_boundary.py index 555042105..13c90cbfb 100644 --- a/tests/v1/params/test_validator_boundary.py +++ b/tests/v1/params/test_validator_boundary.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.boundaries import NoSlipWall from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_cht_solver.py b/tests/v1/params/test_validator_cht_solver.py index 40ece962f..2b7bbc09e 100644 --- a/tests/v1/params/test_validator_cht_solver.py +++ b/tests/v1/params/test_validator_cht_solver.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.boundaries import SolidAdiabaticWall, SolidIsothermalWall from flow360.component.v1.flow360_output import ( diff --git a/tests/v1/params/test_validator_consistency_ddes_unsteady.py b/tests/v1/params/test_validator_consistency_ddes_unsteady.py index 8725863ca..3e81e6ca2 100644 --- a/tests/v1/params/test_validator_consistency_ddes_unsteady.py +++ b/tests/v1/params/test_validator_consistency_ddes_unsteady.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import Flow360Params, SteadyTimeStepping from flow360.component.v1.solvers import SpalartAllmaras diff --git a/tests/v1/params/test_validator_equation_eval_frequency.py b/tests/v1/params/test_validator_equation_eval_frequency.py index 94e80dfbe..ef4ea9576 100644 --- a/tests/v1/params/test_validator_equation_eval_frequency.py +++ b/tests/v1/params/test_validator_equation_eval_frequency.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import Flow360Params, SteadyTimeStepping from flow360.component.v1.solvers import SpalartAllmaras, TransitionModelSolver diff --git a/tests/v1/params/test_validator_output_consistency.py b/tests/v1/params/test_validator_output_consistency.py index 1c404d4b0..aa42c5dd6 100644 --- a/tests/v1/params/test_validator_output_consistency.py +++ b/tests/v1/params/test_validator_output_consistency.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.boundaries import FreestreamBoundary, NoSlipWall, WallFunction from flow360.component.v1.flow360_output import SurfaceOutput from flow360.component.v1.flow360_params import Flow360Params diff --git a/tests/v1/params/test_validator_periodic_mapping.py b/tests/v1/params/test_validator_periodic_mapping.py index 21995dff4..8a6330d65 100644 --- a/tests/v1/params/test_validator_periodic_mapping.py +++ b/tests/v1/params/test_validator_periodic_mapping.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.boundaries import ( NoSlipWall, RotationallyPeriodic, diff --git a/tests/v1/params/test_volume_zones.py b/tests/v1/params/test_volume_zones.py index 06ad93dfc..d67101da6 100644 --- a/tests/v1/params/test_volume_zones.py +++ b/tests/v1/params/test_volume_zones.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import VolumeZones from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, diff --git a/tests/v1/test_case.py b/tests/v1/test_case.py index 28c529933..2627b6962 100644 --- a/tests/v1/test_case.py +++ b/tests/v1/test_case.py @@ -1,6 +1,8 @@ import pytest -from flow360.component.v1.modules import ( +from flow360.exceptions import Flow360RuntimeError, Flow360ValueError +from flow360.log import set_logging_level +from flow360.v1 import ( Case, Flow360Params, FreestreamFromVelocity, @@ -9,8 +11,6 @@ VolumeMesh, air, ) -from flow360.exceptions import Flow360RuntimeError, Flow360ValueError -from flow360.log import set_logging_level set_logging_level("DEBUG") diff --git a/tests/v1/test_case_webapi.py b/tests/v1/test_case_webapi.py index 6542750ff..b19457b5f 100644 --- a/tests/v1/test_case_webapi.py +++ b/tests/v1/test_case_webapi.py @@ -1,8 +1,8 @@ import pytest -from flow360.component.v1.modules import Case from flow360.exceptions import Flow360RuntimeError from flow360.log import Logger, log +from flow360.v1 import Case Logger.log_to_file = False diff --git a/tests/v1/test_dev_flow360_params.py b/tests/v1/test_dev_flow360_params.py index f96bde1d0..1b55c85de 100644 --- a/tests/v1/test_dev_flow360_params.py +++ b/tests/v1/test_dev_flow360_params.py @@ -2,7 +2,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from ..utils import compare_to_ref, to_file_from_file_test diff --git a/tests/v1/test_flow360_params.py b/tests/v1/test_flow360_params.py index 97a12be90..9858730ce 100644 --- a/tests/v1/test_flow360_params.py +++ b/tests/v1/test_flow360_params.py @@ -5,7 +5,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.flow360_params import ( Flow360MeshParams, diff --git a/tests/v1/test_folders.py b/tests/v1/test_folders.py index 8137f5773..7a60536ce 100644 --- a/tests/v1/test_folders.py +++ b/tests/v1/test_folders.py @@ -1,5 +1,5 @@ -from flow360.component.v1.modules import Case, Folder from flow360.log import set_logging_level +from flow360.v1 import Case, Folder set_logging_level("DEBUG") diff --git a/tests/v1/test_handle_version_and_unit_system.py b/tests/v1/test_handle_version_and_unit_system.py index d5fd1791f..1478881ec 100644 --- a/tests/v1/test_handle_version_and_unit_system.py +++ b/tests/v1/test_handle_version_and_unit_system.py @@ -4,10 +4,10 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as modules import flow360.component.v1.units as u -from flow360.component.v1.modules import Flow360Params +import flow360.v1 as v1 from flow360.exceptions import Flow360NotImplementedError, Flow360RuntimeError +from flow360.v1 import Flow360Params params_old_version = { "version": "0.2.0b01", @@ -106,7 +106,7 @@ def test_import_no_unit_system_with_context(): json.dump(params_no_unit_system, temp_file) with pytest.raises(Flow360RuntimeError): - with modules.flow360_unit_system: + with v1.flow360_unit_system: Flow360Params(temp_file.name) @@ -116,7 +116,7 @@ def test_import_with_unit_system_no_context(): params = Flow360Params(temp_file.name) assert params - assert params.unit_system == modules.SI_unit_system + assert params.unit_system == v1.SI_unit_system def test_import_with_unit_system_with_context(): @@ -124,7 +124,7 @@ def test_import_with_unit_system_with_context(): json.dump(params_current_version, temp_file) with pytest.raises(Flow360RuntimeError): - with modules.SI_unit_system: + with v1.SI_unit_system: Flow360Params(temp_file.name) @@ -150,30 +150,30 @@ def test_copy_with_unit_system_with_context(): assert params # passes, the models are consistent - with modules.SI_unit_system: + with v1.SI_unit_system: params_copy = params.copy() assert params_copy # fails, the models are inconsistent - with modules.CGS_unit_system: + with v1.CGS_unit_system: with pytest.raises(Flow360RuntimeError): params_copy = params.copy() def test_create_no_unit_system_no_context(): with pytest.raises(Flow360RuntimeError): - modules.Flow360Params( - geometry=modules.Geometry( + v1.Flow360Params( + geometry=v1.Geometry( ref_area=1 * u.m**2, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), - fluid_properties=modules.air, - freestream=modules.FreestreamFromVelocity(velocity=286 * u.m / u.s), - time_stepping=modules.UnsteadyTimeStepping( + fluid_properties=v1.air, + freestream=v1.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=v1.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=modules.AdaptiveCFL(), + CFL=v1.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), @@ -182,40 +182,40 @@ def test_create_no_unit_system_no_context(): def test_create_with_unit_system_no_context(): with pytest.raises(Flow360RuntimeError): - modules.Flow360Params( - geometry=modules.Geometry( + v1.Flow360Params( + geometry=v1.Geometry( ref_area=1 * u.m**2, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), - fluid_properties=modules.air, - freestream=modules.FreestreamFromVelocity(velocity=286 * u.m / u.s), - time_stepping=modules.UnsteadyTimeStepping( + fluid_properties=v1.air, + freestream=v1.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=v1.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=modules.AdaptiveCFL(), + CFL=v1.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=modules.SI_unit_system, + unit_system=v1.SI_unit_system, ) def test_create_no_unit_system_with_context(): - with modules.SI_unit_system: - modules.Flow360Params( - geometry=modules.Geometry( + with v1.SI_unit_system: + v1.Flow360Params( + geometry=v1.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=modules.air, - freestream=modules.FreestreamFromVelocity(velocity=286), - time_stepping=modules.UnsteadyTimeStepping( + fluid_properties=v1.air, + freestream=v1.FreestreamFromVelocity(velocity=286), + time_stepping=v1.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=modules.AdaptiveCFL(), + CFL=v1.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), @@ -223,50 +223,50 @@ def test_create_no_unit_system_with_context(): def test_create_with_unit_system_with_context(): - with modules.SI_unit_system: - modules.Flow360Params( - geometry=modules.Geometry( + with v1.SI_unit_system: + v1.Flow360Params( + geometry=v1.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=modules.air, - freestream=modules.FreestreamFromVelocity(velocity=286), - time_stepping=modules.UnsteadyTimeStepping( + fluid_properties=v1.air, + freestream=v1.FreestreamFromVelocity(velocity=286), + time_stepping=v1.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=modules.AdaptiveCFL(), + CFL=v1.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=modules.SI_unit_system, + unit_system=v1.SI_unit_system, ) with pytest.raises(Flow360RuntimeError): - with modules.CGS_unit_system: - modules.Flow360Params( - geometry=modules.Geometry( + with v1.CGS_unit_system: + v1.Flow360Params( + geometry=v1.Geometry( ref_area=1, moment_length=(1.47602, 0.801672958512342, 1.47602) * u.inch, moment_center=(1, 2, 3) * u.flow360_length_unit, mesh_unit=u.mm, ), boundaries={}, - fluid_properties=modules.air, - freestream=modules.FreestreamFromVelocity(velocity=286), - time_stepping=modules.UnsteadyTimeStepping( + fluid_properties=v1.air, + freestream=v1.FreestreamFromVelocity(velocity=286), + time_stepping=v1.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=modules.AdaptiveCFL(), + CFL=v1.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=modules.SI_unit_system, + unit_system=v1.SI_unit_system, ) def test_change_version(): - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params(**params_no_hash) with pytest.raises(ValueError): params.version = "changed" @@ -277,7 +277,7 @@ def test_parse_with_version(): json.dump(params_no_hash, temp_file) params = Flow360Params(temp_file.name) - assert params.version == modules.__version__ + assert params.version == v1.__version__ def test_parse_no_version(): @@ -298,12 +298,12 @@ def test_parse_wrong_version(): def test_parse_with_hash(): with pytest.raises(pd.ValidationError): - with modules.SI_unit_system: + with v1.SI_unit_system: Flow360Params(**params_current_version) def test_parse_no_hash(): - with modules.SI_unit_system: + with v1.SI_unit_system: params = Flow360Params(**params_no_hash) assert params_no_hash.get("hash") is None assert not hasattr(params, "hash") @@ -311,5 +311,5 @@ def test_parse_no_hash(): def test_parse_wrong_hash(): with pytest.raises(pd.ValidationError): - with modules.SI_unit_system: + with v1.SI_unit_system: Flow360Params(**params_wrong_hash) diff --git a/tests/v1/test_schema_generator.py b/tests/v1/test_schema_generator.py index 33c5253e9..37bddc50a 100644 --- a/tests/v1/test_schema_generator.py +++ b/tests/v1/test_schema_generator.py @@ -1,6 +1,6 @@ import json -import flow360.component.v1.modules as fl +import flow360.v1 as fl def test_schema_generators(): diff --git a/tests/v1/test_services_v1.py b/tests/v1/test_services_v1.py index d387b0346..1da71c11f 100644 --- a/tests/v1/test_services_v1.py +++ b/tests/v1/test_services_v1.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import services diff --git a/tests/v1/test_unit_system_v1.py b/tests/v1/test_unit_system_v1.py index c9517cf4c..7a4a00ebe 100644 --- a/tests/v1/test_unit_system_v1.py +++ b/tests/v1/test_unit_system_v1.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1 import units as u from flow360.component.v1.params_base import Flow360BaseModel from flow360.component.v1.unit_system import ( diff --git a/tests/v1/test_updater.py b/tests/v1/test_updater.py index c5610361e..6c8ff5d7e 100644 --- a/tests/v1/test_updater.py +++ b/tests/v1/test_updater.py @@ -3,7 +3,7 @@ import pytest -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_legacy import LinearSolverLegacy from flow360.component.v1.initial_condition import ExpressionInitialCondition from flow360.component.v1.updater import UPDATE_MAP, _find_update_path, _no_update diff --git a/tests/v1/test_validator_valid_output_fields.py b/tests/v1/test_validator_valid_output_fields.py index 952107fd1..7f97c398f 100644 --- a/tests/v1/test_validator_valid_output_fields.py +++ b/tests/v1/test_validator_valid_output_fields.py @@ -2,8 +2,8 @@ import pytest -import flow360.component.v1.modules as fl import flow360.component.v1.units as u +import flow360.v1 as fl from flow360.component.v1.boundaries import FreestreamBoundary, NoSlipWall from flow360.component.v1.flow360_output import ( IsoSurface, diff --git a/tests/v1/test_volume_mesh.py b/tests/v1/test_volume_mesh.py index f3babc1be..a937ecee5 100644 --- a/tests/v1/test_volume_mesh.py +++ b/tests/v1/test_volume_mesh.py @@ -1,6 +1,6 @@ import pytest -import flow360.component.v1.modules as modules +import flow360.v1 as v1 from flow360.component.utils import CompressionFormat, MeshFileFormat, UGRIDEndianness from flow360.component.v1.boundaries import NoSlipWall from flow360.component.v1.flow360_params import ( @@ -47,7 +47,7 @@ def test_get_no_slip_walls(): assert walls assert len(walls) == 3 - with modules.SI_unit_system: + with v1.SI_unit_system: param = Flow360Params( boundaries={ "fluid/fuselage": NoSlipWall(), @@ -66,7 +66,7 @@ def test_get_no_slip_walls(): def test_validate_cgns(): - with modules.SI_unit_system: + with v1.SI_unit_system: param = Flow360Params( boundaries={ "fluid/fuselage": NoSlipWall(), diff --git a/tools/integrations/schema_generation.py b/tools/integrations/schema_generation.py index 03540a84c..0bb9c922f 100644 --- a/tools/integrations/schema_generation.py +++ b/tools/integrations/schema_generation.py @@ -4,7 +4,7 @@ import pydantic.v1 as pd -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.flow360_params import ( BETDiskChord, BETDiskSectionalPolar, diff --git a/tools/integrations/tests/_test_webui_workbench_integration.py b/tools/integrations/tests/_test_webui_workbench_integration.py index 2f6e0ecd6..d8d383b2a 100644 --- a/tools/integrations/tests/_test_webui_workbench_integration.py +++ b/tools/integrations/tests/_test_webui_workbench_integration.py @@ -1,7 +1,7 @@ import json import os -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.simulation.meshing_param.face_params import ( BoundaryLayer, SurfaceRefinement, diff --git a/tools/integrations/unit_defaults.py b/tools/integrations/unit_defaults.py index 3d2dd1f98..8ce5a8de6 100644 --- a/tools/integrations/unit_defaults.py +++ b/tools/integrations/unit_defaults.py @@ -3,7 +3,7 @@ import pydantic.v1 as pd -import flow360.component.v1.modules as fl +import flow360.v1 as fl from flow360.component.v1.params_base import Flow360BaseModel From b8cba4fa81d00f9bed523c99d8db2570a3edac8a Mon Sep 17 00:00:00 2001 From: BenYuan Date: Fri, 1 Nov 2024 18:16:48 +0000 Subject: [PATCH 4/4] comment addressed --- flow360/__init__.py | 7 +++++++ flow360/v1.py | 7 ------- tests/test_current_flow360_version.py | 2 +- tests/test_environment.py | 2 +- tests/test_shared_accounts.py | 3 ++- tests/test_utils.py | 2 +- tests/v1/test_handle_version_and_unit_system.py | 3 ++- tests/v1/test_updater.py | 3 ++- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/flow360/__init__.py b/flow360/__init__.py index 506b7ec8b..1e739ab3d 100644 --- a/flow360/__init__.py +++ b/flow360/__init__.py @@ -2,6 +2,7 @@ This module is flow360 for simulation based models """ +from flow360.accounts_utils import Accounts from flow360.component.project import Project from flow360.component.simulation import services from flow360.component.simulation import units as u @@ -115,8 +116,14 @@ from flow360.component.simulation.user_defined_dynamics.user_defined_dynamics import ( UserDefinedDynamic, ) +from flow360.environment import Env +from flow360.version import __solver_version__, __version__ __all__ = [ + "Env", + "__solver_version__", + "__version__", + "Accounts", "Project", "u", "SimulationParams", diff --git a/flow360/v1.py b/flow360/v1.py index 8b862d641..74d857616 100644 --- a/flow360/v1.py +++ b/flow360/v1.py @@ -7,7 +7,6 @@ from numpy import pi from flow360 import global_exception_handler -from flow360.accounts_utils import Accounts from flow360.cli import flow360 from flow360.cloud.s3_utils import ProgressCallbackInterface from flow360.component.case import Case @@ -140,13 +139,10 @@ ) from flow360.component.volume_mesh import VolumeMesh from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes -from flow360.environment import Env from flow360.flags import Flags from flow360.user_config import UserConfig -from flow360.version import __solver_version__, __version__ __all__ = [ - "Accounts", "ActuatorDisk", "AdaptiveCFL", "AeroacousticOutput", @@ -163,7 +159,6 @@ "Case", "CylinderRefinement", "Edges", - "Env", "ExpressionInitialCondition", "Face", "Faces", @@ -259,8 +254,6 @@ "WallFunction", "ZeroFreestream", "ZeroFreestreamFromVelocity", - "__version__", - "__solver_version__", "air", "flow360", "flow360_unit_system", diff --git a/tests/test_current_flow360_version.py b/tests/test_current_flow360_version.py index b18435254..93bf5c471 100644 --- a/tests/test_current_flow360_version.py +++ b/tests/test_current_flow360_version.py @@ -1,4 +1,4 @@ -from flow360.v1 import __version__ +from flow360.version import __version__ def test_version(): diff --git a/tests/test_environment.py b/tests/test_environment.py index fca0be431..502d152c3 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -1,4 +1,4 @@ -from flow360.v1 import Env +from flow360 import Env def test_version(): diff --git a/tests/test_shared_accounts.py b/tests/test_shared_accounts.py index d6e937e74..14ab1921a 100644 --- a/tests/test_shared_accounts.py +++ b/tests/test_shared_accounts.py @@ -2,7 +2,8 @@ import pytest -from flow360.v1 import Accounts, Env +from flow360.accounts_utils import Accounts +from flow360.environment import Env def test_shared_account(mock_response, monkeypatch): diff --git a/tests/test_utils.py b/tests/test_utils.py index 06cdd9de8..02febaa65 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -2,6 +2,7 @@ import pytest +from flow360.accounts_utils import Accounts from flow360.cli.dict_utils import merge_overwrite from flow360.component.utils import ( CompressionFormat, @@ -14,7 +15,6 @@ ) from flow360.component.volume_mesh import VolumeMeshMeta from flow360.exceptions import Flow360TypeError, Flow360ValueError -from flow360.v1 import Accounts def test_validate_type(): diff --git a/tests/v1/test_handle_version_and_unit_system.py b/tests/v1/test_handle_version_and_unit_system.py index 1478881ec..2144e2633 100644 --- a/tests/v1/test_handle_version_and_unit_system.py +++ b/tests/v1/test_handle_version_and_unit_system.py @@ -8,6 +8,7 @@ import flow360.v1 as v1 from flow360.exceptions import Flow360NotImplementedError, Flow360RuntimeError from flow360.v1 import Flow360Params +from flow360.version import __version__ params_old_version = { "version": "0.2.0b01", @@ -277,7 +278,7 @@ def test_parse_with_version(): json.dump(params_no_hash, temp_file) params = Flow360Params(temp_file.name) - assert params.version == v1.__version__ + assert params.version == __version__ def test_parse_no_version(): diff --git a/tests/v1/test_updater.py b/tests/v1/test_updater.py index 6c8ff5d7e..27d5e8946 100644 --- a/tests/v1/test_updater.py +++ b/tests/v1/test_updater.py @@ -8,6 +8,7 @@ from flow360.component.v1.initial_condition import ExpressionInitialCondition from flow360.component.v1.updater import UPDATE_MAP, _find_update_path, _no_update from flow360.exceptions import Flow360NotImplementedError +from flow360.version import __version__ @pytest.fixture(autouse=True) @@ -265,4 +266,4 @@ def test_updater_map(): assert len(update_path) == 3 update_path = _find_update_path(version_from=UPDATE_MAP[0][0], version_to=UPDATE_MAP[-1][1]) - update_path = _find_update_path(version_from=UPDATE_MAP[0][0], version_to=fl.__version__) + update_path = _find_update_path(version_from=UPDATE_MAP[0][0], version_to=__version__)