Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Examples] examples folder cleanup #740

Merged
merged 10 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/case_from_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import flow360 as fl
from flow360.examples import OM6wing

OM6wing.get_files()


project = fl.Project.from_file(
files=fl.VolumeMeshFile(OM6wing.mesh_filename), name="OM6Wing json input from Python"
)

params = fl.SimulationParams.from_file("data/om6wing_params.yaml")

project.run_case(params, name="OM6Wing json input case from Python")
9 changes: 0 additions & 9 deletions examples/case_from_multiple_files/boundaries.yaml

This file was deleted.

42 changes: 42 additions & 0 deletions examples/case_from_multiple_files/case_from_multiple_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os

import flow360 as fl
from flow360.examples import OM6wing

here = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")

OM6wing.get_files()


class datafiles:
boundary_wall = os.path.join(here, "models_wall.yaml")
boundary_slipwall = os.path.join(here, "models_slipwall.yaml")
bounrday_freestream = os.path.join(here, "models_freestream.yaml")
surface_output = os.path.join(here, "outputs_surface.yaml")
volume_output = os.path.join(here, "outputs_volume.yaml")
operating_condition = os.path.join(here, "operating_condition.yaml")
reference_geometry = os.path.join(here, "reference_geometry.yaml")
time_stepping = os.path.join(here, "time_stepping.yaml")


project = fl.Project.from_file(
files=fl.VolumeMeshFile(OM6wing.mesh_filename), name="OM6Wing from Python"
)

with fl.SI_unit_system:
params = fl.SimulationParams(
reference_geometry=fl.ReferenceGeometry.from_file(datafiles.reference_geometry),
operating_condition=fl.AerospaceCondition.from_file(datafiles.operating_condition),
time_stepping=fl.Steady.from_file(datafiles.time_stepping),
models=[
fl.Wall.from_file(datafiles.boundary_wall),
fl.SlipWall.from_file(datafiles.boundary_slipwall),
fl.Freestream.from_file(datafiles.bounrday_freestream),
],
outputs=[
fl.SurfaceOutput.from_file(datafiles.surface_output),
fl.VolumeOutput.from_file(datafiles.volume_output),
],
)

project.run_case(params, "OM6Wing case yaml from Python")
14 changes: 14 additions & 0 deletions examples/case_from_multiple_files/data/models_freestream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
entities:
stored_entities:
- name: '3'
private_attribute_entity_type_name: Surface
private_attribute_full_name: '3'
private_attribute_id: null
private_attribute_is_interface: false
private_attribute_registry_bucket_name: SurfaceEntityType
private_attribute_sub_components: []
private_attribute_tag_key: null
name: null
turbulence_quantities: null
type: Freestream
velocity: null
12 changes: 12 additions & 0 deletions examples/case_from_multiple_files/data/models_slipwall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
entities:
stored_entities:
- name: '2'
private_attribute_entity_type_name: Surface
private_attribute_full_name: '2'
private_attribute_id: null
private_attribute_is_interface: false
private_attribute_registry_bucket_name: SurfaceEntityType
private_attribute_sub_components: []
private_attribute_tag_key: null
name: null
type: SlipWall
22 changes: 22 additions & 0 deletions examples/case_from_multiple_files/data/models_wall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
entities:
stored_entities:
- name: '1'
private_attribute_entity_type_name: Surface
private_attribute_full_name: '1'
private_attribute_id: null
private_attribute_is_interface: false
private_attribute_registry_bucket_name: SurfaceEntityType
private_attribute_sub_components: []
private_attribute_tag_key: null
heat_spec:
type_name: HeatFlux
value:
units: W/m**2
value: 0.0
name: null
roughness_height:
units: m
value: 0.0
type: Wall
use_wall_function: false
velocity: null
71 changes: 71 additions & 0 deletions examples/case_from_multiple_files/data/operating_condition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
alpha:
units: degree
value: 3.06
beta:
units: degree
value: 0.0
private_attribute_constructor: default
private_attribute_input_cache:
alpha:
units: degree
value: 3.06
beta:
units: degree
value: 0.0
mach: null
reference_mach: null
thermal_state:
density:
units: kg/m**3
value: 1.225
material:
dynamic_viscosity:
effective_temperature:
units: K
value: 110.4
reference_temperature:
units: K
value: 273.15
reference_viscosity:
units: Pa*s
value: 1.716e-05
name: air
type: air
private_attribute_constructor: default
private_attribute_input_cache:
altitude: null
temperature_offset: null
temperature:
units: K
value: 288.15
type_name: ThermalState
reference_velocity_magnitude: null
thermal_state:
density:
units: kg/m**3
value: 1.225
material:
dynamic_viscosity:
effective_temperature:
units: K
value: 110.4
reference_temperature:
units: K
value: 273.15
reference_viscosity:
units: Pa*s
value: 1.716e-05
name: air
type: air
private_attribute_constructor: default
private_attribute_input_cache:
altitude: null
temperature_offset: null
temperature:
units: K
value: 288.15
type_name: ThermalState
type_name: AerospaceCondition
velocity_magnitude:
units: m/s
value: 286.0
21 changes: 21 additions & 0 deletions examples/case_from_multiple_files/data/outputs_surface.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
entities:
stored_entities:
- name: '1'
private_attribute_entity_type_name: Surface
private_attribute_full_name: '1'
private_attribute_id: null
private_attribute_is_interface: false
private_attribute_registry_bucket_name: SurfaceEntityType
private_attribute_sub_components: []
private_attribute_tag_key: null
frequency: -1
frequency_offset: 0
name: Surface output
output_fields:
items:
- primitiveVars
- Cp
- Cf
output_format: paraview
output_type: SurfaceOutput
write_single_file: false
9 changes: 9 additions & 0 deletions examples/case_from_multiple_files/data/outputs_volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
frequency: -1
frequency_offset: 0
name: Volume output
output_fields:
items:
- primitiveVars
- Mach
output_format: paraview
output_type: VolumeOutput
15 changes: 15 additions & 0 deletions examples/case_from_multiple_files/data/reference_geometry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
area:
units: m**2
value: 1.15315084119231
moment_center:
units: m
value:
- 0.0
- 0.0
- 0.0
moment_length:
units: m
value:
- 1.47602
- 0.801672958512342
- 1.47602
8 changes: 8 additions & 0 deletions examples/case_from_multiple_files/data/time_stepping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CFL:
convergence_limiting_factor: 0.25
max: 10000.0
max_relative_change: 1.0
min: 0.1
type: adaptive
max_steps: 500
type_name: Steady
6 changes: 0 additions & 6 deletions examples/case_from_multiple_files/geometry.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions examples/case_from_multiple_files/main.py

This file was deleted.

54 changes: 0 additions & 54 deletions examples/case_from_multiple_files/outputs.yaml

This file was deleted.

16 changes: 8 additions & 8 deletions examples/case_from_yaml.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import flow360.v1 as fl
import flow360 as fl
from flow360.examples import OM6wing

OM6wing.get_files()

volume_mesh = fl.VolumeMesh.from_file(OM6wing.mesh_filename, name="OM6wing-mesh")
volume_mesh = volume_mesh.submit()
print(volume_mesh)

params = fl.Flow360Params(OM6wing.case_yaml)
case = volume_mesh.create_case("om6wing-from-yaml", params)
case = case.submit()
print(case)
project = fl.Project.from_file(
files=fl.VolumeMeshFile(OM6wing.mesh_filename), name="OM6Wing yaml input from Python"
)

params = fl.SimulationParams.from_file("data/om6wing_params.json")

project.run_case(params, name="OM6Wing yaml input case from Python")
Loading