Skip to content

Commit 960fa55

Browse files
authored
[FXC-6100] Fix restart of mass flow rate boundary conditions (#1874)
1 parent a2ce573 commit 960fa55

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

flow360/component/simulation/translator/solver_translator.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,13 +1514,13 @@ def _get_default_mass_outflow_udd(entities, mass_flow_rate):
15141514
"Kp": proportional_coefficient,
15151515
"initialStaticPressureRatio": 1.0,
15161516
},
1517-
output_vars={
1518-
"staticPressureRatio": "if (pseudoStep > 0) state[0]; else initialStaticPressureRatio;"
1519-
},
1517+
output_vars={"staticPressureRatio": "state[0];"},
15201518
state_vars_initial_value=["initialStaticPressureRatio"],
15211519
update_law=[
1522-
"if (hasSupersonicFlow and massFlowRate > 0) (1.0 + Kp) * state[0]; else state[0] + "
1523-
+ "Kp * (massFlowRate/area - massFlowRateTarget/area);"
1520+
"(pseudoStep > 0) ? ("
1521+
"(hasSupersonicFlow and massFlowRate > 0) ? ((1.0 + Kp) * state[0]) : (state[0] + "
1522+
"Kp * (massFlowRate/area - massFlowRateTarget/area))"
1523+
") : (state[0]);"
15241524
],
15251525
input_boundary_patches=entities.stored_entities,
15261526
output_target=entity,
@@ -1543,13 +1543,13 @@ def _get_default_mass_inflow_udd(entities, mass_flow_rate):
15431543
"Kp": proportional_coefficient,
15441544
"initialTotalPressureRatio": 1.0,
15451545
},
1546-
output_vars={
1547-
"totalPressureRatio": "if (pseudoStep > 0) state[0]; else initialTotalPressureRatio;"
1548-
},
1546+
output_vars={"totalPressureRatio": "state[0];"},
15491547
state_vars_initial_value=["initialTotalPressureRatio"],
15501548
update_law=[
1551-
"if (hasSupersonicFlow and massFlowRate > 0) (1.0 - Kp) * state[0]; else state[0] - "
1552-
+ "Kp * (massFlowRate/area - massFlowRateTarget/area);"
1549+
"(pseudoStep > 0) ? ("
1550+
"(hasSupersonicFlow and massFlowRate > 0) ? ((1.0 - Kp) * state[0]) : (state[0] - "
1551+
"Kp * (massFlowRate/area - massFlowRateTarget/area))"
1552+
") : (state[0]);"
15531553
],
15541554
input_boundary_patches=entities.stored_entities,
15551555
output_target=entity,

tests/simulation/translator/ref/Flow360_boundaries.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@
202202
],
203203
"outputTargetName": "boundary_name_B",
204204
"outputVars": {
205-
"totalPressureRatio": "(pseudoStep > 0) ? (state[0]) : (initialTotalPressureRatio);"
205+
"totalPressureRatio": "state[0];"
206206
},
207207
"stateVarsInitialValue": [
208208
"initialTotalPressureRatio"
209209
],
210210
"updateLaw": [
211-
"(hasSupersonicFlow and massFlowRate > 0) ? ((1.0 - Kp) * state[0]) : (state[0] - Kp * (massFlowRate/area - massFlowRateTarget/area));"
211+
"(pseudoStep > 0) ? ((hasSupersonicFlow and massFlowRate > 0) ? ((1.0 - Kp) * state[0]) : (state[0] - Kp * (massFlowRate/area - massFlowRateTarget/area))) : (state[0]);"
212212
]
213213
},
214214
{
@@ -228,13 +228,13 @@
228228
],
229229
"outputTargetName": "boundary_name_H",
230230
"outputVars": {
231-
"staticPressureRatio": "(pseudoStep > 0) ? (state[0]) : (initialStaticPressureRatio);"
231+
"staticPressureRatio": "state[0];"
232232
},
233233
"stateVarsInitialValue": [
234234
"initialStaticPressureRatio"
235235
],
236236
"updateLaw": [
237-
"(hasSupersonicFlow and massFlowRate > 0) ? ((1.0 + Kp) * state[0]) : (state[0] + Kp * (massFlowRate/area - massFlowRateTarget/area));"
237+
"(pseudoStep > 0) ? ((hasSupersonicFlow and massFlowRate > 0) ? ((1.0 + Kp) * state[0]) : (state[0] + Kp * (massFlowRate/area - massFlowRateTarget/area))) : (state[0]);"
238238
]
239239
}
240240
],

0 commit comments

Comments
 (0)