Skip to content

Commit

Permalink
Merge pull request #88 from andr1976:validation-cases
Browse files Browse the repository at this point in the history
Fix validation cases #87
  • Loading branch information
andr1976 authored Dec 26, 2024
2 parents cad991b + a58e4c5 commit 1d66717
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 26 deletions.
Binary file modified src/hyddown/__pycache__/hdclass.cpython-38.pyc
Binary file not shown.
Binary file modified src/hyddown/__pycache__/validator.cpython-38.pyc
Binary file not shown.
41 changes: 22 additions & 19 deletions src/hyddown/hdclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,26 +827,29 @@ def plot(self, filename=None, verbose=True):
if filename != None:
plt.savefig(filename + "_main.png")

if filename != None:
plt.figure(2, figsize=(12, 7), dpi=300)
else:
plt.figure(2)

self.fluid.build_phase_envelope("None")
PE = self.fluid.get_phase_envelope_data()

plt.plot(PE.T, PE.p, "-", label="HEOS Phase Envelope", color="g")
plt.plot(self.T_fluid, self.P, "-.", label="P/T fluid trajectory", color="b")
plt.plot(self.T_fluid[0], self.P[0], "o", label="Start", color="b")
plt.plot(self.T_fluid[-1], self.P[-1], ".", label="End", color="b")
plt.xlabel("Temperature [K]")
plt.ylabel("Pressure [Pa]")
plt.legend(loc="best")
plt.tight_layout()

if filename != None:
plt.savefig(filename + "_envelope.png")
try:
self.fluid.build_phase_envelope("None")
PE = self.fluid.get_phase_envelope_data()
if filename != None:
plt.figure(2, figsize=(12, 7), dpi=300)
else:
plt.figure(2)

plt.plot(PE.T, PE.p, "-", label="HEOS Phase Envelope", color="g")
plt.plot(
self.T_fluid, self.P, "-.", label="P/T fluid trajectory", color="b"
)
plt.plot(self.T_fluid[0], self.P[0], "o", label="Start", color="b")
plt.plot(self.T_fluid[-1], self.P[-1], ".", label="End", color="b")
plt.xlabel("Temperature [K]")
plt.ylabel("Pressure [Pa]")
plt.legend(loc="best")
plt.tight_layout()

if filename != None:
plt.savefig(filename + "_envelope.png")
except:
print("Failed to build and plot phase envelope.")
if verbose:
plt.show()

Expand Down
1 change: 0 additions & 1 deletion validation/Air_3-7kPa_21mm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.05
end_time: 80.
eta: 1
valve:
flow: "filling"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/Air_3-7kPa_271mm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.05
end_time: 80.
eta: 1
valve:
flow: "filling"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/Byrnes_run8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.1
end_time: 480.
eta: 1
valve:
flow: "discharge"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/N2_Exp_I1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.05
end_time: 100.
eta: 1
valve:
flow: "discharge"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/Striednig_fillingH2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.02
end_time: 240.
eta: 1
valve:
flow: "filling"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/dischargeH2_woodfield.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.01
end_time: 50.
eta: 1.0
valve:
flow: "discharge"
type: "orifice"
Expand Down
1 change: 0 additions & 1 deletion validation/fillingH2_woodfield.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ calculation:
type: "energybalance"
time_step: 0.1
end_time: 50.
eta: 1
valve:
flow: "filling"
type: "mdot"
Expand Down

0 comments on commit 1d66717

Please sign in to comment.