Skip to content

Update input for MassInflow boundary condition #333

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

Merged
merged 4 commits into from
Jun 26, 2024
Merged
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
1 change: 1 addition & 0 deletions flow360/component/flow360_params/boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class MassInflow(BoundaryWithTurbulenceQuantities):

type: Literal["MassInflow"] = pd.Field("MassInflow", const=True)
mass_flow_rate: PositiveFloat = pd.Field(alias="massFlowRate")
total_temperature_ratio: PositiveFloat = pd.Field(alias="totalTemperatureRatio")
ramp_steps: Optional[PositiveInt] = pd.Field(alias="rampSteps")


Expand Down
3 changes: 2 additions & 1 deletion tests/data/cases/case_boundaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
},
"5":{
"type":"MassInflow",
"massFlowRate":2.0
"massFlowRate":2.0,
"totalTemperatureRatio":1.0
}
}
}
8 changes: 7 additions & 1 deletion tests/params/test_params_boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ def test_boundary_types():
)
assert SlidingInterfaceBoundary().type == "SlidingInterface"
assert WallFunction().type == "WallFunction"
assert MassInflow(massFlowRate=1).type == "MassInflow"
assert MassInflow(massFlowRate=1, totalTemperatureRatio=1).type == "MassInflow"
with pytest.raises(pd.ValidationError):
MassInflow(massFlowRate=-1)
with pytest.raises(pd.ValidationError):
MassInflow(totalTemperatureRatio=-1)
assert MassOutflow(massFlowRate=1).type == "MassOutflow"
with pytest.raises(pd.ValidationError):
MassOutflow(massFlowRate=-1)
Expand Down Expand Up @@ -320,6 +322,7 @@ def test_boundary_types():
bc = MassInflow(
name="SomeBC",
mass_flow_rate=0.2,
total_temperature_ratio=0.43,
turbulence_quantities=TurbulenceQuantities(modified_viscosity_ratio=1.2),
)

Expand All @@ -328,6 +331,7 @@ def test_boundary_types():
bc = MassInflow(
name="SomeBC",
mass_flow_rate=0.2,
total_temperature_ratio=0.43,
turbulence_quantities=TurbulenceQuantities(turbulent_intensity=0.2),
)

Expand All @@ -336,6 +340,7 @@ def test_boundary_types():
bc = MassInflow(
name="SomeBC",
mass_flow_rate=0.2,
total_temperature_ratio=0.43,
turbulence_quantities=TurbulenceQuantities(turbulent_kinetic_energy=12.2),
)

Expand All @@ -344,6 +349,7 @@ def test_boundary_types():
bc = MassInflow(
name="SomeBC",
mass_flow_rate=0.2,
total_temperature_ratio=0.43,
turbulence_quantities=TurbulenceQuantities(turbulent_length_scale=1.23),
)

Expand Down
10 changes: 10 additions & 0 deletions tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_updater_from_files():
"case_customDynamics1.json",
"case_HeatTransfer.json",
"case_20.json",
"case_boundaries.json",
]

for file in files:
Expand Down Expand Up @@ -173,6 +174,15 @@ def test_updater_from_files():
assert params.heat_equation_solver is None
assert params.transition_model_solver is None

params = fl.Flow360Params("data/cases/case_boundaries.json")
assert params.boundaries["1"].static_pressure_ratio == 0.4
assert params.boundaries["2"].Mach == 1.0
assert params.boundaries["3"].total_pressure_ratio == 1.0
assert params.boundaries["3"].total_temperature_ratio == 1.0
assert params.boundaries["4"].mass_flow_rate == 1.0
assert params.boundaries["5"].mass_flow_rate == 2.0
assert params.boundaries["5"].total_temperature_ratio == 1.0


def test_version_update():
files = ["test_version_b16.json"]
Expand Down
Loading