Skip to content

[Hotfix 25.5]: changed mach reynolds to use charcteristic length #1155

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

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
reference_geometry=fl.ReferenceGeometry(
moment_center=[0.25, 0, 0], moment_length=[1, 1, 1], area=0.01
),
operating_condition=fl.operating_condition_from_mach_reynolds(
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
mach=0.17,
reynolds=1.71e06,
reynolds_mesh_unit=1.71e06,
project_length_unit=1 * fl.u.m,
temperature=288.16,
alpha=8.5 * fl.u.deg,
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced_simulations/aerodynamics/airfoils/2D_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
reference_geometry=fl.ReferenceGeometry(
moment_center=[0.25, 0, 0], moment_length=[1, 1, 1], area=0.01
),
operating_condition=fl.operating_condition_from_mach_reynolds(
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
project_length_unit=1 * fl.u.m,
temperature=272.1,
alpha=16 * fl.u.deg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
reference_geometry=fl.ReferenceGeometry(
moment_center=[0.25, 0, 0], moment_length=[1, 1, 1], area=0.01
),
operating_condition=fl.operating_condition_from_mach_reynolds(
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
mach=0.13,
reynolds=2.2e06,
reynolds_mesh_unit=2.2e06,
project_length_unit=1 * fl.u.m,
temperature=288.16,
alpha=4 * fl.u.deg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
moment_center=[0, 0, 0],
moment_length=[1.47601, 0.80167, 1.47601],
),
operating_condition=fl.operating_condition_from_mach_reynolds(
reynolds=11.72e6,
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
reynolds_mesh_unit=11.72e6,
mach=0.84,
project_length_unit=0.80167 * fl.u.m,
temperature=297.78,
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced_simulations/turbomachinery/periodic_BC.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
normal=[1, 0, 0],
origin=[294.65, 0, 0] * fl.u.m,
)
operating_condition = fl.operating_condition_from_mach_reynolds(
operating_condition = fl.AerospaceCondition.from_mach_reynolds(
mach=0.13989,
reynolds=3200,
reynolds_mesh_unit=3200,
project_length_unit=1 * fl.u.m,
temperature=298.25 * fl.u.K,
)
Expand Down
4 changes: 2 additions & 2 deletions examples/basic_simulations/steady/steady_3D_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
reference_geometry=fl.ReferenceGeometry(
area=340, moment_center=[0, 0, 0], moment_length=[1, 1, 1]
),
operating_condition=fl.operating_condition_from_mach_reynolds(
reynolds=5, mach=0.1, project_length_unit=fl.u.m
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
reynolds_mesh_unit=5, mach=0.1, project_length_unit=fl.u.m
),
time_stepping=fl.Steady(),
models=[
Expand Down
4 changes: 2 additions & 2 deletions examples/basic_simulations/unsteady/unsteady_2D_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
reference_geometry=fl.ReferenceGeometry(
area=20, moment_center=[0, 0, 0], moment_length=[1, 1, 1]
),
operating_condition=fl.operating_condition_from_mach_reynolds(
reynolds=50, mach=0.1, project_length_unit=fl.u.m
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
reynolds_mesh_unit=50, mach=0.1, project_length_unit=fl.u.m
),
models=[
fl.Fluid(
Expand Down
4 changes: 2 additions & 2 deletions examples/post_processing/field_data/volumetric_and_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
moment_center=[0, 0, 0],
moment_length=[1.47602, 0.801672958512342, 1.47602],
),
operating_condition=fl.operating_condition_from_mach_reynolds(
reynolds=14.6e6, mach=0.84, alpha=3.06 * fl.u.deg, project_length_unit=fl.u.m
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
reynolds_mesh_unit=14.6e6, mach=0.84, alpha=3.06 * fl.u.deg, project_length_unit=fl.u.m
),
time_stepping=fl.Steady(
max_steps=500, CFL=fl.RampCFL(initial=5, final=200, ramp_steps=100)
Expand Down
4 changes: 2 additions & 2 deletions examples/post_processing/monitoring/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
moment_center=[0, 0, 0],
moment_length=[1.47602, 0.801672958512342, 1.47602],
),
operating_condition=fl.operating_condition_from_mach_reynolds(
reynolds=14.6e6, mach=0.84, alpha=3.06 * fl.u.deg, project_length_unit=fl.u.m
operating_condition=fl.AerospaceCondition.from_mach_reynolds(
reynolds_mesh_unit=14.6e6, mach=0.84, alpha=3.06 * fl.u.deg, project_length_unit=fl.u.m
),
time_stepping=fl.Steady(max_steps=500),
models=[
Expand Down
8 changes: 4 additions & 4 deletions examples/tutorials/notebooks/notebook_tutorial_2D_crm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"\n",
"We will walk through all the steps such as importing modules, creating a project and assigning simulation parameters.\n",
"\n",
"Additionally, we will use the function `fl.operating_condition_from_mach_reynolds()`, which is often utilized when running workshop cases and allows us to define operating conditions using mach and reynolds number.\n",
"Additionally, we will use the function `fl.AerospaceCondition.from_mach_reynolds()`, which is often utilized when running workshop cases and allows us to define operating conditions using mach and reynolds number.\n",
"\n",
"In order to get a closer look at how we describe each parameter, we will first split the simulation parameters into smaller parts, which will be assembled later on."
]
Expand Down Expand Up @@ -906,7 +906,7 @@
"metadata": {},
"source": [
"### Operating condition\n",
"Next up is the definition of flow conditions with the help of `fl.operating_condition_from_mach_reynolds()` function, which does not require knowledge of air properties in desired conditions and instead allows the usage of mach number in conjunction with reynolds number. This is particularly useful for conducting workshop cases as we can easily simulate flow conditions for different values of reynolds number. Viscosity as well as density are going to be automatically calculated based on input parameters."
"Next up is the definition of flow conditions with the help of `fl.AerospaceCondition.from_mach_reynolds()` function, which does not require knowledge of air properties in desired conditions and instead allows the usage of mach number in conjunction with reynolds number. This is particularly useful for conducting workshop cases as we can easily simulate flow conditions for different values of reynolds number. Viscosity as well as density are going to be automatically calculated based on input parameters."
]
},
{
Expand Down Expand Up @@ -948,9 +948,9 @@
"with fl.SI_unit_system:\n",
" operating_condition_params = fl.SimulationParams(\n",
" # Create operating conditions using mach and reynolds number\n",
" operating_condition=fl.operating_condition_from_mach_reynolds(\n",
" operating_condition=fl.AerospaceCondition.from_mach_reynolds(\n",
" mach=0.2,\n",
" reynolds=5e6,\n",
" reynolds_mesh_unit=5e6,\n",
" temperature=272.1,\n",
" alpha=16 * fl.u.deg,\n",
" beta=0 * fl.u.deg,\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class AerospaceConditionCache(Flow360BaseModel):
"""[INTERNAL] Cache for AerospaceCondition inputs"""

mach: Optional[pd.NonNegativeFloat] = None
reynolds: Optional[pd.PositiveFloat] = None
reynolds_mesh_unit: Optional[pd.PositiveFloat] = None
project_length_unit: Optional[LengthType.Positive] = None
alpha: Optional[AngleType] = None
beta: Optional[AngleType] = None
Expand Down Expand Up @@ -379,7 +379,7 @@ def from_mach(
def from_mach_reynolds(
cls,
mach: pd.PositiveFloat,
reynolds: pd.PositiveFloat,
reynolds_mesh_unit: pd.PositiveFloat,
project_length_unit: LengthType.Positive,
alpha: Optional[AngleType] = 0 * u.deg,
beta: Optional[AngleType] = 0 * u.deg,
Expand All @@ -397,10 +397,12 @@ def from_mach_reynolds(
----------
mach : NonNegativeFloat
Freestream Mach number (must be non-negative).
reynolds : PositiveFloat
Freestream Reynolds number defined with mesh unit (must be positive).
reynolds_mesh_unit : PositiveFloat
Freestream Reynolds number scaled to mesh unit (must be positive).
For example if the mesh unit is 1 mm, the reynolds_mesh_unit should be
equal to a Reynolds number that has the characteristic length of 1 mm.
project_length_unit: LengthType.Positive
Project length unit.
Project length unit used to compute the density (must be positive).
alpha : AngleType, optional
Angle of attack. Default is 0 degrees.
beta : AngleType, optional
Expand All @@ -419,9 +421,9 @@ def from_mach_reynolds(
-------
Example usage:

>>> condition = operating_condition_from_mach_reynolds(
>>> condition = fl.AerospaceCondition.from_mach_reynolds(
... mach=0.85,
... reynolds=1e6,
... reynolds_mesh_unit=1e6,
... project_length_unit=1 * u.mm,
... temperature=288.15 * u.K,
... alpha=2.0 * u.deg,
Expand All @@ -441,7 +443,7 @@ def from_mach_reynolds(
velocity = mach * material.get_speed_of_sound(temperature)

density = (
reynolds
reynolds_mesh_unit
* material.get_dynamic_viscosity(temperature)
/ (velocity * project_length_unit)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/simulation/framework/test_multi_constructor_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_aerospace_condition_using_from_mach():
def get_aerospace_condition_using_from_mach_reynolds():
return AerospaceCondition.from_mach_reynolds(
mach=0.8,
reynolds=1e6,
reynolds_mesh_unit=1e6,
project_length_unit=u.m,
alpha=5 * u.deg,
temperature=290 * u.K,
Expand Down
6 changes: 3 additions & 3 deletions tests/simulation/params/test_simulation_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def test_subsequent_param_with_different_unit_system():
def test_mach_reynolds_op_cond():
condition = AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
temperature=288.15 * u.K,
alpha=2.0 * u.deg,
beta=0.0 * u.deg,
Expand All @@ -357,7 +357,7 @@ def test_mach_reynolds_op_cond():

condition = AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
temperature=288.15 * u.K,
alpha=2.0 * u.deg,
beta=0.0 * u.deg,
Expand All @@ -369,7 +369,7 @@ def test_mach_reynolds_op_cond():
with pytest.raises(ValueError, match="Input should be greater than 0"):
condition = AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=0,
reynolds_mesh_unit=0,
temperature=288.15 * u.K,
project_length_unit=u.m,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_2dcrm_tutorial_param():
),
operating_condition=AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
temperature=272.1 * u.K,
alpha=16 * u.deg,
beta=0 * u.deg,
Expand Down Expand Up @@ -54,7 +54,7 @@ def get_2dcrm_tutorial_param_deg_c():
),
operating_condition=AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
temperature=-1.05 * u.degC,
alpha=16 * u.deg,
beta=0 * u.deg,
Expand Down Expand Up @@ -82,7 +82,7 @@ def get_2dcrm_tutorial_param_deg_f():
),
operating_condition=AerospaceCondition.from_mach_reynolds(
mach=0.2,
reynolds=5e6,
reynolds_mesh_unit=5e6,
temperature=30.11 * u.degF,
alpha=16 * u.deg,
beta=0 * u.deg,
Expand Down