diff --git a/examples/case_from_multiple_files/main.py b/examples/case_from_multiple_files/main.py index 976c9f8b4..07a429067 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.v1xxx 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..d9a38ba63 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 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..832e0e5d5 100644 --- a/examples/case_params_with_units.py +++ b/examples/case_params_with_units.py @@ -1,7 +1,6 @@ import json from pprint import pprint -import flow360.component.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 e2e2f7e2f..20cf19897 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 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..7fc2ec5ba 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.v1xxx 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..8ef150b96 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.v1xxx 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..840cf2cc8 100644 --- a/examples/dev/dev_use_unit_system.py +++ b/examples/dev/dev_use_unit_system.py @@ -6,8 +6,8 @@ import pydantic.v1 as pd import unyt -import flow360.component.v1 as fl -from flow360.component.v1 import Geometry +import flow360.component.v1xxx as fl +from flow360.component.v1xxx import Geometry from flow360.component.v1 import units as u from flow360.component.v1.unit_system import ( AngularVelocityType, diff --git a/examples/dev/list_cases_all_params.py b/examples/dev/list_cases_all_params.py index 62bf79927..09d1da339 100644 --- a/examples/dev/list_cases_all_params.py +++ b/examples/dev/list_cases_all_params.py @@ -1,7 +1,7 @@ -import flow360.component.v1 as fl +from flow360.component.case import CaseList as MyCases from flow360.exceptions import Flow360ValidationError -for case in fl.MyCases(limit=10000): +for case in MyCases(limit=10000): print(case.id, case.status, case.name, case.info.userEmail) try: case.params diff --git a/examples/display_mesh_info.py b/examples/display_mesh_info.py index f7cfb0b96..45c0d043e 100644 --- a/examples/display_mesh_info.py +++ b/examples/display_mesh_info.py @@ -1,6 +1,6 @@ -import flow360.component.v1 as fl +from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes -meshes = fl.MyVolumeMeshes() +meshes = MyVolumeMeshes() mesh = meshes[0] for mesh in meshes: 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..f436203e5 100644 --- a/examples/list_cases.py +++ b/examples/list_cases.py @@ -1,7 +1,8 @@ -import flow360.component.v1 as fl +from flow360.component.case import CaseList as MyCases +from flow360.component.volume_mesh import VolumeMeshList as MyVolumeMeshes # get all cases: -my_cases = fl.MyCases() +my_cases = MyCases() # print metadata for the latest case: print(my_cases[0]) @@ -15,7 +16,7 @@ print(case0.params.freestream.Mach) # get all meshes: -meshes = fl.MyVolumeMeshes(limit=None, include_deleted=True) +meshes = MyVolumeMeshes(limit=None, include_deleted=True) meshes[0].info.surface_mesh_id for mesh in meshes: @@ -25,14 +26,14 @@ mesh = meshes[0] # list of cases for a given mesh -mesh_cases = fl.MyCases(mesh_id=mesh.id, include_deleted=True) +mesh_cases = MyCases(mesh_id=mesh.id, include_deleted=True) for case in mesh_cases: print(f"id: {case.id}, status: {case.status}, is case deleted: {case.info.deleted}") for mesh in meshes: if mesh.info.surface_mesh_id is not None: - volume_meshes = fl.MyVolumeMeshes(surface_mesh_id=mesh.info.surface_mesh_id) + volume_meshes = MyVolumeMeshes(surface_mesh_id=mesh.info.surface_mesh_id) print(volume_meshes) assert mesh.id in [m.id for m in volume_meshes] break diff --git a/examples/new_workbench_project_from_geometry.py b/examples/new_workbench_project_from_geometry.py index 1bcf50870..5fb5261a8 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 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..d21e9c2a7 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 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..e3923550c 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 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..254136c8b 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 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..5ded73f62 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.v1xxx 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..f6551b1cd 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.v1xxx 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..2753ef20e 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.v1xxx 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..db447366a 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.v1xxx 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..8e8ce5821 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.v1xxx 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..651e6b44e 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.v1xxx 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..348b082e7 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.v1xxx 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..952ff9df2 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.v1xxx 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..f9e2cf3c6 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.v1xxx 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..975dbfd0f 100644 --- a/examples/run_case_from_example_mesh.py +++ b/examples/run_case_from_example_mesh.py @@ -1,9 +1,11 @@ -import flow360.component.v1 as fl from flow360.examples import OM6wing +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.case import Case +from flow360.component.v1.flow360_params import Flow360Params -vm = fl.VolumeMesh.copy_from_example("2ad77a88-1676-4f89-8652-13bd7e34f257") +vm = VolumeMesh.copy_from_example("2ad77a88-1676-4f89-8652-13bd7e34f257") -params = fl.Flow360Params(OM6wing.case_json) -case = fl.Case.create("OM6wing", params, vm.id, solver_version="release-24.2") +params = Flow360Params(OM6wing.case_json) +case = Case.create("OM6wing", params, vm.id, solver_version="release-24.2") case = case.submit() print(case) diff --git a/examples/run_case_from_files.py b/examples/run_case_from_files.py index a27099e44..13abb3e42 100644 --- a/examples/run_case_from_files.py +++ b/examples/run_case_from_files.py @@ -1,15 +1,17 @@ -import flow360.component.v1 as fl from flow360.examples import OM6wing +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.v1.flow360_params import Flow360Params +from flow360.component.case import Case OM6wing.get_files() # submit mesh -volume_mesh = fl.VolumeMesh.from_file(OM6wing.mesh_filename, name="OM6wing-mesh") +volume_mesh = VolumeMesh.from_file(OM6wing.mesh_filename, name="OM6wing-mesh") volume_mesh = volume_mesh.submit() print(volume_mesh) # # submit case using json file -params = fl.Flow360Params(OM6wing.case_json) -case = fl.Case.create("OM6wing", params, volume_mesh.id) +params = Flow360Params(OM6wing.case_json) +case = Case.create("OM6wing", params, volume_mesh.id) case = case.submit() print(case) diff --git a/examples/run_case_from_inputs.py b/examples/run_case_from_inputs.py index 794edd04e..cfbb7b50e 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.v1xxx 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..49a52a922 100644 --- a/examples/run_case_no_submit_warning.py +++ b/examples/run_case_no_submit_warning.py @@ -1,15 +1,17 @@ -import flow360.component.v1 as fl +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.case import Case from flow360.examples import OM6wing +from flow360.component.v1.flow360_params import Flow360Params OM6wing.get_files() # submit mesh -volume_mesh = fl.VolumeMesh.from_file(OM6wing.mesh_filename, name="OM6wing-mesh") +volume_mesh = VolumeMesh.from_file(OM6wing.mesh_filename, name="OM6wing-mesh") # volume_mesh = volume_mesh.submit() print(volume_mesh) # # submit case using json file -params = fl.Flow360Params(OM6wing.case_json) -case = fl.Case.create("OM6wing", params, volume_mesh.id) +params = Flow360Params(OM6wing.case_json) +case = Case.create("OM6wing", params, volume_mesh.id) case = case.submit() print(case) diff --git a/examples/run_case_unsteady_from_files.py b/examples/run_case_unsteady_from_files.py index a041533d2..e6f3d0f78 100644 --- a/examples/run_case_unsteady_from_files.py +++ b/examples/run_case_unsteady_from_files.py @@ -1,15 +1,17 @@ -import flow360.component.v1 as fl from flow360.examples import Cylinder2D +from flow360.component.volume_mesh import VolumeMesh +from flow360.component.v1.flow360_params import Flow360Params +from flow360.component.case import Case Cylinder2D.get_files() # submit mesh -volume_mesh = fl.VolumeMesh.from_file(Cylinder2D.mesh_filename, name="cylinder2d-mesh") +volume_mesh = VolumeMesh.from_file(Cylinder2D.mesh_filename, name="cylinder2d-mesh") volume_mesh = volume_mesh.submit() print(volume_mesh) # # submit case using json file -params = fl.Flow360Params(Cylinder2D.case_json) -case = fl.Case.create("cylinder2d-Re100", params, volume_mesh.id) +params = Flow360Params(Cylinder2D.case_json) +case = Case.create("cylinder2d-Re100", params, volume_mesh.id) case = case.submit() print(case) diff --git a/examples/run_case_with_fork.py b/examples/run_case_with_fork.py index 6527552e7..861928622 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.v1xxx 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..b31b789de 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.v1xxx as fl from flow360.examples import OM6wing OM6wing.get_files() diff --git a/examples/show_storage.py b/examples/show_storage.py index 949304f85..f21b8178f 100644 --- a/examples/show_storage.py +++ b/examples/show_storage.py @@ -1,6 +1,7 @@ -import flow360.component.v1 as fl +import flow360 as fl +from flow360.component.folder import Folder fl.Env.preprod.active() -fl.Folder.print_storage() +Folder.print_storage() diff --git a/examples/submit_case_to_folder.py b/examples/submit_case_to_folder.py index 8cfef0bb5..fc5a98ab0 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.v1xxx 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..38a47c698 100644 --- a/examples/surface_mesh_airplane_from_files.py +++ b/examples/surface_mesh_airplane_from_files.py @@ -1,8 +1,9 @@ -import flow360.component.v1 as fl +from flow360.component.surface_mesh import SurfaceMesh +from flow360.component.v1.meshing.params import SurfaceMeshingParams from flow360.examples import Airplane -params = fl.SurfaceMeshingParams(Airplane.surface_json) -surface_mesh = fl.SurfaceMesh.create( +params = SurfaceMeshingParams(Airplane.surface_json) +surface_mesh = SurfaceMesh.create( Airplane.geometry, params=params, name="airplane-new-python-client" ) surface_mesh = surface_mesh.submit() diff --git a/examples/surface_mesh_airplane_from_inputs.py b/examples/surface_mesh_airplane_from_inputs.py index 6ae9d4b17..00e0ef33c 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.v1xxx 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..9e9d78b48 100644 --- a/examples/surface_mesh_list.py +++ b/examples/surface_mesh_list.py @@ -1,6 +1,7 @@ -import flow360.component.v1 as fl +from flow360.component.surface_mesh import SurfaceMeshList as MySurfaceMeshes -my_meshes = fl.MySurfaceMeshes() + +my_meshes = MySurfaceMeshes() for mesh in my_meshes: diff --git a/examples/volume_mesh_from_surface_mesh_files.py b/examples/volume_mesh_from_surface_mesh_files.py index 92a35f460..80f6d409c 100644 --- a/examples/volume_mesh_from_surface_mesh_files.py +++ b/examples/volume_mesh_from_surface_mesh_files.py @@ -1,13 +1,15 @@ -import flow360.component.v1 as fl +from flow360.component.v1.meshing.params import SurfaceMeshingParams +from flow360.component.v1.meshing.params import VolumeMeshingParams from flow360.examples import Airplane +from flow360.component.surface_mesh import SurfaceMesh -params = fl.SurfaceMeshingParams(Airplane.surface_json) -surface_mesh = fl.SurfaceMesh.create( +params = SurfaceMeshingParams(Airplane.surface_json) +surface_mesh = SurfaceMesh.create( Airplane.geometry, params=params, name="airplane-new-python-client" ) surface_mesh = surface_mesh.submit() -params = fl.VolumeMeshingParams(Airplane.volume_json) +params = VolumeMeshingParams(Airplane.volume_json) volume_mesh = surface_mesh.create_volume_mesh("airplane-new-python-client", params=params) volume_mesh = volume_mesh.submit() diff --git a/examples/volume_mesh_from_surface_mesh_inputs.py b/examples/volume_mesh_from_surface_mesh_inputs.py index 5ebe9f0ca..bc070344f 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.v1xxx as fl from flow360.examples import Airplane params = fl.SurfaceMeshingParams( diff --git a/flow360/__init__.py b/flow360/__init__.py index 85a7d9138..5d33c88e4 100644 --- a/flow360/__init__.py +++ b/flow360/__init__.py @@ -2,7 +2,10 @@ This module is flow360 for simulation based models """ -from flow360.component.simulation import services +import flow360.environment as Env +from version import __solver_version__, __version__ + +from flow360.component.simulation import services from flow360.component.simulation import units as u from flow360.component.simulation.entity_info import GeometryEntityInfo from flow360.component.simulation.framework.param_utils import AssetCache @@ -116,6 +119,7 @@ ) __all__ = [ + "Env" "u", "SimulationParams", "SI_unit_system", diff --git a/flow360/component/v1/__init__.py b/flow360/component/v1/xxx__init__.py similarity index 100% rename from flow360/component/v1/__init__.py rename to flow360/component/v1/xxx__init__.py diff --git a/flow360/component/v1xxx/__init__.py b/flow360/component/v1xxx/__init__.py new file mode 100644 index 000000000..ba1ebb260 --- /dev/null +++ b/flow360/component/v1xxx/__init__.py @@ -0,0 +1,271 @@ +""" +This module is flow360. +""" + +import os + +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.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, + MassInflow, + MassOutflow, + NoSlipWall, + PressureOutflow, + RiemannInvariant, + RotationallyPeriodic, + SlidingInterfaceBoundary, + SlipWall, + SolidAdiabaticWall, + SolidIsothermalWall, + SubsonicInflow, + SubsonicOutflowMach, + SubsonicOutflowPressure, + SupersonicInflow, + SymmetryPlane, + TranslationallyPeriodic, + VelocityInflow, + WallFunction, +) +from ..v1.flow360_output import ( + IsoSurfaceOutput, + IsoSurfaces, + MonitorOutput, + Monitors, + ProbeMonitor, + Slice, + SliceOutput, + Slices, + SurfaceIntegralMonitor, + SurfaceOutput, + Surfaces, +) +from flow360.component.v1.flow360_params import ( + ActuatorDisk, + AeroacousticOutput, + AirDensityTemperature, + AirPressureTemperature, + BETDisk, + BETDiskChord, + BETDiskSectionalPolar, + BETDiskTwist, + Boundaries, + Flow360MeshParams, + Flow360Params, + ForcePerArea, + FreestreamFromMach, + FreestreamFromMachReynolds, + FreestreamFromVelocity, + Geometry, + HeatEquationSolver, + MeshBoundary, + PorousMediumBox, + SlidingInterface, + TransitionModelSolver, + UnvalidatedFlow360Params, + UserDefinedDynamic, + VolumeOutput, + VolumeZones, + ZeroFreestream, + ZeroFreestreamFromVelocity, + air, +) +from ..v1.initial_condition import ExpressionInitialCondition, ModifiedRestartSolution +from flow360.component.v1.meshing.params import ( + Aniso, + BoxRefinement, + CylinderRefinement, + Edges, + Face, + Faces, + Farfield, + ProjectAniso, + RotorDisk, + SurfaceMeshingParams, + UseAdjacent, + Volume, + VolumeMeshingParams, +) +from ..v1.solvers import ( + IncompressibleNavierStokesSolver, + KOmegaSST, + KOmegaSSTModelConstants, + LinearSolver, + NavierStokesSolver, + NoneSolver, + PressureCorrectionSolver, + SpalartAllmaras, + SpalartAllmarasModelConstants, +) +from ..v1.time_stepping import ( + AdaptiveCFL, + RampCFL, + SteadyTimeStepping, + TimeStepping, + UnsteadyTimeStepping, +) +from ..v1.turbulence_quantities import TurbulenceQuantities +from ..v1.volume_zones import ( + FluidDynamicsVolumeZone, + HeatTransferVolumeZone, + InitialConditionHeatTransfer, + PorousMediumVolumeZone, + ReferenceFrame, + ReferenceFrameDynamic, + ReferenceFrameExpression, + ReferenceFrameOmegaDegrees, + ReferenceFrameOmegaRadians, +) + +__all__ = [ + "Accounts", + "ActuatorDisk", + "AdaptiveCFL", + "AeroacousticOutput", + "AirDensityTemperature", + "AirPressureTemperature", + "Aniso", + "BETDisk", + "BETDiskChord", + "BETDiskSectionalPolar", + "BETDiskTwist", + "Boundaries", + "BoxRefinement", + "CGS_unit_system", + "Case", + "CylinderRefinement", + "Edges", + "Env", + "ExpressionInitialCondition", + "Face", + "Faces", + "Farfield", + "Flags", + "Flow360MeshParams", + "Flow360Params", + "FluidDynamicsVolumeZone", + "Folder", + "ForcePerArea", + "FreestreamBoundary", + "FreestreamFromMach", + "FreestreamFromMachReynolds", + "FreestreamFromVelocity", + "Geometry", + "HeatEquationSolver", + "HeatFluxWall", + "HeatTransferVolumeZone", + "IncompressibleNavierStokesSolver", + "InitialConditionHeatTransfer", + "IsoSurfaceOutput", + "IsoSurfaces", + "IsothermalWall", + "KOmegaSST", + "KOmegaSSTModelConstants", + "LinearSolver", + "MassInflow", + "MassOutflow", + "MeshBoundary", + "ModifiedRestartSolution", + "MonitorOutput", + "Monitors", + "MyCases", + "MySurfaceMeshes", + "MyVolumeMeshes", + "NavierStokesSolver", + "NoSlipWall", + "NoneSolver", + "PorousMediumBox", + "PorousMediumVolumeZone", + "PressureCorrectionSolver", + "PressureOutflow", + "ProbeMonitor", + "ProgressCallbackInterface", + "ProjectAniso", + "RampCFL", + "ReferenceFrame", + "ReferenceFrameDynamic", + "ReferenceFrameExpression", + "ReferenceFrameOmegaDegrees", + "ReferenceFrameOmegaRadians", + "RiemannInvariant", + "RotationallyPeriodic", + "RotorDisk", + "SI_unit_system", + "Slice", + "SliceOutput", + "Slices", + "SlidingInterface", + "SlidingInterfaceBoundary", + "SlipWall", + "SolidAdiabaticWall", + "SolidIsothermalWall", + "SpalartAllmaras", + "SpalartAllmarasModelConstants", + "SteadyTimeStepping", + "SubsonicInflow", + "SubsonicOutflowMach", + "SubsonicOutflowPressure", + "SupersonicInflow", + "SurfaceIntegralMonitor", + "SurfaceMesh", + "SurfaceMeshingParams", + "SurfaceOutput", + "Surfaces", + "SymmetryPlane", + "TimeStepping", + "TransitionModelSolver", + "TranslationallyPeriodic", + "TurbulenceQuantities", + "UnitSystem", + "UnsteadyTimeStepping", + "UnvalidatedFlow360Params", + "UseAdjacent", + "UserConfig", + "UserDefinedDynamic", + "VelocityInflow", + "Volume", + "VolumeMesh", + "VolumeMeshingParams", + "VolumeOutput", + "VolumeZones", + "WallFunction", + "ZeroFreestream", + "ZeroFreestreamFromVelocity", + "__version__", + "__solver_version__", + "air", + "flow360", + "flow360_unit_system", + "global_exception_handler", + "imperial_unit_system", + "meshing", + "os", + "pi", + "solvers", + "units", +] diff --git a/tests/test_current_flow360_version.py b/tests/test_current_flow360_version.py index e7eb64980..17fd69823 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 import __version__ def test_version(): diff --git a/tests/test_environment.py b/tests/test_environment.py index 60a823cc5..502d152c3 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -1,4 +1,4 @@ -from flow360.component.v1 import Env +from flow360 import Env def test_version(): diff --git a/tests/test_results.py b/tests/test_results.py index 711601d9e..86e14f684 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.v1xxx 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..cf238b74b 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.v1xxx import Accounts, Env def test_shared_account(mock_response, monkeypatch): diff --git a/tests/test_utils.py b/tests/test_utils.py index 3da5c8d9c..005006abf 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.v1xxx 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..0498b54f7 100644 --- a/tests/v1/_test_case.py +++ b/tests/v1/_test_case.py @@ -1,5 +1,5 @@ from flow360.component.case import Case -from flow360.component.v1 import Env +from flow360.component.v1xxx import Env from flow360.component.v1.flow360_params import Flow360Params, UnsteadyTimeStepping diff --git a/tests/v1/_test_case_submit_solver_version.py b/tests/v1/_test_case_submit_solver_version.py index 90e66089e..0b1f08a48 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.v1xxx 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..92f025087 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.v1xxx 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..202dd9d6a 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.v1xxx 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..54c92583e 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.v1xxx 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..db9487f9c 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.v1xxx as v1xxx 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 v1xxx.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": v1xxx.NoSlipWall(name="wing"), + "2": v1xxx.SlipWall(name="symmetry"), + "3": v1xxx.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 v1xxx.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": v1xxx.NoSlipWall(name="wing"), + "2": v1xxx.SlipWall(name="symmetry"), + "3": v1xxx.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": v1xxx.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": v1xxx.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": v1xxx.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": v1xxx.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": v1xxx.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": v1xxx.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": v1xxx.Slice( slice_normal=[0, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": v1.Slice( + "sliceName_2": v1xxx.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 v1xxx.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 v1xxx.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": v1xxx.Slice( slice_normal=[5, 1, 0], slice_origin=(0, 0.56413, 0) * u.flow360_length_unit, ), - "sliceName_2": v1.Slice( + "sliceName_2": v1xxx.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 v1xxx.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 v1xxx.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": v1xxx.Slice( slice_normal=(0, 1, 0), slice_origin=(0, 0.56413, 0) * u.m, ), - "sliceName_2": v1.Slice( + "sliceName_2": v1xxx.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 v1xxx.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 v1xxx.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 v1xxx.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 v1xxx.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 v1xxx.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 v1xxx.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": v1xxx.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 v1xxx.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 v1xxx.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..25784b854 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.v1xxx 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..6182a0aa5 100644 --- a/tests/v1/params/test_porous_media.py +++ b/tests/v1/params/test_porous_media.py @@ -2,7 +2,7 @@ import pytest -from flow360.component.v1 import SI_unit_system +from flow360.component.v1.unit_system import SI_unit_system from flow360.component.v1.flow360_params import PorousMediumBox from tests.utils import to_file_from_file_test diff --git a/tests/v1/params/test_preconditioner.py b/tests/v1/params/test_preconditioner.py index 26f00bd6f..2b8cdd673 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.v1xxx 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..9f00ba8ee 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.v1xxx 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..cadae6ce1 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.v1xxx 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..efcef2405 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.v1xxx 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..e126f6613 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.v1xxx 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..d16567e2e 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.v1xxx 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..bbc58b485 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.v1xxx 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..57cddbdc8 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.v1xxx 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..58831b12b 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.v1xxx 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..d63623eed 100644 --- a/tests/v1/params/test_validator_cht_solver.py +++ b/tests/v1/params/test_validator_cht_solver.py @@ -2,7 +2,9 @@ import pytest -import flow360.component.v1 as fl +from flow360.component.v1.unit_system import SI_unit_system +from flow360.component.v1.flow360_output import Slice, ProbeMonitor +from flow360.component.v1.flow360_params import FreestreamFromMach from flow360.component.v1 import units as u from flow360.component.v1.boundaries import SolidAdiabaticWall, SolidIsothermalWall from flow360.component.v1.flow360_output import ( @@ -35,18 +37,18 @@ def change_test_dir(request, monkeypatch): def test_cht_solver_no_heat_transfer_zone(): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( volume_zones={ "blk-1": FluidDynamicsVolumeZone(), "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises(ValueError, match="Heat equation solver activated with no zone definition."): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( heat_equation_solver=HeatEquationSolver(), volume_zones={ @@ -54,14 +56,14 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="SolidIsothermalWall boundary is defined with no definition of volume zone of heat transfer. ", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( boundaries={ "bnd1": SolidIsothermalWall(temperature=1.01), @@ -70,14 +72,14 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-1": FluidDynamicsVolumeZone(), "blk-2": FluidDynamicsVolumeZone(), }, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="SolidAdiabaticWall boundary is defined with no definition of volume zone of heat transfer. ", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( boundaries={ "bnd1": SolidAdiabaticWall(), @@ -86,14 +88,14 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-1": FluidDynamicsVolumeZone(), "blk-2": FluidDynamicsVolumeZone(), }, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat equation output variables: residualHeatSolver is requested with no definition of volume zone of heat transfer.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( surface_output=SurfaceOutput(output_fields=["residualHeatSolver"]), volume_zones={ @@ -101,14 +103,14 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat equation output variables: residualHeatSolver is requested with no definition of volume zone of heat transfer.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( volume_output=VolumeOutput(output_fields=["residualHeatSolver"]), volume_zones={ @@ -116,30 +118,30 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat equation output variables: residualHeatSolver is requested with no definition of volume zone of heat transfer.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( slice_output=SliceOutput( output_fields=["residualHeatSolver"], - slices={"s1": fl.Slice(slice_normal=(1, 0, 0), slice_origin=(1, 2, 3))}, + slices={"s1": Slice(slice_normal=(1, 0, 0), slice_origin=(1, 2, 3))}, ), volume_zones={ "blk-1": FluidDynamicsVolumeZone(), "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat equation output variables: residualHeatSolver is requested with no definition of volume zone of heat transfer.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( iso_surface_output=IsoSurfaceOutput( iso_surfaces={ @@ -160,18 +162,18 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat equation output variables: residualHeatSolver is requested with no definition of volume zone of heat transfer.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( monitor_output=MonitorOutput( output_fields=["residualHeatSolver"], monitors={ - "probe_1": fl.ProbeMonitor(monitor_locations=[(1, 1, 2), (2, 2, 23)]) + "probe_1": ProbeMonitor(monitor_locations=[(1, 1, 2), (2, 2, 23)]) }, ), volume_zones={ @@ -179,26 +181,26 @@ def test_cht_solver_no_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) def test_cht_solver_has_heat_transfer_zone(): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( volume_zones={ "blk-1": HeatTransferVolumeZone(thermal_conductivity=0.1), "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Conjugate heat transfer can not be used with incompressible flow solver.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( navier_stokes_solver=IncompressibleNavierStokesSolver(), volume_zones={ @@ -206,10 +208,10 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( time_stepping=UnsteadyTimeStepping(physical_steps=10, time_step_size=0.1 * u.s), volume_zones={ @@ -221,14 +223,14 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Heat capacity needs to be specified for all heat transfer volume zones for unsteady simulations.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( time_stepping=UnsteadyTimeStepping(physical_steps=10, time_step_size=0.1 * u.s), volume_zones={ @@ -236,13 +238,13 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Initial condition needs to be specified for all heat transfer volume zones for unsteady simulations.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( time_stepping=UnsteadyTimeStepping(physical_steps=10, time_step_size=0.1 * u.s), volume_zones={ @@ -250,9 +252,9 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( initial_condition=ExpressionInitialCondition(rho=1, u=1, v=1, w=1, p=1), volume_zones={ @@ -263,14 +265,14 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) with pytest.raises( ValueError, match="Initial condition needs to be specified for all heat transfer zones for initialization with expressions.", ): - with fl.SI_unit_system: + with SI_unit_system: Flow360Params( initial_condition=ExpressionInitialCondition(rho=1, u=1, v=1, w=1, p=1), volume_zones={ @@ -278,5 +280,5 @@ def test_cht_solver_has_heat_transfer_zone(): "blk-2": FluidDynamicsVolumeZone(), }, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=1, mu_ref=1), ) diff --git a/tests/v1/params/test_validator_consistency_ddes_unsteady.py b/tests/v1/params/test_validator_consistency_ddes_unsteady.py index d268fcbb0..f3bc717af 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.v1xxx 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..fe3a387aa 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.v1xxx 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..7be5a8589 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.v1xxx 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..65ab24a4b 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.v1xxx 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..26901687f 100644 --- a/tests/v1/params/test_volume_zones.py +++ b/tests/v1/params/test_volume_zones.py @@ -4,16 +4,29 @@ import pydantic.v1 as pd import pytest -import flow360.component.v1 as fl from flow360.component.v1.flow360_params import VolumeZones from flow360.component.v1.volume_zones import ( FluidDynamicsVolumeZone, HeatTransferVolumeZone, InitialConditionHeatTransfer, ReferenceFrame, + ReferenceFrameDynamic, + ReferenceFrameExpression, + ReferenceFrameOmegaRadians, + ReferenceFrameOmegaDegrees ) from tests.utils import to_file_from_file_test +from flow360.component.v1.unit_system import ( + CGS_unit_system, + SI_unit_system, + UnitSystem, + flow360_unit_system, + imperial_unit_system, +) +from flow360.component.v1.flow360_params import Flow360Params, Geometry, air +from flow360.component.v1.flow360_params import FreestreamFromMach + assertions = unittest.TestCase("__init__") @@ -25,13 +38,13 @@ def change_test_dir(request, monkeypatch): @pytest.mark.usefixtures("array_equality_override") def test_volume_zones(): with pytest.raises(pd.ValidationError): - with fl.SI_unit_system: + with SI_unit_system: rf = ReferenceFrame( center=(0, 0, 0), axis=(0, 0, 1), ) - with fl.SI_unit_system: + with SI_unit_system: rf = ReferenceFrame(center=(0, 0, 0), axis=(0, 0, 1), omega=1) assert rf @@ -64,33 +77,33 @@ def test_volume_zones(): assert zones - with fl.SI_unit_system: - param = fl.Flow360Params( - geometry=fl.Geometry(mesh_unit=1), - fluid_properties=fl.air, + with SI_unit_system: + param = Flow360Params( + geometry=Geometry(mesh_unit=1), + fluid_properties=air, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), volume_zones={ - "zone1": fl.FluidDynamicsVolumeZone( - reference_frame=fl.ReferenceFrameDynamic(axis=(1, 2, 3), center=(1, 1, 1)) + "zone1": FluidDynamicsVolumeZone( + reference_frame=ReferenceFrameDynamic(axis=(1, 2, 3), center=(1, 1, 1)) ), - "zone2": fl.FluidDynamicsVolumeZone( - reference_frame=fl.ReferenceFrameExpression( + "zone2": FluidDynamicsVolumeZone( + reference_frame=ReferenceFrameExpression( axis=(1, 2, 3), center=(1, 1, 1), theta_degrees="0.2*t" ) ), - "zone3": fl.FluidDynamicsVolumeZone( - reference_frame=fl.ReferenceFrameOmegaRadians( + "zone3": FluidDynamicsVolumeZone( + reference_frame=ReferenceFrameOmegaRadians( axis=(1, 4, 3), center=(1, 1, 1), omega_radians=0.5 ) ), - "zone4": fl.FluidDynamicsVolumeZone( - reference_frame=fl.ReferenceFrameOmegaDegrees( + "zone4": FluidDynamicsVolumeZone( + reference_frame=ReferenceFrameOmegaDegrees( axis=(1, 5, 3), center=(1, 1, 1), omega_degrees=1.5 ) ), - "zone5": fl.FluidDynamicsVolumeZone( - reference_frame=fl.ReferenceFrame(axis=(-5, 2, 3), center=(1, 1, 1), omega=2.5) + "zone5": FluidDynamicsVolumeZone( + reference_frame=ReferenceFrame(axis=(-5, 2, 3), center=(1, 1, 1), omega=2.5) ), }, ) @@ -117,12 +130,12 @@ def test_volume_zones(): to_file_from_file_test(zones) - with fl.SI_unit_system: - param = fl.Flow360Params( - geometry=fl.Geometry(mesh_unit=1), - fluid_properties=fl.air, + with SI_unit_system: + param = Flow360Params( + geometry=Geometry(mesh_unit=1), + fluid_properties=air, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), volume_zones={ "zone1": fl.HeatTransferVolumeZone( thermal_conductivity=1, @@ -138,12 +151,12 @@ def test_volume_zones(): assert solver_params.heat_equation_solver is not None assert solver_params.heat_equation_solver.equation_eval_frequency == 11 - with fl.SI_unit_system: - param = fl.Flow360Params( - geometry=fl.Geometry(mesh_unit=1), - fluid_properties=fl.air, + with SI_unit_system: + param = Flow360Params( + geometry=Geometry(mesh_unit=1), + fluid_properties=air, boundaries={}, - freestream=fl.FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), + freestream=FreestreamFromMach(Mach=1, temperature=288.15, mu_ref=1), volume_zones={ "zone1": fl.HeatTransferVolumeZone( thermal_conductivity=1, diff --git a/tests/v1/test_case.py b/tests/v1/test_case.py index 4b775a6a0..afbe52f2c 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.v1xxx import ( Case, Flow360Params, FreestreamFromVelocity, diff --git a/tests/v1/test_case_webapi.py b/tests/v1/test_case_webapi.py index 9e633f4f8..7f9b0f8e8 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.v1xxx 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..e53c139b7 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.v1xxx 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..1d3a51ebc 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.v1xxx 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..d096c83c3 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.v1xxx 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..77aa6bd31 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.v1xxx as v1xxx import flow360.component.v1.units as u -from flow360.component.v1 import Flow360Params +from flow360.component.v1xxx 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 v1xxx.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 == v1xxx.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 v1xxx.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 v1xxx.SI_unit_system: params_copy = params.copy() assert params_copy # fails, the models are inconsistent - with v1.CGS_unit_system: + with v1xxx.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( + v1xxx.Flow360Params( + geometry=v1xxx.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=v1xxx.air, + freestream=v1xxx.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=v1xxx.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=v1xxx.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( + v1xxx.Flow360Params( + geometry=v1xxx.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=v1xxx.air, + freestream=v1xxx.FreestreamFromVelocity(velocity=286 * u.m / u.s), + time_stepping=v1xxx.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=v1xxx.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=v1xxx.SI_unit_system, ) def test_create_no_unit_system_with_context(): - with v1.SI_unit_system: - v1.Flow360Params( - geometry=v1.Geometry( + with v1xxx.SI_unit_system: + v1xxx.Flow360Params( + geometry=v1xxx.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=v1xxx.air, + freestream=v1xxx.FreestreamFromVelocity(velocity=286), + time_stepping=v1xxx.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=v1xxx.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 v1xxx.SI_unit_system: + v1xxx.Flow360Params( + geometry=v1xxx.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=v1xxx.air, + freestream=v1xxx.FreestreamFromVelocity(velocity=286), + time_stepping=v1xxx.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=v1xxx.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=v1xxx.SI_unit_system, ) with pytest.raises(Flow360RuntimeError): - with v1.CGS_unit_system: - v1.Flow360Params( - geometry=v1.Geometry( + with v1xxx.CGS_unit_system: + v1xxx.Flow360Params( + geometry=v1xxx.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=v1xxx.air, + freestream=v1xxx.FreestreamFromVelocity(velocity=286), + time_stepping=v1xxx.UnsteadyTimeStepping( max_pseudo_steps=500, - CFL=v1.AdaptiveCFL(), + CFL=v1xxx.AdaptiveCFL(), time_step_size=1.2 * u.s, physical_steps=10, ), - unit_system=v1.SI_unit_system, + unit_system=v1xxx.SI_unit_system, ) def test_change_version(): - with v1.SI_unit_system: + with v1xxx.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 == v1xxx.__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 v1xxx.SI_unit_system: Flow360Params(**params_current_version) def test_parse_no_hash(): - with v1.SI_unit_system: + with v1xxx.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 v1xxx.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..b61e9339f 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.v1xxx as fl def test_schema_generators(): diff --git a/tests/v1/test_services_v1.py b/tests/v1/test_services_v1.py index 38e28cf00..e5ecf533b 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.v1xxx 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..f66357096 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.v1xxx 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..7a3f70b69 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.v1xxx 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..1ea18e952 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.v1xxx 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..c19859bff 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.v1xxx as v1xxx 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 v1xxx.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 v1xxx.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..24f2a362c 100644 --- a/tools/integrations/schema_generation.py +++ b/tools/integrations/schema_generation.py @@ -4,7 +4,6 @@ import pydantic.v1 as pd -import flow360.component.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 8cc51c036..b9848c4bd 100644 --- a/tools/integrations/tests/_test_webui_workbench_integration.py +++ b/tools/integrations/tests/_test_webui_workbench_integration.py @@ -1,7 +1,9 @@ import json import os -import flow360.component.v1 as fl +import flow360 as fl +from flow360.user_config import UserConfig +from flow360.component.v1.flow360_params import Geometry from flow360.component.simulation.meshing_param.face_params import ( BoundaryLayer, SurfaceRefinement, @@ -25,10 +27,9 @@ from flow360.component.simulation.time_stepping.time_stepping import Steady from flow360.component.simulation.unit_system import SI_unit_system, u -fl.UserConfig.set_profile("auto_test_1") +UserConfig.set_profile("auto_test_1") fl.Env.dev.active() -from flow360.component.geometry_v1 import Geometry from flow360.examples import Airplane SOLVER_VERSION = "workbench-24.6.0" diff --git a/tools/integrations/unit_defaults.py b/tools/integrations/unit_defaults.py index 8e58f28f7..da06ade62 100644 --- a/tools/integrations/unit_defaults.py +++ b/tools/integrations/unit_defaults.py @@ -3,18 +3,23 @@ import pydantic.v1 as pd -import flow360.component.v1 as fl from flow360.component.v1.params_base import Flow360BaseModel +from flow360.component.v1.unit_system import ( + CGS_unit_system, + SI_unit_system, + flow360_unit_system, + imperial_unit_system, +) class UnitDefaults(Flow360BaseModel): - defaults_SI: Dict = pd.Field(alias="defaultsSI", default=fl.SI_unit_system.defaults()) - defaults_CGS: Dict = pd.Field(alias="defaultsCGS", default=fl.CGS_unit_system.defaults()) + defaults_SI: Dict = pd.Field(alias="defaultsSI", default=SI_unit_system.defaults()) + defaults_CGS: Dict = pd.Field(alias="defaultsCGS", default=CGS_unit_system.defaults()) defaults_imperial: Dict = pd.Field( - alias="defaultsImperial", default=fl.imperial_unit_system.defaults() + alias="defaultsImperial", default=imperial_unit_system.defaults() ) defaults_flow360: Dict = pd.Field( - alias="defaultsFlow360", default=fl.flow360_unit_system.defaults() + alias="defaultsFlow360", default=flow360_unit_system.defaults() )