Skip to content

Commit 14bc64d

Browse files
Merge pull request #13 from Deltares/fix-examples
Run examples and compile in OM
2 parents 3f253d2 + 071c0c2 commit 14bc64d

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Branches/Internal/PartialHomotopic.mo

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@ partial model PartialHomotopic
2020
input SI.Stress wind_stress_v(nominal = 1e-1) = 0.0; // Wind stress in y (v, northing) direction (= 0.5*pi radians, 90 degrees)
2121
// Flow
2222
SI.VolumeFlowRate[n_level_nodes + 1] Q(each nominal = abs(Q_nominal));
23-
// Water level
24-
SI.Position[n_level_nodes] H(
25-
min = cat(1,
26-
{max(H_b[1], H_b[2])},
27-
{ max(H_b[1 + i], max(H_b[2 + i], H_b[3 + i])) for i in 0:n_level_nodes - 3 },
28-
{max(H_b[n_level_nodes - 1], H_b[n_level_nodes])}
29-
)
30-
);
23+
//Assumption: the minimum water level in the channel is at least the maximum bottom level at any part of the channel,
24+
// thus for steep channels this assumption might be a bit restrictive, but operatinally still reasonable.
25+
SI.Position[n_level_nodes] H(each min=max(H_b[1],H_b[n_level_nodes]));
3126
// Array of Bottom Levels
3227
parameter SI.Position[n_level_nodes] H_b;
3328
// Length

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Storage/Internal/PartialStorage.mo

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ partial model PartialStorage
1414
parameter SI.VolumeFlowRate Q_nominal = 1.0;
1515
equation
1616
der(V) / Q_nominal = (HQ.Q + sum(QForcing)) / Q_nominal;
17+
/*
18+
Note: this does not compile in OMEdit.
19+
The following alternative compiles but is incompatible with pymoca
20+
for substance in 1:medium.n_substances loop
21+
HQ.M[substance] / (Q_nominal * C_nominal[substance]) = (theta * der(V * HQ.C[substance]) + (1 - theta) * Q_nominal * der(HQ.C[substance])) / (Q_nominal * C_nominal[substance]);
22+
end for;
23+
*/
1724
HQ.M[:] / (Q_nominal * C_nominal[:]) = (theta * der(V * HQ.C[:]) + (1 - theta) * Q_nominal * der(HQ.C[:])) / (Q_nominal * C_nominal[:]);
18-
1925
end PartialStorage;

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Structures/PumpUserEquationdH.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ within Deltares.ChannelFlow.Hydraulic.Structures;
22

33
model PumpUserEquationdH "PumpUserEquationdH"
44
extends DischargeControlledStructure;
5-
Modelica.SIunits.Position HW;
5+
Modelica.Units.SI.Position HW;
66
// Note: This block introduces a new state (HW).
77
// This must be set via an equation. The choice of equation is up to the user.
88
// Note: This block can be extended to support other head options
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
DischargeControlledStructure
22
Pump
3+
PumpUserEquationdH

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Internal/Functions/SmoothMin.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ function SmoothMin "Smooth Approximation of a Min() Function"
77
input Real eps = Deltares.Constants.eps;
88
output Real smooth_min;
99
algorithm
10-
smooth_min := -1.0 * Deltares.Functions.SmoothMax(a=-1.0 * a, b=-1.0 * b, eps=eps);
10+
smooth_min := -1.0 * SmoothMax(a=-1.0 * a, b=-1.0 * b, eps=eps);
1111
end SmoothMin;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Reservoir
2-
Reservoir_turbine_out
2+
Reservoir_turbine_out
3+
Reservoir_multi_io

0 commit comments

Comments
 (0)