From 30f0834154f4c5fcbd546adb3266adc99e853fb1 Mon Sep 17 00:00:00 2001 From: Malhar Prajapati Date: Mon, 24 Jun 2024 11:08:26 -0400 Subject: [PATCH 1/4] Add total_temperature_ratio as required input --- flow360/component/flow360_params/boundaries.py | 1 + 1 file changed, 1 insertion(+) diff --git a/flow360/component/flow360_params/boundaries.py b/flow360/component/flow360_params/boundaries.py index 1a0e916c6..6ad3c4cfb 100644 --- a/flow360/component/flow360_params/boundaries.py +++ b/flow360/component/flow360_params/boundaries.py @@ -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") From 5e63e095b33e36ae87ab6be3ecdd097fa9bb2c6a Mon Sep 17 00:00:00 2001 From: Malhar Prajapati Date: Mon, 24 Jun 2024 13:49:48 -0400 Subject: [PATCH 2/4] Add totalTemperatureRatio in tests --- tests/params/test_params_boundary.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/params/test_params_boundary.py b/tests/params/test_params_boundary.py index b66af4de8..a1565d036 100644 --- a/tests/params/test_params_boundary.py +++ b/tests/params/test_params_boundary.py @@ -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) @@ -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), ) @@ -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), ) @@ -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), ) @@ -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), ) From 1dc8d9e1c3a9a938a79d956e0b63964786b191c7 Mon Sep 17 00:00:00 2001 From: Malhar Prajapati Date: Tue, 25 Jun 2024 16:21:25 -0400 Subject: [PATCH 3/4] Add total temperature ratio in massInflow BC --- tests/data/cases/case_boundaries.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/data/cases/case_boundaries.json b/tests/data/cases/case_boundaries.json index 5bf59ed11..8c7c3996f 100644 --- a/tests/data/cases/case_boundaries.json +++ b/tests/data/cases/case_boundaries.json @@ -116,7 +116,8 @@ }, "5":{ "type":"MassInflow", - "massFlowRate":2.0 + "massFlowRate":2.0, + "totalTemperatureRatio":1.0 } } } From 5b2a7fe50efad03f892dccd90664fcb29d03e060 Mon Sep 17 00:00:00 2001 From: Malhar Prajapati Date: Tue, 25 Jun 2024 16:21:58 -0400 Subject: [PATCH 4/4] Add tests for test_boundaries.json --- tests/test_updater.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_updater.py b/tests/test_updater.py index 4c3025e7d..73c6dcfb8 100644 --- a/tests/test_updater.py +++ b/tests/test_updater.py @@ -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: @@ -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"]