Skip to content
New issue

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

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

Already on GitHub? # to your account

Add porous medium example #670

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Changes from 1 commit
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
22 changes: 20 additions & 2 deletions flow360/component/simulation/models/volume_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,15 @@ def _ensure_entities_have_sufficient_attributes(cls, value: EntityList):
class PorousMedium(Flow360BaseModel):
"""
:class:`PorousMedium` class for specifying porous media settings.`.
For further information please refer to the :ref:`porous media knowledge base <knowledge_base_porousMedia>`
For further information please refer to the :ref:`porous media knowledge base <knowledge_base_porousMedia>`.

Example
-------

Define a porous medium model :code:`porous_zone` with the :py:class:`Box` entity.
The center and size of the `porous_zone` box is (0, 0, 0) * fl.u.m and (0.2, 0.3, 2) * fl.u.m, respectively.
The axes of the :code:`porous_zone` is set as (0, 1, 0) and (0, 0, 1).

>>> fl.PorousMedium(
... entities=[
... fl.Box.from_principal_axes(
Expand All @@ -718,6 +722,19 @@ class PorousMedium(Flow360BaseModel):
... volumetric_heat_source=1.0 * fl.u.W/ fl.u.m **3,
... )

Define a porous medium model :code:`porous_zone` with the :code:`volume_mesh["porous_zone"]` volume.
The axes of entity must be specified for the :class:`PorousMedium` model, and we set the axes of
the :code:`porous_zone` as (1, 0, 0) and (0, 1, 0).

>>> porous_zone = volume_mesh["porous_zone"]
>>> porous_zone.axes = [(1, 0, 0), (0, 1, 0)]
>>> porous_medium_model = fl.PorousMedium(
... entities=[porous_zone],
... darcy_coefficient=(1e6, 0, 0) / fl.u.m **2,
... forchheimer_coefficient=(1, 0, 0) / fl.u.m,
... volumetric_heat_source=1.0 * fl.u.W/ fl.u.m **3,
... )

====
"""

Expand All @@ -726,7 +743,8 @@ class PorousMedium(Flow360BaseModel):
entities: EntityList[GenericVolume, Box] = pd.Field(
alias="volumes",
description="The entity list for the `PorousMedium` model. "
+ "The entity should be :class:`Box` type.",
+ "The entity should be defined by :class:`Box` or zones from the geometry/volume mesh."
+ "The axes of entity must be specified for the :class:`PorousMedium` model.",
)

darcy_coefficient: InverseAreaType.Point = pd.Field(
Expand Down
Loading