-
Notifications
You must be signed in to change notification settings - Fork 7
Project class interface #511
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
Changes from 8 commits
29024e4
4f82beb
8ca3122
266df20
b6ea7cc
b9ca4a7
6372e0e
6f6648f
9ba5587
3b7aa70
99f2143
8e1ad0b
d07cfe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from flow360.component.project import Project | ||
from flow360.component.simulation.meshing_param.params import ( | ||
MeshingDefaults, | ||
MeshingParams, | ||
) | ||
from flow360.component.simulation.meshing_param.volume_params import AutomatedFarfield | ||
from flow360.component.simulation.models.surface_models import Freestream, Wall | ||
from flow360.component.simulation.operating_condition.operating_condition import ( | ||
AerospaceCondition, | ||
) | ||
from flow360.component.simulation.outputs.outputs import SurfaceOutput | ||
from flow360.component.simulation.primitives import ReferenceGeometry | ||
from flow360.component.simulation.simulation_params import SimulationParams | ||
from flow360.component.simulation.time_stepping.time_stepping import Steady | ||
from flow360.component.simulation.unit_system import SI_unit_system, u | ||
from flow360.environment import dev | ||
|
||
dev.active() | ||
|
||
project = Project.from_cloud("prj-f3569ba5-16a3-4e41-bfd2-b8840df79835") | ||
print(project.get_simulation_json()) | ||
|
||
geometry = project.geometry | ||
geometry.show_available_groupings(verbose_mode=True) | ||
geometry.group_faces_by_tag("faceId") | ||
|
||
with SI_unit_system: | ||
params = SimulationParams( | ||
meshing=MeshingParams( | ||
defaults=MeshingDefaults( | ||
boundary_layer_first_layer_thickness=0.001, surface_max_edge_length=1 | ||
), | ||
volume_zones=[AutomatedFarfield()], | ||
), | ||
reference_geometry=ReferenceGeometry(), | ||
operating_condition=AerospaceCondition(velocity_magnitude=100, alpha=5 * u.deg), | ||
time_stepping=Steady(max_steps=1000), | ||
models=[ | ||
Wall( | ||
surfaces=[geometry["*"]], | ||
name="Wall", | ||
), | ||
Freestream(surfaces=[AutomatedFarfield().farfield], name="Freestream"), | ||
], | ||
outputs=[ | ||
SurfaceOutput(surfaces=geometry["*"], output_fields=["Cp", "Cf", "yPlus", "CfVec"]) | ||
], | ||
) | ||
|
||
project.run_surface_mesher(params=params, draft_name="Case of Simple Airplane from Python") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import flow360.component.simulation.units as u | ||
from flow360.component.project import Project | ||
from flow360.component.simulation.models.surface_models import Freestream, Wall | ||
from flow360.component.simulation.models.volume_models import Fluid | ||
from flow360.component.simulation.operating_condition.operating_condition import ( | ||
AerospaceCondition, | ||
) | ||
from flow360.component.simulation.simulation_params import SimulationParams | ||
from flow360.component.simulation.unit_system import SI_unit_system | ||
from flow360.environment import dev | ||
|
||
dev.active() | ||
|
||
project = Project.from_cloud("prj-e8c6c7eb-c18b-4c15-bac8-edf5aaf9b155") | ||
print(project.get_simulation_json()) | ||
|
||
volume_mesh = project.volume_mesh | ||
|
||
with SI_unit_system: | ||
params = SimulationParams( | ||
operating_condition=AerospaceCondition(velocity_magnitude=100 * u.m / u.s), | ||
models=[ | ||
Fluid(), | ||
Wall(entities=[volume_mesh["fluid/wall"]]), | ||
Freestream(entities=[volume_mesh["fluid/farfield"]]), | ||
], | ||
) | ||
|
||
project.run_case(params=params) | ||
maciej-flexcompute marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import flow360 as fl | ||
from flow360.component.project import Project | ||
from flow360.component.simulation.meshing_param.params import ( | ||
MeshingDefaults, | ||
MeshingParams, | ||
) | ||
from flow360.component.simulation.meshing_param.volume_params import AutomatedFarfield | ||
from flow360.component.simulation.models.surface_models import Freestream, Wall | ||
from flow360.component.simulation.operating_condition.operating_condition import ( | ||
AerospaceCondition, | ||
) | ||
from flow360.component.simulation.outputs.outputs import SurfaceOutput | ||
from flow360.component.simulation.primitives import ReferenceGeometry | ||
from flow360.component.simulation.simulation_params import SimulationParams | ||
from flow360.component.simulation.time_stepping.time_stepping import Steady | ||
from flow360.component.simulation.unit_system import SI_unit_system, u | ||
from flow360.examples import Airplane | ||
|
||
fl.Env.dev.active() | ||
|
||
SOLVER_VERSION = "workbench-24.9.3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's be consistent with solver version. Let's always use release-24.11 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 9ba5587 |
||
|
||
project = Project.from_file( | ||
Airplane.geometry, name="airplane-geometry-python-upload", solver_version=SOLVER_VERSION | ||
) | ||
|
||
geometry = project.geometry | ||
geometry.show_available_groupings(verbose_mode=True) | ||
geometry.group_faces_by_tag("groupName") | ||
|
||
with SI_unit_system: | ||
params = SimulationParams( | ||
meshing=MeshingParams( | ||
defaults=MeshingDefaults( | ||
boundary_layer_first_layer_thickness=0.001, surface_max_edge_length=1 | ||
), | ||
volume_zones=[AutomatedFarfield()], | ||
), | ||
reference_geometry=ReferenceGeometry(), | ||
operating_condition=AerospaceCondition(velocity_magnitude=100, alpha=5 * u.deg), | ||
time_stepping=Steady(max_steps=1000), | ||
models=[ | ||
Wall( | ||
surfaces=[geometry["*"]], | ||
name="Wall", | ||
), | ||
Freestream(surfaces=[AutomatedFarfield().farfield], name="Freestream"), | ||
], | ||
outputs=[ | ||
SurfaceOutput(surfaces=geometry["*"], output_fields=["Cp", "Cf", "yPlus", "CfVec"]) | ||
], | ||
) | ||
|
||
case = project.run_surface_mesher(params=params, draft_name="Case of Simple Airplane from Python") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import flow360 as fl | ||
import flow360.component.simulation.units as u | ||
from flow360.component.project import Project | ||
from flow360.component.simulation.models.surface_models import ( | ||
Freestream, | ||
SymmetryPlane, | ||
Wall, | ||
) | ||
from flow360.component.simulation.models.volume_models import Fluid | ||
from flow360.component.simulation.operating_condition.operating_condition import ( | ||
AerospaceCondition, | ||
) | ||
from flow360.component.simulation.simulation_params import SimulationParams | ||
from flow360.component.simulation.unit_system import SI_unit_system | ||
from flow360.examples import OM6wing | ||
|
||
fl.Env.dev.active() | ||
|
||
OM6wing.get_files() | ||
# Creating and uploading a volume mesh from file | ||
project = Project.from_file( | ||
OM6wing.mesh_filename, | ||
name="wing-volume-mesh-python-upload", | ||
solver_version="workbench-24.9.3", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add repository-level default solver version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 9ba5587, added |
||
tags=["python"], | ||
) | ||
|
||
volume_mesh = project.volume_mesh | ||
|
||
with SI_unit_system: | ||
params = SimulationParams( | ||
operating_condition=AerospaceCondition(velocity_magnitude=100 * u.m / u.s), | ||
models=[ | ||
Fluid(), | ||
Wall(entities=[volume_mesh["1"]]), | ||
Freestream(entities=[volume_mesh["3"]]), | ||
SymmetryPlane(entities=[volume_mesh["2"]]), | ||
], | ||
) | ||
|
||
project.run_case(params=params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fluid will be added automatically, remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9ba5587