idaes-pse icon indicating copy to clipboard operation
idaes-pse copied to clipboard

Upwinding 1D Heat Exchanger and conservation in 1D Control Volume

Open dallan-keylogic opened this issue 3 years ago • 0 comments
trafficstars

While reviewing https://github.com/IDAES/examples-pse/pull/107#issue, I noticed that the 1D Heat Exchanger currently uses a downwind (backward) difference for the cold side in counter-current flow:

https://github.com/IDAES/idaes-pse/blob/897dc3b8f7cb8a9cd39ae71b6cbc0b0c57d2d418/idaes/models/unit_models/heat_exchanger_1D.py#L373-L381

I tried switching it to a forward difference scheme in order for it to be upwind, but then encountered test failures regarding energy conservation. After discussing the issue with @andrewlee94, we determined that we shouldn't expect energy conservation in general when discretizing PDEs using finite differences, but the error in energy conserved should decrease to zero as the grid is refined. Andrew also mentioned that we might be able to ensure energy conservation by using s1.heat[i] = -s2.heat[i+1].

Ideally, we'd like to ensure energy conservation even with a coarse grid. One way we could do that is by using a finite volume method to discretize the ControlVolume1D instead of a finite difference method, but that's probably a lot of work and may require changes on Pyomo's end.

dallan-keylogic avatar Nov 08 '22 16:11 dallan-keylogic