Skip to content
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

Fix SOC sign error #1303

Merged
merged 4 commits into from
Dec 14, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def mass_transfer_coeff(b, t, iz, i):
@self.Constraint(tset, iznodes, comps)
def material_flux_x0_eqn(b, t, iz, i):
return (
-b.material_flux_x0[t, iz, i] / b.mass_transfer_coeff[t, iz, i]
b.material_flux_x0[t, iz, i] / b.mass_transfer_coeff[t, iz, i]
== b.conc_mol_comp_deviation_x0[t, iz, i]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,43 @@ def test_initialization_cell_voltage_drop_custom(model_vdc):
assert approx(0.3094487) == pyo.value(cell.oxygen_outlet.mole_frac_comp[0, "O2"])
assert approx(0.690551) == pyo.value(cell.oxygen_outlet.mole_frac_comp[0, "N2"])

for iz in cell.iznodes:
# H2O is consumed at fuel electrode, concentration at electrode surface
# should be less than that in channel, and concentration at TPB should
# be less than that at the surface
assert pyo.value(cell.fuel_channel.conc_mol_comp_deviation_x1[0, iz, "H2O"]) < 0
assert (
pyo.value(
cell.fuel_electrode.conc_mol_comp_deviation_x1[0, iz, "H2O"]
- cell.fuel_channel.conc_mol_comp_deviation_x1[0, iz, "H2O"]
)
< 0
)
# H2 is produced at fuel electrode, concentration at electrode surface
# should be greater than that in channel, and concentration at TPB should
# be greater than that at the surface
assert pyo.value(cell.fuel_channel.conc_mol_comp_deviation_x1[0, iz, "H2"]) > 0
assert (
pyo.value(
cell.fuel_electrode.conc_mol_comp_deviation_x1[0, iz, "H2"]
- cell.fuel_channel.conc_mol_comp_deviation_x1[0, iz, "H2"]
)
> 0
)
# O2 is produced at oxygen electrode, concentration at electrode surface
# should be greater than that in channel, and concentration at TPB should
# be greater than that at the surface
assert (
pyo.value(cell.oxygen_channel.conc_mol_comp_deviation_x0[0, iz, "O2"]) > 0
)
assert (
pyo.value(
cell.oxygen_electrode.conc_mol_comp_deviation_x0[0, iz, "O2"]
- cell.oxygen_channel.conc_mol_comp_deviation_x0[0, iz, "O2"]
)
> 0
)

# Test whether unfixed degrees of freedom remain unfixed
cell.potential.unfix()
cell.fuel_inlet.temperature[0].unfix()
Expand Down Expand Up @@ -790,5 +827,5 @@ def test_model_replication_voltage_drop_custom(model_vdc):
m = model_func()
out = kazempoor_braun_replication(m)
# Uncomment to recreate cached data
# for i, df in enumerate(out):
# df.to_csv(os.sep.join([data_cache, f"case_{i+1}_interconnect.csv"]))
for i, df in enumerate(out):
df.to_csv(os.sep.join([data_cache, f"case_{i+1}_interconnect.csv"]))
Loading