Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
44 changes: 26 additions & 18 deletions flow360/component/simulation/models/surface_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,17 @@ class Pressure(SingleAttributeModel):

class SlaterPorousBleed(Flow360BaseModel):
"""
:class:`SlaterPorousBleed` class to specify the static pressure of the Slater porous
bleed model `Outflow` boundary condition via :py:attr:`Outflow.spec`. This model is
often used for supersonic porous bleed regions, and used a porosity and static
pressure ratio to control the flow out of a porous bleed region.
:class:`SlaterPorousBleed` is a no-slip wall model which prescribes a normal
velocity at the surface as a function of the surface pressure and density according
to the model of John Slater.

Example
-------
- Specify a static pressure of 1.01e6 Pascals at the slater bleed boundary, and
set the porosity of the surface to 0.4 (40%).

>>> fl.SlaterPorousBleed(static_pressure = 1.01e6 * fl.u.Pa,
porosity = 0.4)
>>> fl.SlaterPorousBleeed(static_pressure = 1.01e6 * fl.u.Pa,
porosity = 0.4, initial_step = 200)

====
"""
Expand All @@ -161,6 +160,9 @@ class SlaterPorousBleed(Flow360BaseModel):
# pylint: disable=no-member
static_pressure: PressureType.Positive = pd.Field(description="The static pressure value.")
porosity: float = pd.Field(gt=0, le=1, description="The porosity of the bleed region.")
initial_step: Optional[pd.PositiveInt] = pd.Field(
None, description="Pseudo step at which to start applying the SlaterPorousBleedModel."
)


class MassFlowRate(Flow360BaseModel):
Expand Down Expand Up @@ -273,6 +275,15 @@ class Wall(BoundaryBase):
... heat_spec=fl.HeatFlux(1.0 * fl.u.W/fl.u.m**2),
... )

- Define Slater no-slip bleed model on entities
with the naming pattern :code:`"fluid/SlaterBoundary-*"`:

>>> fl.Wall(
... entities=volume_mesh["fluid/SlaterBoundary-*"],
... wall_velocity_model = fl.SlaterPorousBleed(static_pressure = 1.01e6 * fl.u.Pa,
porosity = 0.4)
... )

====
"""

Expand All @@ -284,7 +295,7 @@ class Wall(BoundaryBase):
+ "close to the solid boundaries.",
)
velocity: Optional[VelocityVectorType] = pd.Field(
None, description="Prescribe a tangential velocity on the wall."
None, description="Prescribe a velocity on the wall."
)
# pylint: disable=no-member
heat_spec: Union[HeatFlux, Temperature] = pd.Field(
Expand All @@ -296,6 +307,11 @@ class Wall(BoundaryBase):
0 * u.m,
description="Equivalant sand grain roughness height. Available only to `Fluid` zone boundaries.",
)
wall_velocity_model: Optional[SlaterPorousBleed] = pd.Field(
None,
description="Specify a model to compute the local wall velocity. Currently only "
+ " SlaterPorousBleed is supported.",
)


class Freestream(BoundaryBaseWithTurbulenceQuantities):
Expand Down Expand Up @@ -367,23 +383,15 @@ class Outflow(BoundaryBase):
... spec=fl.MassFlowRate(value = 123 * fl.u.lb / fl.u.s)
... )

- Define outflow boundary condition with Slater porous bleed model::

>>> fl.Outflow(
... surfaces=volume_mesh["fluid/bleed1"],
... spec=fl.SlaterPorousBleed(static_pressure = 0.99e6 * fl.u.Pa,
... porosity = 0.4)
... )

====
"""

name: Optional[str] = pd.Field(None, description="Name of the `Outflow` boundary condition.")
type: Literal["Outflow"] = pd.Field("Outflow", frozen=True)
spec: Union[Pressure, MassFlowRate, Mach, SlaterPorousBleed] = pd.Field(
spec: Union[Pressure, MassFlowRate, Mach] = pd.Field(
discriminator="type_name",
description="Specify the static pressure, mass flow rate, Mach number, or "
+ "SlaterPorousBleed parameters at the `Outflow` boundary.",
description="Specify the static pressure, mass flow rate, or Mach number parameters at"
+ " the `Outflow` boundary.",
)


Expand Down
19 changes: 13 additions & 6 deletions flow360/component/simulation/translator/solver_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,19 @@ def boundary_spec_translator(model: SurfaceModelTypes, op_acousitc_to_static_pre
boundary["type"] = "WallFunction" if model.use_wall_function else "NoSlipWall"
if model.velocity is not None:
boundary["velocity"] = list(model_dict["velocity"])
if model.wall_velocity_model is not None:
if isinstance(model.wall_velocity_model, SlaterPorousBleed):
boundary["wallVelocityModel"] = {}
boundary["wallVelocityModel"]["staticPressureRatio"] = (
model.wall_velocity_model.static_pressure.value
* op_acousitc_to_static_pressure_ratio
)
boundary["wallVelocityModel"]["porosity"] = model.wall_velocity_model.porosity
boundary["wallVelocityModel"]["type"] = model.wall_velocity_model.type_name
if model.wall_velocity_model.initial_step is not None:
boundary["wallVelocityModel"][
"initialStep"
] = model.wall_velocity_model.initial_step
if isinstance(model.heat_spec, Temperature):
boundary["temperature"] = model_dict["heatSpec"]["value"]
elif isinstance(model.heat_spec, HeatFlux):
Expand All @@ -794,12 +807,6 @@ def boundary_spec_translator(model: SurfaceModelTypes, op_acousitc_to_static_pre
boundary["staticPressureRatio"] = (
model_dict["spec"]["value"] * op_acousitc_to_static_pressure_ratio
)
elif isinstance(model.spec, SlaterPorousBleed):
boundary["type"] = "SlaterPorousBleed"
boundary["staticPressureRatio"] = (
model_dict["spec"]["staticPressure"] * op_acousitc_to_static_pressure_ratio
)
boundary["porosity"] = model_dict["spec"]["porosity"]
elif isinstance(model.spec, Mach):
boundary["type"] = "SubsonicOutflowMach"
boundary["MachNumber"] = model_dict["spec"]["value"]
Expand Down
12 changes: 9 additions & 3 deletions tests/simulation/translator/ref/Flow360_boundaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
"MachNumber": 0.3
},
"boundary_name_G" : {
"type" : "SlaterPorousBleed",
"staticPressureRatio" : 0.8165514936615943,
"porosity" : 0.49
"type" : "NoSlipWall",
"wallVelocityModel" : {
"type" : "SlaterPorousBleed",
"staticPressureRatio" : 0.8165514936615943,
"porosity" : 0.49,
"initialStep" : 20
},
"heatFlux" : 0.0,
"roughnessHeight" : 0.0
}
},
"freestream": {
Expand Down
6 changes: 4 additions & 2 deletions tests/simulation/translator/test_solver_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,12 @@ def test_boundaries():
surfaces=Surface(name="boundary_name_F"),
spec=Mach(0.3),
),
Outflow(
Wall(
name="slater-porous-bleed",
surfaces=Surface(name="boundary_name_G"),
spec=SlaterPorousBleed(static_pressure=12.0 * u.psi, porosity=0.49),
wall_velocity_model=SlaterPorousBleed(
static_pressure=12.0 * u.psi, porosity=0.49, initial_step=20
),
),
],
)
Expand Down