Submit Case to Folder

Contents

Submit Case to Folder#

This script demonstrates managing simulation workflows within the Flow360 environment by organizing cases into folders. It illustrates the creation of nested folders, submission of a simulation case using the Project interface, and subsequent relocation of the completed case into a designated folder using methods from the v1 module.

 1import flow360 as fl
 2from flow360.examples import OM6wing
 3from flow360.v1 import Case, Folder
 4
 5# create folder in ROOT level
 6folder_A = Folder.create("folder-python-level-A").submit()
 7print(folder_A)
 8
 9# create folder inside the above folder
10folder_B = Folder.create("folder-python-level-B", parent_folder=folder_A).submit()
11print(folder_B)
12
13# create folder in ROOT level and move inside folder_B
14folder_C = Folder.create("folder-python-level-C").submit()
15folder_C = folder_C.move_to_folder(folder_B)
16print(folder_C)
17
18
19OM6wing.get_files()
20
21project = fl.Project.from_volume_mesh(
22    OM6wing.mesh_filename, name="Move case to a folder from Python"
23)
24vm = project.volume_mesh
25
26with fl.SI_unit_system:
27    params = fl.SimulationParams(
28        reference_geometry=fl.ReferenceGeometry(
29            area=1.15315084119231,
30            moment_center=[0, 0, 0],
31            moment_length=[1.47602, 0.801672958512342, 1.47602],
32        ),
33        operating_condition=fl.AerospaceCondition(velocity_magnitude=286, alpha=3.06 * fl.u.deg),
34        time_stepping=fl.Steady(max_steps=500),
35        models=[
36            fl.Wall(surfaces=vm["1"]),
37            fl.SlipWall(surfaces=vm["2"]),
38            fl.Freestream(surfaces=vm["3"]),
39        ],
40        outputs=[
41            fl.SurfaceOutput(output_fields=["primitiveVars", "Cp", "Cf"], surfaces=[vm["1"]]),
42            fl.VolumeOutput(output_fields=["primitiveVars", "Mach"]),
43        ],
44    )
45
46case = project.run_case(params, "OM6Wing-default-0")
47
48case = Case(case.id)
49
50# move case to folder_C
51case = case.move_to_folder(folder_C)
52print(case.info)

Notes#

  • Folder hierarchy is managed using v1.Folder, enabling creation and relocation of folders.

  • Simulation setup and submission utilize the Project interface for defining parameters and initiating the run.

  • Post-submission, a case can be moved into a specific folder using the move_to_folder method available on a v1.Case object.