Skip to content

Commit b91cb78

Browse files
committed
Revert "Scheduled sync: main → develop (#1422)"
This reverts commit ac56ca0.
1 parent ac56ca0 commit b91cb78

97 files changed

Lines changed: 194 additions & 13211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,4 @@ tmp/
331331
/.vscode
332332

333333
# test residual
334-
flow360/examples/cylinder2D/flow360mesh.json
335-
336-
/local_tests
334+
flow360/examples/cylinder2D/flow360mesh.json

examples/advanced_simulations/aerodynamics/dynamic_derivatives/dynamic_derivatives.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
Example script for calculating dynamic derivatives using sliding interfaces in Flow360
3-
See documentation for more information:
4-
https://docs.flexcompute.com/projects/flow360/en/latest/tutorials/DynamicDerivatives/DynamicDerivatives.html
5-
"""
6-
71
import math
82

93
import flow360 as fl
@@ -71,11 +65,8 @@
7165
operating_condition=fl.AerospaceCondition(
7266
velocity_magnitude=50,
7367
),
74-
time_stepping=fl.Unsteady(
75-
max_pseudo_steps=80,
76-
steps=400,
77-
step_size=0.01 * 2.0 * math.pi / 20.0 * fl.u.s,
78-
CFL=fl.AdaptiveCFL(),
68+
time_stepping=fl.Steady(
69+
max_steps=10000, CFL=fl.RampCFL(initial=1, final=100, ramp_steps=1000)
7970
),
8071
outputs=[
8172
fl.VolumeOutput(
@@ -94,7 +85,7 @@
9485
models=[
9586
fl.Rotation(
9687
volumes=cylinder,
97-
spec=fl.AngleExpression("0.0349066 * sin(0.05877271 * t)"),
88+
spec=fl.AngularVelocity(0 * fl.u.rad / fl.u.s),
9889
),
9990
fl.Freestream(surfaces=farfield.farfield),
10091
fl.Wall(surfaces=geometry["wing"]),
@@ -110,8 +101,27 @@
110101
),
111102
],
112103
)
113-
# Run unsteady case with an oscillating sliding interface to collecting the data.
104+
105+
# Run steady case with a fixed sliding interface for initializing the flow field.
106+
project.run_case(
107+
params=params,
108+
name="Tutorial Calculating Dynamic Derivatives using Sliding Interfaces (Steady)",
109+
)
110+
parent_case = fl.Case.from_cloud(project.case.id)
111+
112+
# Update the parameters for the unsteady case.
113+
with fl.SI_unit_system:
114+
params.time_stepping = fl.Unsteady(
115+
max_pseudo_steps=80,
116+
steps=400,
117+
step_size=0.01 * 2.0 * math.pi / 20.0 * fl.u.s,
118+
CFL=fl.RampCFL(initial=1, final=1e8, ramp_steps=20),
119+
)
120+
params.models[0].spec = fl.AngleExpression("0.0349066 * sin(0.05877271 * t)")
121+
122+
# Run unsteady case with an oscillating sliding interface for collecting the data.
114123
project.run_case(
115124
params=params,
116-
name="Tutorial Calculating Dynamic Derivatives using Sliding Interfaces",
125+
name="Tutorial Calculating Dynamic Derivatives using Sliding Interfaces (Unsteady)",
126+
fork_from=parent_case,
117127
)

flow360/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
PorousMedium,
9797
Rotation,
9898
Solid,
99-
StopCriterion,
10099
XFOILFile,
101100
XROTORFile,
102101
)
@@ -118,7 +117,6 @@
118117
ImportedSurfaceIntegralOutput,
119118
ImportedSurfaceOutput,
120119
IsosurfaceOutput,
121-
MovingStatistic,
122120
Observer,
123121
ProbeOutput,
124122
SliceOutput,
@@ -309,6 +307,4 @@
309307
"get_user_variable",
310308
"show_user_variables",
311309
"remove_user_variable",
312-
"StopCriterion",
313-
"MovingStatistic",
314310
]

flow360/component/case.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
from .simulation import services
6767
from .simulation.simulation_params import SimulationParams
6868
from .utils import (
69-
_local_download_file_list_overwrite,
7069
_local_download_overwrite,
7170
is_valid_uuid,
7271
shared_account_confirm_proceed,
@@ -748,10 +747,8 @@ def from_local_storage(cls, local_storage_path, meta_data: CaseMeta) -> Case:
748747
An instance of `Case` with data loaded from local storage.
749748
"""
750749
_local_download_file = _local_download_overwrite(local_storage_path, cls.__name__)
751-
_local_download_file_list = _local_download_file_list_overwrite(local_storage_path)
752750
case = cls._from_meta(meta_data)
753751
case._download_file = _local_download_file
754-
case.get_download_file_list = _local_download_file_list
755752
case._results = CaseResultsModel(case=case)
756753
case.results.set_local_storage(local_storage_path, keep_remote_structure=True)
757754
return case
@@ -906,9 +903,15 @@ def pass_download_function(self):
906903
value._get_params_method = lambda: self.case.params
907904
value.local_storage = self.local_storage
908905

909-
if hasattr(value, "get_download_file_list_method"):
910-
value.get_download_file_list_method = self.case.get_download_file_list
906+
return self
911907

908+
@pd.model_validator(mode="after")
909+
def pass_get_files_function(self):
910+
"""
911+
Pass file getters into fields of the case results
912+
"""
913+
# pylint: disable=no-member,assigning-non-slot
914+
self.monitors.get_download_file_list_method = self.case.get_download_file_list
912915
return self
913916

914917
# pylint: disable=protected-access,no-member

flow360/component/project_utils.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import datetime
6-
from typing import List, Literal, Optional, get_args
6+
from typing import List, Literal, Optional
77

88
import pydantic as pd
99

@@ -14,14 +14,12 @@
1414
from flow360.component.simulation.framework.base_model import Flow360BaseModel
1515
from flow360.component.simulation.framework.entity_base import EntityList
1616
from flow360.component.simulation.framework.param_utils import AssetCache
17-
from flow360.component.simulation.models.volume_models import Fluid
1817
from flow360.component.simulation.outputs.output_entities import (
1918
Point,
2019
PointArray,
2120
PointArray2D,
2221
Slice,
2322
)
24-
from flow360.component.simulation.outputs.outputs import MonitorOutputType
2523
from flow360.component.simulation.primitives import (
2624
Box,
2725
CustomVolume,
@@ -348,35 +346,6 @@ def _set_up_default_reference_geometry(params: SimulationParams, length_unit: Le
348346
return params
349347

350348

351-
def _set_up_monitor_output_from_stopping_criterion(params: SimulationParams):
352-
"""
353-
Setting up the monitor output in the stopping criterion if not provided in params.outputs.
354-
"""
355-
if not params.models:
356-
return params
357-
stopping_criterion = None
358-
for model in params.models:
359-
if not isinstance(model, Fluid):
360-
continue
361-
stopping_criterion = model.stopping_criterion
362-
if not stopping_criterion:
363-
return params
364-
monitor_output_ids = []
365-
if params.outputs is not None:
366-
for output in params.outputs:
367-
if not isinstance(output, get_args(get_args(MonitorOutputType)[0])):
368-
continue
369-
monitor_output_ids.append(output.private_attribute_id)
370-
for criterion in stopping_criterion:
371-
monitor_output = criterion.monitor_output
372-
if isinstance(monitor_output, str):
373-
continue
374-
if monitor_output.private_attribute_id not in monitor_output_ids:
375-
params.outputs.append(monitor_output)
376-
monitor_output_ids.append(monitor_output.private_attribute_id)
377-
return params
378-
379-
380349
def set_up_params_for_uploading(
381350
root_asset,
382351
length_unit: LengthType,
@@ -422,7 +391,6 @@ def set_up_params_for_uploading(
422391
params = _set_up_default_geometry_accuracy(root_asset, params, use_geometry_AI)
423392

424393
params = _set_up_default_reference_geometry(params, length_unit)
425-
params = _set_up_monitor_output_from_stopping_criterion(params=params)
426394

427395
# Convert all reference of UserVariables to VariableToken
428396
params = save_user_variables(params)

flow360/component/results/base_results.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -638,12 +638,3 @@ def _filtered_sum(self):
638638
regex_pattern = rf"^(?!total).*{variable}$"
639639
df[new_col_name] = list(df.filter(regex=regex_pattern).sum(axis=1))
640640
self.update(df)
641-
642-
def reload_data(self, filter_physical_steps_only: bool = False, include_time: bool = False):
643-
"""
644-
Change default behavior of data loader, reload
645-
"""
646-
super().reload_data(
647-
filter_physical_steps_only=filter_physical_steps_only, include_time=include_time
648-
)
649-
self._filtered_sum()

flow360/component/results/case_results.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import re
66
from collections import defaultdict
77
from enum import Enum
8-
from pathlib import Path
98
from typing import Callable, Dict, List, Optional
109

1110
import numpy as np
@@ -15,7 +14,6 @@
1514
from flow360.component.results.base_results import (
1615
_PHYSICAL_STEP,
1716
_PSEUDO_STEP,
18-
_TIME,
1917
PerEntityResultCSVModel,
2018
ResultBaseModel,
2119
ResultCSVModel,
@@ -357,7 +355,6 @@ class SurfaceHeatTransferResultCSVModel(PerEntityResultCSVModel, TimeSeriesResul
357355
class AeroacousticsResultCSVModel(TimeSeriesResultCSVModel):
358356
"""AeroacousticsResultCSVModel"""
359357

360-
_x_columns: List[str] = [_PHYSICAL_STEP, _TIME]
361358
remote_file_name: str = pd.Field(CaseDownloadable.AEROACOUSTICS.value, frozen=True)
362359

363360

@@ -394,9 +391,9 @@ def monitor_names(self):
394391
file["fileName"]
395392
for file in self.get_download_file_list_method() # pylint:disable=not-callable
396393
]
397-
for filepath in file_list:
398-
if str(Path(filepath).parent) == "results":
399-
filename = Path(filepath).name
394+
for filename in file_list:
395+
if filename.startswith("results/"):
396+
filename = filename.split("results/")[1]
400397
match = re.match(pattern, filename)
401398
if match:
402399
name = match.group(1)
@@ -476,9 +473,9 @@ def udd_names(self):
476473
file["fileName"]
477474
for file in self.get_download_file_list_method() # pylint:disable=not-callable
478475
]
479-
for filepath in file_list:
480-
if str(Path(filepath).parent) == "results":
481-
filename = Path(filepath).name
476+
for filename in file_list:
477+
if filename.startswith("results/"):
478+
filename = filename.split("results/")[1]
482479
match = re.match(pattern, filename)
483480
if match:
484481
name = match.group(1)

flow360/component/simulation/meshing_param/face_params.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,8 @@ class GeometryRefinement(Flow360BaseModel):
6666
entities: EntityList[Surface] = pd.Field(alias="faces")
6767
# pylint: disable=no-member
6868

69-
geometry_accuracy: Optional[LengthType.Positive] = pd.Field(
70-
None,
71-
description="The smallest length scale that will be resolved accurately by the surface meshing process. ",
72-
)
73-
74-
preserve_thin_geometry: Optional[bool] = pd.Field(
75-
False,
76-
description="Flag to specify whether thin geometry features with thickness roughly equal "
77-
+ "to geometry_accuracy should be resolved accurately during the surface meshing process.",
69+
geometry_accuracy: LengthType.Positive = pd.Field(
70+
description="The smallest length scale that will be resolved accurately by the surface meshing process. "
7871
)
7972

8073
@pd.field_validator("entities", mode="after")

flow360/component/simulation/meshing_param/params.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ class MeshingDefaults(Flow360BaseModel):
152152
context=SURFACE_MESH,
153153
)
154154

155-
preserve_thin_geometry: Optional[bool] = pd.Field(
156-
False,
157-
description="Flag to specify whether thin geometry features with thickness roughly equal "
158-
+ "to geometry_accuracy should be resolved accurately during the surface meshing process."
159-
+ "This can be overridden with class: ~flow360.GeometryRefinement",
160-
)
161-
162155
@pd.field_validator("number_of_boundary_layers", mode="after")
163156
@classmethod
164157
def invalid_number_of_boundary_layers(cls, value):
@@ -189,14 +182,11 @@ def invalid_geometry_accuracy(cls, value):
189182
return value
190183

191184
@pd.field_validator(
192-
"surface_max_aspect_ratio",
193-
"surface_max_adaptation_iterations",
194-
"preserve_thin_geometry",
195-
mode="after",
185+
"surface_max_aspect_ratio", "surface_max_adaptation_iterations", mode="after"
196186
)
197187
@classmethod
198188
def invalid_geometry_ai_features(cls, value, info):
199-
"""Ensure GAI features are not specified when GAI is not used"""
189+
"""Ensure surface max aspect ratio is not specified when GAI is not used"""
200190
validation_info = get_validation_info()
201191

202192
if validation_info is None:

0 commit comments

Comments
 (0)